From c3f171d0cbaea1a5deed2e1fa2f9a69346863399 Mon Sep 17 00:00:00 2001 From: Geremy Cambus <43472014+GeremC@users.noreply.github.com> Date: Mon, 23 Nov 2026 16:53:02 +0100 Subject: allocator_proxy, queue_proxy tests: take the guard fault's code in the filter (#6864) Squash-merged after diff review of PR #6864 - allocator_proxy, queue_proxy tests: take the guard fault's code in the filter (Wine 9) --- runtime/test/queue_proxy_test.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'runtime/test/queue_proxy_test.cpp') diff --git a/runtime/test/queue_proxy_test.cpp b/runtime/test/queue_proxy_test.cpp index 142eae84e..3f46567f8 100644 --- a/runtime/test/queue_proxy_test.cpp +++ b/runtime/test/queue_proxy_test.cpp @@ -95,11 +95,15 @@ std::uint64_t raw_call(void* object, unsigned slot, std::uint64_t a1 = 0, std::u // ---- Structured-exception guards (no C++ objects in these frames) ---- ULONG_PTR g_fault_address = 0; +// The code is taken in the filter, from the exception record: GetExceptionCode() in the __except body returns 0 +// under Wine 9.0 (clang-cl reads it from what the unwind hands the handler, which that Wine does not supply). +DWORD g_fault_code = 0; bool g_shared_checked = false; // check_shared ran OpenSharedHandle (the backend has shared fences) bool g_shared_created = false; // check_shared made a shared fence and called CreateSharedHandle (slot 31) bool g_reserved_checked = false; // check_slots had reserved resources for UpdateTileMappings/CopyTileMappings int record_fault(EXCEPTION_POINTERS* info) { + g_fault_code = info->ExceptionRecord->ExceptionCode; g_fault_address = info->ExceptionRecord->NumberParameters >= 2 ? info->ExceptionRecord->ExceptionInformation[1] : 0; return EXCEPTION_EXECUTE_HANDLER; } @@ -113,12 +117,13 @@ __declspec(noinline) void* read_entry(void* const* vtable, unsigned slot) { // Reads vtable[slot] the way a call through it does. Returns the exception code, or 0 when the read worked. DWORD read_slot_guarded(void* const* vtable, unsigned slot) { g_fault_address = 0; + g_fault_code = 0; __try { void* volatile entry = read_entry(vtable, slot); (void)entry; return 0; } __except (record_fault(GetExceptionInformation())) { - return GetExceptionCode(); + return g_fault_code; } } -- cgit v1.2.3