https://git.reactos.org/?p=reactos.git;a=commitdiff;h=6ec0420dc6ba17e58ffa9cbb9ab4a190ba5b2e6c

commit 6ec0420dc6ba17e58ffa9cbb9ab4a190ba5b2e6c
Author:     Jérôme Gardou <jerome.gar...@reactos.org>
AuthorDate: Fri Jul 30 15:40:33 2021 +0200
Commit:     Jérôme Gardou <zefk...@users.noreply.github.com>
CommitDate: Tue Aug 3 23:13:19 2021 +0200

    [WIN32K:NTUSER] Allocate & free timers under global user lock
---
 win32ss/user/ntuser/simplecall.c |  9 ++++++++-
 win32ss/user/ntuser/timer.c      | 37 +++++++++++++++++++------------------
 2 files changed, 27 insertions(+), 19 deletions(-)

diff --git a/win32ss/user/ntuser/simplecall.c b/win32ss/user/ntuser/simplecall.c
index fdc52c1c478..ce190357db1 100644
--- a/win32ss/user/ntuser/simplecall.c
+++ b/win32ss/user/ntuser/simplecall.c
@@ -761,7 +761,14 @@ NtUserCallHwndParam(
     switch (Routine)
     {
         case HWNDPARAM_ROUTINE_KILLSYSTEMTIMER:
-            return IntKillTimer(UserGetWindowObject(hWnd), (UINT_PTR)Param, 
TRUE);
+        {
+            DWORD ret;
+
+            UserEnterExclusive();
+            ret = IntKillTimer(UserGetWindowObject(hWnd), (UINT_PTR)Param, 
TRUE);
+            UserLeave();
+            return ret;
+        }
 
         case HWNDPARAM_ROUTINE_SETWNDCONTEXTHLPID:
         {
diff --git a/win32ss/user/ntuser/timer.c b/win32ss/user/ntuser/timer.c
index 3ae4dea0f88..31ec4e256da 100644
--- a/win32ss/user/ntuser/timer.c
+++ b/win32ss/user/ntuser/timer.c
@@ -635,19 +635,18 @@ NtUserSetTimer
 )
 {
    PWND Window = NULL;
-   DECLARE_RETURN(UINT_PTR);
+   UINT_PTR ret;
 
    TRACE("Enter NtUserSetTimer\n");
    UserEnterExclusive();
    if (hWnd) Window = UserGetWindowObject(hWnd);
-   UserLeave();
 
-   RETURN(IntSetTimer(Window, nIDEvent, uElapse, lpTimerFunc, TMRF_TIFROMWND));
+   ret = IntSetTimer(Window, nIDEvent, uElapse, lpTimerFunc, TMRF_TIFROMWND);
 
-CLEANUP:
-   TRACE("Leave NtUserSetTimer, ret=%u\n", _ret_);
+   UserLeave();
+   TRACE("Leave NtUserSetTimer, ret=%u\n", ret);
 
-   END_CLEANUP;
+   return ret;
 }
 
 
@@ -660,18 +659,18 @@ NtUserKillTimer
 )
 {
    PWND Window = NULL;
-   DECLARE_RETURN(BOOL);
+   BOOL ret;
 
    TRACE("Enter NtUserKillTimer\n");
    UserEnterExclusive();
    if (hWnd) Window = UserGetWindowObject(hWnd);
-   UserLeave();
 
-   RETURN(IntKillTimer(Window, uIDEvent, FALSE));
+   ret = IntKillTimer(Window, uIDEvent, FALSE);
 
-CLEANUP:
-   TRACE("Leave NtUserKillTimer, ret=%i\n", _ret_);
-   END_CLEANUP;
+   UserLeave();
+
+   TRACE("Leave NtUserKillTimer, ret=%i\n", ret);
+   return ret;
 }
 
 
@@ -684,15 +683,17 @@ NtUserSetSystemTimer(
    TIMERPROC lpTimerFunc
 )
 {
-   DECLARE_RETURN(UINT_PTR);
+    UINT_PTR ret;
+
+    UserEnterExclusive();
+    TRACE("Enter NtUserSetSystemTimer\n");
 
-   TRACE("Enter NtUserSetSystemTimer\n");
+    ret = IntSetTimer(UserGetWindowObject(hWnd), nIDEvent, uElapse, NULL, 
TMRF_SYSTEM);
 
-   RETURN(IntSetTimer(UserGetWindowObject(hWnd), nIDEvent, uElapse, NULL, 
TMRF_SYSTEM));
+    UserLeave();
 
-CLEANUP:
-   TRACE("Leave NtUserSetSystemTimer, ret=%u\n", _ret_);
-   END_CLEANUP;
+    TRACE("Leave NtUserSetSystemTimer, ret=%u\n", ret);
+    return ret;
 }
 
 BOOL

Reply via email to