The RegConnectRegistry function establishes a connection to a predefined registry handle on another computer.
LONG RegConnectRegistry(
LPTSTR lpMachineName,
// address of name of remote computer
HKEY hKey, // predefined registry handle
PHKEY phkResult // address of buffer for remote registry handle
);
\\computername
If lpMachineName is NULL, the local computer name is used.
HKEY_LOCAL_MACHINE
HKEY_USERS
Windows NT: HKEY_PERFORMANCE_DATA, if the remote computer is running Windows NT
Windows 95 and Windows 98: HKEY_DYN_DATA, if the remote computer is running Windows 95 or Windows 98
Windows 95 and Windows 98: HKEY_CURRENT_CONFIG, if the remote computer is running Windows 95 or Windows 98
You cannot specify the HKEY_CLASSES_ROOT or HKEY_CURRENT_USER value for this parameter.
If the function succeeds, the return value is ERROR_SUCCESS.
If the function fails, the return value is a nonzero error code defined in WINERROR.H. You can use the FormatMessage function with the FORMAT_MESSAGE_FROM_SYSTEM flag to get a generic description of the error.
When a handle returned by RegConnectRegistry is no longer needed, it should be closed by calling RegCloseKey.
Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Unsupported.
Header: Declared in winreg.h.
Import Library: Use advapi32.lib.
Unicode: Implemented as Unicode and ANSI versions on Windows NT.
Registry Overview, Registry Functions, RegCloseKey