Module: wine Branch: master Commit: cdf7b1bb77a6c3ba91adffe45f4bb81161e5d64e URL: https://gitlab.winehq.org/wine/wine/-/commit/cdf7b1bb77a6c3ba91adffe45f4bb81...
Author: Alexandre Julliard julliard@winehq.org Date: Thu Jan 18 14:56:36 2024 +0100
user32: Return result through NtCallbackReturn for the thunk lock callback.
---
dlls/user.exe16/message.c | 9 ++++++--- dlls/win32u/message.c | 7 +++++-- 2 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/dlls/user.exe16/message.c b/dlls/user.exe16/message.c index 203d543ce90..b2b5ce947b1 100644 --- a/dlls/user.exe16/message.c +++ b/dlls/user.exe16/message.c @@ -22,6 +22,8 @@ #include <stdarg.h> #include <string.h>
+#include "ntstatus.h" +#define WIN32_NO_STATUS #include "wine/winuser16.h" #include "wownt32.h" #include "winerror.h" @@ -2587,16 +2589,17 @@ static void WINAPI User16CallFreeIcon( ULONG *param, ULONG size ) }
-static DWORD WINAPI User16ThunkLock( DWORD *param, ULONG size ) +static NTSTATUS WINAPI User16ThunkLock( void *args, ULONG size ) { + DWORD *param = args; if (size != sizeof(DWORD)) { DWORD lock; ReleaseThunkLock( &lock ); - return lock; + return NtCallbackReturn( &lock, sizeof(lock), STATUS_SUCCESS ); } RestoreThunkLock( *param ); - return 0; + return STATUS_SUCCESS; }
diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c index ac0970c5344..2b6df6cc72c 100644 --- a/dlls/win32u/message.c +++ b/dlls/win32u/message.c @@ -3007,12 +3007,15 @@ static inline LARGE_INTEGER *get_nt_timeout( LARGE_INTEGER *time, DWORD timeout static DWORD wait_message( DWORD count, const HANDLE *handles, DWORD timeout, DWORD mask, DWORD flags ) { LARGE_INTEGER time; - DWORD ret, lock; + DWORD ret, lock = 0; void *ret_ptr; ULONG ret_len;
if (enable_thunk_lock) - lock = KeUserModeCallback( NtUserThunkLock, NULL, 0, &ret_ptr, &ret_len ); + { + if (!KeUserModeCallback( NtUserThunkLock, NULL, 0, &ret_ptr, &ret_len ) && ret_len == sizeof(lock)) + lock = *(DWORD *)ret_ptr; + }
if (user_driver->pProcessEvents( mask )) ret = count ? count - 1 : 0; else if (count)