Jacek Caban : win32u: Move NtUserSetTimer implementation from user32.
Alexandre Julliard
julliard at winehq.org
Wed Mar 16 16:48:23 CDT 2022
Module: wine
Branch: master
Commit: ac8e0ce2554b17aea03043b974ab3bad11ae549f
URL: https://source.winehq.org/git/wine.git/?a=commit;h=ac8e0ce2554b17aea03043b974ab3bad11ae549f
Author: Jacek Caban <jacek at codeweavers.com>
Date: Wed Mar 16 15:35:55 2022 +0100
win32u: Move NtUserSetTimer implementation from user32.
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/user32/message.c | 35 +----------------------------------
dlls/user32/user32.spec | 2 +-
dlls/win32u/message.c | 32 ++++++++++++++++++++++++++++++++
dlls/win32u/syscall.c | 1 +
dlls/win32u/win32u.spec | 2 +-
dlls/wow64win/syscall.h | 1 +
dlls/wow64win/user.c | 11 +++++++++++
include/ntuser.h | 1 +
8 files changed, 49 insertions(+), 36 deletions(-)
diff --git a/dlls/user32/message.c b/dlls/user32/message.c
index c5bdc0efccc..da0abef9469 100644
--- a/dlls/user32/message.c
+++ b/dlls/user32/message.c
@@ -4408,45 +4408,12 @@ BOOL WINAPI MessageBeep( UINT i )
}
-/***********************************************************************
- * SetCoalescableTimer (USER32.@)
- */
-UINT_PTR WINAPI SetCoalescableTimer( HWND hwnd, UINT_PTR id, UINT timeout, TIMERPROC proc, ULONG tolerance )
-{
- 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_TIMER;
- 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;
-}
-
-
/******************************************************************
* SetTimer (USER32.@)
*/
UINT_PTR WINAPI SetTimer( HWND hwnd, UINT_PTR id, UINT timeout, TIMERPROC proc )
{
- return SetCoalescableTimer( hwnd, id, timeout, proc, TIMERV_DEFAULT_COALESCING );
+ return NtUserSetTimer( hwnd, id, timeout, proc, TIMERV_DEFAULT_COALESCING );
}
diff --git a/dlls/user32/user32.spec b/dlls/user32/user32.spec
index a70ac8605d7..7f27a0731a2 100644
--- a/dlls/user32/user32.spec
+++ b/dlls/user32/user32.spec
@@ -655,7 +655,7 @@
@ stdcall SetClassWord(long long long) NtUserSetClassWord
@ stdcall SetClipboardData(long long)
@ stdcall SetClipboardViewer(long)
-@ stdcall SetCoalescableTimer(long long long ptr long)
+@ stdcall SetCoalescableTimer(long long long ptr long) NtUserSetTimer
# @ stub SetConsoleReserveKeys
@ stdcall -import SetCursor(long) NtUserSetCursor
@ stub SetCursorContents
diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c
index c28114668b8..e895f65c652 100644
--- a/dlls/win32u/message.c
+++ b/dlls/win32u/message.c
@@ -128,6 +128,38 @@ BOOL WINAPI NtUserGetGUIThreadInfo( DWORD id, GUITHREADINFO *info )
return ret;
}
+/***********************************************************************
+ * NtUserSetTimer (win32u.@)
+ */
+UINT_PTR WINAPI NtUserSetTimer( HWND hwnd, UINT_PTR id, UINT timeout, TIMERPROC proc, ULONG tolerance )
+{
+ 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_TIMER;
+ 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/syscall.c b/dlls/win32u/syscall.c
index abe32b8d70c..b167ecc9680 100644
--- a/dlls/win32u/syscall.c
+++ b/dlls/win32u/syscall.c
@@ -154,6 +154,7 @@ static void * const syscalls[] =
NtUserSetProcessWindowStation,
NtUserSetProp,
NtUserSetThreadDesktop,
+ NtUserSetTimer,
NtUserSetWinEventHook,
NtUserSetWindowsHookEx,
NtUserUnhookWinEvent,
diff --git a/dlls/win32u/win32u.spec b/dlls/win32u/win32u.spec
index 2b5e4d71461..7d4599f0241 100644
--- a/dlls/win32u/win32u.spec
+++ b/dlls/win32u/win32u.spec
@@ -1236,7 +1236,7 @@
@ stub NtUserSetThreadInputBlocked
@ stub NtUserSetThreadLayoutHandles
@ stub NtUserSetThreadState
-@ stub NtUserSetTimer
+@ stdcall -syscall NtUserSetTimer(long long long ptr long)
@ stdcall -syscall NtUserSetWinEventHook(long long long ptr ptr long long long)
@ stub NtUserSetWindowArrangement
@ stub NtUserSetWindowBand
diff --git a/dlls/wow64win/syscall.h b/dlls/wow64win/syscall.h
index b6cdf5edfb2..3ded58962b8 100644
--- a/dlls/wow64win/syscall.h
+++ b/dlls/wow64win/syscall.h
@@ -139,6 +139,7 @@
SYSCALL_ENTRY( NtUserSetProcessWindowStation ) \
SYSCALL_ENTRY( NtUserSetProp ) \
SYSCALL_ENTRY( NtUserSetThreadDesktop ) \
+ SYSCALL_ENTRY( NtUserSetTimer ) \
SYSCALL_ENTRY( NtUserSetWinEventHook ) \
SYSCALL_ENTRY( NtUserSetWindowsHookEx ) \
SYSCALL_ENTRY( NtUserUnhookWinEvent ) \
diff --git a/dlls/wow64win/user.c b/dlls/wow64win/user.c
index b8c4a86a352..c9f81d86672 100644
--- a/dlls/wow64win/user.c
+++ b/dlls/wow64win/user.c
@@ -533,6 +533,17 @@ NTSTATUS WINAPI wow64_NtUserGetGUIThreadInfo( UINT *args )
return TRUE;
}
+NTSTATUS WINAPI wow64_NtUserSetTimer( UINT *args )
+{
+ HWND hwnd = get_handle( &args );
+ UINT_PTR id = get_ulong( &args );
+ UINT timeout = get_ulong( &args );
+ TIMERPROC proc = get_ptr( &args );
+ ULONG tolerance = get_ulong( &args );
+
+ return NtUserSetTimer( hwnd, id, timeout, proc, tolerance );
+}
+
NTSTATUS WINAPI wow64_NtUserCopyAcceleratorTable( UINT *args )
{
HACCEL src = get_handle( &args );
diff --git a/include/ntuser.h b/include/ntuser.h
index 4ca4c063ef8..a055aa47905 100644
--- a/include/ntuser.h
+++ b/include/ntuser.h
@@ -403,6 +403,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 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 );
LONG_PTR WINAPI NtUserSetWindowLongPtr( HWND hwnd, INT offset, LONG_PTR newval, BOOL ansi );
BOOL WINAPI NtUserSetWindowPos( HWND hwnd, HWND after, INT x, INT y, INT cx, INT cy, UINT flags );
More information about the wine-cvs
mailing list