ntdll/tests: Test setting the return value via alertable NtContinue().

This is currently broken on WoW64.
This commit is contained in:
Zebediah Figura 2022-06-25 20:12:16 -05:00 committed by Alexandre Julliard
parent 1168dfc3c1
commit e39880d945

View file

@ -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");
}