We have a VB6 application that uses windows API calls to read and write to the registry. To open the key to be able to write to it, we use the call...
Private Type SECURITY_ATTRIBUTES
nLength As Long
lpSecurityDescriptor As Long
bInheritHandle As Long
Dim hKey As Long ' receives handle to the registry key
Dim neworused As Long ' receives flag for if the key was created or opened
Dim retVal As Long ' return value
' Set the name of the new key and the default security settings
secattr.nLength = Len(secattr)
secattr.lpSecurityDescriptor = 0
secattr.bInheritHandle = 1
retval = RegCreateKeyEx(&H80000002, sSubKey, 0, "", 0, &H20006, secattr, hKey, neworused)
This works fine most of the time. However, with a particular customer, their ADMIN users do not have write privaliges to HKEY_LOCAL_MACHINE, and when our app tries to create a new key as above, the app just vanishes, no error messages. Is there any way we can test whether or not we can create a key, everything we have tried seems to have the same effect of crashing VB.
Thanks in advance,