model_server/IDE/configshell/cfshell.cxx
//
// Determine if a particular subkey exists.
//
Determine if a particular subkey exists.
Determine if a particular subkey exists .
BOOL SubkeyExists(const char* pszPath,    
                  const char* szSubkey)   
{
	HKEY hKey ;
	char szKeyBuf[80] ;
	strcpy(szKeyBuf, pszPath) ;
	if (szSubkey != NULL)
	{
		strcat(szKeyBuf, "\\") ;
		strcat(szKeyBuf, szSubkey ) ;
	}
	LONG lResult = ::RegOpenKeyEx(HKEY_CLASSES_ROOT, 
	                              szKeyBuf,
	                              0,
	                              KEY_ALL_ACCESS,
	                              &hKey) ;
	if (lResult == ERROR_SUCCESS)
	{
		RegCloseKey(hKey) ;
		return TRUE ;
	}
	return FALSE ;
}
BOOL SubkeyExists ( const char * pszPath , const char * szSubkey ) { HKEY hKey ; char szKeyBuf [ 80 ] ; strcpy ( szKeyBuf , pszPath ) ; if ( szSubkey != NULL ) { strcat ( szKeyBuf , " \\ " ) ; strcat ( szKeyBuf , szSubkey ) ; } LONG lResult = :: RegOpenKeyEx ( HKEY_CLASSES_ROOT , szKeyBuf , 0 , KEY_ALL_ACCESS , & hKey ) ; if ( lResult == ERROR_SUCCESS ) { RegCloseKey ( hKey ) ; return TRUE ; } return FALSE ; }
Determine if a particular subkey exists.
Determine if a particular subkey exists .
// Path of key to check // Key to check // Copy keyname into buffer. // Add subkey name to buffer. // Determine if key exists by trying to open it.