James Eder : wineboot: Expect one PROCESSOR_POWER_INFORMATION structure for each CPU present when calling NtPowerInformation .
Alexandre Julliard
julliard at winehq.org
Thu Sep 13 14:39:22 CDT 2012
Module: wine
Branch: master
Commit: 7f9dfe273a80d31e3f8c5bd0c100c81370aa6f38
URL: http://source.winehq.org/git/wine.git/?a=commit;h=7f9dfe273a80d31e3f8c5bd0c100c81370aa6f38
Author: James Eder <jimportal at gmail.com>
Date: Wed Sep 12 13:15:50 2012 -0600
wineboot: Expect one PROCESSOR_POWER_INFORMATION structure for each CPU present when calling NtPowerInformation.
---
programs/wineboot/wineboot.c | 17 +++++++++++++----
1 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/programs/wineboot/wineboot.c b/programs/wineboot/wineboot.c
index aac17ec..0be773b 100644
--- a/programs/wineboot/wineboot.c
+++ b/programs/wineboot/wineboot.c
@@ -189,19 +189,27 @@ static void create_hardware_registry_keys(void)
unsigned int i;
HKEY hkey, system_key, cpu_key, fpu_key;
SYSTEM_CPU_INFORMATION sci;
- PROCESSOR_POWER_INFORMATION power_info;
+ PROCESSOR_POWER_INFORMATION* power_info;
+ ULONG sizeof_power_info = sizeof(PROCESSOR_POWER_INFORMATION) * NtCurrentTeb()->Peb->NumberOfProcessors;
WCHAR idW[60];
NtQuerySystemInformation( SystemCpuInformation, &sci, sizeof(sci), NULL );
- if (NtPowerInformation(ProcessorInformation, NULL, 0, &power_info, sizeof(power_info)))
- power_info.MaxMhz = 0;
+
+ power_info = HeapAlloc( GetProcessHeap(), 0, sizeof_power_info );
+ if (power_info == NULL)
+ return;
+ if (NtPowerInformation( ProcessorInformation, NULL, 0, power_info, sizeof_power_info ))
+ memset( power_info, 0, sizeof_power_info );
/*TODO: report 64bit processors properly*/
sprintfW( idW, IntelCpuDescrW, sci.Level, HIBYTE(sci.Revision), LOBYTE(sci.Revision) );
if (RegCreateKeyExW( HKEY_LOCAL_MACHINE, SystemW, 0, NULL, REG_OPTION_VOLATILE,
KEY_ALL_ACCESS, NULL, &system_key, NULL ))
+ {
+ HeapFree( GetProcessHeap(), 0, power_info );
return;
+ }
set_reg_value( system_key, IdentifierW, SysidW );
@@ -225,7 +233,7 @@ static void create_hardware_registry_keys(void)
/*TODO; report amd's properly*/
set_reg_value( hkey, ProcessorNameStringW, IntelCpuStringW );
set_reg_value( hkey, VendorIdentifierW, VenidIntelW );
- RegSetValueExW( hkey, mhzKeyW, 0, REG_DWORD, (BYTE *)&power_info.MaxMhz, sizeof(DWORD) );
+ RegSetValueExW( hkey, mhzKeyW, 0, REG_DWORD, (BYTE *)&power_info[i].MaxMhz, sizeof(DWORD) );
RegCloseKey( hkey );
}
if (!RegCreateKeyExW( fpu_key, numW, 0, NULL, REG_OPTION_VOLATILE,
@@ -238,6 +246,7 @@ static void create_hardware_registry_keys(void)
RegCloseKey( fpu_key );
RegCloseKey( cpu_key );
RegCloseKey( system_key );
+ HeapFree( GetProcessHeap(), 0, power_info );
}
More information about the wine-cvs
mailing list