Skip to content

Commit 9255e89

Browse files
committed
[win32][arm64] Support Dark Theme on newer Windows builds
1 parent a39c321 commit 9255e89

File tree

1 file changed

+10
-2
lines changed
  • bundles/org.eclipse.swt/Eclipse SWT PI/win32/library

1 file changed

+10
-2
lines changed

bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_custom.c

+10-2
Original file line numberDiff line numberDiff line change
@@ -234,9 +234,17 @@ BOOL Validate_SetPreferredAppMode(const BYTE* functionPtr)
234234
(functionPtr[0x06] == 0x87) && (functionPtr[0x07] == 0x0D) && // xchg ecx,dword ptr [uxtheme!g_preferredAppMode]
235235
(functionPtr[0x0C] == 0xC3); // ret
236236
#elif defined(_M_ARM64)
237-
if (*(const DWORD*)(&functionPtr[0x1C]) == 0x912F6100) // add x0,x8,#0xBD8
237+
const DWORD ldr = *(const DWORD*)(&functionPtr[0x14]);
238+
const DWORD add = *(const DWORD*)(&functionPtr[0x1C]);
239+
240+
if ((ldr & 0xFFC003FF) == 0xB9400113 && // ldr, w19,[x8, arg0]
241+
*(const DWORD*)(&functionPtr[0x18]) == 0x2A0003E1 && // mov w1,w0
242+
(add & 0xFFC003FF) == 0x91000100 && // add x0,x8,arg1
243+
*(const DWORD*)(&functionPtr[0x24]) == 0x2A1303E0) // mov w0,w19
238244
{
239-
return TRUE;
245+
const DWORD arg0 = ((ldr & 0x003FFFFF) >> 10) * 4;
246+
const DWORD arg1 = ((add & 0x003FFFFF) >> 10);
247+
return arg0 == arg1;
240248
}
241249

242250
return FALSE;

0 commit comments

Comments
 (0)