Hey Guys,
Trying to delete a registry key In vista and not doing so well. My attempted code is as follows ...
InitializeSecurityDescriptor(pSD, %SECURITY_DESCRIPTOR_REVISION)
SetSecurityDescriptorDacl(pSD,%FALSE,pACL,%TRUE)
zStrKey = "SYSTEM\CurrentControlSet\Enum\USB\Vid_067b&Pid_0001\1"
temp& = RegOpenKeyEx(ByVal %HKEY_LOCAL_MACHINE,zStrKey,0,%WRITE_DAC + %KEY_QUERY_VALUE,hKey)
RegQueryValueEx (hkey,"DeviceDesc",byval 0, byval 0,keyval,256)
regClosekey hkey
If InStr(keyval, "Reg key i wish to delete") = 0 Then
temp& = RegOpenKeyEx(ByVal %HKEY_LOCAL_MACHINE,zStrkey ,0,%WRITE_DAC,hKey)
regsetkeysecurity (hkey,%DACL_SECURITY_INFORMATION,byval(varptr(psd)))
regClosekey hkey
temp& = RegOpenKeyEx(ByVal %HKEY_LOCAL_MACHINE,zStrkey ,0, %KEY_ALL_ACCESS,hKey)
temp& = 1
'RegSetValueEx (hkey, "ConfigFlags",%Null,%REG_DWORD,temp&,4)
If RegDeleteValue (hkey, "ConfigFlags") = %error_success Then
MsgBox "done"
End If
ps also tried to work around it by creating a regedit file to execute, and no this doesnt work either
Shell "regedit delete.reg"
I get the motions in advanced mode such as are yous ure you want this program accessing the registry. but always permission denied