Module: wine Branch: master Commit: 7686cba10523d5ff9a5b427c9ecc15b18cfbc677 URL: https://gitlab.winehq.org/wine/wine/-/commit/7686cba10523d5ff9a5b427c9ecc15b...
Author: Alexandre Julliard julliard@winehq.org Date: Fri Mar 24 13:17:27 2023 +0100
ntdll: One more fix for CPU information in old Wow64 mode.
---
dlls/ntdll/tests/info.c | 1 - dlls/ntdll/unix/system.c | 9 +-------- dlls/ntdll/unix/virtual.c | 13 ++++++++++++- 3 files changed, 13 insertions(+), 10 deletions(-)
diff --git a/dlls/ntdll/tests/info.c b/dlls/ntdll/tests/info.c index f500fc09092..ae1c8c7c89d 100644 --- a/dlls/ntdll/tests/info.c +++ b/dlls/ntdll/tests/info.c @@ -322,7 +322,6 @@ static void test_query_cpu(void) { ok( sci.ProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL, "ProcessorArchitecture wrong %x\n", sci.ProcessorArchitecture ); - todo_wine ok( sci2.ProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64 || sci2.ProcessorArchitecture == PROCESSOR_ARCHITECTURE_ARM64, "ProcessorArchitecture wrong %x\n", sci2.ProcessorArchitecture ); diff --git a/dlls/ntdll/unix/system.c b/dlls/ntdll/unix/system.c index 3eecccc4972..04755fac5ea 100644 --- a/dlls/ntdll/unix/system.c +++ b/dlls/ntdll/unix/system.c @@ -2568,14 +2568,7 @@ NTSTATUS WINAPI NtQuerySystemInformation( SYSTEM_INFORMATION_CLASS class, }
case SystemCpuInformation: /* 1 */ - if (size >= (len = sizeof(cpu_info))) - { - SYSTEM_CPU_INFORMATION cpu = cpu_info; - - if (is_old_wow64() && cpu.ProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL) - cpu.ProcessorArchitecture = PROCESSOR_ARCHITECTURE_AMD64; - memcpy(info, &cpu, len); - } + if (size >= (len = sizeof(cpu_info))) memcpy(info, &cpu_info, len); else ret = STATUS_INFO_LENGTH_MISMATCH; break;
diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c index 1d07744ed1a..0faf3e343e3 100644 --- a/dlls/ntdll/unix/virtual.c +++ b/dlls/ntdll/unix/virtual.c @@ -5319,10 +5319,21 @@ NTSTATUS WINAPI NtWow64WriteVirtualMemory64( HANDLE process, ULONG64 addr, const NTSTATUS WINAPI NtWow64GetNativeSystemInformation( SYSTEM_INFORMATION_CLASS class, void *info, ULONG len, ULONG *retlen ) { + NTSTATUS status; + switch (class) { - case SystemBasicInformation: case SystemCpuInformation: + status = NtQuerySystemInformation( class, info, len, retlen ); + if (!status && is_old_wow64()) + { + SYSTEM_CPU_INFORMATION *cpu = info; + + if (cpu->ProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL) + cpu->ProcessorArchitecture = PROCESSOR_ARCHITECTURE_AMD64; + } + return status; + case SystemBasicInformation: case SystemEmulationBasicInformation: case SystemEmulationProcessorInformation: return NtQuerySystemInformation( class, info, len, retlen );