From dc05494ca40180450aca2369e80f9a58e2e8811d Mon Sep 17 00:00:00 2001 From: Sebastian Ratz Date: Mon, 21 Oct 2024 12:52:26 +0100 Subject: [PATCH] Backport Fix to 4_23 maintenance branch #1546 Win32: Update search for AllowDarkModeForWindowWithTelemetryId for 24H2 Fixes #1546 --- .../Eclipse SWT PI/win32/library/os_custom.c | 21 +++++++++++++++++++ bundles/org.eclipse.swt/META-INF/MANIFEST.MF | 2 +- bundles/org.eclipse.swt/pom.xml | 2 +- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_custom.c b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_custom.c index d39a7b96be7..ed5c0670658 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_custom.c +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_custom.c @@ -114,6 +114,27 @@ BOOL Validate_AllowDarkModeForWindowWithTelemetryId(const BYTE* functionPtr) return TRUE; } + /* Win11 builds from 22621 */ + if ((functionPtr[0x15] == 0xBA) && // mov edx, + (*(const DWORD*)(functionPtr + 0x16) == 0xA91E)) // 0A91Eh + { + return TRUE; + } + + /* Win11 builds from 26100 */ + if ((functionPtr[0x16] == 0xBE) && // mov esi, + (*(const DWORD*)(functionPtr + 0x17) == 0xA91E)) // 0A91Eh + { + return TRUE; + } + + return FALSE; +#elif defined(_M_ARM64) + if (*(const DWORD*)(&functionPtr[0x18]) == 0xD29523C1) // mov x1,#0xA91E + { + return TRUE; + } + return FALSE; #else #error Unsupported processor type diff --git a/bundles/org.eclipse.swt/META-INF/MANIFEST.MF b/bundles/org.eclipse.swt/META-INF/MANIFEST.MF index c09ae2b24fa..f3d02bf150c 100644 --- a/bundles/org.eclipse.swt/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.swt/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-Name: %pluginName Bundle-Vendor: %providerName Bundle-SymbolicName: org.eclipse.swt; singleton:=true -Bundle-Version: 3.119.200.qualifier +Bundle-Version: 3.119.201.qualifier Bundle-ManifestVersion: 2 Bundle-Localization: plugin DynamicImport-Package: org.eclipse.swt.accessibility2 diff --git a/bundles/org.eclipse.swt/pom.xml b/bundles/org.eclipse.swt/pom.xml index 0a35734ece8..44ea1f10927 100644 --- a/bundles/org.eclipse.swt/pom.xml +++ b/bundles/org.eclipse.swt/pom.xml @@ -21,7 +21,7 @@ org.eclipse.swt org.eclipse.swt - 3.119.200-SNAPSHOT + 3.119.201-SNAPSHOT eclipse-plugin