diff --git a/dlls/user32/caret.c b/dlls/user32/caret.c index a5e9b25aa29..8bf4962b708 100644 --- a/dlls/user32/caret.c +++ b/dlls/user32/caret.c @@ -274,7 +274,7 @@ BOOL WINAPI SetCaretPos( INT x, INT y ) r.left = x; r.top = y; CARET_DisplayCaret( hwnd, &r ); - SetSystemTimer( hwnd, TIMERID, Caret.timeout, CARET_Callback ); + NtUserSetSystemTimer( hwnd, TIMERID, Caret.timeout, CARET_Callback ); } return ret; } @@ -352,7 +352,7 @@ BOOL WINAPI ShowCaret( HWND hwnd ) if (ret && (hidden == 1)) /* hidden was 1 so it's now 0 */ { CARET_DisplayCaret( hwnd, &r ); - SetSystemTimer( hwnd, TIMERID, Caret.timeout, CARET_Callback ); + NtUserSetSystemTimer( hwnd, TIMERID, Caret.timeout, CARET_Callback ); } return ret; } diff --git a/dlls/user32/input.c b/dlls/user32/input.c index 4f7e44bff02..39e7ae17e13 100644 --- a/dlls/user32/input.c +++ b/dlls/user32/input.c @@ -862,7 +862,8 @@ TrackMouseEvent (TRACKMOUSEEVENT *ptme) /* Initialize HoverInfo variables even if not hover tracking */ tracking_info.pos = pos; - timer = SetSystemTimer(tracking_info.tme.hwndTrack, (UINT_PTR)&tracking_info.tme, hover_time, TrackMouseEventProc); + timer = NtUserSetSystemTimer( tracking_info.tme.hwndTrack, (UINT_PTR)&tracking_info.tme, + hover_time, TrackMouseEventProc ); } } diff --git a/dlls/user32/listbox.c b/dlls/user32/listbox.c index ff86ea1a7f9..32c9273945b 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) - SetSystemTimer( descr->self, LB_TIMER_ID, LB_SCROLL_TIMEOUT, NULL); + NtUserSetSystemTimer( descr->self, LB_TIMER_ID, LB_SCROLL_TIMEOUT, NULL); 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 da0abef9469..eee4759513a 100644 --- a/dlls/user32/message.c +++ b/dlls/user32/message.c @@ -4417,39 +4417,6 @@ 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, TIMERPROC proc ) -{ - UINT_PTR ret; - WNDPROC winproc = 0; - - if (proc) winproc = WINPROC_AllocProc( (WNDPROC)proc, FALSE ); - - timeout = min( max( USER_TIMER_MINIMUM, timeout ), USER_TIMER_MAXIMUM ); - - SERVER_START_REQ( set_win_timer ) - { - req->win = wine_server_user_handle( hwnd ); - req->msg = WM_SYSTIMER; - req->id = id; - req->rate = timeout; - req->lparam = (ULONG_PTR)winproc; - if (!wine_server_call_err( req )) - { - ret = reply->id; - if (!ret) ret = TRUE; - } - else ret = 0; - } - SERVER_END_REQ; - - TRACE("Added %p %lx %p timeout %d\n", hwnd, id, winproc, timeout ); - return ret; -} - - /*********************************************************************** * KillTimer (USER32.@) */ diff --git a/dlls/user32/scroll.c b/dlls/user32/scroll.c index a07737009e5..d666707299f 100644 --- a/dlls/user32/scroll.c +++ b/dlls/user32/scroll.c @@ -949,8 +949,8 @@ void SCROLL_HandleScrollEvent( HWND hwnd, INT nBar, UINT msg, POINT pt ) SB_LINEUP, (LPARAM)hwndCtl ); } - SetSystemTimer( hwnd, SCROLL_TIMER, (msg == WM_LBUTTONDOWN) ? - SCROLL_FIRST_DELAY : SCROLL_REPEAT_DELAY, NULL ); + NtUserSetSystemTimer( hwnd, SCROLL_TIMER, (msg == WM_LBUTTONDOWN) ? + SCROLL_FIRST_DELAY : SCROLL_REPEAT_DELAY, NULL ); } else KillSystemTimer( hwnd, SCROLL_TIMER ); break; @@ -964,8 +964,8 @@ void SCROLL_HandleScrollEvent( HWND hwnd, INT nBar, UINT msg, POINT pt ) SendMessageW( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL, SB_PAGEUP, (LPARAM)hwndCtl ); } - SetSystemTimer( hwnd, SCROLL_TIMER, (msg == WM_LBUTTONDOWN) ? - SCROLL_FIRST_DELAY : SCROLL_REPEAT_DELAY, NULL ); + NtUserSetSystemTimer( hwnd, SCROLL_TIMER, (msg == WM_LBUTTONDOWN) ? + SCROLL_FIRST_DELAY : SCROLL_REPEAT_DELAY, NULL ); } else KillSystemTimer( hwnd, SCROLL_TIMER ); break; @@ -1022,8 +1022,8 @@ void SCROLL_HandleScrollEvent( HWND hwnd, INT nBar, UINT msg, POINT pt ) SendMessageW( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL, SB_PAGEDOWN, (LPARAM)hwndCtl ); } - SetSystemTimer( hwnd, SCROLL_TIMER, (msg == WM_LBUTTONDOWN) ? - SCROLL_FIRST_DELAY : SCROLL_REPEAT_DELAY, NULL ); + NtUserSetSystemTimer( hwnd, SCROLL_TIMER, (msg == WM_LBUTTONDOWN) ? + SCROLL_FIRST_DELAY : SCROLL_REPEAT_DELAY, NULL ); } else KillSystemTimer( hwnd, SCROLL_TIMER ); break; @@ -1038,8 +1038,8 @@ void SCROLL_HandleScrollEvent( HWND hwnd, INT nBar, UINT msg, POINT pt ) SB_LINEDOWN, (LPARAM)hwndCtl ); } - SetSystemTimer( hwnd, SCROLL_TIMER, (msg == WM_LBUTTONDOWN) ? - SCROLL_FIRST_DELAY : SCROLL_REPEAT_DELAY, NULL ); + NtUserSetSystemTimer( hwnd, SCROLL_TIMER, (msg == WM_LBUTTONDOWN) ? + SCROLL_FIRST_DELAY : SCROLL_REPEAT_DELAY, NULL ); } else KillSystemTimer( hwnd, SCROLL_TIMER ); break; diff --git a/dlls/user32/user32.spec b/dlls/user32/user32.spec index 7f27a0731a2..c5ea5e6c4c0 100644 --- a/dlls/user32/user32.spec +++ b/dlls/user32/user32.spec @@ -707,7 +707,7 @@ @ stdcall SetSysColorsTemp(ptr ptr long) @ stdcall SetSystemCursor(long long) @ stdcall SetSystemMenu(long long) -@ stdcall SetSystemTimer(long long long ptr) +@ stdcall SetSystemTimer(long long long ptr) NtUserSetSystemTimer @ stdcall SetTaskmanWindow (long) @ stdcall SetThreadDesktop(long) NtUserSetThreadDesktop @ stdcall SetThreadDpiAwarenessContext(ptr) diff --git a/dlls/user32/user_private.h b/dlls/user32/user_private.h index 465522e54dc..d512ecb1501 100644 --- a/dlls/user32/user_private.h +++ b/dlls/user32/user_private.h @@ -36,9 +36,6 @@ #define GET_DWORD(ptr) (*(const DWORD *)(ptr)) #define GET_LONG(ptr) (*(const LONG *)(ptr)) -#define WM_SYSTIMER 0x0118 -#define WM_POPUPSYSTEMMENU 0x0313 - #define WINE_MOUSE_HANDLE ((HANDLE)1) #define WINE_KEYBOARD_HANDLE ((HANDLE)2) @@ -132,7 +129,6 @@ typedef LRESULT (*winproc_callback_t)( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp LRESULT *result, void *arg ); extern WNDPROC WINPROC_GetProc( WNDPROC proc, BOOL unicode ) DECLSPEC_HIDDEN; -extern WNDPROC WINPROC_AllocProc( WNDPROC func, BOOL unicode ) DECLSPEC_HIDDEN; extern BOOL WINPROC_IsUnicode( WNDPROC proc, BOOL def_val ) DECLSPEC_HIDDEN; extern LRESULT WINPROC_CallProcAtoW( winproc_callback_t callback, HWND hwnd, UINT msg, diff --git a/dlls/user32/winproc.c b/dlls/user32/winproc.c index abca1d50e97..b489dadcda6 100644 --- a/dlls/user32/winproc.c +++ b/dlls/user32/winproc.c @@ -193,7 +193,7 @@ WNDPROC WINPROC_GetProc( WNDPROC proc, BOOL unicode ) * lot of windows, it will usually only have a limited number of window procedures, so the * array won't grow too large, and this way we avoid the need to track allocations per window. */ -WNDPROC WINPROC_AllocProc( WNDPROC func, BOOL unicode ) +static WNDPROC WINPROC_AllocProc( WNDPROC func, BOOL unicode ) { return (WNDPROC)NtUserCallTwoParam( (UINT_PTR)func, !unicode, NtUserAllocWinProc ); } diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c index e895f65c652..5fb238566f3 100644 --- a/dlls/win32u/message.c +++ b/dlls/win32u/message.c @@ -160,6 +160,38 @@ UINT_PTR WINAPI NtUserSetTimer( HWND hwnd, UINT_PTR id, UINT timeout, TIMERPROC return ret; } +/*********************************************************************** + * NtUserSetSystemTimer (win32u.@) + */ +UINT_PTR WINAPI NtUserSetSystemTimer( HWND hwnd, UINT_PTR id, UINT timeout, TIMERPROC proc ) +{ + UINT_PTR ret; + WNDPROC winproc = 0; + + if (proc) winproc = alloc_winproc( (WNDPROC)proc, TRUE ); + + timeout = min( max( USER_TIMER_MINIMUM, timeout ), USER_TIMER_MAXIMUM ); + + SERVER_START_REQ( set_win_timer ) + { + req->win = wine_server_user_handle( hwnd ); + req->msg = WM_SYSTIMER; + req->id = id; + req->rate = timeout; + req->lparam = (ULONG_PTR)winproc; + if (!wine_server_call_err( req )) + { + ret = reply->id; + if (!ret) ret = TRUE; + } + else ret = 0; + } + SERVER_END_REQ; + + TRACE( "Added %p %lx %p timeout %d\n", hwnd, id, winproc, timeout ); + return ret; +} + /* see SendMessageW */ LRESULT send_message( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam ) { diff --git a/dlls/win32u/ntuser_private.h b/dlls/win32u/ntuser_private.h index 6b0345461ea..d6c3e681c2f 100644 --- a/dlls/win32u/ntuser_private.h +++ b/dlls/win32u/ntuser_private.h @@ -49,6 +49,9 @@ struct user_callbacks const RECT *valid_rects ); }; +#define WM_SYSTIMER 0x0118 +#define WM_POPUPSYSTEMMENU 0x0313 + struct user_object { HANDLE handle; diff --git a/dlls/win32u/syscall.c b/dlls/win32u/syscall.c index b167ecc9680..5dbf6f43ac6 100644 --- a/dlls/win32u/syscall.c +++ b/dlls/win32u/syscall.c @@ -153,6 +153,7 @@ static void * const syscalls[] = NtUserSetProcessDpiAwarenessContext, NtUserSetProcessWindowStation, NtUserSetProp, + NtUserSetSystemTimer, NtUserSetThreadDesktop, NtUserSetTimer, NtUserSetWinEventHook, diff --git a/dlls/win32u/win32u.spec b/dlls/win32u/win32u.spec index 7d4599f0241..9c6103b84f8 100644 --- a/dlls/win32u/win32u.spec +++ b/dlls/win32u/win32u.spec @@ -1230,7 +1230,7 @@ @ stdcall NtUserSetSysColors(long ptr ptr) @ stub NtUserSetSystemCursor @ stub NtUserSetSystemMenu -@ stub NtUserSetSystemTimer +@ stdcall -syscall NtUserSetSystemTimer(long long long ptr) @ stub NtUserSetTargetForResourceBrokering @ stdcall -syscall NtUserSetThreadDesktop(long) @ stub NtUserSetThreadInputBlocked diff --git a/dlls/wow64win/syscall.h b/dlls/wow64win/syscall.h index 3ded58962b8..4b181ecba89 100644 --- a/dlls/wow64win/syscall.h +++ b/dlls/wow64win/syscall.h @@ -138,6 +138,7 @@ SYSCALL_ENTRY( NtUserSetProcessDpiAwarenessContext ) \ SYSCALL_ENTRY( NtUserSetProcessWindowStation ) \ SYSCALL_ENTRY( NtUserSetProp ) \ + SYSCALL_ENTRY( NtUserSetSystemTimer ) \ SYSCALL_ENTRY( NtUserSetThreadDesktop ) \ SYSCALL_ENTRY( NtUserSetTimer ) \ SYSCALL_ENTRY( NtUserSetWinEventHook ) \ diff --git a/dlls/wow64win/user.c b/dlls/wow64win/user.c index c9f81d86672..2af7f9a3115 100644 --- a/dlls/wow64win/user.c +++ b/dlls/wow64win/user.c @@ -533,6 +533,16 @@ NTSTATUS WINAPI wow64_NtUserGetGUIThreadInfo( UINT *args ) return TRUE; } +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 ); +} + NTSTATUS WINAPI wow64_NtUserSetTimer( UINT *args ) { HWND hwnd = get_handle( &args ); diff --git a/include/ntuser.h b/include/ntuser.h index a055aa47905..afa4d0d561f 100644 --- a/include/ntuser.h +++ b/include/ntuser.h @@ -402,6 +402,7 @@ BOOL WINAPI NtUserSetProcessDpiAwarenessContext( ULONG awareness, ULONG unkno 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 ); +UINT_PTR WINAPI NtUserSetSystemTimer( HWND hwnd, UINT_PTR id, UINT timeout, TIMERPROC proc ); 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 );