ReactOS 0.4.15-dev-7942-gd23573b
processor.c File Reference
#include <stdarg.h>
#include <windef.h>
#include <winbase.h>
#include <winreg.h>
#include <winuser.h>
#include <setupapi.h>
#include <powrprof.h>
#include <strsafe.h>
#include "resource.h"
Include dependency graph for processor.c:

Go to the source code of this file.

Macros

#define WIN32_NO_STATUS
 
#define _INC_WINDOWS
 
#define COM_NO_WINDOWS_H
 

Functions

INT_PTR CALLBACK ProcessorDlgProc (HWND hDlg, UINT uMessage, WPARAM wParam, LPARAM lParam)
 
BOOL APIENTRY DllMain (HANDLE hInstance, DWORD dwReason, LPVOID lpReserved)
 
BOOL APIENTRY PropSheetExtProc (PSP_PROPSHEETPAGE_REQUEST PropPageRequest, LPFNADDPROPSHEETPAGE fAddFunc, LPARAM lParam)
 
void AddFeature (WCHAR *szFeatures, size_t cbDest, WCHAR *Feature, BOOL *bFirst)
 

Variables

HINSTANCE g_hInstance = NULL
 

Macro Definition Documentation

◆ _INC_WINDOWS

#define _INC_WINDOWS

Definition at line 11 of file processor.c.

◆ COM_NO_WINDOWS_H

#define COM_NO_WINDOWS_H

Definition at line 12 of file processor.c.

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 10 of file processor.c.

Function Documentation

◆ AddFeature()

void AddFeature ( WCHAR szFeatures,
size_t  cbDest,
WCHAR Feature,
BOOL bFirst 
)

Definition at line 77 of file processor.c.

78{
79 if (!*bFirst)
80 StringCbCatW(szFeatures, cbDest, L", ");
81 *bFirst = FALSE;
82 StringCbCatW(szFeatures, cbDest, Feature);
83}
_In_ ULONG const _In_ FEATURE_NUMBER const Feature
Definition: cdrom.h:1077
#define FALSE
Definition: types.h:117
#define L(x)
Definition: ntvdm.h:50
STRSAFEAPI StringCbCatW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:342

Referenced by ProcessorDlgProc().

◆ DllMain()

BOOL APIENTRY DllMain ( HANDLE  hInstance,
DWORD  dwReason,
LPVOID  lpReserved 
)

Definition at line 29 of file processor.c.

30{
31 switch (dwReason)
32 {
37 break;
38 }
39
41 return TRUE;
42}
DWORD dwReason
Definition: misc.cpp:154
HINSTANCE hInstance
Definition: charmap.c:19
#define TRUE
Definition: types.h:120
HINSTANCE g_hInstance
Definition: processor.c:24
#define DLL_THREAD_DETACH
Definition: compat.h:133
#define DLL_PROCESS_ATTACH
Definition: compat.h:131
#define DLL_PROCESS_DETACH
Definition: compat.h:130
#define DLL_THREAD_ATTACH
Definition: compat.h:132
HANDLE HINSTANCE
Definition: typedefs.h:77

◆ ProcessorDlgProc()

INT_PTR CALLBACK ProcessorDlgProc ( HWND  hDlg,
UINT  uMessage,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 87 of file processor.c.

88{
89 switch (uMessage) {
90 case WM_INITDIALOG:
91 {
92 WCHAR szFeatures[MAX_PATH] = L"";
93 WCHAR szModel[3];
94 WCHAR szStepping[3];
95 WCHAR szMhz[16];
96 WCHAR szCurrentMhz[10];
97 BOOL bFirst = TRUE;
98 SYSTEM_INFO SystemInfo;
100
101 if (!LoadStringW(g_hInstance, IDS_MEGAHERTZ, szMhz, ARRAYSIZE(szMhz)))
102 {
103 StringCbCopyW(szMhz, sizeof(szMhz), L"%ld MHz");
104 }
105
107 AddFeature(szFeatures, sizeof(szFeatures), L"MMX", &bFirst);
109 AddFeature(szFeatures, sizeof(szFeatures), L"SSE", &bFirst);
111 AddFeature(szFeatures, sizeof(szFeatures), L"SSE2", &bFirst);
112 /*if (IsProcessorFeaturePresent(PF_SSE3_INSTRUCTIONS_AVAILABLE))
113 AddFeature(szFeatures, sizeof(szFeatures), L"SSE3", &bFirst); */
115 AddFeature(szFeatures, sizeof(szFeatures), L"3DNOW", &bFirst);
116
117 SetDlgItemTextW(hDlg, IDC_FEATURES, szFeatures);
118
119 GetSystemInfo(&SystemInfo);
120
121 StringCbPrintfW(szModel, sizeof(szModel), L"%x", HIBYTE(SystemInfo.wProcessorRevision));
122 StringCbPrintfW(szStepping, sizeof(szStepping), L"%d", LOBYTE(SystemInfo.wProcessorRevision));
123
124 SetDlgItemTextW(hDlg, IDC_MODEL, szModel);
125 SetDlgItemTextW(hDlg, IDC_STEPPING, szStepping);
126
127 CallNtPowerInformation(11, NULL, 0, &PowerInfo, sizeof(PowerInfo));
128 StringCbPrintfW(szCurrentMhz, sizeof(szCurrentMhz), szMhz, PowerInfo.CurrentMhz);
129 SetDlgItemTextW(hDlg, IDC_CORESPEED, szCurrentMhz);
130
131 return TRUE;
132 }
133 }
134 return FALSE;
135}
#define NULL
Definition: types.h:112
#define IDS_MEGAHERTZ
Definition: resource.h:62
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
void AddFeature(WCHAR *szFeatures, size_t cbDest, WCHAR *Feature, BOOL *bFirst)
Definition: processor.c:77
#define IDC_STEPPING
Definition: resource.h:7
#define IDC_CORESPEED
Definition: resource.h:8
#define IDC_FEATURES
Definition: resource.h:5
#define IDC_MODEL
Definition: resource.h:6
#define MAX_PATH
Definition: compat.h:34
VOID WINAPI GetSystemInfo(IN LPSYSTEM_INFO lpSystemInfo)
Definition: sysinfo.c:143
BOOL WINAPI IsProcessorFeaturePresent(IN DWORD ProcessorFeature)
Definition: sysinfo.c:169
unsigned int BOOL
Definition: ntddk_ex.h:94
#define LOBYTE(W)
Definition: jmemdos.c:487
#define HIBYTE(W)
Definition: jmemdos.c:486
NTSTATUS WINAPI CallNtPowerInformation(POWER_INFORMATION_LEVEL InformationLevel, PVOID lpInputBuffer, ULONG nInputBufferSize, PVOID lpOutputBuffer, ULONG nOutputBufferSize)
Definition: powrprof.c:59
STRSAFEAPI StringCbCopyW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:166
STRSAFEAPI StringCbPrintfW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:557
WORD wProcessorRevision
Definition: winbase.h:1181
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
#define WM_INITDIALOG
Definition: winuser.h:1739
#define PF_3DNOW_INSTRUCTIONS_AVAILABLE
Definition: ketypes.h:131
#define PF_MMX_INSTRUCTIONS_AVAILABLE
Definition: ketypes.h:127
#define PF_XMMI64_INSTRUCTIONS_AVAILABLE
Definition: ketypes.h:134
#define PF_XMMI_INSTRUCTIONS_AVAILABLE
Definition: ketypes.h:130
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by PropSheetExtProc().

◆ PropSheetExtProc()

BOOL APIENTRY PropSheetExtProc ( PSP_PROPSHEETPAGE_REQUEST  PropPageRequest,
LPFNADDPROPSHEETPAGE  fAddFunc,
LPARAM  lParam 
)

Definition at line 47 of file processor.c.

48{
50 HPROPSHEETPAGE hPropSheetPage;
51
53 return FALSE;
54
55 if ((!PropPageRequest->DeviceInfoSet) || (!PropPageRequest->DeviceInfoData))
56 return FALSE;
57
59 PropSheetPage.dwSize = sizeof(PROPSHEETPAGE);
60 PropSheetPage.hInstance = g_hInstance;
63
64 hPropSheetPage = CreatePropertySheetPage(&PropSheetPage);
65 if(!hPropSheetPage)
66 return FALSE;
67
68 if(!(fAddFunc)(hPropSheetPage, lParam)) {
69 DestroyPropertySheetPage (hPropSheetPage);
70 return FALSE;
71 }
72
73 return TRUE;
74}
LPARAM lParam
Definition: combotst.c:139
INT_PTR CALLBACK ProcessorDlgProc(HWND hDlg, UINT uMessage, WPARAM wParam, LPARAM lParam)
Definition: processor.c:87
#define DLG_PROCESSORINFO
Definition: resource.h:3
BOOL WINAPI DestroyPropertySheetPage(HPROPSHEETPAGE hPropPage)
Definition: propsheet.c:3152
struct _PSP * HPROPSHEETPAGE
Definition: mstask.idl:90
#define CreatePropertySheetPage
Definition: prsht.h:399
#define PROPSHEETPAGE
Definition: prsht.h:389
#define SPPSR_ENUM_ADV_DEVICE_PROPERTIES
Definition: setupapi.h:615
PSP_DEVINFO_DATA DeviceInfoData
Definition: setupapi.h:1104
#define ZeroMemory
Definition: winbase.h:1712
#define MAKEINTRESOURCE
Definition: winuser.h:591

Variable Documentation

◆ g_hInstance

HINSTANCE g_hInstance = NULL

Definition at line 24 of file processor.c.

Referenced by DllMain(), ProcessorDlgProc(), and PropSheetExtProc().