void ReadFromRegistry() { HRESULT hRes = S_OK; HKEY hRootKey = NULL; WC_W32(RegOpenKeyEx( HKEY_CURRENT_USER, RKEY_ROOT, NULL, KEY_READ, &hRootKey)); // Now that we have a root key, go get our values if (hRootKey) { int i = 0; for (i = 0 ; i < NUMRegKeys ; i++) { if (RegKeys[i].ulRegKeyType == regDWORD) { ReadDWORDFromRegistry( hRootKey, RegKeys[i].szKeyName, &RegKeys[i].ulCurDWORD); } else if (RegKeys[i].ulRegKeyType == regSTRING) { ReadStringFromRegistry( hRootKey, RegKeys[i].szKeyName, RegKeys[i].szCurSTRING, _countof(RegKeys[i].szCurSTRING)); if (RegKeys[i].szCurSTRING[0] == _T('\0')) { EC_H(StringCchCopy( RegKeys[i].szCurSTRING, _countof(RegKeys[i].szCurSTRING), RegKeys[i].szDefSTRING)); } } } EC_W32(RegCloseKey(hRootKey)); } SetDebugLevel(RegKeys[regkeyDEBUG_TAG].ulCurDWORD); DebugPrintVersion(DBGVersionBanner); } // ReadFromRegistry
void clAudioSubsystem_OpenAL::Start() { m_AudioThread = std::make_shared<std::thread>( [this]() { m_Device = alcOpenDevice( nullptr ); m_Context = alcCreateContext( m_Device, nullptr ); alcMakeContextCurrent( m_Context ); if ( IsVerbose() ) DebugPrintVersion(); m_IsInitialized = true; while ( !m_IsPendingExit ) { std::this_thread::sleep_for(std::chrono::milliseconds(10)); { auto sources = this->GetLockedSources(); for (auto i : sources) { i->UpdateBuffers(); } } } // A dirty workaround for a possible bug in OpenAL Soft // http://openal.org/pipermail/openal/2015-January/000312.html #if !defined(_WIN32) alcDestroyContext( m_Context ); alcCloseDevice( m_Device ); #endif m_IsInitialized = false; } ); // wait while ( !m_IsInitialized ); }
CParentWnd::CParentWnd() { // OutputDebugStringOutput only at first // Get any settings from the registry SetDefaults(); ReadFromRegistry(); // After this call we may output to the debug file OpenDebugFile(); DebugPrintVersion(DBGVersionBanner); // Force the system riched20 so we don't load office's version. (void) LoadFromSystemDir(_T("riched20.dll")); // STRING_OK // Second part is to load rundll32.exe // Don't plan on unloading this, so don't care about the return value (void) LoadFromSystemDir(_T("rundll32.exe")); // STRING_OK // Load DLLS and get functions from them ImportProcs(); // Initialize objects for theming InitializeGDI(); m_cRef = 1; m_hwinEventHook = SetWinEventHook( EVENT_OBJECT_REORDER, EVENT_OBJECT_REORDER, NULL, &MyWinEventProc, GetCurrentProcessId(), NULL, NULL); ForceOutlookMAPI(0 != RegKeys[regkeyFORCEOUTLOOKMAPI].ulCurDWORD); ForceSystemMAPI(0 != RegKeys[regkeyFORCESYSTEMMAPI].ulCurDWORD); LoadAddIns(); // Notice we never create a window here! TRACE_CONSTRUCTOR(CLASS); } // CParentWnd::CParentWnd