[PATCH v2 4/6] win32u: Remove the "proc" parameter to NtUserSetSystemTimer().

Zebediah Figura zfigura at codeweavers.com
Fri Apr 15 13:28:26 CDT 2022


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 at 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);
-- 
2.35.1




More information about the wine-devel mailing list