Skip to content

Commit 2425c4c

Browse files
committed
Addendum to last
1 parent 37784c8 commit 2425c4c

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

Client/core/CVersionUpdater.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3158,7 +3158,17 @@ int CVersionUpdater::DoSendDownloadRequestToNextServer()
31583158
int secureBootStatus = 0;
31593159
const SString secureBootValue =
31603160
GetSystemRegistryValue((uint)HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Control\\SecureBoot\\State", "UEFISecureBootEnabled", &secureBootStatus);
3161-
const bool bSecureBootEnabled = (secureBootStatus > 0) ? (secureBootValue.ToInt() != 0) : false;
3161+
bool bSecureBootEnabled = false;
3162+
if (secureBootStatus > 0)
3163+
{
3164+
// Parse the registry value into a numeric flag
3165+
char* secureBootEnd = nullptr;
3166+
const long secureBootNumeric = strtol(secureBootValue.c_str(), &secureBootEnd, 10);
3167+
if (secureBootEnd != secureBootValue.c_str() && *secureBootEnd == '\0')
3168+
{
3169+
bSecureBootEnabled = secureBootNumeric != 0;
3170+
}
3171+
}
31623172
// Compile some system stats
31633173
SDxStatus dxStatus;
31643174
g_pGraphics->GetRenderItemManager()->GetDxStatus(dxStatus);

Client/core/DXHook/CProxyDirect3D9.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,17 @@ HRESULT CProxyDirect3D9::CreateDevice(UINT Adapter, D3DDEVTYPE DeviceType, HWND
353353
int themeStatus = 0;
354354
const SString appsUseLightTheme =
355355
GetSystemRegistryValue((uint)HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize", "AppsUseLightTheme", &themeStatus);
356-
const BOOL darkTitleBar = (themeStatus > 0) ? (appsUseLightTheme.ToInt() == 0) : FALSE;
356+
BOOL darkTitleBar = FALSE;
357+
if (themeStatus > 0)
358+
{
359+
// Parse the registry value into a numeric flag
360+
char* themeEnd = nullptr;
361+
const long themeNumeric = strtol(appsUseLightTheme.c_str(), &themeEnd, 10);
362+
if (themeEnd != appsUseLightTheme.c_str() && *themeEnd == '\0')
363+
{
364+
darkTitleBar = (themeNumeric == 0);
365+
}
366+
}
357367
DwmSetWindowAttribute(hFocusWindow, DWMWA_USE_IMMERSIVE_DARK_MODE, &darkTitleBar, sizeof(darkTitleBar));
358368

359369
// Update icon

0 commit comments

Comments
 (0)