Avoid using SetSystemTimer() to specify a callback; 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 --- v2: Move code into NtUserDispatchMessage() immediately, and use a temporary callback into user32 instead.
dlls/user32/caret.c | 18 +++++++----------- dlls/user32/user_main.c | 1 + dlls/user32/user_private.h | 1 + dlls/win32u/message.c | 11 +++++++++++ dlls/win32u/ntuser_private.h | 6 ++++++ 5 files changed, 26 insertions(+), 11 deletions(-)
diff --git a/dlls/user32/caret.c b/dlls/user32/caret.c index 8bf4962b708..708f4e39f97 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 CDECL 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/user_main.c b/dlls/user32/user_main.c index f99e773d6f4..6d2735cc9ec 100644 --- a/dlls/user32/user_main.c +++ b/dlls/user32/user_main.c @@ -176,6 +176,7 @@ static const struct user_callbacks user_funcs = register_builtin_classes, MENU_SetMenu, SCROLL_SetStandardScrollPainted, + toggle_caret, unpack_dde_message, register_imm, unregister_imm, diff --git a/dlls/user32/user_private.h b/dlls/user32/user_private.h index 52e57a5e6f1..96c47a71753 100644 --- a/dlls/user32/user_private.h +++ b/dlls/user32/user_private.h @@ -99,6 +99,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 CDECL toggle_caret( HWND hwnd ) DECLSPEC_HIDDEN;
typedef LRESULT (*winproc_callback_t)( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp, LRESULT *result, void *arg ); diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c index 36bafccc9a4..24dec5d529f 100644 --- a/dlls/win32u/message.c +++ b/dlls/win32u/message.c @@ -2468,6 +2468,17 @@ LRESULT dispatch_message( const MSG *msg, BOOL ansi ) __ENDTRY return retval; } + if (msg->message == WM_SYSTIMER) + { + switch (msg->wParam) + { + case SYSTEM_TIMER_CARET: + if (!user_callbacks) break; + user_callbacks->toggle_caret( msg->hwnd ); + return 0; + } + } + if (!msg->hwnd) return 0;
spy_enter_message( SPY_DISPATCHMESSAGE, msg->hwnd, msg->message, msg->wParam, msg->lParam ); diff --git a/dlls/win32u/ntuser_private.h b/dlls/win32u/ntuser_private.h index 5aee58fa1e3..0cbe77a2959 100644 --- a/dlls/win32u/ntuser_private.h +++ b/dlls/win32u/ntuser_private.h @@ -51,6 +51,7 @@ struct user_callbacks void (CDECL *register_builtin_classes)(void); BOOL (CDECL *set_menu)( HWND hwnd, HMENU menu ); void (WINAPI *set_standard_scroll_painted)( HWND hwnd, INT bar, BOOL visible ); + void (CDECL *toggle_caret)( HWND hwnd ); BOOL (CDECL *unpack_dde_message)( HWND hwnd, UINT message, WPARAM *wparam, LPARAM *lparam, void **buffer, size_t size ); BOOL (WINAPI *register_imm)( HWND hwnd ); @@ -60,6 +61,11 @@ struct user_callbacks #define WM_SYSTIMER 0x0118 #define WM_POPUPSYSTEMMENU 0x0313
+enum system_timer_id +{ + SYSTEM_TIMER_CARET = 0xffff, +}; + struct user_object { HANDLE handle;
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/user_main.c | 1 + dlls/user32/user_private.h | 1 + dlls/win32u/message.c | 5 +++++ dlls/win32u/ntuser_private.h | 2 ++ 5 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/dlls/user32/input.c b/dlls/user32/input.c index 5a1d82eb7a7..6c0eb82b04f 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 CDECL 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/user_main.c b/dlls/user32/user_main.c index 6d2735cc9ec..30fe6dcce78 100644 --- a/dlls/user32/user_main.c +++ b/dlls/user32/user_main.c @@ -178,6 +178,7 @@ static const struct user_callbacks user_funcs = SCROLL_SetStandardScrollPainted, toggle_caret, unpack_dde_message, + update_mouse_tracking_info, register_imm, unregister_imm, }; diff --git a/dlls/user32/user_private.h b/dlls/user32/user_private.h index 96c47a71753..54b11f2a8ef 100644 --- a/dlls/user32/user_private.h +++ b/dlls/user32/user_private.h @@ -100,6 +100,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 CDECL toggle_caret( HWND hwnd ) DECLSPEC_HIDDEN; +extern void CDECL 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 ); diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c index 24dec5d529f..d75d42c7854 100644 --- a/dlls/win32u/message.c +++ b/dlls/win32u/message.c @@ -2476,6 +2476,11 @@ LRESULT dispatch_message( const MSG *msg, BOOL ansi ) if (!user_callbacks) break; user_callbacks->toggle_caret( msg->hwnd ); return 0; + + case SYSTEM_TIMER_TRACK_MOUSE: + if (!user_callbacks) break; + user_callbacks->update_mouse_tracking_info( msg->hwnd ); + return 0; } }
diff --git a/dlls/win32u/ntuser_private.h b/dlls/win32u/ntuser_private.h index 0cbe77a2959..e53ef33bb8f 100644 --- a/dlls/win32u/ntuser_private.h +++ b/dlls/win32u/ntuser_private.h @@ -54,6 +54,7 @@ struct user_callbacks void (CDECL *toggle_caret)( HWND hwnd ); BOOL (CDECL *unpack_dde_message)( HWND hwnd, UINT message, WPARAM *wparam, LPARAM *lparam, void **buffer, size_t size ); + void (CDECL *update_mouse_tracking_info)( HWND hwnd ); BOOL (WINAPI *register_imm)( HWND hwnd ); void (WINAPI *unregister_imm)( HWND hwnd ); }; @@ -63,6 +64,7 @@ struct user_callbacks
enum system_timer_id { + SYSTEM_TIMER_TRACK_MOUSE = 0xfffa, SYSTEM_TIMER_CARET = 0xffff, };
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=112670
Your paranoid android.
=== debian11 (32 bit Chinese:China report) ===
user32: win.c:10976: Test failed: Expected foreground window 0, got 011400CE win.c:10982: Test failed: Expected foreground window 001A0124, got 011400CE
Testing on 32-bit Windows 10 suggests that the function only has 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 708f4e39f97..bdc7780bf8f 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 6c0eb82b04f..4ef33ab2838 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 51f183fdbc0..360a7ff5baa 100644 --- a/dlls/user32/message.c +++ b/dlls/user32/message.c @@ -1313,6 +1313,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 d75d42c7854..635276e9d3c 100644 --- a/dlls/win32u/message.c +++ b/dlls/win32u/message.c @@ -2650,12 +2650,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 );
@@ -2665,7 +2664,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; @@ -2675,7 +2674,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=112671
Your paranoid android.
=== debian11 (32 bit WoW report) ===
user32: msg.c:8669: Test failed: WmParentPaintNc: 0: the msg 0x000f was expected, but got msg 0x0021 instead msg.c:8669: Test failed: WmParentPaintNc: 1: the msg 0x000f was expected, but got msg 0x0021 instead msg.c:8669: Test failed: WmParentPaintNc: 2: the msg 0x0085 was expected, but got msg 0x0021 instead msg.c:8669: Test failed: WmParentPaintNc: 6: the msg sequence is not complete: expected 0000 - actual 000f
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 635276e9d3c..2f1f2635b52 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 360a7ff5baa..5b36a60ca8e 100644 --- a/dlls/user32/message.c +++ b/dlls/user32/message.c @@ -905,22 +905,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; } return NtUserDispatchMessageA( msg ); }
Hi Zebediah,
On 4/15/22 20:28, Zebediah Figura wrote:
Avoid using SetSystemTimer() to specify a callback; it does not support one.
Signed-off-by: Zebediah Figurazfigura@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(-)
This doesn't seem to work. I tested it with Pipe Dream and with the patch, it's impossible to close dialogs (like high scores, about).
Thanks,
Jacek
On 4/18/22 07:33, Jacek Caban wrote:
Hi Zebediah,
On 4/15/22 20:28, Zebediah Figura wrote:
Avoid using SetSystemTimer() to specify a callback; it does not support one.
Signed-off-by: Zebediah Figurazfigura@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(-)
This doesn't seem to work. I tested it with Pipe Dream and with the patch, it's impossible to close dialogs (like high scores, about).
Thanks, it was a simple error.
Clearly this is another sign that I need to pick up my win16 conformance test work off the floor again...