I'm using the standard fare of Win32API calls to add registry keys on XP machines.
I'm adding a number of keys to the HKEY_LOCAL_MACHINE\Software\CustomCompany\CustomSoftware....
location. Here's the problem I'm having:
I add a key. I add an entry to the key. No problem.
If I now go back and try to SET the value of this key, I get a long return of 5 (access_denied).
So, I can create the thing no problem - but once it is created, I can't seem to change the value?
This seems like it has something to do with the access rights on the key. When I attempt to change the value of the entries, I'm using this call (just an alias to RegSetValueEx):
longstatus = RegSetValueExString(hTargetKey, targetEntry, 0, REG_SZ, newValue, Len(newValue))
Everytime I try to change one of these values that I just created, I get an access denied return.
Here's the call I use to originally create the keys:
longstatus = RegCreateKeyEx("HKEY_LOCAL_MACHINE", "SOFTWARE\Custom...", 0, vbNullString, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, secAttributes.lpSecurityDescriptor, hTargetKey, lFuncBehavior)
I'm assuming the issue is the security descriptor. All I'm doing for this descriptor is the following:
Dim secAttributes as SECURITY_ATTRIBUTES
secAttributes.nLength = Len(secAttributes)
secAttributes.bInheritHandle = CLng(True)
This will take someone far more versed in how the Windows security access stuff works than I. What do I need to do for this to work correctly? I want ANY user to be able to change the values of these keys (they will be changed by the program running, which will be utilized by any user on the computer).
EDIT: Wanted to add also that while I am NOT using an administrator account to do this, the user account running the software DOES seem to have the ability to change these values! After using the software to CREATE the keys and entries, I am fully capable of going into REGEDIT and modifying the entry values. The issue is that I can't seem to do the same using the API calls.
Also do NOT want to use a scripted system to do this, as I am unsure of the status/allowance of the user abilities in places this may be installed. Surely there is a simple thing I am overlooking when it comes to using the correct security information when either CREATING or attempting to EDIT the entries.