[PATCH 3/5] user32: Implement UOI_TIMERPROC_EXCEPTION_SUPPRESSION.

Jinoh Kang jinoh.kang.kr at gmail.com
Mon Apr 18 05:49:15 CDT 2022


Signed-off-by: Jinoh Kang <jinoh.kang.kr at gmail.com>
---
 dlls/user32/message.c      | 11 ++++++++++-
 dlls/user32/tests/msg.c    |  3 ---
 dlls/user32/user32.spec    |  2 +-
 dlls/user32/user_main.c    |  1 +
 dlls/user32/user_private.h |  1 +
 dlls/user32/winstation.c   | 23 ++++++++++++++++++++++-
 6 files changed, 35 insertions(+), 6 deletions(-)

diff --git a/dlls/user32/message.c b/dlls/user32/message.c
index 611f603fc1e..8be708a118d 100644
--- a/dlls/user32/message.c
+++ b/dlls/user32/message.c
@@ -851,6 +851,15 @@ BOOL WINAPI TranslateMessage( const MSG *msg )
 }
 
 
+static LONG WINAPI timerproc_exception_filter(EXCEPTION_POINTERS *eptr)
+{
+    if (suppress_timerproc_exception)
+        return EXCEPTION_EXECUTE_HANDLER;
+
+    return EXCEPTION_CONTINUE_SEARCH;
+}
+
+
 /***********************************************************************
  *		DispatchMessageA (USER32.@)
  *
@@ -870,7 +879,7 @@ LRESULT WINAPI DECLSPEC_HOTPATCH DispatchMessageA( const MSG* msg )
                 retval = CallWindowProcA( (WNDPROC)msg->lParam, msg->hwnd,
                                           msg->message, msg->wParam, GetTickCount() );
             }
-            __EXCEPT_ALL
+            __EXCEPT(timerproc_exception_filter)
             {
                 retval = 0;
             }
diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c
index a2264361c24..96ef7baed06 100644
--- a/dlls/user32/tests/msg.c
+++ b/dlls/user32/tests/msg.c
@@ -10656,7 +10656,6 @@ static void CALLBACK callback_exception(HWND hwnd, UINT uMsg, UINT_PTR idEvent,
     if (tproc_exc_suppress)
     {
         BOOL res = SetUserObjectInformationW(GetCurrentProcess(), UOI_TIMERPROC_EXCEPTION_SUPPRESSION, tproc_exc_suppress, sizeof(*tproc_exc_suppress));
-        todo_wine
         ok(res, "SetUserObjectInformationW error %lu\n", GetLastError());
         tproc_exc_suppress = NULL;
     }
@@ -10953,12 +10952,10 @@ static void test_timers_exception(DWORD code)
     count = 0;
     dispatch_message_handle_exception(&msg);
     ok(count == 1, "expected count to be 1, got %d\n", count);
-    todo_wine
     ok(exception == 0, "exception from timer procedure shall be propagated\n");
 
     value = TRUE;
     ret = SetUserObjectInformationW(GetCurrentProcess(), UOI_TIMERPROC_EXCEPTION_SUPPRESSION, &value, sizeof(value));
-    todo_wine
     ok(ret, "SetUserObjectInformation error %lu\n", GetLastError());
 
     KillTimer(NULL, id);
diff --git a/dlls/user32/user32.spec b/dlls/user32/user32.spec
index 783684e8cc7..6e288f6e315 100644
--- a/dlls/user32/user32.spec
+++ b/dlls/user32/user32.spec
@@ -714,7 +714,7 @@
 @ stdcall SetThreadDpiAwarenessContext(ptr)
 @ stdcall SetTimer(long long long ptr)
 @ stdcall SetUserObjectInformationA(long long ptr long)
-@ stdcall SetUserObjectInformationW(long long ptr long) NtUserSetObjectInformation
+@ stdcall SetUserObjectInformationW(long long ptr long)
 @ stdcall SetUserObjectSecurity(long ptr ptr)
 @ stdcall SetWinEventHook(long long long ptr long long long)
 @ stdcall SetWindowCompositionAttribute(ptr ptr)
diff --git a/dlls/user32/user_main.c b/dlls/user32/user_main.c
index c477d0325d3..7e37ff36251 100644
--- a/dlls/user32/user_main.c
+++ b/dlls/user32/user_main.c
@@ -37,6 +37,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(graphics);
 WINE_DECLARE_DEBUG_CHANNEL(message);
 
 HMODULE user32_module = 0;
+BOOL suppress_timerproc_exception = TRUE;
 
 static DWORD exiting_thread_id;
 
diff --git a/dlls/user32/user_private.h b/dlls/user32/user_private.h
index 52e57a5e6f1..8970569d45c 100644
--- a/dlls/user32/user_private.h
+++ b/dlls/user32/user_private.h
@@ -66,6 +66,7 @@ static inline struct user_thread_info *get_user_thread_info(void)
 }
 
 extern HMODULE user32_module DECLSPEC_HIDDEN;
+extern BOOL suppress_timerproc_exception DECLSPEC_HIDDEN;
 
 struct dce;
 struct tagWND;
diff --git a/dlls/user32/winstation.c b/dlls/user32/winstation.c
index c0c8ec7a14f..495e22727dc 100644
--- a/dlls/user32/winstation.c
+++ b/dlls/user32/winstation.c
@@ -389,12 +389,33 @@ BOOL WINAPI GetUserObjectInformationA( HANDLE handle, INT index, LPVOID info, DW
 }
 
 
+/******************************************************************************
+ *              SetUserObjectInformationW   (USER32.@)
+ */
+BOOL WINAPI SetUserObjectInformationW( HANDLE handle, INT index, LPVOID info, DWORD len )
+{
+    if (index == UOI_TIMERPROC_EXCEPTION_SUPPRESSION)
+    {
+        if (handle != GetCurrentProcess() || len != sizeof(BOOL))
+        {
+            SetLastError(ERROR_INVALID_PARAMETER);
+            return FALSE;
+        }
+
+        suppress_timerproc_exception = *(const BOOL *)info;
+        return TRUE;
+    }
+
+    return NtUserSetObjectInformation( handle, index, info, len );
+}
+
+
 /******************************************************************************
  *              SetUserObjectInformationA   (USER32.@)
  */
 BOOL WINAPI SetUserObjectInformationA( HANDLE handle, INT index, LPVOID info, DWORD len )
 {
-    return NtUserSetObjectInformation( handle, index, info, len );
+    return SetUserObjectInformationW( handle, index, info, len );
 }
 
 
-- 
2.34.1




More information about the wine-devel mailing list