Module: wine Branch: master Commit: 6775a20f4e58d07e166438f99f92143b288e4967 URL: https://source.winehq.org/git/wine.git/?a=commit;h=6775a20f4e58d07e166438f99...
Author: Zebediah Figura zfigura@codeweavers.com Date: Sat Jun 25 20:05:54 2022 -0500
ntdll/tests: Fix test_user_apc() on i386.
---
dlls/ntdll/tests/exception.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
diff --git a/dlls/ntdll/tests/exception.c b/dlls/ntdll/tests/exception.c index 820e435bc1b..86f2f5d6cb2 100644 --- a/dlls/ntdll/tests/exception.c +++ b/dlls/ntdll/tests/exception.c @@ -8784,7 +8784,27 @@ static void test_user_apc(void)
pass = 0; InterlockedIncrement(&pass); +#ifdef __i386__ + { + /* RtlCaptureContext puts the return address of the caller's stack + * frame into %eip, so we need a thunk to get it to return here */ + static const BYTE code[] = + { + 0x55, /* pushl %ebp */ + 0x89, 0xe5, /* movl %esp, %ebp */ + 0xff, 0x75, 0x0c, /* pushl 0xc(%ebp) */ + 0xff, 0x55, 0x08, /* call *0x8(%ebp) */ + 0xc9, /* leave */ + 0xc3, /* ret */ + }; + void (__cdecl *func)(void *capture, CONTEXT *context) = code_mem; + + memcpy(code_mem, code, sizeof(code)); + func(RtlCaptureContext, &context); + } +#else RtlCaptureContext(&context); +#endif InterlockedIncrement(&pass);
if (pass == 2)