Article ID: 193465
Article Last Modified on 11/21/2006
141460 HOWTO: Install Remote Administration Services
#include <windows.h>
#include <stdio.h>
void main( int argc, char* argv[] ) {
if (argc < 2) {
printf("Usage: RegConnectRegistry \\\\server");
} else {
HKEY hRemoteKey = NULL;
HKEY hKey = NULL;
LONG lResult = RegConnectRegistryA( argv[1], HKEY_LOCAL_MACHINE,
&hRemoteKey);
if (lResult == ERROR_SUCCESS) {
printf( "Connected to remote %s registry.\n", argv[1] );
lResult = RegOpenKeyEx( hRemoteKey, "SOFTWARE", 0,
KEY_ALL_ACCESS, &hKey);
if (lResult == ERROR_SUCCESS) {
DWORD cbMaxSubKeyLen;
printf( "Key opened.\n" );
lResult = RegQueryInfoKey( hKey, NULL, NULL, NULL,
NULL, &cbMaxSubKeyLen, NULL, NULL, NULL, NULL, NULL,
NULL );
if (lResult == ERROR_SUCCESS) {
printf( "The max subkey length of %s is %d.\n",
"HKEY_LOCAL_MACHINE\\SOFTWARE", cbMaxSubKeyLen );
}
RegCloseKey( hKey );
} else {
printf( "RegOpenKey() failed.\nError: %d\n", lResult );
}
RegCloseKey( hRemoteKey );
} else {
printf( "RegConnectRegistry( %s ) failed.\nError: %d\n",
argv[1], lResult );
}
}
}
193463 HOWTO: Troubleshoot Remote Registry Access on Windows 95/98
Keywords: kbbug kbkernbase kbnofix kbregistry KB193465