ntdll: Fixup CPU information for old Wow64 mode.
This commit is contained in:
parent
8f52d8a4e1
commit
da7411fdb3
2 changed files with 18 additions and 6 deletions
|
@ -68,6 +68,17 @@ static void init(void)
|
|||
|
||||
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 )
|
||||
GET_PROC( NtQuerySystemInformation );
|
||||
GET_PROC( NtQuerySystemInformationEx );
|
||||
|
@ -102,10 +113,6 @@ static void init(void)
|
|||
case PROCESSOR_ARCHITECTURE_AMD64:
|
||||
native_machine = IMAGE_FILE_MACHINE_AMD64;
|
||||
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,
|
|||
case SystemCpuInformation: /* 1 */
|
||||
if (size >= (len = sizeof(cpu_info)))
|
||||
{
|
||||
if (!info) ret = STATUS_ACCESS_VIOLATION;
|
||||
else memcpy(info, &cpu_info, len);
|
||||
SYSTEM_CPU_INFORMATION cpu = cpu_info;
|
||||
|
||||
#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;
|
||||
break;
|
||||
|
|
Loading…
Add table
Reference in a new issue