Commit da7411fd authored by Alexandre Julliard's avatar Alexandre Julliard

ntdll: Fixup CPU information for old Wow64 mode.

parent 8f52d8a4
...@@ -68,6 +68,17 @@ static void init(void) ...@@ -68,6 +68,17 @@ static void init(void)
if (!IsWow64Process( GetCurrentProcess(), &is_wow64 )) is_wow64 = FALSE; if (!IsWow64Process( GetCurrentProcess(), &is_wow64 )) is_wow64 = FALSE;
if (is_wow64)
{
TEB64 *teb64 = ULongToPtr( NtCurrentTeb()->GdiBatchCount );
if (teb64)
{
PEB64 *peb64 = ULongToPtr(teb64->Peb);
old_wow64 = !peb64->LdrData;
}
}
#define GET_PROC(func) p##func = (void *)GetProcAddress( ntdll, #func ) #define GET_PROC(func) p##func = (void *)GetProcAddress( ntdll, #func )
GET_PROC( NtQuerySystemInformation ); GET_PROC( NtQuerySystemInformation );
GET_PROC( NtQuerySystemInformationEx ); GET_PROC( NtQuerySystemInformationEx );
...@@ -102,10 +113,6 @@ static void init(void) ...@@ -102,10 +113,6 @@ static void init(void)
case PROCESSOR_ARCHITECTURE_AMD64: case PROCESSOR_ARCHITECTURE_AMD64:
native_machine = IMAGE_FILE_MACHINE_AMD64; native_machine = IMAGE_FILE_MACHINE_AMD64;
break; break;
case PROCESSOR_ARCHITECTURE_INTEL:
old_wow64 = TRUE;
native_machine = IMAGE_FILE_MACHINE_AMD64;
break;
} }
} }
......
...@@ -2570,8 +2570,13 @@ NTSTATUS WINAPI NtQuerySystemInformation( SYSTEM_INFORMATION_CLASS class, ...@@ -2570,8 +2570,13 @@ NTSTATUS WINAPI NtQuerySystemInformation( SYSTEM_INFORMATION_CLASS class,
case SystemCpuInformation: /* 1 */ case SystemCpuInformation: /* 1 */
if (size >= (len = sizeof(cpu_info))) if (size >= (len = sizeof(cpu_info)))
{ {
if (!info) ret = STATUS_ACCESS_VIOLATION; SYSTEM_CPU_INFORMATION cpu = cpu_info;
else memcpy(info, &cpu_info, len);
#ifndef _WIN64
if (is_wow64 && cpu.ProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL)
cpu.ProcessorArchitecture = PROCESSOR_ARCHITECTURE_AMD64;
#endif
memcpy(info, &cpu, len);
} }
else ret = STATUS_INFO_LENGTH_MISMATCH; else ret = STATUS_INFO_LENGTH_MISMATCH;
break; break;
......
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