Is there a way to read/write in to NT registry?
Is there a way to read/write in to NT registry?
(OP)
Here is the explanation of the problem.
I am writing a VB program to Query/update the Registry entries in both Windows and NT. The followin URL has the nice information about required functions information inside the advapi32.dll.
http://www.microsoft.com/OfficeDev/Articles/Ctrl_reg.htm
So this code is very well written and is working very well on windows95/98. But the problem is with the security aspects of NT. i.e. I was able to read an entry but it is giving an encripted number instead of real value of the
registry entry. Is there a way to read/write in to NT registry? I found the following code in side the above document interesting. This clearly tells that I need to do something different on NT to get around the
Security mask(SAM).' **********************************************
' Security mask attributes for Windows NT (SAM).
' **********************************************
TypeSECURITY_ATTRIBUTES
nLength As Long lpSecurityDescriptor As Long bInheritHandle As Boolean
End Type
I am looking for suggestions/direction on how to proceed further on NT.
Also it is required that the computer to be on the network and not necessary
on a local domain.
I am writing a VB program to Query/update the Registry entries in both Windows and NT. The followin URL has the nice information about required functions information inside the advapi32.dll.
http://www.microsoft.com/OfficeDev/Articles/Ctrl_reg.htm
So this code is very well written and is working very well on windows95/98. But the problem is with the security aspects of NT. i.e. I was able to read an entry but it is giving an encripted number instead of real value of the
registry entry. Is there a way to read/write in to NT registry? I found the following code in side the above document interesting. This clearly tells that I need to do something different on NT to get around the
Security mask(SAM).' **********************************************
' Security mask attributes for Windows NT (SAM).
' **********************************************
TypeSECURITY_ATTRIBUTES
nLength As Long lpSecurityDescriptor As Long bInheritHandle As Boolean
End Type
I am looking for suggestions/direction on how to proceed further on NT.
Also it is required that the computer to be on the network and not necessary
on a local domain.
RE: Is there a way to read/write in to NT registry?
RE: Is there a way to read/write in to NT registry?
Like RoyLofquist said, you have to have administrator priveledges.
But.. it also depends on where in the registry you plan to write. If you want to write to the HKEY_CURRENT_USER, you shouldn't have a problem even if you don't have admin authority. Anywhere else, and you need to be in the administrators group, or be the administrator user.
Something else to pay attention to when you call RegOpenKeyEx(), is the access level you're requesting. You don't need KEY_ALL_ACCESS to do a simple read, and if you only want to write a value, then only request KEY_SET_VALUE, not KEY_WRITE access.
You can see all this in the MSDN docs.
Chip H.