Commit ff1dfb42 authored by Alexandre Julliard's avatar Alexandre Julliard

ntdll/tests: Work around a Windows pointer truncation bug in CPU info.

parent 5bd5fecb
......@@ -4350,6 +4350,12 @@ static void test_wow64_context(void)
ok( cpu->Machine == IMAGE_FILE_MACHINE_I386, "wrong machine %04x\n", cpu->Machine );
ret = pRtlWow64GetCpuAreaInfo( cpu, 0, &cpu_info );
ok( !ret, "RtlWow64GetCpuAreaInfo failed %lx\n", ret );
/* work around pointer truncation bug on win10 <= 1709 */
if (!((ULONG_PTR)cpu_info.Context >> 32))
{
cpu_info.Context = (char *)cpu + (ULONG)((char *)cpu_info.Context - (char *)cpu);
cpu_info.ContextEx = (char *)cpu + (ULONG)((char *)cpu_info.ContextEx - (char *)cpu);
}
ctx_ptr = (WOW64_CONTEXT *)cpu_info.Context;
ok(!*(void **)cpu_info.ContextEx, "got context_ex %p\n", *(void **)cpu_info.ContextEx);
ok(ctx_ptr->ContextFlags == WOW64_CONTEXT_ALL, "got context flags %#lx\n", ctx_ptr->ContextFlags);
......
......@@ -1340,8 +1340,10 @@ static void test_cpu_area(void)
status = pRtlWow64GetCpuAreaInfo( cpu, 0, &info );
ok( status == tests[i].expect, "%lu:%lu: failed %lx\n", i, j, status );
if (status) continue;
ok( info.Context == ALIGN( cpu + 1, tests[i].align ), "%lu:%lu: wrong offset %lu\n",
i, j, (ULONG)((char *)info.Context - (char *)cpu) );
ok( info.Context == ALIGN( cpu + 1, tests[i].align ) ||
broken( (ULONG_PTR)info.Context == (ULONG)(ULONG_PTR)ALIGN( cpu + 1, tests[i].align ) ), /* win10 <= 1709 */
"%lu:%lu: wrong offset %Iu cpu %p context %p\n",
i, j, (ULONG_PTR)((char *)info.Context - (char *)cpu), cpu, info.Context );
ok( info.ContextEx == ALIGN( (char *)info.Context + tests[i].size, sizeof(void*) ),
"%lu:%lu: wrong ex offset %lu\n", i, j, (ULONG)((char *)info.ContextEx - (char *)cpu) );
ok( info.ContextFlagsLocation == (char *)info.Context + tests[i].offset,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment