Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is there a way to read/write in to NT registry?

Status
Not open for further replies.

ScoobyDoo

Programmer
Jul 22, 1999
5
0
0
US
Here is the explanation of the problem.<br>
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.<br>
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 <br>
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 <br>
Security mask(SAM).' **********************************************<br>
' Security mask attributes for Windows NT (SAM).<br>
' **********************************************<br>
TypeSECURITY_ATTRIBUTES<br>
nLength As Long lpSecurityDescriptor As Long bInheritHandle As Boolean<br>
End Type <br>
I am looking for suggestions/direction on how to proceed further on NT.<br>
Also it is required that the computer to be on the network and not necessary<br>
on a local domain.
 
Hi ScoobyDoo!<br>
<br>
Like RoyLofquist said, you have to have administrator priveledges.<br>
<br>
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.<br>
<br>
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.<br>
<br>
You can see all this in the MSDN docs.<br>
<br>
Chip H.<br>

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top