RegConnectRegistry

  LONG RegConnectRegistry(lpszMachineName, hkey, phkResult)    
  LPTSTR lpszMachineName; /* name of remote machine */
  HKEY hkey; /* predefined registry handle */
  PHKEY phkResult; /* buffer for remote registry handle */

The RegConnectRegistry function establishes a connection to a predefined handle on another machine.

Parameters

lpszMachineName

Points to a null-terminated string specifying the name of the remote machine. The string has the following for:

\\machine

If lpszMachineName is NULL, the local machine name is used.

hkey

Specifies the predefined handle of the registry on the remote machine. Currently, the following values may be used:

HKEY_LOCAL_MACHINE HKEY_USERS

phkResult

Points to a variable that receives a key handle that represents the predefined handle on the remote machine.

Return Value

The return value is ERROR_SUCCESS if the function is successful. Otherwise, it is an error value.

Comments

HKEY_CLASSES and HKEY_CURRENT_USER are predefined handles, but they are not supported by this function as they do not make sense in the context of a remote Registry.