static void ReadDebugFlagFromRegistryKey()

in Include/debugutil.h [95:123]


static void ReadDebugFlagFromRegistryKey(const char* pszRegKey, IN DWORD dwDefault)
{
    HKEY hkey = NULL;
    g_dwDebugFlags = dwDefault;
    DWORD dwType;
    DWORD dwBuffer;
    DWORD  cbBuffer = sizeof(dwBuffer);
    
    DWORD dwError = RegOpenKeyExA(HKEY_LOCAL_MACHINE,
                                  pszRegKey,
                                  0,
                                  KEY_READ,
                                  &hkey);
    if ( dwError == NO_ERROR && hkey != NULL) 
    {
        dwError = RegQueryValueExA( hkey,
                               DEBUG_FLAGS_REGISTRY_LOCATION_A,
                               NULL,
                               &dwType,
                               (LPBYTE)&dwBuffer,
                               &cbBuffer );
        if( ( dwError == NO_ERROR ) && ( dwType == REG_DWORD ) )
        {
            g_dwDebugFlags = dwBuffer;
        }
        RegCloseKey( hkey);
        hkey = NULL;
    }
}