James Eder : ntdll: Return as many PROCESSOR_POWER_INFORMATIONs as there are CPUs.

Alexandre Julliard julliard at winehq.org
Thu Sep 13 14:39:22 CDT 2012


Module: wine
Branch: master
Commit: c683b98da55a6d31475f04386cca96db2de2ffcc
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=c683b98da55a6d31475f04386cca96db2de2ffcc

Author: James Eder <jimportal at gmail.com>
Date:   Wed Sep 12 13:14:27 2012 -0600

ntdll: Return as many PROCESSOR_POWER_INFORMATIONs as there are CPUs.

---

 dlls/ntdll/nt.c |   29 ++++++++++++++++++-----------
 1 files 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);




More information about the wine-cvs mailing list