[PATCH 1/4] ntdll: Return as many PROCESSOR_POWER_INFORMATIONs as there are CPUs

James Eder jimportal at gmail.com
Wed Sep 12 14:14:27 CDT 2012


---
 dlls/ntdll/nt.c | 29 ++++++++++++++++++-----------
 1 file changed, 18 insertions(+), 11 deletions(-)

diff --git a/dlls/ntdll/nt.c b/dlls/ntdll/nt.c
index 44bdc5f..ca05203 100644
--- a/dlls/ntdll/nt.c
+++ b/dlls/ntdll/nt.c
@@ -2325,20 +2325,27 @@ NTSTATUS WINAPI NtPowerInformation(
 			*ExecutionState = ES_USER_PRESENT;
 			return STATUS_SUCCESS;
 		}
-                case ProcessorInformation: {
-			PPROCESSOR_POWER_INFORMATION cpu_power = lpOutputBuffer;
+		case ProcessorInformation: {
+			PROCESSOR_POWER_INFORMATION* cpu_power = lpOutputBuffer;
+			int i;
 
 			WARN("semi-stub: ProcessorInformation\n");
-			if (nOutputBufferSize < sizeof(PROCESSOR_POWER_INFORMATION))
+
+			if ((lpOutputBuffer == NULL) || (nOutputBufferSize == 0))
+				return STATUS_INVALID_PARAMETER;
+			if ((nOutputBufferSize / sizeof(PROCESSOR_POWER_INFORMATION)) < NtCurrentTeb()->Peb->NumberOfProcessors)
 				return STATUS_BUFFER_TOO_SMALL;
-                        cpu_power->Number = NtCurrentTeb()->Peb->NumberOfProcessors;
-                        cpu_power->MaxMhz = cpuHz / 1000000;
-                        cpu_power->CurrentMhz = cpuHz / 1000000;
-                        cpu_power->MhzLimit = cpuHz / 1000000;
-                        cpu_power->MaxIdleState = 0; /* FIXME */
-                        cpu_power->CurrentIdleState = 0; /* FIXME */
-                        return STATUS_SUCCESS;
-                }
+
+			for(i = 0; i < NtCurrentTeb()->Peb->NumberOfProcessors; i++) {
+				cpu_power[i].Number = i;
+				cpu_power[i].MaxMhz = cpuHz / 1000000;
+				cpu_power[i].CurrentMhz = cpuHz / 1000000;
+				cpu_power[i].MhzLimit = cpuHz / 1000000;
+				cpu_power[i].MaxIdleState = 0; /* FIXME */
+				cpu_power[i].CurrentIdleState = 0; /* FIXME */
+			}
+			return STATUS_SUCCESS;
+		}
 		default:
 			/* FIXME: Needed by .NET Framework */
 			WARN("Unimplemented NtPowerInformation action: %d\n", InformationLevel);
-- 
1.7.12




More information about the wine-patches mailing list