Skip to content

Commit 6e19a73

Browse files
committed
Replace ReadRegistryStringValue
1 parent f1e6d99 commit 6e19a73

File tree

4 files changed

+343
-34
lines changed

4 files changed

+343
-34
lines changed

Client/core/CVersionUpdater.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3155,8 +3155,10 @@ int CVersionUpdater::DoSendDownloadRequestToNextServer()
31553155
iReqKB3035131 = IsHotFixInstalled("KB3035131") ? 0 : 1;
31563156
}
31573157

3158-
bool bSecureBootEnabled =
3159-
(GetSystemRegistryValue((uint)HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Control\\SecureBoot\\State", "UEFISecureBootEnabled") == "\x01");
3158+
int secureBootStatus = 0;
3159+
const SString secureBootValue =
3160+
GetSystemRegistryValue((uint)HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Control\\SecureBoot\\State", "UEFISecureBootEnabled", &secureBootStatus);
3161+
const bool bSecureBootEnabled = (secureBootStatus > 0) ? (secureBootValue.ToInt() != 0) : false;
31603162
// Compile some system stats
31613163
SDxStatus dxStatus;
31623164
g_pGraphics->GetRenderItemManager()->GetDxStatus(dxStatus);

Client/core/DXHook/CProxyDirect3D9.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,10 @@ HRESULT CProxyDirect3D9::CreateDevice(UINT Adapter, D3DDEVTYPE DeviceType, HWND
350350
#endif
351351

352352
// Set dark titlebar if needed
353-
BOOL darkTitleBar = GetSystemRegistryValue((uint)HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize", "AppsUseLightTheme") == "\x0";
353+
int themeStatus = 0;
354+
const SString appsUseLightTheme =
355+
GetSystemRegistryValue((uint)HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize", "AppsUseLightTheme", &themeStatus);
356+
const BOOL darkTitleBar = (themeStatus > 0) ? (appsUseLightTheme.ToInt() == 0) : FALSE;
354357
DwmSetWindowAttribute(hFocusWindow, DWMWA_USE_IMMERSIVE_DARK_MODE, &darkTitleBar, sizeof(darkTitleBar));
355358

356359
// Update icon

Shared/sdk/SharedUtil.Misc.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,20 +64,20 @@ namespace SharedUtil
6464
SString GetMajorVersionString();
6565

6666
// Get a system registry value
67-
SString GetSystemRegistryValue(uint hKey, const SString& strPath, const SString& strName);
67+
SString GetSystemRegistryValue(uint hKey, const SString& strPath, const SString& strName, int* iResult = nullptr);
6868

6969
// Get/set registry values for the current version
7070
void SetRegistryValue(const SString& strPath, const SString& strName, const SString& strValue, bool bFlush = false);
71-
SString GetRegistryValue(const SString& strPath, const SString& strName);
71+
SString GetRegistryValue(const SString& strPath, const SString& strName, int* iResult = nullptr);
7272
bool RemoveRegistryKey(const SString& strPath);
7373

7474
// Get/set registry values for a particular version
7575
void SetVersionRegistryValue(const SString& strVersion, const SString& strPath, const SString& strName, const SString& strValue);
76-
SString GetVersionRegistryValue(const SString& strVersion, const SString& strPath, const SString& strName);
76+
SString GetVersionRegistryValue(const SString& strVersion, const SString& strPath, const SString& strName, int* iResult = nullptr);
7777

7878
// Get/set registry values for all versions (Common)
7979
void SetCommonRegistryValue(const SString& strPath, const SString& strName, const SString& strValue);
80-
SString GetCommonRegistryValue(const SString& strPath, const SString& strName);
80+
SString GetCommonRegistryValue(const SString& strPath, const SString& strName, int* iResult = nullptr);
8181

8282
bool ShellExecuteBlocking(const SString& strAction, const SString& strFile, const SString& strParameters = "", const SString& strDirectory = "",
8383
int nShowCmd = 1);

0 commit comments

Comments
 (0)