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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RemoteRegistry Set Value

Status
Not open for further replies.

djwatts

Programmer
Joined
Nov 10, 2004
Messages
91
Location
GB
Hi All,

I have written some code to connect to remote registry's, enumerate keys from HKEY_USERS and modify a value in all the user profiles.

All the API calls are returning success but when I check the registry, the values havn't changed. Any one experianced this???


Public Function RemoteRegConnect(PCname As String, OptData As String) As Boolean
Dim hSubKey As Long
Dim RemoteHKLM As Long
Dim SubKey As String * 1000
Dim Index As Long
Dim TMP As String
Dim lResult As Long

OptData = CStr(OptData & vbNullChar)

RegConnectRegistry "\\" & PCname, HKEY_USERS, RemoteHKLM
While RegEnumKeyEx(RemoteHKLM, Index, SubKey, Len(SubKey), 0, vbNullString, ByVal 0&, ByVal 0&) = ERROR_SUCCESS
TMP = Left(SubKey, InStr(1, SubKey, vbNullChar) - 1)
If UCase(Right(TMP, 8)) <> "_CLASSES" Then
RegOpenKeyEx RemoteHKLM, TMP & REGISTRY_KEY, 0, KEY_ALL_ACCESS, hSubKey
lResult = RegSetValueEx(hSubKey, "dbPath", 0, REG_SZ, ByVal OptData, Len(OptData))

If lResult = 0& Then
RemoteRegConnect = True
Else
RemoteRegConnect = False
End If

RegCloseKey hSubKey
End If
Index = Index + 1
Wend
RegCloseKey RemoteHKLM
End Function






Thanks for any advice. Have been trying to crack this for a while

Regards
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top