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
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