BOOL RegValueExistsEx( HKEY hRoot, LPCTSTR lpSubKey, LPCTSTR lpValueName, BOOL bNoDirect ) { if(bNoDirect) { CRegistryWow<REGISTRY_WOW> reg; return reg.ExistsValue(hRoot, lpSubKey, lpValueName); } else return RegValueExists(hRoot, lpSubKey, lpValueName); }
CNotifications::CNotifications(HWND hWnd) { TCHAR szWindowClass[100]; GetClassName(hWnd, szWindowClass, CountOf(szWindowClass)); StringCchPrintf(szSoftwareSubKey, CountOf(szSoftwareSubKey), L"Software\\%s", szWindowClass); SN_DW[SN_RELOADICON].pszSubKey = szSoftwareSubKey; SN_DW[SN_RELOADICONS].pszSubKey = szSoftwareSubKey; for (int i = 0; i < MAXDWORDNOTIFICATION; i++) { dwHrNotify[i] = NULL; dwNotifications[i] = 0; dwNotificationsChanged[i] = FALSE; if (!RegValueExists(SN_DW[i].hKey, SN_DW[i].pszSubKey, SN_DW[i].pszValueName)) { HKEY h = SN_DW[i].hKey; if (h == HKEY_LOCAL_MACHINE) { h = HKEY_CURRENT_USER; } else if (h == HKEY_CURRENT_USER) { h = HKEY_LOCAL_MACHINE; } if (RegValueExists(h, SN_DW[i].pszSubKey, SN_DW[i].pszValueName)) { SN_DW[i].hKey = h; } } } for (int i = 0; i < MAXSTRINGNOTIFICATION; i++) { szHrNotify[i] = NULL; szNotifications[i][0] = 0; szNotificationsChanged[i] = FALSE; } for (int i = 0; i < MAXFILETIMENOTIFICATION; i++) { ftHrNotify[i] = NULL; ftNotificationsChanged[i] = FALSE; } this->PollingUpdate(); this->InitRegistryNotifications(hWnd); }