Avoid passing a callback to SetSystemTimer(); it does not support one.
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/user.exe16/message.c | 4 ++++ dlls/user.exe16/user_private.h | 2 ++ dlls/user.exe16/window.c | 4 ++-- 3 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/dlls/user.exe16/message.c b/dlls/user.exe16/message.c index 819d9d9b837..8d9e5404b09 100644 --- a/dlls/user.exe16/message.c +++ b/dlls/user.exe16/message.c @@ -1292,6 +1292,10 @@ LRESULT WINPROC_CallProc32ATo16( winproc_callback16_t callback, HWND hwnd, UINT lParam = MAKELPARAM( 0, convert_handle_32_to_16( lParam, GMEM_DDESHARE )); ret = callback( HWND_16(hwnd), msg, wParam, lParam, result, arg ); break; /* FIXME don't know how to free allocated memory (handle) !! */ + case WM_TIMER: + if (wParam & SYSTEM_TIMER_FLAG) + msg = WM_SYSTIMER; + break; case SBM_SETRANGE: ret = callback( HWND_16(hwnd), SBM_SETRANGE16, 0, MAKELPARAM(wParam, lParam), result, arg ); break; diff --git a/dlls/user.exe16/user_private.h b/dlls/user.exe16/user_private.h index 8a325cf9fb2..0805997246b 100644 --- a/dlls/user.exe16/user_private.h +++ b/dlls/user.exe16/user_private.h @@ -95,6 +95,8 @@ extern void call_WH_CALLWNDPROC_hook( HWND16 hwnd, UINT16 msg, WPARAM16 wp, LPAR
#define WM_SYSTIMER 0x0118
+#define SYSTEM_TIMER_FLAG 0x10000 + /* Dialog info structure (must match the user32 one) */ typedef struct tagDIALOGINFO { diff --git a/dlls/user.exe16/window.c b/dlls/user.exe16/window.c index 590b8ae9f7c..e54dd6a803e 100644 --- a/dlls/user.exe16/window.c +++ b/dlls/user.exe16/window.c @@ -111,7 +111,7 @@ UINT16 WINAPI SetTimer16( HWND16 hwnd, UINT16 id, UINT16 timeout, TIMERPROC16 pr UINT16 WINAPI SetSystemTimer16( HWND16 hwnd, UINT16 id, UINT16 timeout, TIMERPROC16 proc ) { TIMERPROC proc32 = (TIMERPROC)WINPROC_AllocProc16( (WNDPROC16)proc ); - return SetSystemTimer( WIN_Handle32(hwnd), id, timeout, proc32 ); + return SetTimer( WIN_Handle32(hwnd), (UINT_PTR)id | SYSTEM_TIMER_FLAG, timeout, proc32 ); }
@@ -1087,7 +1087,7 @@ void WINAPI SwitchToThisWindow16( HWND16 hwnd, BOOL16 restore ) */ BOOL16 WINAPI KillSystemTimer16( HWND16 hwnd, UINT16 id ) { - return KillSystemTimer( WIN_Handle32(hwnd), id ); + return KillTimer( WIN_Handle32(hwnd), (UINT_PTR)id | SYSTEM_TIMER_FLAG ); }
Avoid passing a callback to NtUserSetSystemTimer(); it does not support one.
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/user32/caret.c | 18 +++++++----------- dlls/user32/message.c | 24 ++++++++++++++++++++++++ dlls/user32/user_private.h | 6 ++++++ 3 files changed, 37 insertions(+), 11 deletions(-)
diff --git a/dlls/user32/caret.c b/dlls/user32/caret.c index 8bf4962b708..b51bfd926da 100644 --- a/dlls/user32/caret.c +++ b/dlls/user32/caret.c @@ -27,6 +27,7 @@ #include "winbase.h" #include "wingdi.h" #include "ntuser.h" +#include "user_private.h" #include "wine/server.h" #include "wine/debug.h"
@@ -40,8 +41,6 @@ typedef struct
static CARET Caret = { 0, 500 };
-#define TIMERID 0xffff /* system timer id for the caret */ -
/***************************************************************** * CARET_DisplayCaret @@ -67,10 +66,7 @@ static void CARET_DisplayCaret( HWND hwnd, const RECT *r ) }
-/***************************************************************** - * CARET_Callback - */ -static void CALLBACK CARET_Callback( HWND hwnd, UINT msg, UINT_PTR id, DWORD ctime) +void toggle_caret( HWND hwnd ) { BOOL ret; RECT r; @@ -183,7 +179,7 @@ BOOL WINAPI CreateCaret( HWND hwnd, HBITMAP bitmap, INT width, INT height ) if (prev && !hidden) /* hide the previous one */ { /* FIXME: won't work if prev belongs to a different process */ - KillSystemTimer( prev, TIMERID ); + KillSystemTimer( prev, SYSTEM_TIMER_CARET ); if (old_state) CARET_DisplayCaret( prev, &r ); }
@@ -226,7 +222,7 @@ BOOL WINAPI DestroyCaret(void) if (ret && prev && !hidden) { /* FIXME: won't work if prev belongs to a different process */ - KillSystemTimer( prev, TIMERID ); + KillSystemTimer( prev, SYSTEM_TIMER_CARET ); if (old_state) CARET_DisplayCaret( prev, &r ); } if (Caret.hBmp) DeleteObject( Caret.hBmp ); @@ -274,7 +270,7 @@ BOOL WINAPI SetCaretPos( INT x, INT y ) r.left = x; r.top = y; CARET_DisplayCaret( hwnd, &r ); - NtUserSetSystemTimer( hwnd, TIMERID, Caret.timeout, CARET_Callback ); + NtUserSetSystemTimer( hwnd, SYSTEM_TIMER_CARET, Caret.timeout, NULL ); } return ret; } @@ -314,7 +310,7 @@ BOOL WINAPI HideCaret( HWND hwnd ) if (ret && !hidden) { if (old_state) CARET_DisplayCaret( hwnd, &r ); - KillSystemTimer( hwnd, TIMERID ); + KillSystemTimer( hwnd, SYSTEM_TIMER_CARET ); } return ret; } @@ -352,7 +348,7 @@ BOOL WINAPI ShowCaret( HWND hwnd ) if (ret && (hidden == 1)) /* hidden was 1 so it's now 0 */ { CARET_DisplayCaret( hwnd, &r ); - NtUserSetSystemTimer( hwnd, TIMERID, Caret.timeout, CARET_Callback ); + NtUserSetSystemTimer( hwnd, SYSTEM_TIMER_CARET, Caret.timeout, NULL ); } return ret; } diff --git a/dlls/user32/message.c b/dlls/user32/message.c index 51f183fdbc0..68f00b325c9 100644 --- a/dlls/user32/message.c +++ b/dlls/user32/message.c @@ -895,6 +895,22 @@ BOOL WINAPI TranslateMessage( const MSG *msg ) }
+static BOOL dispatch_systimer_message( const MSG *msg ) +{ + if (msg->message != WM_SYSTIMER) + return FALSE; + + switch (msg->wParam) + { + case SYSTEM_TIMER_CARET: + toggle_caret( msg->hwnd ); + return TRUE; + } + + return FALSE; +} + + /*********************************************************************** * DispatchMessageA (USER32.@) * @@ -922,6 +938,10 @@ LRESULT WINAPI DECLSPEC_HOTPATCH DispatchMessageA( const MSG* msg ) return retval; } } + + if (dispatch_systimer_message( msg )) + return 0; + return NtUserDispatchMessageA( msg ); }
@@ -970,6 +990,10 @@ LRESULT WINAPI DECLSPEC_HOTPATCH DispatchMessageW( const MSG* msg ) return retval; } } + + if (dispatch_systimer_message( msg )) + return 0; + return NtUserDispatchMessage( msg ); }
diff --git a/dlls/user32/user_private.h b/dlls/user32/user_private.h index 52e57a5e6f1..bb86ed6ffca 100644 --- a/dlls/user32/user_private.h +++ b/dlls/user32/user_private.h @@ -38,6 +38,11 @@ #define WINE_MOUSE_HANDLE ((HANDLE)1) #define WINE_KEYBOARD_HANDLE ((HANDLE)2)
+enum system_timer_id +{ + SYSTEM_TIMER_CARET = 0xffff, +}; + struct received_message_info;
/* data to store state for A/W mappings of WM_CHAR */ @@ -99,6 +104,7 @@ extern HBRUSH SYSCOLOR_Get55AABrush(void) DECLSPEC_HIDDEN; extern void SYSPARAMS_Init(void) DECLSPEC_HIDDEN; extern void USER_CheckNotLock(void) DECLSPEC_HIDDEN; extern BOOL USER_IsExitingThread( DWORD tid ) DECLSPEC_HIDDEN; +extern void toggle_caret( HWND hwnd ) DECLSPEC_HIDDEN;
typedef LRESULT (*winproc_callback_t)( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp, LRESULT *result, void *arg );
Hi Zebediah,
On 4/15/22 03:14, Zebediah Figura wrote:
diff --git a/dlls/user32/message.c b/dlls/user32/message.c index 51f183fdbc0..68f00b325c9 100644 --- a/dlls/user32/message.c +++ b/dlls/user32/message.c @@ -895,6 +895,22 @@ BOOL WINAPI TranslateMessage( const MSG *msg ) }
+static BOOL dispatch_systimer_message( const MSG *msg ) +{
- if (msg->message != WM_SYSTIMER)
return FALSE;
- switch (msg->wParam)
- {
case SYSTEM_TIMER_CARET:
toggle_caret( msg->hwnd );
return TRUE;
- }
- return FALSE;
+}
- /***********************************************************************
DispatchMessageA (USER32.@)
@@ -922,6 +938,10 @@ LRESULT WINAPI DECLSPEC_HOTPATCH DispatchMessageA( const MSG* msg ) return retval; } }
- if (dispatch_systimer_message( msg ))
return 0;
}return NtUserDispatchMessageA( msg );
@@ -970,6 +990,10 @@ LRESULT WINAPI DECLSPEC_HOTPATCH DispatchMessageW( const MSG* msg ) return retval; } }
- if (dispatch_systimer_message( msg ))
return 0;
}return NtUserDispatchMessage( msg );
This makes NtUserDispatchMessage unable to dispatch WM_SYSTIMER. We already use it directly in winex11 and will need it in win32u anyway, so this would probably be better with a temporary entry in user_callbacks called from NtUserDispatchMessage.
Thanks,
Jacek
Avoid passing a callback to NtUserSetSystemTimer(); it does not support one.
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/user32/input.c | 27 +++++++++------------------ dlls/user32/message.c | 4 ++++ dlls/user32/user_private.h | 2 ++ 3 files changed, 15 insertions(+), 18 deletions(-)
diff --git a/dlls/user32/input.c b/dlls/user32/input.c index 5a1d82eb7a7..fd389d77543 100644 --- a/dlls/user32/input.c +++ b/dlls/user32/input.c @@ -527,7 +527,6 @@ typedef struct __TRACKINGLIST {
/* FIXME: move tracking stuff into a per thread data */ static _TRACKINGLIST tracking_info; -static UINT_PTR timer;
static void check_mouse_leave(HWND hwnd, int hittest) { @@ -564,13 +563,12 @@ static void check_mouse_leave(HWND hwnd, int hittest) } }
-static void CALLBACK TrackMouseEventProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, - DWORD dwTime) +void update_mouse_tracking_info( HWND hwnd ) { POINT pos; INT hoverwidth = 0, hoverheight = 0, hittest;
- TRACE("hwnd %p, msg %04x, id %04lx, time %u\n", hwnd, uMsg, idEvent, dwTime); + TRACE( "hwnd %p\n", hwnd );
GetCursorPos(&pos); hwnd = WINPOS_WindowFromPoint(hwnd, pos, &hittest); @@ -632,8 +630,7 @@ static void CALLBACK TrackMouseEventProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, /* stop the timer if the tracking list is empty */ if (!(tracking_info.tme.dwFlags & (TME_HOVER | TME_LEAVE))) { - KillSystemTimer(tracking_info.tme.hwndTrack, timer); - timer = 0; + KillSystemTimer( tracking_info.tme.hwndTrack, SYSTEM_TIMER_TRACK_MOUSE ); tracking_info.tme.hwndTrack = 0; tracking_info.tme.dwFlags = 0; tracking_info.tme.dwHoverTime = 0; @@ -718,8 +715,7 @@ TrackMouseEvent (TRACKMOUSEEVENT *ptme) /* if we aren't tracking on hover or leave remove this entry */ if (!(tracking_info.tme.dwFlags & (TME_HOVER | TME_LEAVE))) { - KillSystemTimer(tracking_info.tme.hwndTrack, timer); - timer = 0; + KillSystemTimer( tracking_info.tme.hwndTrack, SYSTEM_TIMER_TRACK_MOUSE ); tracking_info.tme.hwndTrack = 0; tracking_info.tme.dwFlags = 0; tracking_info.tme.dwHoverTime = 0; @@ -732,14 +728,10 @@ TrackMouseEvent (TRACKMOUSEEVENT *ptme) if (tracking_info.tme.dwFlags & TME_LEAVE && tracking_info.tme.hwndTrack != NULL) check_mouse_leave(hwnd, hittest);
- if (timer) - { - KillSystemTimer(tracking_info.tme.hwndTrack, timer); - timer = 0; - tracking_info.tme.hwndTrack = 0; - tracking_info.tme.dwFlags = 0; - tracking_info.tme.dwHoverTime = 0; - } + KillSystemTimer( tracking_info.tme.hwndTrack, SYSTEM_TIMER_TRACK_MOUSE ); + tracking_info.tme.hwndTrack = 0; + tracking_info.tme.dwFlags = 0; + tracking_info.tme.dwHoverTime = 0;
if (ptme->hwndTrack == hwnd) { @@ -750,8 +742,7 @@ TrackMouseEvent (TRACKMOUSEEVENT *ptme) /* Initialize HoverInfo variables even if not hover tracking */ tracking_info.pos = pos;
- timer = NtUserSetSystemTimer( tracking_info.tme.hwndTrack, (UINT_PTR)&tracking_info.tme, - hover_time, TrackMouseEventProc ); + NtUserSetSystemTimer( tracking_info.tme.hwndTrack, SYSTEM_TIMER_TRACK_MOUSE, hover_time, NULL ); } }
diff --git a/dlls/user32/message.c b/dlls/user32/message.c index 68f00b325c9..c9be190fbcc 100644 --- a/dlls/user32/message.c +++ b/dlls/user32/message.c @@ -905,6 +905,10 @@ static BOOL dispatch_systimer_message( const MSG *msg ) case SYSTEM_TIMER_CARET: toggle_caret( msg->hwnd ); return TRUE; + + case SYSTEM_TIMER_TRACK_MOUSE: + update_mouse_tracking_info( msg->hwnd ); + return TRUE; }
return FALSE; diff --git a/dlls/user32/user_private.h b/dlls/user32/user_private.h index bb86ed6ffca..274732bafbd 100644 --- a/dlls/user32/user_private.h +++ b/dlls/user32/user_private.h @@ -40,6 +40,7 @@
enum system_timer_id { + SYSTEM_TIMER_TRACK_MOUSE = 0xfffa, SYSTEM_TIMER_CARET = 0xffff, };
@@ -105,6 +106,7 @@ extern void SYSPARAMS_Init(void) DECLSPEC_HIDDEN; extern void USER_CheckNotLock(void) DECLSPEC_HIDDEN; extern BOOL USER_IsExitingThread( DWORD tid ) DECLSPEC_HIDDEN; extern void toggle_caret( HWND hwnd ) DECLSPEC_HIDDEN; +extern void update_mouse_tracking_info( HWND hwnd ) DECLSPEC_HIDDEN;
typedef LRESULT (*winproc_callback_t)( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp, LRESULT *result, void *arg );
Testing on 32-bit Windows 10 suggests that the function only has the first three parameters. The test fixed in this patch (which still succeeds on e.g. Windows 2003) suggests that the final parameter to SetSystemTimer() is not a callback, either.
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/comctl32/listbox.c | 2 +- dlls/user32/caret.c | 4 ++-- dlls/user32/input.c | 2 +- dlls/user32/listbox.c | 2 +- dlls/user32/message.c | 11 +++++++++++ dlls/user32/scroll.c | 8 ++++---- dlls/user32/tests/msg.c | 3 +-- dlls/user32/user32.spec | 2 +- dlls/win32u/message.c | 8 +++----- dlls/win32u/win32u.spec | 2 +- dlls/wow64win/user.c | 3 +-- include/ntuser.h | 2 +- include/winuser.h | 2 +- 13 files changed, 29 insertions(+), 22 deletions(-)
diff --git a/dlls/comctl32/listbox.c b/dlls/comctl32/listbox.c index 08bc4db4362..6724dee1487 100644 --- a/dlls/comctl32/listbox.c +++ b/dlls/comctl32/listbox.c @@ -2404,7 +2404,7 @@ static void LISTBOX_HandleMouseMove( LB_DESCR *descr, /* Start/stop the system timer */
if (dir != LB_TIMER_NONE) - SetSystemTimer( descr->self, LB_TIMER_ID, LB_SCROLL_TIMEOUT, NULL); + SetSystemTimer( descr->self, LB_TIMER_ID, LB_SCROLL_TIMEOUT, 0 ); else if (LISTBOX_Timer != LB_TIMER_NONE) KillSystemTimer( descr->self, LB_TIMER_ID ); LISTBOX_Timer = dir; diff --git a/dlls/user32/caret.c b/dlls/user32/caret.c index b51bfd926da..9a857a316ce 100644 --- a/dlls/user32/caret.c +++ b/dlls/user32/caret.c @@ -270,7 +270,7 @@ BOOL WINAPI SetCaretPos( INT x, INT y ) r.left = x; r.top = y; CARET_DisplayCaret( hwnd, &r ); - NtUserSetSystemTimer( hwnd, SYSTEM_TIMER_CARET, Caret.timeout, NULL ); + NtUserSetSystemTimer( hwnd, SYSTEM_TIMER_CARET, Caret.timeout ); } return ret; } @@ -348,7 +348,7 @@ BOOL WINAPI ShowCaret( HWND hwnd ) if (ret && (hidden == 1)) /* hidden was 1 so it's now 0 */ { CARET_DisplayCaret( hwnd, &r ); - NtUserSetSystemTimer( hwnd, SYSTEM_TIMER_CARET, Caret.timeout, NULL ); + NtUserSetSystemTimer( hwnd, SYSTEM_TIMER_CARET, Caret.timeout ); } return ret; } diff --git a/dlls/user32/input.c b/dlls/user32/input.c index fd389d77543..b5f185f189d 100644 --- a/dlls/user32/input.c +++ b/dlls/user32/input.c @@ -742,7 +742,7 @@ TrackMouseEvent (TRACKMOUSEEVENT *ptme) /* Initialize HoverInfo variables even if not hover tracking */ tracking_info.pos = pos;
- NtUserSetSystemTimer( tracking_info.tme.hwndTrack, SYSTEM_TIMER_TRACK_MOUSE, hover_time, NULL ); + NtUserSetSystemTimer( tracking_info.tme.hwndTrack, SYSTEM_TIMER_TRACK_MOUSE, hover_time ); } }
diff --git a/dlls/user32/listbox.c b/dlls/user32/listbox.c index 32c9273945b..5c0aab5b008 100644 --- a/dlls/user32/listbox.c +++ b/dlls/user32/listbox.c @@ -2413,7 +2413,7 @@ static void LISTBOX_HandleMouseMove( LB_DESCR *descr, /* Start/stop the system timer */
if (dir != LB_TIMER_NONE) - NtUserSetSystemTimer( descr->self, LB_TIMER_ID, LB_SCROLL_TIMEOUT, NULL); + NtUserSetSystemTimer( descr->self, LB_TIMER_ID, LB_SCROLL_TIMEOUT ); else if (LISTBOX_Timer != LB_TIMER_NONE) KillSystemTimer( descr->self, LB_TIMER_ID ); LISTBOX_Timer = dir; diff --git a/dlls/user32/message.c b/dlls/user32/message.c index c9be190fbcc..7248d5a5075 100644 --- a/dlls/user32/message.c +++ b/dlls/user32/message.c @@ -1341,6 +1341,17 @@ UINT_PTR WINAPI SetTimer( HWND hwnd, UINT_PTR id, UINT timeout, TIMERPROC proc ) }
+/****************************************************************** + * SetSystemTimer (USER32.@) + */ +UINT_PTR WINAPI SetSystemTimer( HWND hwnd, UINT_PTR id, UINT timeout, void *unknown ) +{ + if (unknown) FIXME( "ignoring unknown parameter %p\n", unknown ); + + return NtUserSetSystemTimer( hwnd, id, timeout ); +} + + /*********************************************************************** * KillSystemTimer (USER32.@) */ diff --git a/dlls/user32/scroll.c b/dlls/user32/scroll.c index c042b72a344..45980b75b2c 100644 --- a/dlls/user32/scroll.c +++ b/dlls/user32/scroll.c @@ -950,7 +950,7 @@ void SCROLL_HandleScrollEvent( HWND hwnd, INT nBar, UINT msg, POINT pt ) }
NtUserSetSystemTimer( hwnd, SCROLL_TIMER, (msg == WM_LBUTTONDOWN) ? - SCROLL_FIRST_DELAY : SCROLL_REPEAT_DELAY, NULL ); + SCROLL_FIRST_DELAY : SCROLL_REPEAT_DELAY ); } else KillSystemTimer( hwnd, SCROLL_TIMER ); break; @@ -965,7 +965,7 @@ void SCROLL_HandleScrollEvent( HWND hwnd, INT nBar, UINT msg, POINT pt ) SB_PAGEUP, (LPARAM)hwndCtl ); } NtUserSetSystemTimer( hwnd, SCROLL_TIMER, (msg == WM_LBUTTONDOWN) ? - SCROLL_FIRST_DELAY : SCROLL_REPEAT_DELAY, NULL ); + SCROLL_FIRST_DELAY : SCROLL_REPEAT_DELAY ); } else KillSystemTimer( hwnd, SCROLL_TIMER ); break; @@ -1023,7 +1023,7 @@ void SCROLL_HandleScrollEvent( HWND hwnd, INT nBar, UINT msg, POINT pt ) SB_PAGEDOWN, (LPARAM)hwndCtl ); } NtUserSetSystemTimer( hwnd, SCROLL_TIMER, (msg == WM_LBUTTONDOWN) ? - SCROLL_FIRST_DELAY : SCROLL_REPEAT_DELAY, NULL ); + SCROLL_FIRST_DELAY : SCROLL_REPEAT_DELAY ); } else KillSystemTimer( hwnd, SCROLL_TIMER ); break; @@ -1039,7 +1039,7 @@ void SCROLL_HandleScrollEvent( HWND hwnd, INT nBar, UINT msg, POINT pt ) }
NtUserSetSystemTimer( hwnd, SCROLL_TIMER, (msg == WM_LBUTTONDOWN) ? - SCROLL_FIRST_DELAY : SCROLL_REPEAT_DELAY, NULL ); + SCROLL_FIRST_DELAY : SCROLL_REPEAT_DELAY ); } else KillSystemTimer( hwnd, SCROLL_TIMER ); break; diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c index a2adf56565d..c0a74d8edbe 100644 --- a/dlls/user32/tests/msg.c +++ b/dlls/user32/tests/msg.c @@ -10735,8 +10735,7 @@ static void test_timers(void) || broken(syscount > 4000 && syscount < 12000) /* win2k3sp0 */, "did not get expected count for minimum timeout (%d != ~%d).\n", syscount, TIMER_COUNT_EXPECTED); - todo_wine ok(count == 0, "did not get expected count for callback timeout (%d != 0).\n", - count); + ok(count == 0, "did not get expected count for callback timeout (%d != 0).\n", count); ok(pKillSystemTimer(info.hWnd, id), "KillSystemTimer failed\n"); }
diff --git a/dlls/user32/user32.spec b/dlls/user32/user32.spec index fcc17aae18e..d689fe94306 100644 --- a/dlls/user32/user32.spec +++ b/dlls/user32/user32.spec @@ -708,7 +708,7 @@ @ stdcall SetSysColorsTemp(ptr ptr long) @ stdcall SetSystemCursor(long long) @ stdcall SetSystemMenu(long long) -@ stdcall SetSystemTimer(long long long ptr) NtUserSetSystemTimer +@ stdcall SetSystemTimer(long long long ptr) @ stdcall SetTaskmanWindow (long) @ stdcall SetThreadDesktop(long) NtUserSetThreadDesktop @ stdcall SetThreadDpiAwarenessContext(ptr) diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c index 36bafccc9a4..f492aeed8f9 100644 --- a/dlls/win32u/message.c +++ b/dlls/win32u/message.c @@ -2634,12 +2634,11 @@ UINT_PTR WINAPI NtUserSetTimer( HWND hwnd, UINT_PTR id, UINT timeout, TIMERPROC /*********************************************************************** * NtUserSetSystemTimer (win32u.@) */ -UINT_PTR WINAPI NtUserSetSystemTimer( HWND hwnd, UINT_PTR id, UINT timeout, TIMERPROC proc ) +UINT_PTR WINAPI NtUserSetSystemTimer( HWND hwnd, UINT_PTR id, UINT timeout ) { UINT_PTR ret; - WNDPROC winproc = 0;
- if (proc) winproc = alloc_winproc( (WNDPROC)proc, TRUE ); + TRACE( "window %p, id %#lx, timeout %u\n", hwnd, id, timeout );
timeout = min( max( USER_TIMER_MINIMUM, timeout ), USER_TIMER_MAXIMUM );
@@ -2649,7 +2648,7 @@ UINT_PTR WINAPI NtUserSetSystemTimer( HWND hwnd, UINT_PTR id, UINT timeout, TIME req->msg = WM_SYSTIMER; req->id = id; req->rate = timeout; - req->lparam = (ULONG_PTR)winproc; + req->lparam = 0; if (!wine_server_call_err( req )) { ret = reply->id; @@ -2659,7 +2658,6 @@ UINT_PTR WINAPI NtUserSetSystemTimer( HWND hwnd, UINT_PTR id, UINT timeout, TIME } SERVER_END_REQ;
- TRACE( "Added %p %lx %p timeout %d\n", hwnd, id, winproc, timeout ); return ret; }
diff --git a/dlls/win32u/win32u.spec b/dlls/win32u/win32u.spec index cf419668789..4f63216e285 100644 --- a/dlls/win32u/win32u.spec +++ b/dlls/win32u/win32u.spec @@ -1230,7 +1230,7 @@ @ stdcall NtUserSetSysColors(long ptr ptr) @ stub NtUserSetSystemCursor @ stub NtUserSetSystemMenu -@ stdcall -syscall NtUserSetSystemTimer(long long long ptr) +@ stdcall -syscall NtUserSetSystemTimer(long long long) @ stub NtUserSetTargetForResourceBrokering @ stdcall -syscall NtUserSetThreadDesktop(long) @ stub NtUserSetThreadInputBlocked diff --git a/dlls/wow64win/user.c b/dlls/wow64win/user.c index db4ba246866..cb703764305 100644 --- a/dlls/wow64win/user.c +++ b/dlls/wow64win/user.c @@ -569,9 +569,8 @@ NTSTATUS WINAPI wow64_NtUserSetSystemTimer( UINT *args ) HWND hwnd = get_handle( &args ); UINT_PTR id = get_ulong( &args ); UINT timeout = get_ulong( &args ); - TIMERPROC proc = get_ptr( &args );
- return NtUserSetSystemTimer( hwnd, id, timeout, proc ); + return NtUserSetSystemTimer( hwnd, id, timeout ); }
NTSTATUS WINAPI wow64_NtUserSetTimer( UINT *args ) diff --git a/include/ntuser.h b/include/ntuser.h index 5cf82043a2e..ae8a5925fec 100644 --- a/include/ntuser.h +++ b/include/ntuser.h @@ -539,7 +539,7 @@ BOOL WINAPI NtUserSetProcessWindowStation( HWINSTA handle ); BOOL WINAPI NtUserSetProp( HWND hwnd, const WCHAR *str, HANDLE handle ); BOOL WINAPI NtUserSetSysColors( INT count, const INT *colors, const COLORREF *values ); BOOL WINAPI NtUserSetSystemMenu( HWND hwnd, HMENU menu ); -UINT_PTR WINAPI NtUserSetSystemTimer( HWND hwnd, UINT_PTR id, UINT timeout, TIMERPROC proc ); +UINT_PTR WINAPI NtUserSetSystemTimer( HWND hwnd, UINT_PTR id, UINT timeout ); BOOL WINAPI NtUserSetThreadDesktop( HDESK handle ); UINT_PTR WINAPI NtUserSetTimer( HWND hwnd, UINT_PTR id, UINT timeout, TIMERPROC proc, ULONG tolerance ); LONG WINAPI NtUserSetWindowLong( HWND hwnd, INT offset, LONG newval, BOOL ansi ); diff --git a/include/winuser.h b/include/winuser.h index 4f79face860..50813415332 100644 --- a/include/winuser.h +++ b/include/winuser.h @@ -4223,7 +4223,7 @@ WINUSERAPI BOOL WINAPI SetScrollRange(HWND,INT,INT,INT,BOOL); #define SetSysModalWindow(hwnd) ((HWND)0) WINUSERAPI BOOL WINAPI SetSystemCursor(HCURSOR,DWORD); WINUSERAPI BOOL WINAPI SetSystemMenu(HWND,HMENU); -WINUSERAPI UINT_PTR WINAPI SetSystemTimer(HWND,UINT_PTR,UINT,TIMERPROC); +WINUSERAPI UINT_PTR WINAPI SetSystemTimer(HWND,UINT_PTR,UINT,void*); WINUSERAPI BOOL WINAPI SetThreadDesktop(HDESK); WINUSERAPI DPI_AWARENESS_CONTEXT WINAPI SetThreadDpiAwarenessContext(DPI_AWARENESS_CONTEXT); WINUSERAPI UINT_PTR WINAPI SetTimer(HWND,UINT_PTR,UINT,TIMERPROC);
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=112618
Your paranoid android.
=== debian11 (32 bit report) ===
user32: menu.c:2337: Test failed: test 25
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/win32u/message.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c index f492aeed8f9..fef12e333a5 100644 --- a/dlls/win32u/message.c +++ b/dlls/win32u/message.c @@ -2450,7 +2450,7 @@ LRESULT dispatch_message( const MSG *msg, BOOL ansi ) LRESULT retval = 0;
/* Process timer messages */ - if (msg->lParam && (msg->message == WM_TIMER || msg->message == WM_SYSTIMER)) + if (msg->lParam && msg->message == WM_TIMER) { params.func = (WNDPROC)msg->lParam; params.result = &retval; /* FIXME */
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/user32/message.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-)
diff --git a/dlls/user32/message.c b/dlls/user32/message.c index 7248d5a5075..ec2462c2edd 100644 --- a/dlls/user32/message.c +++ b/dlls/user32/message.c @@ -925,22 +925,19 @@ LRESULT WINAPI DECLSPEC_HOTPATCH DispatchMessageA( const MSG* msg ) LRESULT retval;
/* Process timer messages */ - if ((msg->message == WM_TIMER) || (msg->message == WM_SYSTIMER)) + if (msg->lParam && msg->message == WM_TIMER) { - if (msg->lParam) + __TRY { - __TRY - { - retval = CallWindowProcA( (WNDPROC)msg->lParam, msg->hwnd, - msg->message, msg->wParam, GetTickCount() ); - } - __EXCEPT_ALL - { - retval = 0; - } - __ENDTRY - return retval; + retval = CallWindowProcA( (WNDPROC)msg->lParam, msg->hwnd, + msg->message, msg->wParam, GetTickCount() ); } + __EXCEPT_ALL + { + retval = 0; + } + __ENDTRY + return retval; }
if (dispatch_systimer_message( msg ))