[PATCH v2 4/6] user32: Implement UOI_TIMERPROC_EXCEPTION_SUPPRESSION.
Jinoh Kang
jinoh.kang.kr at gmail.com
Wed Apr 20 11:03:49 CDT 2022
Signed-off-by: Jinoh Kang <jinoh.kang.kr at gmail.com>
---
Notes:
v1 -> v2: adjust for changes in previous patch
dlls/user32/message.c | 11 ++++++++++-
dlls/user32/tests/msg.c | 6 ------
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(+), 9 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 7fb8469ec2a..5125f8d77ac 100644
--- a/dlls/user32/tests/msg.c
+++ b/dlls/user32/tests/msg.c
@@ -10665,7 +10665,6 @@ static void CALLBACK callback_exception(HWND hwnd, UINT uMsg, UINT_PTR idEvent,
{
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;
}
@@ -10984,14 +10983,12 @@ static void test_timers_exception(DWORD code)
}
else
{
- todo_wine
ok(ret, "SetUserObjectInformationW error %lu\n", GetLastError());
count = 0;
timer_exc_phase = TIMER_EXCEPTION_INITIAL;
dispatch_message_handle_exception(&msg);
ok(count == 1, "expected count to be 1, got %d\n", count);
- todo_wine
ok(timer_exc_phase == TIMER_EXCEPTION_CONTINUE_OK ||
broken(timer_exc_phase == TIMER_EXCEPTION_RAISED) /* < win10 1507 */,
"expected phase %d, got %d\n", TIMER_EXCEPTION_CONTINUE_OK, timer_exc_phase);
@@ -10999,7 +10996,6 @@ static void test_timers_exception(DWORD code)
value = TRUE;
ret = SetUserObjectInformationW(GetCurrentProcess(), UOI_TIMERPROC_EXCEPTION_SUPPRESSION,
&value, sizeof(value));
- todo_wine
ok(ret, "SetUserObjectInformationW error %lu\n", GetLastError());
value = FALSE;
@@ -11008,7 +11004,6 @@ static void test_timers_exception(DWORD code)
timer_exc_phase = TIMER_EXCEPTION_INITIAL;
dispatch_message_handle_exception(&msg);
ok(count == 1, "expected count to be 1, got %d\n", count);
- todo_wine
ok(timer_exc_phase == TIMER_EXCEPTION_CONTINUE_OK ||
broken(timer_exc_phase == TIMER_EXCEPTION_RAISED) /* < win10 1507 */,
"expected phase %d, got %d\n", TIMER_EXCEPTION_CONTINUE_OK, timer_exc_phase);
@@ -11016,7 +11011,6 @@ static void test_timers_exception(DWORD code)
value = TRUE;
ret = SetUserObjectInformationW(GetCurrentProcess(), UOI_TIMERPROC_EXCEPTION_SUPPRESSION,
&value, sizeof(value));
- todo_wine
ok(ret, "SetUserObjectInformationW error %lu\n", GetLastError());
}
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