ID: Q193465
The information in this article applies to:
- Microsoft Windows 95
- Microsoft Windows 98
If a Windows 95 or Windows 98 computer is connected to a remote Windows 95 or Windows 98 registry and hKey is a handle to an open key in that remote registry, RegQueryInfoKey( hKey, ..., &cbMaxSubKeyLen, ... ) returns only half the actual length of the longest subkey of hKey.
Until this bug is fixed, it is best to allocate a buffer twice as large as cbMaxSubKeyLen.
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this bug and will post new information here in the Microsoft Knowledge Base as it becomes available.
Before reproducing this problem, you must make sure that the Remote Administration Services is installed on both Windows 95 or Windows 98 computers. Verify that Microsoft Remote Registry is installed by selecting Network from the Control Panel and scrolling through the list of installed components. For additional information, please see the following article in the Microsoft Knowledge Base:
ARTICLE-ID: Q141460
TITLE : HOWTO: Install Remote Administration Services
Compile and run the following program from a command prompt on a Windows 95
or Windows 98 computer and pass a parameter identifying another Windows 95
or Windows 98 computer. The reported length of the longest subkey will be
half the actual length of that subkey.
#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 );
}
}
}
For additional information, please see the following article in the Microsoft Knowledge Base:
ARTICLE-ID: Q193463
TITLE : HOWTO: Troubleshoot Remote Registry Access on Windows 95/98
Additional query words:
Keywords : kbKernBase kbRegistry kbWinOS95bug kbWinOS98bug
Issue type : kbbug
Solution Type : kbnofix
Last Reviewed: October 2, 1998