lin
Dec 7th, 2000, 03:48 AM
I want to write a registry key to a remote computer.
I used the following code. The first part
(GetMachineRegistryHandle) passed just fine but in the second part (RegConnectRegistry) i got an error code number 6 -> "The handle is invalid."
/////////////////////////////////////////////////
Public Sub writeRedResourceGroupNameKey()
Dim hRemoteKey As Long
Dim hKey As Long
Dim funcResult As Long
Dim result As Long
Dim ret As Long
Dim lpdwDisposition As Long
Dim securAttr As SECURITY_ATTRIBUTES
On Error GoTo errorHandle
securAttr.nLength = 10
securAttr.lpSecurityDescriptor = 0
securAttr.bInheritHandle = True
hRemoteKey = RegConnectRegistry("\\" & RedReComputerName, HKEY_LOCAL_MACHINE, result)
If result = DB_SUCCESS Then
ret = RegCreateKeyEx(hRemoteKey, _
"Software\NiceCti\System\Redundancy", _
0, _
REG_SZ, _
REG_OPTION_NON_VOLATILE, _
KEY_ALL_ACCESS, _
securAttr, _
hKey, _
lpdwDisposition)
If ret = DB_SUCCESS Then
If RegSetValueEx(hKey, "ClsResourceGroupName", 0, Null, RedResourceGroupName, Len(RedResourceGroupName)) = DB_SUCCESS Then
RegCloseKey hKey
RegCloseKey hRemoteKey
End If
End If
End If
Exit Sub
errorHandle:
MsgBox err.Description
End Sub
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
thanks in advance on your help.
Linda.
I used the following code. The first part
(GetMachineRegistryHandle) passed just fine but in the second part (RegConnectRegistry) i got an error code number 6 -> "The handle is invalid."
/////////////////////////////////////////////////
Public Sub writeRedResourceGroupNameKey()
Dim hRemoteKey As Long
Dim hKey As Long
Dim funcResult As Long
Dim result As Long
Dim ret As Long
Dim lpdwDisposition As Long
Dim securAttr As SECURITY_ATTRIBUTES
On Error GoTo errorHandle
securAttr.nLength = 10
securAttr.lpSecurityDescriptor = 0
securAttr.bInheritHandle = True
hRemoteKey = RegConnectRegistry("\\" & RedReComputerName, HKEY_LOCAL_MACHINE, result)
If result = DB_SUCCESS Then
ret = RegCreateKeyEx(hRemoteKey, _
"Software\NiceCti\System\Redundancy", _
0, _
REG_SZ, _
REG_OPTION_NON_VOLATILE, _
KEY_ALL_ACCESS, _
securAttr, _
hKey, _
lpdwDisposition)
If ret = DB_SUCCESS Then
If RegSetValueEx(hKey, "ClsResourceGroupName", 0, Null, RedResourceGroupName, Len(RedResourceGroupName)) = DB_SUCCESS Then
RegCloseKey hKey
RegCloseKey hRemoteKey
End If
End If
End If
Exit Sub
errorHandle:
MsgBox err.Description
End Sub
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
thanks in advance on your help.
Linda.