From 02fcbeb5a16844dd4640e9eec67650f9b1a428ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Zwing?= Date: Tue, 6 Jun 2023 18:00:14 +0200 Subject: [PATCH] wow64: Ignore Thumb flag when parsing ARM syscall number. --- dlls/wow64/syscall.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dlls/wow64/syscall.c b/dlls/wow64/syscall.c index 06dd9822a08..23f8915aa64 100644 --- a/dlls/wow64/syscall.c +++ b/dlls/wow64/syscall.c @@ -639,6 +639,7 @@ NTSTATUS WINAPI wow64_NtWow64IsProcessorFeaturePresent( UINT *args ) */ static DWORD get_syscall_num( const BYTE *syscall ) { + WORD *arm_syscall = (WORD *)((ULONG_PTR)syscall & ~1); DWORD id = ~0u; if (!syscall) return id; @@ -650,9 +651,9 @@ static DWORD get_syscall_num( const BYTE *syscall ) break; case IMAGE_FILE_MACHINE_ARMNT: - if (*(WORD *)syscall == 0xb40f) + if (*arm_syscall == 0xb40f) { - DWORD inst = *(DWORD *)((WORD *)syscall + 1); + DWORD inst = *(DWORD *)(arm_syscall + 1); id = ((inst << 1) & 0x0800) + ((inst << 12) & 0xf000) + ((inst >> 20) & 0x0700) + ((inst >> 16) & 0x00ff); }