From 83e1193fb25210bf3bfb241a65eadb7f40729544 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sun, 22 Oct 2023 21:35:18 +0300 Subject: [PATCH] [WIN32K] Fix alignment checks in NtUserSetInformationThread Fixes random failures on x64. --- win32ss/user/ntuser/ntstubs.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/win32ss/user/ntuser/ntstubs.c b/win32ss/user/ntuser/ntstubs.c index e301c8116e2..99e34dc5008 100644 --- a/win32ss/user/ntuser/ntstubs.c +++ b/win32ss/user/ntuser/ntstubs.c @@ -701,7 +701,7 @@ NtUserSetInformationThread(IN HANDLE ThreadHandle, TRACE("Shutdown initiated\n"); - if (ThreadInformationLength != sizeof(ULONG)) + if (ThreadInformationLength != sizeof(CapturedFlags)) { Status = STATUS_INFO_LENGTH_MISMATCH; break; @@ -711,7 +711,7 @@ NtUserSetInformationThread(IN HANDLE ThreadHandle, Status = STATUS_SUCCESS; _SEH2_TRY { - ProbeForWrite(ThreadInformation, sizeof(CapturedFlags), sizeof(PVOID)); + ProbeForWrite(ThreadInformation, sizeof(CapturedFlags), __alignof(CapturedFlags)); CapturedFlags = *(PULONG)ThreadInformation; } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) @@ -753,7 +753,7 @@ NtUserSetInformationThread(IN HANDLE ThreadHandle, Status = STATUS_SUCCESS; _SEH2_TRY { - ProbeForRead(ThreadInformation, sizeof(ShutdownStatus), sizeof(PVOID)); + ProbeForRead(ThreadInformation, sizeof(ShutdownStatus), __alignof(ShutdownStatus)); ShutdownStatus = *(NTSTATUS*)ThreadInformation; } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) @@ -783,7 +783,7 @@ NtUserSetInformationThread(IN HANDLE ThreadHandle, Status = STATUS_SUCCESS; _SEH2_TRY { - ProbeForRead(ThreadInformation, sizeof(CsrPortHandle), sizeof(PVOID)); + ProbeForRead(ThreadInformation, sizeof(CsrPortHandle), __alignof(CsrPortHandle)); CsrPortHandle = *(PHANDLE)ThreadInformation; } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)