Author: weiden
Date: Sat Apr 21 23:37:11 2007
New Revision: 26454
URL:
http://svn.reactos.org/svn/reactos?rev=26454&view=rev
Log:
Display current CPU speed
Modified:
trunk/reactos/dll/cpl/cpl.rbuild
trunk/reactos/dll/cpl/sysdm/general.c
trunk/reactos/dll/cpl/sysdm/precomp.h
trunk/reactos/include/psdk/winnt.h
Modified: trunk/reactos/dll/cpl/cpl.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/cpl.rbuild?rev=264…
==============================================================================
--- trunk/reactos/dll/cpl/cpl.rbuild (original)
+++ trunk/reactos/dll/cpl/cpl.rbuild Sat Apr 21 23:37:11 2007
@@ -25,6 +25,9 @@
<directory name="ncpa">
<xi:include href="ncpa/ncpa.rbuild" />
</directory>
+<directory name="odbccp32">
+ <xi:include href="odbccp32/odbccp32.rbuild" />
+</directory>
<directory name="powercfg">
<xi:include href="powercfg/powercfg.rbuild" />
</directory>
Modified: trunk/reactos/dll/cpl/sysdm/general.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/sysdm/general.c?re…
==============================================================================
--- trunk/reactos/dll/cpl/sysdm/general.c (original)
+++ trunk/reactos/dll/cpl/sysdm/general.c Sat Apr 21 23:37:11 2007
@@ -205,24 +205,33 @@
{
TCHAR szBuf[64];
- DWORD dwBuf;
DWORD BufSize = sizeof(DWORD);
DWORD Type = REG_SZ;
-
- if (RegQueryValueEx(hKey,
+ PROCESSOR_POWER_INFORMATION ppi;
+
+ ZeroMemory(&ppi,
+ sizeof(ppi));
+
+ if ((CallNtPowerInformation(ProcessorInformation,
+ NULL,
+ 0,
+ (PVOID)&ppi,
+ sizeof(ppi)) == STATUS_SUCCESS &&
+ ppi.CurrentMhz != 0) ||
+ RegQueryValueEx(hKey,
Value,
NULL,
&Type,
- (PBYTE)&dwBuf,
+ (PBYTE)&ppi.CurrentMhz,
&BufSize) == ERROR_SUCCESS)
{
- if (dwBuf < 1000)
- {
- _stprintf(szBuf, _T("%.2f MHz"), dwBuf);
+ if (ppi.CurrentMhz < 1000)
+ {
+ _stprintf(szBuf, _T("%lu MHz"), ppi.CurrentMhz);
}
else
{
- double flt = dwBuf / 1000.0;
+ double flt = ppi.CurrentMhz / 1000.0;
_stprintf(szBuf, _T("%.2f GHz"), flt);
}
Modified: trunk/reactos/dll/cpl/sysdm/precomp.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/sysdm/precomp.h?re…
==============================================================================
--- trunk/reactos/dll/cpl/sysdm/precomp.h (original)
+++ trunk/reactos/dll/cpl/sysdm/precomp.h Sat Apr 21 23:37:11 2007
@@ -1,8 +1,12 @@
#ifndef __CPL_PRECOMP_H
#define __CPL_PRECOMP_H
+#include <ntstatus.h>
+#define WIN32_NO_STATUS
+#include <windows.h>
#include <windows.h>
#include <commctrl.h>
+#include <powrprof.h>
#include <tchar.h>
#include <stdio.h>
#include <cpl.h>
Modified: trunk/reactos/include/psdk/winnt.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/winnt.h?rev=2…
==============================================================================
--- trunk/reactos/include/psdk/winnt.h (original)
+++ trunk/reactos/include/psdk/winnt.h Sat Apr 21 23:37:11 2007
@@ -3667,6 +3667,17 @@
ULONG DefaultAlert2;
} SYSTEM_BATTERY_STATE, *PSYSTEM_BATTERY_STATE;
+#ifndef __NTDDK_H /* HACK!!! ntddk.h shouldn't include winnt.h! */
+typedef struct _PROCESSOR_POWER_INFORMATION {
+ ULONG Number;
+ ULONG MaxMhz;
+ ULONG CurrentMhz;
+ ULONG MhzLimit;
+ ULONG MaxIdleState;
+ ULONG CurrentIdleState;
+} PROCESSOR_POWER_INFORMATION, *PPROCESSOR_POWER_INFORMATION;
+#endif
+
typedef DWORD EXECUTION_STATE;
typedef enum _POWER_INFORMATION_LEVEL {
SystemPowerPolicyAc,