mirror of
https://github.com/reactos/reactos.git
synced 2024-07-17 18:06:11 +00:00
Display current CPU speed
svn path=/trunk/; revision=26454
This commit is contained in:
parent
ab2d232623
commit
447e15240e
|
@ -25,6 +25,9 @@
|
||||||
<directory name="ncpa">
|
<directory name="ncpa">
|
||||||
<xi:include href="ncpa/ncpa.rbuild" />
|
<xi:include href="ncpa/ncpa.rbuild" />
|
||||||
</directory>
|
</directory>
|
||||||
|
<directory name="odbccp32">
|
||||||
|
<xi:include href="odbccp32/odbccp32.rbuild" />
|
||||||
|
</directory>
|
||||||
<directory name="powercfg">
|
<directory name="powercfg">
|
||||||
<xi:include href="powercfg/powercfg.rbuild" />
|
<xi:include href="powercfg/powercfg.rbuild" />
|
||||||
</directory>
|
</directory>
|
||||||
|
|
|
@ -205,24 +205,33 @@ SetProcSpeed(HWND hwnd,
|
||||||
|
|
||||||
{
|
{
|
||||||
TCHAR szBuf[64];
|
TCHAR szBuf[64];
|
||||||
DWORD dwBuf;
|
|
||||||
DWORD BufSize = sizeof(DWORD);
|
DWORD BufSize = sizeof(DWORD);
|
||||||
DWORD Type = REG_SZ;
|
DWORD Type = REG_SZ;
|
||||||
|
PROCESSOR_POWER_INFORMATION ppi;
|
||||||
|
|
||||||
if (RegQueryValueEx(hKey,
|
ZeroMemory(&ppi,
|
||||||
|
sizeof(ppi));
|
||||||
|
|
||||||
|
if ((CallNtPowerInformation(ProcessorInformation,
|
||||||
|
NULL,
|
||||||
|
0,
|
||||||
|
(PVOID)&ppi,
|
||||||
|
sizeof(ppi)) == STATUS_SUCCESS &&
|
||||||
|
ppi.CurrentMhz != 0) ||
|
||||||
|
RegQueryValueEx(hKey,
|
||||||
Value,
|
Value,
|
||||||
NULL,
|
NULL,
|
||||||
&Type,
|
&Type,
|
||||||
(PBYTE)&dwBuf,
|
(PBYTE)&ppi.CurrentMhz,
|
||||||
&BufSize) == ERROR_SUCCESS)
|
&BufSize) == ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
if (dwBuf < 1000)
|
if (ppi.CurrentMhz < 1000)
|
||||||
{
|
{
|
||||||
_stprintf(szBuf, _T("%.2f MHz"), dwBuf);
|
_stprintf(szBuf, _T("%lu MHz"), ppi.CurrentMhz);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
double flt = dwBuf / 1000.0;
|
double flt = ppi.CurrentMhz / 1000.0;
|
||||||
_stprintf(szBuf, _T("%.2f GHz"), flt);
|
_stprintf(szBuf, _T("%.2f GHz"), flt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,12 @@
|
||||||
#ifndef __CPL_PRECOMP_H
|
#ifndef __CPL_PRECOMP_H
|
||||||
#define __CPL_PRECOMP_H
|
#define __CPL_PRECOMP_H
|
||||||
|
|
||||||
|
#include <ntstatus.h>
|
||||||
|
#define WIN32_NO_STATUS
|
||||||
|
#include <windows.h>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <commctrl.h>
|
#include <commctrl.h>
|
||||||
|
#include <powrprof.h>
|
||||||
#include <tchar.h>
|
#include <tchar.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <cpl.h>
|
#include <cpl.h>
|
||||||
|
|
|
@ -3667,6 +3667,17 @@ typedef struct _SYSTEM_BATTERY_STATE {
|
||||||
ULONG DefaultAlert2;
|
ULONG DefaultAlert2;
|
||||||
} SYSTEM_BATTERY_STATE, *PSYSTEM_BATTERY_STATE;
|
} 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 DWORD EXECUTION_STATE;
|
||||||
typedef enum _POWER_INFORMATION_LEVEL {
|
typedef enum _POWER_INFORMATION_LEVEL {
|
||||||
SystemPowerPolicyAc,
|
SystemPowerPolicyAc,
|
||||||
|
|
Loading…
Reference in a new issue