diff --git a/dlls/user32/message.c b/dlls/user32/message.c index 2255e0ee4ba..dff7ca24786 100644 --- a/dlls/user32/message.c +++ b/dlls/user32/message.c @@ -1807,7 +1807,7 @@ BOOL WINAPI PostMessageW( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam ) return TRUE; } - if (!hwnd) return PostThreadMessageW( GetCurrentThreadId(), msg, wparam, lparam ); + if (!hwnd) return NtUserPostThreadMessage( GetCurrentThreadId(), msg, wparam, lparam ); if (!(info.dest_tid = GetWindowThreadProcessId( hwnd, NULL ))) return FALSE; @@ -1823,32 +1823,7 @@ BOOL WINAPI PostMessageW( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam ) BOOL WINAPI PostThreadMessageA( DWORD thread, UINT msg, WPARAM wparam, LPARAM lparam ) { if (!map_wparam_AtoW( msg, &wparam, WMCHAR_MAP_POSTMESSAGE )) return TRUE; - return PostThreadMessageW( thread, msg, wparam, lparam ); -} - - -/********************************************************************** - * PostThreadMessageW (USER32.@) - */ -BOOL WINAPI PostThreadMessageW( DWORD thread, UINT msg, WPARAM wparam, LPARAM lparam ) -{ - struct send_message_info info; - - if (is_pointer_message( msg, wparam )) - { - SetLastError( ERROR_MESSAGE_SYNC_ONLY ); - return FALSE; - } - if (USER_IsExitingThread( thread )) return TRUE; - - info.type = MSG_POSTED; - info.dest_tid = thread; - info.hwnd = 0; - info.msg = msg; - info.wparam = wparam; - info.lparam = lparam; - info.flags = 0; - return put_message_in_queue( &info, NULL ); + return NtUserPostThreadMessage( thread, msg, wparam, lparam ); } diff --git a/dlls/user32/user32.spec b/dlls/user32/user32.spec index 89c9d76f568..2c4dba5cd86 100644 --- a/dlls/user32/user32.spec +++ b/dlls/user32/user32.spec @@ -571,7 +571,7 @@ @ stdcall PostMessageW(long long long long) @ stdcall PostQuitMessage(long) @ stdcall PostThreadMessageA(long long long long) -@ stdcall PostThreadMessageW(long long long long) +@ stdcall PostThreadMessageW(long long long long) NtUserPostThreadMessage @ stdcall PrintWindow(long long long) @ stdcall PrivateExtractIconExA(str long ptr ptr long) @ stdcall PrivateExtractIconExW(wstr long ptr ptr long) diff --git a/dlls/win32u/gdiobj.c b/dlls/win32u/gdiobj.c index 4d78c99bbc7..645e29305e8 100644 --- a/dlls/win32u/gdiobj.c +++ b/dlls/win32u/gdiobj.c @@ -1193,6 +1193,7 @@ static struct unix_funcs unix_funcs = NtUserMoveWindow, NtUserMsgWaitForMultipleObjectsEx, NtUserPeekMessage, + NtUserPostThreadMessage, NtUserRedrawWindow, NtUserRegisterClassExWOW, NtUserRegisterHotKey, diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c index 73312424283..f3e695ea16a 100644 --- a/dlls/win32u/message.c +++ b/dlls/win32u/message.c @@ -2407,6 +2407,30 @@ BOOL WINAPI NtUserPostMessage( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam return user_callbacks->pPostMessageW( hwnd, msg, wparam, lparam ); } +/********************************************************************** + * NtUserPostThreadMessage (win32u.@) + */ +BOOL WINAPI NtUserPostThreadMessage( DWORD thread, UINT msg, WPARAM wparam, LPARAM lparam ) +{ + struct send_message_info info; + + if (is_pointer_message( msg, wparam )) + { + SetLastError( ERROR_MESSAGE_SYNC_ONLY ); + return FALSE; + } + if (is_exiting_thread( thread )) return TRUE; + + info.type = MSG_POSTED; + info.dest_tid = thread; + info.hwnd = 0; + info.msg = msg; + info.wparam = wparam; + info.lparam = lparam; + info.flags = 0; + return put_message_in_queue( &info, NULL ); +} + LRESULT WINAPI NtUserMessageCall( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, void *result_info, DWORD type, BOOL ansi ) { diff --git a/dlls/win32u/win32u.spec b/dlls/win32u/win32u.spec index 31561cb3a1c..7670e1a5310 100644 --- a/dlls/win32u/win32u.spec +++ b/dlls/win32u/win32u.spec @@ -1104,7 +1104,7 @@ @ stub NtUserPhysicalToLogicalPoint @ stub NtUserPostKeyboardInputMessage @ stub NtUserPostMessage -@ stub NtUserPostThreadMessage +@ stdcall NtUserPostThreadMessage(long long long long) @ stub NtUserPrintWindow @ stub NtUserProcessConnect @ stub NtUserProcessInkFeedbackCommand diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h index c844603640e..ffd050adbcf 100644 --- a/dlls/win32u/win32u_private.h +++ b/dlls/win32u/win32u_private.h @@ -242,6 +242,7 @@ struct unix_funcs DWORD (WINAPI *pNtUserMsgWaitForMultipleObjectsEx)( DWORD count, const HANDLE *handles, DWORD timeout, DWORD mask, DWORD flags ); BOOL (WINAPI *pNtUserPeekMessage)( MSG *msg_out, HWND hwnd, UINT first, UINT last, UINT flags ); + BOOL (WINAPI *pNtUserPostThreadMessage)( DWORD thread, UINT msg, WPARAM wparam, LPARAM lparam ); BOOL (WINAPI *pNtUserRedrawWindow)( HWND hwnd, const RECT *rect, HRGN hrgn, UINT flags ); ATOM (WINAPI *pNtUserRegisterClassExWOW)( const WNDCLASSEXW *wc, UNICODE_STRING *name, UNICODE_STRING *version, diff --git a/dlls/win32u/wrappers.c b/dlls/win32u/wrappers.c index 4f7c6191df8..159cade9aea 100644 --- a/dlls/win32u/wrappers.c +++ b/dlls/win32u/wrappers.c @@ -977,6 +977,12 @@ BOOL WINAPI NtUserPeekMessage( MSG *msg_out, HWND hwnd, UINT first, UINT last, U return unix_funcs->pNtUserPeekMessage( msg_out, hwnd, first, last, flags ); } +BOOL WINAPI NtUserPostThreadMessage( DWORD thread, UINT msg, WPARAM wparam, LPARAM lparam ) +{ + if (!unix_funcs) return FALSE; + return unix_funcs->pNtUserPostThreadMessage( thread, msg, wparam, lparam ); +} + BOOL WINAPI NtUserRedrawWindow( HWND hwnd, const RECT *rect, HRGN hrgn, UINT flags ) { if (!unix_funcs) return FALSE;