From 79b6f98c6c35984241755be8c526e3447e1635fc Mon Sep 17 00:00:00 2001 From: Valentin Radu Date: Tue, 4 Jan 2022 02:01:44 +0200 Subject: [PATCH] Protect classic theme mitigations state variable from changing once its setting is read from the registry --- ExplorerPatcher/dllmain.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ExplorerPatcher/dllmain.c b/ExplorerPatcher/dllmain.c index 7f46f33..7d503ed 100644 --- a/ExplorerPatcher/dllmain.c +++ b/ExplorerPatcher/dllmain.c @@ -64,6 +64,7 @@ DWORD bOpenAtLogon = FALSE; DWORD bClockFlyoutOnWinC = FALSE; DWORD bDisableImmersiveContextMenu = FALSE; DWORD bClassicThemeMitigations = FALSE; +DWORD bWasClassicThemeMitigationsSet = FALSE; DWORD bHookStartMenu = TRUE; DWORD bPropertiesInWinX = FALSE; DWORD bNoMenuAccelerator = FALSE; @@ -4094,15 +4095,21 @@ void WINAPI LoadSettings(LPARAM lParam) &bDisableImmersiveContextMenu, &dwSize ); + dwTemp = FALSE; dwSize = sizeof(DWORD); RegQueryValueExW( hKey, TEXT("ClassicThemeMitigations"), 0, NULL, - &bClassicThemeMitigations, + &dwTemp, &dwSize ); + if (!bWasClassicThemeMitigationsSet) + { + bClassicThemeMitigations = dwTemp; + bWasClassicThemeMitigationsSet = TRUE; + } dwSize = sizeof(DWORD); RegQueryValueExW( hKey,