From 9b4b22164e5e76f7e6efcc13d8a7f0971e2af4dd Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Mon, 30 Dec 2019 17:17:48 -0600 Subject: [PATCH 2/3] ntdll: Handle unaligned SRW locks when using keyed events. --- dlls/ntdll/sync.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dlls/ntdll/sync.c b/dlls/ntdll/sync.c index ac324ebbbe..5b0f5b903c 100644 --- a/dlls/ntdll/sync.c +++ b/dlls/ntdll/sync.c @@ -2035,11 +2035,11 @@ static NTSTATUS fast_release_srw_shared( RTL_SRWLOCK *lock ) #define SRWLOCK_RES_SHARED 0x00000001 #ifdef WORDS_BIGENDIAN -#define srwlock_key_exclusive(lock) (&lock->Ptr) -#define srwlock_key_shared(lock) ((void *)((char *)&lock->Ptr + 2)) +#define srwlock_key_exclusive(lock) ((void *)(((ULONG_PTR)&lock->Ptr + 1) & ~1)) +#define srwlock_key_shared(lock) ((void *)(((ULONG_PTR)&lock->Ptr + 3) & ~1)) #else -#define srwlock_key_exclusive(lock) ((void *)((char *)&lock->Ptr + 2)) -#define srwlock_key_shared(lock) (&lock->Ptr) +#define srwlock_key_exclusive(lock) ((void *)(((ULONG_PTR)&lock->Ptr + 3) & ~1)) +#define srwlock_key_shared(lock) ((void *)(((ULONG_PTR)&lock->Ptr + 1) & ~1)) #endif static inline void srwlock_check_invalid( unsigned int val ) -- 2.24.1