From 40294182c1554a97dcfa8414b609b6f8de8f5239 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Hentschel?= Date: Mon, 3 Jan 2011 20:27:00 +0100 Subject: [PATCH] ntdll: Respect multiple CPUs when faking values. --- dlls/ntdll/nt.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/dlls/ntdll/nt.c b/dlls/ntdll/nt.c index 7ad56e495cf..ee78aeca158 100644 --- a/dlls/ntdll/nt.c +++ b/dlls/ntdll/nt.c @@ -1647,17 +1647,18 @@ NTSTATUS WINAPI NtQuerySystemInformation( if (cpus == 0) { static int i = 1; - - sppi = RtlAllocateHeap(GetProcessHeap(),0,sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION)); - - memset(sppi, 0 , sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION)); + int n; + cpus = min(NtCurrentTeb()->Peb->NumberOfProcessors, out_cpus); + len = sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION) * cpus; + sppi = RtlAllocateHeap(GetProcessHeap(), 0, len); FIXME("stub info_class SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION\n"); - /* many programs expect these values to change so fake change */ - len = sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION); - sppi->KernelTime.QuadPart = 1 * i; - sppi->UserTime.QuadPart = 2 * i; - sppi->IdleTime.QuadPart = 3 * i; + for (n = 0; n < cpus; n++) + { + sppi[n].KernelTime.QuadPart = 1 * i; + sppi[n].UserTime.QuadPart = 2 * i; + sppi[n].IdleTime.QuadPart = 3 * i; + } i++; }