I’m working with RB2008. I know it’s old and needs to be upgraded, but currently that’s not an option.
The app runs under normal unprivileged user account and I need it to edit edit a key using elevated privileges.
This is what I currently have and works if the app is run with administrator rights.
// action is either 'Enabling' or 'Disabling'
// dword is either 3 or 4
WriteLog("info", action + " USB ports")
LoginWindow.StatusWindow.AppendText(action + " USB ports" + EndOfLine + EndOfLine)
LoginWindow.StatusWindow.Refresh
Dim usb as RegistryItem
usb = new RegistryItem("HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\USBSTOR")
try
usb.Value("Start") = dword
Catch err as RegistryAccessErrorException
MsgBox("Unable to modify USB registry value")
End Try
Any suggestions on how I can edit this reg key in RB?