Windows CE 5.0 added a function to retrieve information about an open registry key. The function is CeRegGetInfo() which takes a handle to an open registry key, or one of the root keys, and a pointer to a CE_REGISTRY_INFO structure. It returns information about the registry key in the CE_REGISTRY_INFO structure.
Before calling CeRegGetInfo() the structure needs to be initialized with its size, a buffer to receive the key name string and pointer to the size of the string buffer. Here is an example of using CeRegGetInfo() to output a key name based on a registry key;
CE_REGISTRY_INFO RegInfo;
DWORD KeyNameLen = MAX_PATH * sizeof( TCHAR );
RegInfo.cbSize = sizeof( CE_REGISTRY_INFO );
RegInfo.pdwKeyNameLen = &KeyNameLen;
RegInfo.pszFullKeyName = (TCHAR *)malloc( KeyNameLen );
if( ERROR_SUCCESS == CeRegGetInfo( hRegKey, &RegInfo ) )
RETAILMSG( 1, (TEXT("[%s]\r\n"), RegInfo.pszFullKeyName ));
else
RETAILMSG( 1, (TEXT("CeRegGetInfo failed %d\r\n"), GetLastError() ));
free(RegInfo.pszFullKeyName);
Copyright © 2009 – Bruce Eitman
All Rights Reserved