From dfee1aee3716efdd7aa1b05f18b1693ec1ce3ce3 Mon Sep 17 00:00:00 2001 From: Amrsatrio Date: Sat, 23 Sep 2023 11:46:02 +0700 Subject: [PATCH] All: Fixed a bug that crashed `explorer` on OS builds lower than 22621 (Windows 11 22H2) --- ExplorerPatcher/osutility.h | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/ExplorerPatcher/osutility.h b/ExplorerPatcher/osutility.h index 041f68c..affc78c 100644 --- a/ExplorerPatcher/osutility.h +++ b/ExplorerPatcher/osutility.h @@ -59,37 +59,32 @@ inline HRESULT SetMicaMaterialForThisWindow(HWND hWnd, BOOL bApply) inline BOOL IsWindows11Version22H2OrHigher() { if (!global_rovi.dwMajorVersion) global_ubr = VnGetOSVersionAndUBR(&global_rovi); - if (global_rovi.dwBuildNumber >= 22621) return TRUE; - return FALSE; + return global_rovi.dwBuildNumber >= 22621; } -inline BOOL IsWindows11BuildHigherThan22631() +inline BOOL IsWindows11Version23H2OrHigher() { if (!global_rovi.dwMajorVersion) global_ubr = VnGetOSVersionAndUBR(&global_rovi); - if (global_rovi.dwBuildNumber > 22631) return TRUE; - return FALSE; + return global_rovi.dwBuildNumber >= 22631; } inline BOOL IsWindows11BuildHigherThan25158() { if (!global_rovi.dwMajorVersion) global_ubr = VnGetOSVersionAndUBR(&global_rovi); - if (global_rovi.dwBuildNumber > 25158) return TRUE; - return FALSE; + return global_rovi.dwBuildNumber > 25158; } inline BOOL IsWindows11Version22H2Build1413OrHigher() { - if (IsWindows11BuildHigherThan22631()) return TRUE; if (!global_rovi.dwMajorVersion) global_ubr = VnGetOSVersionAndUBR(&global_rovi); - if (global_ubr >= 1413) return TRUE; - return FALSE; + if (global_rovi.dwBuildNumber > 22621) return TRUE; + return global_rovi.dwBuildNumber == 22621 && global_ubr >= 1413; } inline BOOL IsWindows11Version22H2Build2134OrHigher() { - if (IsWindows11BuildHigherThan22631()) return TRUE; if (!global_rovi.dwMajorVersion) global_ubr = VnGetOSVersionAndUBR(&global_rovi); - if (global_ubr >= 2134) return TRUE; - return FALSE; + if (global_rovi.dwBuildNumber > 22621) return TRUE; + return global_rovi.dwBuildNumber == 22621 && global_ubr >= 2134; } #endif