[PATCH 3/3] ntdll/tests: Test setting the return value via alertable NtContinue().

Zebediah Figura wine at gitlab.winehq.org
Mon Jun 27 16:20:41 CDT 2022


From: Zebediah Figura <zfigura at codeweavers.com>

This is currently broken on WoW64.
---
 dlls/ntdll/tests/exception.c | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/dlls/ntdll/tests/exception.c b/dlls/ntdll/tests/exception.c
index 748ee0e52ee..753a44c769b 100644
--- a/dlls/ntdll/tests/exception.c
+++ b/dlls/ntdll/tests/exception.c
@@ -8775,6 +8775,7 @@ static void test_user_apc(void)
     NTSTATUS status;
     CONTEXT context;
     LONG pass;
+    int ret;
 
     if (!pNtQueueApcThread)
     {
@@ -8797,16 +8798,20 @@ static void test_user_apc(void)
             0xc9,               /* leave */
             0xc3,               /* ret */
         };
-        void (__cdecl *func)(void *capture, CONTEXT *context) = code_mem;
+        int (__cdecl *func)(void *capture, CONTEXT *context) = code_mem;
 
         memcpy(code_mem, code, sizeof(code));
-        func(RtlCaptureContext, &context);
+        ret = func(RtlCaptureContext, &context);
         /* work around broken RtlCaptureContext on Windows < 7 which doesn't set
          * ContextFlags */
         context.ContextFlags = CONTEXT_FULL;
     }
 #else
-    RtlCaptureContext(&context);
+    {
+        int (WINAPI *func)(CONTEXT *context) = (void *)RtlCaptureContext;
+
+        ret = func(&context);
+    }
 #endif
     InterlockedIncrement(&pass);
 
@@ -8815,6 +8820,16 @@ static void test_user_apc(void)
         /* Try to make sure context data is far enough below context.Esp. */
         CONTEXT c[4];
 
+#ifdef __i386__
+        context.Eax = 0xabacab;
+#elif defined(__x86_64__)
+        context.Rax = 0xabacab;
+#elif defined(__arm__)
+        context.R0 = 0xabacab;
+#elif defined(__aarch64__)
+        context.X0 = 0xabacab;
+#endif
+
         c[0] = context;
 
         test_apc_called = FALSE;
@@ -8830,6 +8845,7 @@ static void test_user_apc(void)
         ok(0, "Should not get here, status %#lx.\n", status);
         return;
     }
+    ok(ret == 0xabacab, "Got return value %#x.\n", ret);
     ok(pass == 3, "Got unexpected pass %ld.\n", pass);
     ok(test_apc_called, "Test user APC was not called.\n");
 }
-- 
GitLab

https://gitlab.winehq.org/wine/wine/-/merge_requests/327



More information about the wine-devel mailing list