der_bell
asked on
RegConnectRegistry failure
I'm trying to change a registry key in a remote machine's HKEY_LOCAL_MACHINE branch using RegConnectRegistry(). Everything's set up okay - both machines are NT4 servers (SP3) and Administrator account is set up so that it has full control over both machine A and machine B and full access to both registries.
Here's my code:
LPTSTR lpMachineName; // address of name of remote computer
lpMachineName = "\\SEURD01WEB002";
HKEY hKey; // predefined registry handle
hKey = HKEY_LOCAL_MACHINE;
PHKEY phkResult; // address of buffer for remote registry handle
LONG diditwork;
diditwork = 0;
diditwork = RegConnectRegistry(
lpMachineName,
hKey,
phkResult
);
if (diditwork != ERROR_SUCCESS)
MessageBox ("Remote connection failed");
Can you guys see anything wrong with this code ? I've performed the connection manually using regedt32 and connecting to the machine name and the branch - it works fine...
...so please, save me from going crazy and tell me what I'm doing wrong ! Thanks a lot,
Derek
Here's my code:
LPTSTR lpMachineName; // address of name of remote computer
lpMachineName = "\\SEURD01WEB002";
HKEY hKey; // predefined registry handle
hKey = HKEY_LOCAL_MACHINE;
PHKEY phkResult; // address of buffer for remote registry handle
LONG diditwork;
diditwork = 0;
diditwork = RegConnectRegistry(
lpMachineName,
hKey,
phkResult
);
if (diditwork != ERROR_SUCCESS)
MessageBox ("Remote connection failed");
Can you guys see anything wrong with this code ? I've performed the connection manually using regedt32 and connecting to the machine name and the branch - it works fine...
...so please, save me from going crazy and tell me what I'm doing wrong ! Thanks a lot,
Derek
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks a lot - it works fine when I make the amendment you suggest. I'm an idiot - I was looking in the wrong place for the error !
Derek