winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
July 2022
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
1 participants
639 discussions
Start a n
N
ew thread
Jacek Caban : win32u: Get rid of no longer needed NtUserSetCallbacks.
by Alexandre Julliard
21 Jul '22
21 Jul '22
Module: wine Branch: master Commit: 88462d9127f68519e6ba3db019466e60f28d36c1 URL:
https://gitlab.winehq.org/wine/wine/-/commit/88462d9127f68519e6ba3db019466e…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Wed Jul 20 01:02:52 2022 +0200 win32u: Get rid of no longer needed NtUserSetCallbacks. --- dlls/user32/user_main.c | 20 -------------------- dlls/win32u/gdiobj.c | 3 --- dlls/win32u/ntuser_private.h | 10 ---------- dlls/win32u/sysparams.c | 3 --- dlls/win32u/win32u_private.h | 2 -- dlls/win32u/window.c | 2 +- include/ntuser.h | 1 - 7 files changed, 1 insertion(+), 40 deletions(-) diff --git a/dlls/user32/user_main.c b/dlls/user32/user_main.c index 7125e32b154..d3940d4a95c 100644 --- a/dlls/user32/user_main.c +++ b/dlls/user32/user_main.c @@ -119,23 +119,6 @@ static void dpiaware_init(void) } } -static NTSTATUS try_finally( NTSTATUS (CDECL *func)( void *), void *arg, - void (CALLBACK *finally_func)( BOOL )) -{ - NTSTATUS status; - __TRY - { - status = func( arg ); - } - __FINALLY( finally_func ); - return status; -} - -static const struct user_callbacks user_funcs = -{ - try_finally, -}; - static NTSTATUS WINAPI User32CopyImage( const struct copy_image_params *params, ULONG size ) { HANDLE ret = CopyImage( params->hwnd, params->type, params->dx, params->dy, params->flags ); @@ -247,9 +230,6 @@ static BOOL process_attach(void) { NtCurrentTeb()->Peb->KernelCallbackTable = kernel_callback_table; - /* FIXME: should not be needed */ - NtUserCallOneParam( (UINT_PTR)&user_funcs, NtUserSetCallbacks ); - dpiaware_init(); winproc_init(); register_desktop_class(); diff --git a/dlls/win32u/gdiobj.c b/dlls/win32u/gdiobj.c index 30c507275fc..b20e3a7ddbb 100644 --- a/dlls/win32u/gdiobj.c +++ b/dlls/win32u/gdiobj.c @@ -50,8 +50,6 @@ static GDI_HANDLE_ENTRY *next_unused; static LONG debug_count; SYSTEM_BASIC_INFORMATION system_info; -const struct user_callbacks *user_callbacks = NULL; - static inline HGDIOBJ entry_to_handle( GDI_HANDLE_ENTRY *entry ) { unsigned int idx = entry - gdi_shared->Handles; @@ -1283,7 +1281,6 @@ NTSTATUS gdi_init(void) NTSTATUS callbacks_init( void *args ) { - user_callbacks = *(const struct user_callbacks **)args; *(const struct unix_funcs **)args = &unix_funcs; return 0; } diff --git a/dlls/win32u/ntuser_private.h b/dlls/win32u/ntuser_private.h index 69adad822a0..313382505d4 100644 --- a/dlls/win32u/ntuser_private.h +++ b/dlls/win32u/ntuser_private.h @@ -25,16 +25,6 @@ #include "ntuser.h" #include "wine/list.h" -struct dce; -struct tagWND; - -struct hardware_msg_data; - -struct user_callbacks -{ - NTSTATUS (CDECL *try_finally)( NTSTATUS (CDECL *func)( void *), void *arg, - void (CALLBACK *finally_func)( BOOL )); -}; #define WM_SYSTIMER 0x0118 #define WM_POPUPSYSTEMMENU 0x0313 diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c index e8b55616f6a..8bb6b46397e 100644 --- a/dlls/win32u/sysparams.c +++ b/dlls/win32u/sysparams.c @@ -4953,9 +4953,6 @@ ULONG_PTR WINAPI NtUserCallOneParam( ULONG_PTR arg, ULONG code ) default: user_check_not_lock(); return 0; } - case NtUserSetCallbacks: - return (UINT_PTR)InterlockedExchangePointer( (void **)&user_callbacks, (void *)arg ); - case NtUserSpyGetVKeyName: return (UINT_PTR)debugstr_vkey_name( arg ); diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h index 262d46d3d7c..bdc8235a831 100644 --- a/dlls/win32u/win32u_private.h +++ b/dlls/win32u/win32u_private.h @@ -32,8 +32,6 @@ #include "wine/debug.h" #include "wine/server.h" -extern const struct user_callbacks *user_callbacks DECLSPEC_HIDDEN; - struct unix_funcs { /* win32u functions */ diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index fee1617ef10..a2ef9e72a06 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -3438,7 +3438,7 @@ BOOL set_window_pos( WINDOWPOS *winpos, int parent_x, int parent_y ) /* child windows get WM_CHILDACTIVATE message */ if ((get_window_long( winpos->hwnd, GWL_STYLE ) & (WS_CHILD | WS_POPUP)) == WS_CHILD) send_message( winpos->hwnd, WM_CHILDACTIVATE, 0, 0 ); - else if (user_callbacks) + else set_foreground_window( winpos->hwnd, FALSE ); } diff --git a/include/ntuser.h b/include/ntuser.h index 67058defb6f..59916d25d6d 100644 --- a/include/ntuser.h +++ b/include/ntuser.h @@ -924,7 +924,6 @@ enum NtUserGetDeskPattern, NtUserGetWinProcPtr, NtUserLock, - NtUserSetCallbacks, NtUserSpyGetVKeyName, };
1
0
0
0
Jacek Caban : win32u: Use syscall interface for NtUserMessageCall and NtUserTrackPopupMenuEx.
by Alexandre Julliard
21 Jul '22
21 Jul '22
Module: wine Branch: master Commit: e52e42b8756ff4453889e05e16a8cfc3c299eefc URL:
https://gitlab.winehq.org/wine/wine/-/commit/e52e42b8756ff4453889e05e16a8cf…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Sat Jul 9 17:29:57 2022 +0200 win32u: Use syscall interface for NtUserMessageCall and NtUserTrackPopupMenuEx. try_finally() hack is no longer needed. We don't expect exceptions from unixlib code and client callbacks' exceptions are not propagated anyway. --- dlls/win32u/gdiobj.c | 2 -- dlls/win32u/menu.c | 42 +----------------------------------------- dlls/win32u/syscall.c | 2 ++ dlls/win32u/win32u.spec | 4 ++-- dlls/win32u/win32u_private.h | 4 ---- dlls/win32u/wrappers.c | 14 -------------- dlls/wow64win/syscall.h | 2 ++ dlls/wow64win/user.c | 26 ++++++++++++++++++++++++++ 8 files changed, 33 insertions(+), 63 deletions(-)
1
0
0
0
Jacek Caban : win32u: Use syscall interface for NtUserMsgWaitForMultipleObjectsEx.
by Alexandre Julliard
21 Jul '22
21 Jul '22
Module: wine Branch: master Commit: b3fddeb8e4fe06cded9241eee8ed87c115d0a2ef URL:
https://gitlab.winehq.org/wine/wine/-/commit/b3fddeb8e4fe06cded9241eee8ed87…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Sat Jul 9 15:46:39 2022 +0200 win32u: Use syscall interface for NtUserMsgWaitForMultipleObjectsEx. --- dlls/user32/user_main.c | 1 - dlls/win32u/driver.c | 8 ++------ dlls/win32u/gdiobj.c | 1 - dlls/win32u/ntuser_private.h | 1 - dlls/win32u/syscall.c | 1 + dlls/win32u/win32u.spec | 2 +- dlls/win32u/win32u_private.h | 2 -- dlls/win32u/wrappers.c | 7 ------- dlls/wineandroid.drv/android.h | 2 -- dlls/wineandroid.drv/dllmain.c | 1 - dlls/wineandroid.drv/init.c | 3 --- dlls/wineandroid.drv/unixlib.h | 1 - dlls/wineandroid.drv/window.c | 4 ++-- dlls/winemac.drv/dllmain.c | 1 - dlls/winemac.drv/event.c | 8 ++++---- dlls/winemac.drv/macdrv.h | 3 --- dlls/winemac.drv/macdrv_main.c | 3 --- dlls/winemac.drv/unixlib.h | 1 - dlls/winex11.drv/dllmain.c | 1 - dlls/winex11.drv/event.c | 8 ++++---- dlls/winex11.drv/unixlib.h | 1 - dlls/winex11.drv/x11drv.h | 3 --- dlls/winex11.drv/x11drv_main.c | 9 --------- dlls/wow64win/syscall.h | 1 + dlls/wow64win/user.c | 21 +++++++++++++++++++++ 25 files changed, 36 insertions(+), 58 deletions(-)
1
0
0
0
Jacek Caban : win32u/tests: Add tests for catching exceptions from timer proc.
by Alexandre Julliard
21 Jul '22
21 Jul '22
Module: wine Branch: master Commit: 6395bf962fe55d93bc3ca599d4519daccb7ab4de URL:
https://gitlab.winehq.org/wine/wine/-/commit/6395bf962fe55d93bc3ca599d4519d…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Tue Jul 19 19:51:53 2022 +0200 win32u/tests: Add tests for catching exceptions from timer proc. We currently depend on default behaviour of suppressing exceptions from client callbacks. If we change it to fail by default, we will need a separated filter for NtUserDispatchMessage. --- dlls/win32u/tests/win32u.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/dlls/win32u/tests/win32u.c b/dlls/win32u/tests/win32u.c index 07179e6cdb9..0985478b2f0 100644 --- a/dlls/win32u/tests/win32u.c +++ b/dlls/win32u/tests/win32u.c @@ -632,6 +632,50 @@ static void test_message_filter(void) ok( ret, "NtUserUnhookWindowsHook failed: %lu\n", GetLastError() ); } +static char calls[128]; + +static void WINAPI timer_func( HWND hwnd, UINT msg, UINT_PTR id, DWORD time ) +{ + sprintf( calls + strlen( calls ), "timer%Iu,", id ); + NtUserKillTimer( hwnd, id ); + + if (!id) + { + MSG msg; + NtUserSetTimer( hwnd, 1, 1, timer_func, TIMERV_DEFAULT_COALESCING ); + while (GetMessageW( &msg, NULL, 0, 0 )) + { + TranslateMessage( &msg ); + NtUserDispatchMessage( &msg ); + if (msg.message == WM_TIMER) break; + } + } + + strcat( calls, "crash," ); + *(volatile int *)0 = 0; +} + +static void test_timer(void) +{ + HWND hwnd; + MSG msg; + + hwnd = CreateWindowExA( 0, "static", NULL, WS_POPUP, 0,0,0,0,0,0,0, NULL ); + + NtUserSetTimer( hwnd, 0, 1, timer_func, TIMERV_DEFAULT_COALESCING ); + + calls[0] = 0; + while (GetMessageW( &msg, NULL, 0, 0 )) + { + TranslateMessage( &msg ); + NtUserDispatchMessage( &msg ); + if (msg.message == WM_TIMER) break; + } + + ok( !strcmp( calls, "timer0,timer1,crash,crash," ), "calls = %s\n", calls ); + DestroyWindow( hwnd ); +} + START_TEST(win32u) { /* native win32u.dll fails if user32 is not loaded, so make sure it's fully initialized */ @@ -646,6 +690,7 @@ START_TEST(win32u) test_window_text(); test_menu(); test_message_filter(); + test_timer(); test_NtUserCloseWindowStation(); }
1
0
0
0
Jacek Caban : win32u: Use syscall interface for NtUserDispatchMessage.
by Alexandre Julliard
21 Jul '22
21 Jul '22
Module: wine Branch: master Commit: 1e5d4e94229201b66f62a89138bf6c654e91f335 URL:
https://gitlab.winehq.org/wine/wine/-/commit/1e5d4e94229201b66f62a89138bf6c…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Sat Jul 9 17:19:02 2022 +0200 win32u: Use syscall interface for NtUserDispatchMessage. --- dlls/win32u/gdiobj.c | 1 - dlls/win32u/message.c | 10 +--------- dlls/win32u/syscall.c | 1 + dlls/win32u/win32u.spec | 2 +- dlls/win32u/win32u_private.h | 1 - dlls/win32u/wrappers.c | 6 ------ dlls/wow64win/syscall.h | 1 + dlls/wow64win/user.c | 10 +++++++++- 8 files changed, 13 insertions(+), 19 deletions(-) diff --git a/dlls/win32u/gdiobj.c b/dlls/win32u/gdiobj.c index fddaf898761..e5c2c185511 100644 --- a/dlls/win32u/gdiobj.c +++ b/dlls/win32u/gdiobj.c @@ -1158,7 +1158,6 @@ static struct unix_funcs unix_funcs = NtUserDestroyMenu, NtUserDestroyWindow, NtUserDisableThreadIme, - NtUserDispatchMessage, NtUserDragDetect, NtUserDrawCaptionTemp, NtUserDrawIconEx, diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c index 1b9585c4178..7045aedb4b1 100644 --- a/dlls/win32u/message.c +++ b/dlls/win32u/message.c @@ -2514,15 +2514,7 @@ LRESULT WINAPI NtUserDispatchMessage( const MSG *msg ) if (!init_win_proc_params( ¶ms, msg->hwnd, msg->message, msg->wParam, NtGetTickCount(), FALSE )) return 0; - __TRY - { - dispatch_win_proc_params( ¶ms, sizeof(params) ); - } - __EXCEPT - { - retval = 0; - } - __ENDTRY + dispatch_win_proc_params( ¶ms, sizeof(params) ); return retval; } if (msg->message == WM_SYSTIMER) diff --git a/dlls/win32u/syscall.c b/dlls/win32u/syscall.c index f5508f62d16..a7e18158fb5 100644 --- a/dlls/win32u/syscall.c +++ b/dlls/win32u/syscall.c @@ -117,6 +117,7 @@ static void * const syscalls[] = NtUserDeleteMenu, NtUserDestroyAcceleratorTable, NtUserDestroyInputContext, + NtUserDispatchMessage, NtUserEndMenu, NtUserFindExistingCursorIcon, NtUserFindWindowEx, diff --git a/dlls/win32u/win32u.spec b/dlls/win32u/win32u.spec index d74685ad603..7ec96eedfcf 100644 --- a/dlls/win32u/win32u.spec +++ b/dlls/win32u/win32u.spec @@ -839,7 +839,7 @@ @ stub NtUserDisableProcessWindowFiltering @ stdcall NtUserDisableThreadIme(long) @ stub NtUserDiscardPointerFrameMessages -@ stdcall NtUserDispatchMessage(ptr) +@ stdcall -syscall NtUserDispatchMessage(ptr) @ stub NtUserDisplayConfigGetDeviceInfo @ stub NtUserDisplayConfigSetDeviceInfo @ stub NtUserDoSoundConnect diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h index 914a02ffd52..d5b3e0fdda8 100644 --- a/dlls/win32u/win32u_private.h +++ b/dlls/win32u/win32u_private.h @@ -215,7 +215,6 @@ struct unix_funcs BOOL (WINAPI *pNtUserDestroyMenu)( HMENU handle ); BOOL (WINAPI *pNtUserDestroyWindow)( HWND hwnd ); BOOL (WINAPI *pNtUserDisableThreadIme)( DWORD thread_id ); - LRESULT (WINAPI *pNtUserDispatchMessage)( const MSG *msg ); BOOL (WINAPI *pNtUserDragDetect)( HWND hwnd, int x, int y ); BOOL (WINAPI *pNtUserDrawCaptionTemp)( HWND hwnd, HDC hdc, const RECT *rect, HFONT font, HICON icon, const WCHAR *str, UINT flags ); diff --git a/dlls/win32u/wrappers.c b/dlls/win32u/wrappers.c index 609e893403b..9c2264e887e 100644 --- a/dlls/win32u/wrappers.c +++ b/dlls/win32u/wrappers.c @@ -855,12 +855,6 @@ BOOL WINAPI NtUserDisableThreadIme( DWORD thread_id ) return unix_funcs->pNtUserDisableThreadIme( thread_id ); } -LRESULT WINAPI NtUserDispatchMessage( const MSG *msg ) -{ - if (!unix_funcs) return 0; - return unix_funcs->pNtUserDispatchMessage( msg ); -} - BOOL WINAPI NtUserDragDetect( HWND hwnd, int x, int y ) { if (!unix_funcs) return FALSE; diff --git a/dlls/wow64win/syscall.h b/dlls/wow64win/syscall.h index 005037d71a5..3842eb3c1da 100644 --- a/dlls/wow64win/syscall.h +++ b/dlls/wow64win/syscall.h @@ -104,6 +104,7 @@ SYSCALL_ENTRY( NtUserDeleteMenu ) \ SYSCALL_ENTRY( NtUserDestroyAcceleratorTable ) \ SYSCALL_ENTRY( NtUserDestroyInputContext ) \ + SYSCALL_ENTRY( NtUserDispatchMessage ) \ SYSCALL_ENTRY( NtUserEndMenu ) \ SYSCALL_ENTRY( NtUserFindExistingCursorIcon ) \ SYSCALL_ENTRY( NtUserFindWindowEx ) \ diff --git a/dlls/wow64win/user.c b/dlls/wow64win/user.c index 386458ccf0c..7ca1e87109d 100644 --- a/dlls/wow64win/user.c +++ b/dlls/wow64win/user.c @@ -78,7 +78,7 @@ typedef struct DWORD dwType; } RAWINPUTDEVICELIST32; -static MSG *msg_32to64( MSG *msg, MSG32 *msg32 ) +static MSG *msg_32to64( MSG *msg, const MSG32 *msg32 ) { if (!msg32) return NULL; @@ -281,6 +281,14 @@ NTSTATUS WINAPI wow64_NtUserDestroyInputContext( UINT *args ) return NtUserDestroyInputContext( handle ); } +NTSTATUS WINAPI wow64_NtUserDispatchMessage( UINT *args ) +{ + const MSG32 *msg32 = get_ptr( &args ); + MSG msg; + + return NtUserDispatchMessage( msg_32to64( &msg, msg32 )); +} + NTSTATUS WINAPI wow64_NtUserEndMenu( UINT *args ) { return NtUserEndMenu();
1
0
0
0
Jacek Caban : ntdll: Suppress callback exceptions in KiUserCallbackDispatcher.
by Alexandre Julliard
21 Jul '22
21 Jul '22
Module: wine Branch: master Commit: 079179fec720780679db3eed90adcc257f4ff240 URL:
https://gitlab.winehq.org/wine/wine/-/commit/079179fec720780679db3eed90adcc…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Tue Jul 19 19:42:26 2022 +0200 ntdll: Suppress callback exceptions in KiUserCallbackDispatcher. --- dlls/ntdll/signal_arm.c | 16 ++++++++++++++-- dlls/ntdll/signal_arm64.c | 16 ++++++++++++++-- dlls/ntdll/signal_i386.c | 16 ++++++++++++++-- dlls/ntdll/signal_x86_64.c | 16 ++++++++++++++-- dlls/ntdll/unix/signal_arm.c | 3 +++ dlls/ntdll/unix/signal_arm64.c | 3 +++ dlls/ntdll/unix/signal_i386.c | 3 +++ dlls/ntdll/unix/signal_x86_64.c | 3 +++ 8 files changed, 68 insertions(+), 8 deletions(-) diff --git a/dlls/ntdll/signal_arm.c b/dlls/ntdll/signal_arm.c index d0229d934ce..c3674487277 100644 --- a/dlls/ntdll/signal_arm.c +++ b/dlls/ntdll/signal_arm.c @@ -533,9 +533,21 @@ void WINAPI KiUserApcDispatcher( CONTEXT *context, ULONG_PTR ctx, ULONG_PTR arg1 */ void WINAPI KiUserCallbackDispatcher( ULONG id, void *args, ULONG len ) { - NTSTATUS (WINAPI *func)(void *, ULONG) = ((void **)NtCurrentTeb()->Peb->KernelCallbackTable)[id]; + NTSTATUS status; + + __TRY + { + NTSTATUS (WINAPI *func)(void *, ULONG) = ((void **)NtCurrentTeb()->Peb->KernelCallbackTable)[id]; + status = NtCallbackReturn( NULL, 0, func( args, len )); + } + __EXCEPT_ALL + { + ERR_(seh)( "ignoring exception\n" ); + status = NtCallbackReturn( 0, 0, 0 ); + } + __ENDTRY - RtlRaiseStatus( NtCallbackReturn( NULL, 0, func( args, len ))); + RtlRaiseStatus( status ); } diff --git a/dlls/ntdll/signal_arm64.c b/dlls/ntdll/signal_arm64.c index 959c3ea50dc..ee3204ebce8 100644 --- a/dlls/ntdll/signal_arm64.c +++ b/dlls/ntdll/signal_arm64.c @@ -576,9 +576,21 @@ void WINAPI KiUserApcDispatcher( CONTEXT *context, ULONG_PTR arg1, ULONG_PTR arg */ void WINAPI KiUserCallbackDispatcher( ULONG id, void *args, ULONG len ) { - NTSTATUS (WINAPI *func)(void *, ULONG) = ((void **)NtCurrentTeb()->Peb->KernelCallbackTable)[id]; + NTSTATUS status; + + __TRY + { + NTSTATUS (WINAPI *func)(void *, ULONG) = ((void **)NtCurrentTeb()->Peb->KernelCallbackTable)[id]; + status = NtCallbackReturn( NULL, 0, func( args, len )); + } + __EXCEPT_ALL + { + ERR_(seh)( "ignoring exception\n" ); + status = NtCallbackReturn( 0, 0, 0 ); + } + __ENDTRY - RtlRaiseStatus( NtCallbackReturn( NULL, 0, func( args, len ))); + RtlRaiseStatus( status ); } diff --git a/dlls/ntdll/signal_i386.c b/dlls/ntdll/signal_i386.c index f4c935ecc94..ae065f8c37b 100644 --- a/dlls/ntdll/signal_i386.c +++ b/dlls/ntdll/signal_i386.c @@ -257,9 +257,21 @@ void WINAPI KiUserApcDispatcher( CONTEXT *context, ULONG_PTR ctx, ULONG_PTR arg1 */ void WINAPI KiUserCallbackDispatcher( ULONG id, void *args, ULONG len ) { - NTSTATUS (WINAPI *func)(void *, ULONG) = ((void **)NtCurrentTeb()->Peb->KernelCallbackTable)[id]; + NTSTATUS status; + + __TRY + { + NTSTATUS (WINAPI *func)(void *, ULONG) = ((void **)NtCurrentTeb()->Peb->KernelCallbackTable)[id]; + status = NtCallbackReturn( NULL, 0, func( args, len )); + } + __EXCEPT_ALL + { + ERR_(seh)( "ignoring exception\n" ); + status = NtCallbackReturn( 0, 0, 0 ); + } + __ENDTRY - RtlRaiseStatus( NtCallbackReturn( NULL, 0, func( args, len ))); + RtlRaiseStatus( status ); } diff --git a/dlls/ntdll/signal_x86_64.c b/dlls/ntdll/signal_x86_64.c index 9957d0c3dfa..b1ab4933b93 100644 --- a/dlls/ntdll/signal_x86_64.c +++ b/dlls/ntdll/signal_x86_64.c @@ -661,9 +661,21 @@ __ASM_GLOBAL_FUNC( KiUserApcDispatcher, */ void WINAPI KiUserCallbackDispatcher( ULONG id, void *args, ULONG len ) { - NTSTATUS (WINAPI *func)(void *, ULONG) = ((void **)NtCurrentTeb()->Peb->KernelCallbackTable)[id]; + NTSTATUS status; + + __TRY + { + NTSTATUS (WINAPI *func)(void *, ULONG) = ((void **)NtCurrentTeb()->Peb->KernelCallbackTable)[id]; + status = NtCallbackReturn( NULL, 0, func( args, len )); + } + __EXCEPT_ALL + { + ERR_(seh)( "ignoring exception\n" ); + status = NtCallbackReturn( 0, 0, 0 ); + } + __ENDTRY - RtlRaiseStatus( NtCallbackReturn( NULL, 0, func( args, len ))); + RtlRaiseStatus( status ); } diff --git a/dlls/ntdll/unix/signal_arm.c b/dlls/ntdll/unix/signal_arm.c index 73843ba56a6..5d1478a1ff4 100644 --- a/dlls/ntdll/unix/signal_arm.c +++ b/dlls/ntdll/unix/signal_arm.c @@ -721,6 +721,7 @@ struct user_callback_frame ULONG *ret_len; __wine_jmp_buf jmpbuf; NTSTATUS status; + void *teb_frame; }; /*********************************************************************** @@ -756,6 +757,7 @@ NTSTATUS WINAPI KeUserModeCallback( ULONG id, const void *args, ULONG len, void callback_frame.frame.restore_flags = CONTEXT_INTEGER; callback_frame.frame.syscall_table = frame->syscall_table; callback_frame.frame.prev_frame = frame; + callback_frame.teb_frame = NtCurrentTeb()->Tib.ExceptionList; arm_thread_data()->syscall_frame = &callback_frame.frame; __wine_syscall_dispatcher_return( &callback_frame.frame, 0 ); @@ -777,6 +779,7 @@ NTSTATUS WINAPI NtCallbackReturn( void *ret_ptr, ULONG ret_len, NTSTATUS status *frame->ret_len = ret_len; frame->status = status; arm_thread_data()->syscall_frame = frame->frame.prev_frame; + NtCurrentTeb()->Tib.ExceptionList = frame->teb_frame; __wine_longjmp( &frame->jmpbuf, 1 ); } diff --git a/dlls/ntdll/unix/signal_arm64.c b/dlls/ntdll/unix/signal_arm64.c index 10543322a8f..4e552e0f10a 100644 --- a/dlls/ntdll/unix/signal_arm64.c +++ b/dlls/ntdll/unix/signal_arm64.c @@ -730,6 +730,7 @@ struct user_callback_frame ULONG *ret_len; __wine_jmp_buf jmpbuf; NTSTATUS status; + void *teb_frame; }; /*********************************************************************** @@ -766,6 +767,7 @@ NTSTATUS WINAPI KeUserModeCallback( ULONG id, const void *args, ULONG len, void callback_frame.frame.restore_flags = CONTEXT_INTEGER; callback_frame.frame.syscall_table = frame->syscall_table; callback_frame.frame.prev_frame = frame; + callback_frame.teb_frame = NtCurrentTeb()->Tib.ExceptionList; arm64_thread_data()->syscall_frame = &callback_frame.frame; __wine_syscall_dispatcher_return( &callback_frame.frame, 0 ); @@ -787,6 +789,7 @@ NTSTATUS WINAPI NtCallbackReturn( void *ret_ptr, ULONG ret_len, NTSTATUS status *frame->ret_len = ret_len; frame->status = status; arm64_thread_data()->syscall_frame = frame->frame.prev_frame; + NtCurrentTeb()->Tib.ExceptionList = frame->teb_frame; __wine_longjmp( &frame->jmpbuf, 1 ); } diff --git a/dlls/ntdll/unix/signal_i386.c b/dlls/ntdll/unix/signal_i386.c index 5ddef2701c4..2dfce706394 100644 --- a/dlls/ntdll/unix/signal_i386.c +++ b/dlls/ntdll/unix/signal_i386.c @@ -1575,6 +1575,7 @@ struct user_callback_frame ULONG *ret_len; __wine_jmp_buf jmpbuf; NTSTATUS status; + void *teb_frame; }; /*********************************************************************** @@ -1614,6 +1615,7 @@ NTSTATUS WINAPI KeUserModeCallback( ULONG id, const void *args, ULONG len, void callback_frame.frame.syscall_flags = frame->syscall_flags; callback_frame.frame.syscall_table = frame->syscall_table; callback_frame.frame.prev_frame = frame; + callback_frame.teb_frame = NtCurrentTeb()->Tib.ExceptionList; x86_thread_data()->syscall_frame = &callback_frame.frame; __wine_syscall_dispatcher_return( &callback_frame.frame, 0 ); @@ -1635,6 +1637,7 @@ NTSTATUS WINAPI NtCallbackReturn( void *ret_ptr, ULONG ret_len, NTSTATUS status *frame->ret_len = ret_len; frame->status = status; x86_thread_data()->syscall_frame = frame->frame.prev_frame; + NtCurrentTeb()->Tib.ExceptionList = frame->teb_frame; __wine_longjmp( &frame->jmpbuf, 1 ); } diff --git a/dlls/ntdll/unix/signal_x86_64.c b/dlls/ntdll/unix/signal_x86_64.c index 9b7a19bce72..d6f19dbfa84 100644 --- a/dlls/ntdll/unix/signal_x86_64.c +++ b/dlls/ntdll/unix/signal_x86_64.c @@ -2327,6 +2327,7 @@ struct user_callback_frame ULONG *ret_len; __wine_jmp_buf jmpbuf; NTSTATUS status; + void *teb_frame; }; /*********************************************************************** @@ -2368,6 +2369,7 @@ NTSTATUS WINAPI KeUserModeCallback( ULONG id, const void *args, ULONG len, void callback_frame.frame.prev_frame = frame; callback_frame.frame.syscall_flags = frame->syscall_flags; callback_frame.frame.syscall_table = frame->syscall_table; + callback_frame.teb_frame = NtCurrentTeb()->Tib.ExceptionList; amd64_thread_data()->syscall_frame = &callback_frame.frame; __wine_syscall_dispatcher_return( &callback_frame.frame, 0 ); @@ -2389,6 +2391,7 @@ NTSTATUS WINAPI NtCallbackReturn( void *ret_ptr, ULONG ret_len, NTSTATUS status *frame->ret_len = ret_len; frame->status = status; amd64_thread_data()->syscall_frame = frame->frame.prev_frame; + NtCurrentTeb()->Tib.ExceptionList = frame->teb_frame; __wine_longjmp( &frame->jmpbuf, 1 ); }
1
0
0
0
Jacek Caban : win32u: Avoid using client callbacks for NtUserSendMessage.
by Alexandre Julliard
21 Jul '22
21 Jul '22
Module: wine Branch: master Commit: c1c57bd75014d660abbe456d926320e80b088d67 URL:
https://gitlab.winehq.org/wine/wine/-/commit/c1c57bd75014d660abbe456d926320…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Tue Jul 19 19:19:56 2022 +0200 win32u: Avoid using client callbacks for NtUserSendMessage. --- dlls/user32/message.c | 39 +++++++++++++++++++++++++++++++++++++-- dlls/win32u/hook.c | 2 +- dlls/win32u/message.c | 26 +++++++++++++++++++++++--- dlls/win32u/tests/win32u.c | 4 ++-- dlls/win32u/win32u_private.h | 1 + 5 files changed, 64 insertions(+), 8 deletions(-) diff --git a/dlls/user32/message.c b/dlls/user32/message.c index 40babb71eba..71c0f339b54 100644 --- a/dlls/user32/message.c +++ b/dlls/user32/message.c @@ -597,12 +597,41 @@ LRESULT WINAPI SendMessageTimeoutA( HWND hwnd, UINT msg, WPARAM wparam, LPARAM l } +static LRESULT dispatch_send_message( struct win_proc_params *params ) +{ + struct user_thread_info *thread_info = get_user_thread_info(); + INPUT_MESSAGE_SOURCE prev_source = thread_info->msg_source; + LRESULT retval = 0; + + static const INPUT_MESSAGE_SOURCE msg_source_unavailable = { IMDT_UNAVAILABLE, IMO_UNAVAILABLE }; + + thread_info->recursion_count++; + + params->result = &retval; + thread_info->msg_source = msg_source_unavailable; + SPY_EnterMessage( SPY_SENDMESSAGE, params->hwnd, params->msg, params->wparam, params->lparam ); + + dispatch_win_proc_params( params ); + + SPY_ExitMessage( SPY_RESULT_OK, params->hwnd, params->msg, retval, params->wparam, params->lparam ); + thread_info->msg_source = prev_source; + thread_info->recursion_count--; + return retval; +} + + /*********************************************************************** * SendMessageW (USER32.@) */ LRESULT WINAPI SendMessageW( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam ) { - return NtUserMessageCall( hwnd, msg, wparam, lparam, NULL, NtUserSendMessage, FALSE ); + struct win_proc_params params; + LRESULT retval; + + params.hwnd = 0; + retval = NtUserMessageCall( hwnd, msg, wparam, lparam, ¶ms, NtUserSendMessage, FALSE ); + if (params.hwnd) retval = dispatch_send_message( ¶ms ); + return retval; } @@ -611,6 +640,9 @@ LRESULT WINAPI SendMessageW( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam ) */ LRESULT WINAPI SendMessageA( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam ) { + struct win_proc_params params; + LRESULT retval; + if (msg == WM_CHAR && !WIN_IsCurrentThread( hwnd )) { if (!map_wparam_AtoW( msg, &wparam, WMCHAR_MAP_SENDMESSAGE )) @@ -618,7 +650,10 @@ LRESULT WINAPI SendMessageA( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam ) return NtUserMessageCall( hwnd, msg, wparam, lparam, NULL, NtUserSendMessage, FALSE ); } - return NtUserMessageCall( hwnd, msg, wparam, lparam, NULL, NtUserSendMessage, TRUE ); + params.hwnd = 0; + retval = NtUserMessageCall( hwnd, msg, wparam, lparam, ¶ms, NtUserSendMessage, TRUE ); + if (params.hwnd) retval = dispatch_send_message( ¶ms ); + return retval; } diff --git a/dlls/win32u/hook.c b/dlls/win32u/hook.c index a271693622a..dcf2bb9f865 100644 --- a/dlls/win32u/hook.c +++ b/dlls/win32u/hook.c @@ -60,7 +60,7 @@ static const char *debugstr_hook_id( unsigned int id ) return hook_names[id - WH_MINHOOK]; } -static BOOL is_hooked( INT id ) +BOOL is_hooked( INT id ) { struct user_thread_info *thread_info = get_user_thread_info(); diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c index 49dc3fd6d08..1b9585c4178 100644 --- a/dlls/win32u/message.c +++ b/dlls/win32u/message.c @@ -109,6 +109,7 @@ struct send_message_info SENDASYNCPROC callback; /* callback function for SendMessageCallback */ ULONG_PTR data; /* callback data */ enum wm_char_mapping wm_char; + struct win_proc_params *params; }; static const INPUT_MESSAGE_SOURCE msg_source_unavailable = { IMDT_UNAVAILABLE, IMO_UNAVAILABLE }; @@ -2374,6 +2375,7 @@ LRESULT send_internal_message_timeout( DWORD dest_pid, DWORD dest_tid, info.lparam = lparam; info.flags = flags; info.timeout = timeout; + info.params = NULL; ret = send_inter_thread_message( &info, &result ); } @@ -2399,6 +2401,7 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *r info.hwnd = hwnd; info.flags = 0; info.timeout = 0; + info.params = NULL; if (input->type == INPUT_HARDWARE && rawinput->header.dwType == RIM_TYPEHID) { @@ -2635,6 +2638,16 @@ static BOOL process_message( struct send_message_info *info, DWORD_PTR *res_ptr, if (!(info->dest_tid = get_window_thread( info->hwnd, &dest_pid ))) return FALSE; if (is_exiting_thread( info->dest_tid )) return FALSE; + if (info->params && info->dest_tid == GetCurrentThreadId() && + !is_hooked( WH_CALLWNDPROC ) && !is_hooked( WH_CALLWNDPROCRET ) && + thread_info->recursion_count <= MAX_WINPROC_RECURSION) + { + /* if we're called from client side and need just a simple winproc call, + * just fill dispatch params and let user32 do the rest */ + return init_window_call_params( info->params, info->hwnd, info->msg, info->wparam, info->lparam, + NULL, ansi, info->wm_char ); + } + thread_info->msg_source = msg_source_unavailable; spy_enter_message( SPY_SENDMESSAGE, info->hwnd, info->msg, info->wparam, info->lparam ); @@ -2755,7 +2768,8 @@ BOOL kill_system_timer( HWND hwnd, UINT_PTR id ) return ret; } -static LRESULT send_window_message( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, BOOL ansi ) +static LRESULT send_window_message( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, + struct win_proc_params *client_params, BOOL ansi ) { struct send_message_info info; DWORD_PTR res = 0; @@ -2768,6 +2782,7 @@ static LRESULT send_window_message( HWND hwnd, UINT msg, WPARAM wparam, LPARAM l info.flags = SMTO_NORMAL; info.timeout = 0; info.wm_char = WMCHAR_MAP_SENDMESSAGETIMEOUT; + info.params = client_params; process_message( &info, &res, ansi ); return res; @@ -2787,6 +2802,7 @@ LRESULT send_message_timeout( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, info.flags = flags; info.timeout = timeout; info.wm_char = WMCHAR_MAP_SENDMESSAGETIMEOUT; + info.params = NULL; return process_message( &info, res_ptr, ansi ); } @@ -2794,7 +2810,7 @@ LRESULT send_message_timeout( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, /* see SendMessageW */ LRESULT send_message( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam ) { - return send_window_message( hwnd, msg, wparam, lparam, FALSE ); + return send_window_message( hwnd, msg, wparam, lparam, NULL, FALSE ); } /* see SendNotifyMessageW */ @@ -2815,6 +2831,7 @@ static BOOL send_notify_message( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpar info.lparam = lparam; info.flags = 0; info.wm_char = WMCHAR_MAP_SENDMESSAGETIMEOUT; + info.params = NULL; return process_message( &info, NULL, ansi ); } @@ -2840,6 +2857,7 @@ static BOOL send_message_callback( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lp info.data = params->data; info.flags = 0; info.wm_char = WMCHAR_MAP_SENDMESSAGETIMEOUT; + info.params = NULL; return process_message( &info, NULL, ansi ); } @@ -2866,6 +2884,7 @@ BOOL WINAPI NtUserPostMessage( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam info.wparam = wparam; info.lparam = lparam; info.flags = 0; + info.params = NULL; if (is_broadcast(hwnd)) return broadcast_message( &info, NULL ); @@ -2899,6 +2918,7 @@ BOOL WINAPI NtUserPostThreadMessage( DWORD thread, UINT msg, WPARAM wparam, LPAR info.wparam = wparam; info.lparam = lparam; info.flags = 0; + info.params = NULL; return put_message_in_queue( &info, NULL ); } @@ -2924,7 +2944,7 @@ LRESULT WINAPI NtUserMessageCall( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpa wparam, lparam, ansi ); case NtUserSendMessage: - return send_window_message( hwnd, msg, wparam, lparam, ansi ); + return send_window_message( hwnd, msg, wparam, lparam, result_info, ansi ); case NtUserSendMessageTimeout: { diff --git a/dlls/win32u/tests/win32u.c b/dlls/win32u/tests/win32u.c index dc1638f37ab..07179e6cdb9 100644 --- a/dlls/win32u/tests/win32u.c +++ b/dlls/win32u/tests/win32u.c @@ -425,10 +425,10 @@ static void test_message_call(void) hwnd = CreateWindowExW( 0, L"TestClass", NULL, WS_POPUP, 0,0,0,0,0,0,0, NULL ); - res = NtUserMessageCall( hwnd, WM_USER, 1, 2, (void *)0xdeadbeef, NtUserSendMessage, FALSE ); + res = NtUserMessageCall( hwnd, WM_USER, 1, 2, NULL, NtUserSendMessage, FALSE ); ok( res == 3, "res = %Iu\n", res ); - res = NtUserMessageCall( hwnd, WM_USER, 1, 2, (void *)0xdeadbeef, NtUserSendMessage, TRUE ); + res = NtUserMessageCall( hwnd, WM_USER, 1, 2, NULL, NtUserSendMessage, TRUE ); ok( res == 3, "res = %Iu\n", res ); res = NtUserMessageCall( hwnd, WM_SETTEXT, 0, (LPARAM)L"test", NULL, NtUserSendMessage, FALSE ); diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h index a7f0624fdba..914a02ffd52 100644 --- a/dlls/win32u/win32u_private.h +++ b/dlls/win32u/win32u_private.h @@ -391,6 +391,7 @@ extern LRESULT handle_nc_hit_test( HWND hwnd, POINT pt ) DECLSPEC_HIDDEN; /* hook.c */ extern LRESULT call_current_hook( HHOOK hhook, INT code, WPARAM wparam, LPARAM lparam ) DECLSPEC_HIDDEN; extern LRESULT call_hooks( INT id, INT code, WPARAM wparam, LPARAM lparam, BOOL unicode ) DECLSPEC_HIDDEN; +extern BOOL is_hooked( INT id ) DECLSPEC_HIDDEN; extern BOOL unhook_windows_hook( INT id, HOOKPROC proc ) DECLSPEC_HIDDEN; /* imm.c */
1
0
0
0
Jacek Caban : win32u: Remove no longer needed NtUserDispatchMessageA.
by Alexandre Julliard
21 Jul '22
21 Jul '22
Module: wine Branch: master Commit: 2ef6a6eee67cc3fb5b81e9dc4594bee40e908332 URL:
https://gitlab.winehq.org/wine/wine/-/commit/2ef6a6eee67cc3fb5b81e9dc4594be…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Tue Jul 19 18:42:49 2022 +0200 win32u: Remove no longer needed NtUserDispatchMessageA. --- dlls/user32/message.c | 2 +- dlls/win32u/message.c | 16 ++++------------ dlls/win32u/sysparams.c | 3 --- dlls/win32u/win32u_private.h | 1 - include/ntuser.h | 6 ------ 5 files changed, 5 insertions(+), 23 deletions(-) diff --git a/dlls/user32/message.c b/dlls/user32/message.c index f72d837ac94..40babb71eba 100644 --- a/dlls/user32/message.c +++ b/dlls/user32/message.c @@ -877,7 +877,7 @@ LRESULT WINAPI DECLSPEC_HOTPATCH DispatchMessageA( const MSG* msg ) if (msg->message != WM_SYSTIMER && msg->message != WM_PAINT) return dispatch_message( msg, TRUE ); - return NtUserDispatchMessageA( msg ); + return NtUserDispatchMessage( msg ); } diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c index 50bce801339..49dc3fd6d08 100644 --- a/dlls/win32u/message.c +++ b/dlls/win32u/message.c @@ -2496,9 +2496,9 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *r } /********************************************************************** - * dispatch_message + * NtUserDispatchMessage (win32u.@) */ -LRESULT dispatch_message( const MSG *msg, BOOL ansi ) +LRESULT WINAPI NtUserDispatchMessage( const MSG *msg ) { struct win_proc_params params; LRESULT retval = 0; @@ -2509,7 +2509,7 @@ LRESULT dispatch_message( const MSG *msg, BOOL ansi ) params.func = (WNDPROC)msg->lParam; params.result = &retval; /* FIXME */ if (!init_win_proc_params( ¶ms, msg->hwnd, msg->message, - msg->wParam, NtGetTickCount(), ansi )) + msg->wParam, NtGetTickCount(), FALSE )) return 0; __TRY { @@ -2541,7 +2541,7 @@ LRESULT dispatch_message( const MSG *msg, BOOL ansi ) spy_enter_message( SPY_DISPATCHMESSAGE, msg->hwnd, msg->message, msg->wParam, msg->lParam ); if (init_window_call_params( ¶ms, msg->hwnd, msg->message, msg->wParam, msg->lParam, - &retval, ansi, WMCHAR_MAP_DISPATCHMESSAGE )) + &retval, FALSE, WMCHAR_MAP_DISPATCHMESSAGE )) dispatch_win_proc_params( ¶ms, sizeof(params) ); else if (!is_window( msg->hwnd )) SetLastError( ERROR_INVALID_WINDOW_HANDLE ); else SetLastError( ERROR_MESSAGE_SYNC_ONLY ); @@ -2558,14 +2558,6 @@ LRESULT dispatch_message( const MSG *msg, BOOL ansi ) return retval; } -/********************************************************************** - * NtUserDispatchMessage (win32u.@) - */ -LRESULT WINAPI NtUserDispatchMessage( const MSG *msg ) -{ - return dispatch_message( msg, FALSE ); -} - static BOOL is_message_broadcastable( UINT msg ) { return msg < WM_USER || msg >= 0xc000; diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c index 2c1f8f4241f..e8b55616f6a 100644 --- a/dlls/win32u/sysparams.c +++ b/dlls/win32u/sysparams.c @@ -4880,9 +4880,6 @@ ULONG_PTR WINAPI NtUserCallOneParam( ULONG_PTR arg, ULONG code ) case NtUserCallOneParam_CreateMenu: return HandleToUlong( create_menu( arg ) ); - case NtUserCallOneParam_DispatchMessageA: - return dispatch_message( (const MSG *)arg, TRUE ); - case NtUserCallOneParam_EnableDC: return set_dce_flags( UlongToHandle(arg), DCHF_ENABLEDC ); diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h index a0b3e8c2e9e..a7f0624fdba 100644 --- a/dlls/win32u/win32u_private.h +++ b/dlls/win32u/win32u_private.h @@ -436,7 +436,6 @@ extern void track_keyboard_menu_bar( HWND hwnd, UINT wparam, WCHAR ch ) DECLSPEC extern void track_mouse_menu_bar( HWND hwnd, INT ht, int x, int y ) DECLSPEC_HIDDEN; /* message.c */ -extern LRESULT dispatch_message( const MSG *msg, BOOL ansi ) DECLSPEC_HIDDEN; extern BOOL kill_system_timer( HWND hwnd, UINT_PTR id ) DECLSPEC_HIDDEN; extern BOOL reply_message_result( LRESULT result, MSG *msg ) DECLSPEC_HIDDEN; extern NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *rawinput, diff --git a/include/ntuser.h b/include/ntuser.h index b0ebfbfcf5f..67058defb6f 100644 --- a/include/ntuser.h +++ b/include/ntuser.h @@ -902,7 +902,6 @@ enum NtUserCallOneParam_BeginDeferWindowPos, NtUserCallOneParam_CreateCursorIcon, NtUserCallOneParam_CreateMenu, - NtUserCallOneParam_DispatchMessageA, NtUserCallOneParam_EnableDC, NtUserCallOneParam_EnableThunkLock, NtUserCallOneParam_EnumClipboardFormats, @@ -944,11 +943,6 @@ static inline HMENU NtUserCreateMenu( BOOL is_popup ) return UlongToHandle( NtUserCallOneParam( is_popup, NtUserCallOneParam_CreateMenu )); } -static inline LRESULT NtUserDispatchMessageA( const MSG *msg ) -{ - return NtUserCallOneParam( (UINT_PTR)msg, NtUserCallOneParam_DispatchMessageA ); -} - static inline WORD NtUserEnableDC( HDC hdc ) { return NtUserCallOneParam( HandleToUlong(hdc), NtUserCallOneParam_EnableDC );
1
0
0
0
Jacek Caban : user32: Avoid using NtUserDispatchMessage in DispatchMessage.
by Alexandre Julliard
21 Jul '22
21 Jul '22
Module: wine Branch: master Commit: 26a4fb74ee9966252724627969a35637fb5e8f70 URL:
https://gitlab.winehq.org/wine/wine/-/commit/26a4fb74ee9966252724627969a356…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Tue Jul 19 18:33:42 2022 +0200 user32: Avoid using NtUserDispatchMessage in DispatchMessage. When possible, call window proc on PE side to allow unwinding exceptions through DispatchMessageW call. --- dlls/user32/message.c | 26 ++++++++++++++++++++++++++ dlls/user32/user_private.h | 1 + dlls/user32/winproc.c | 2 +- dlls/win32u/message.c | 9 +++++++++ include/ntuser.h | 5 +++-- 5 files changed, 40 insertions(+), 3 deletions(-) diff --git a/dlls/user32/message.c b/dlls/user32/message.c index f4e9b5b404e..f72d837ac94 100644 --- a/dlls/user32/message.c +++ b/dlls/user32/message.c @@ -832,6 +832,22 @@ BOOL WINAPI TranslateMessage( const MSG *msg ) } +static LRESULT dispatch_message( const MSG *msg, BOOL ansi ) +{ + struct win_proc_params params; + LRESULT retval = 0; + + if (!NtUserMessageCall( msg->hwnd, msg->message, msg->wParam, msg->lParam, + ¶ms, NtUserGetDispatchParams, ansi )) return 0; + params.result = &retval; + + SPY_EnterMessage( SPY_DISPATCHMESSAGE, msg->hwnd, msg->message, msg->wParam, msg->lParam ); + dispatch_win_proc_params( ¶ms ); + SPY_ExitMessage( SPY_RESULT_OK, msg->hwnd, msg->message, retval, msg->wParam, msg->lParam ); + return retval; +} + + /*********************************************************************** * DispatchMessageA (USER32.@) * @@ -856,6 +872,11 @@ LRESULT WINAPI DECLSPEC_HOTPATCH DispatchMessageA( const MSG* msg ) __ENDTRY return retval; } + + /* whenever possible, avoid using NtUserDispatchMessage to make the call unwindable */ + if (msg->message != WM_SYSTIMER && msg->message != WM_PAINT) + return dispatch_message( msg, TRUE ); + return NtUserDispatchMessageA( msg ); } @@ -904,6 +925,11 @@ LRESULT WINAPI DECLSPEC_HOTPATCH DispatchMessageW( const MSG* msg ) return retval; } } + + /* whenever possible, avoid using NtUserDispatchMessage to make the call unwindable */ + if (msg->message != WM_SYSTIMER && msg->message != WM_PAINT) + return dispatch_message( msg, FALSE ); + return NtUserDispatchMessage( msg ); } diff --git a/dlls/user32/user_private.h b/dlls/user32/user_private.h index 2e09605cc03..81c3c5021ab 100644 --- a/dlls/user32/user_private.h +++ b/dlls/user32/user_private.h @@ -89,6 +89,7 @@ extern LRESULT WINPROC_CallProcAtoW( winproc_callback_t callback, HWND hwnd, UIN extern INT_PTR WINPROC_CallDlgProcA( DLGPROC func, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ) DECLSPEC_HIDDEN; extern INT_PTR WINPROC_CallDlgProcW( DLGPROC func, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ) DECLSPEC_HIDDEN; extern void winproc_init(void) DECLSPEC_HIDDEN; +extern void dispatch_win_proc_params( struct win_proc_params *params ) DECLSPEC_HIDDEN; extern void get_winproc_params( struct win_proc_params *params ) DECLSPEC_HIDDEN; extern ATOM get_class_info( HINSTANCE instance, const WCHAR *name, WNDCLASSEXW *info, diff --git a/dlls/user32/winproc.c b/dlls/user32/winproc.c index 098bd17fbc0..5fc134c6718 100644 --- a/dlls/user32/winproc.c +++ b/dlls/user32/winproc.c @@ -719,7 +719,7 @@ static LRESULT WINPROC_CallProcWtoA( winproc_callback_t callback, HWND hwnd, UIN } -static void dispatch_win_proc_params( struct win_proc_params *params ) +void dispatch_win_proc_params( struct win_proc_params *params ) { DPI_AWARENESS_CONTEXT context = SetThreadDpiAwarenessContext( params->dpi_awareness ); diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c index 0045c8a54c0..50bce801339 100644 --- a/dlls/win32u/message.c +++ b/dlls/win32u/message.c @@ -2952,6 +2952,15 @@ LRESULT WINAPI NtUserMessageCall( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpa case NtUserClipboardWindowProc: return user_driver->pClipboardWindowProc( hwnd, msg, wparam, lparam ); + case NtUserGetDispatchParams: + if (!hwnd) return FALSE; + if (init_window_call_params( result_info, hwnd, msg, wparam, lparam, + NULL, ansi, WMCHAR_MAP_DISPATCHMESSAGE )) + return TRUE; + if (!is_window( hwnd )) SetLastError( ERROR_INVALID_WINDOW_HANDLE ); + else SetLastError( ERROR_MESSAGE_SYNC_ONLY ); + return FALSE; + case NtUserSpyEnter: spy_enter_message( ansi, hwnd, msg, wparam, lparam ); return 0; diff --git a/include/ntuser.h b/include/ntuser.h index 8cd7833717f..b0ebfbfcf5f 100644 --- a/include/ntuser.h +++ b/include/ntuser.h @@ -276,8 +276,9 @@ enum NtUserSendMessageCallback = 0x02b8, /* Wine-specific exports */ NtUserClipboardWindowProc = 0x0300, - NtUserSpyEnter = 0x0301, - NtUserSpyExit = 0x0302, + NtUserGetDispatchParams = 0x3001, + NtUserSpyEnter = 0x0302, + NtUserSpyExit = 0x0303, }; /* NtUserThunkedMenuItemInfo codes */
1
0
0
0
Connor McAdams : uiautomationcore: Add support for ProviderOptions_UseComThreading flag.
by Alexandre Julliard
21 Jul '22
21 Jul '22
Module: wine Branch: master Commit: e382997c8b86de60bead165a86d433e050766955 URL:
https://gitlab.winehq.org/wine/wine/-/commit/e382997c8b86de60bead165a86d433…
Author: Connor McAdams <cmcadams(a)codeweavers.com> Date: Mon Jun 20 15:58:13 2022 -0400 uiautomationcore: Add support for ProviderOptions_UseComThreading flag. Signed-off-by: Connor McAdams <cmcadams(a)codeweavers.com> --- dlls/uiautomationcore/tests/uiautomation.c | 126 +++++++++++++++++++++++++++++ dlls/uiautomationcore/uia_classes.idl | 40 +++++---- dlls/uiautomationcore/uia_client.c | 83 ++++++++++++++++++- dlls/uiautomationcore/uia_main.c | 4 +- 4 files changed, 233 insertions(+), 20 deletions(-)
1
0
0
0
← Newer
1
...
17
18
19
20
21
22
23
...
64
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
Results per page:
10
25
50
100
200