ReactOS  0.4.15-dev-1070-ge1a01de
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 }
STRSAFEAPI StringCbCatW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:342
#define FALSE
Definition: types.h:117
static const WCHAR L[]
Definition: oid.c:1250

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  {
33  case DLL_THREAD_ATTACH:
34  case DLL_THREAD_DETACH:
35  case DLL_PROCESS_ATTACH:
36  case DLL_PROCESS_DETACH:
37  break;
38  }
39 
41  return TRUE;
42 }
HINSTANCE g_hInstance
Definition: processor.c:24
#define TRUE
Definition: types.h:120
#define DLL_THREAD_ATTACH
Definition: compat.h:132
#define DLL_PROCESS_ATTACH
Definition: compat.h:131
#define DLL_THREAD_DETACH
Definition: compat.h:133
DWORD dwReason
Definition: misc.cpp:154
HINSTANCE hInstance
Definition: charmap.c:20
#define DLL_PROCESS_DETACH
Definition: compat.h:130
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 }
HINSTANCE g_hInstance
Definition: processor.c:24
#define IDC_STEPPING
Definition: resource.h:7
#define IDC_CORESPEED
Definition: resource.h:8
#define LOBYTE(W)
Definition: jmemdos.c:487
#define IDC_FEATURES
Definition: resource.h:5
#define TRUE
Definition: types.h:120
#define IDS_MEGAHERTZ
Definition: resource.h:61
#define HIBYTE(W)
Definition: jmemdos.c:486
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
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)
WORD wProcessorRevision
Definition: winbase.h:1147
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
NTSTATUS WINAPI CallNtPowerInformation(POWER_INFORMATION_LEVEL InformationLevel, PVOID lpInputBuffer, ULONG nInputBufferSize, PVOID lpOutputBuffer, ULONG nOutputBufferSize)
Definition: powrprof.c:59
#define PF_XMMI_INSTRUCTIONS_AVAILABLE
smooth NULL
Definition: ftsmooth.c:416
STRSAFEAPI StringCbPrintfW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:557
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
static const WCHAR L[]
Definition: oid.c:1250
BOOL WINAPI IsProcessorFeaturePresent(IN DWORD ProcessorFeature)
Definition: sysinfo.c:168
VOID WINAPI GetSystemInfo(IN LPSYSTEM_INFO lpSystemInfo)
Definition: sysinfo.c:142
void AddFeature(WCHAR *szFeatures, size_t cbDest, WCHAR *Feature, BOOL *bFirst)
Definition: processor.c:77
#define PF_XMMI64_INSTRUCTIONS_AVAILABLE
STRSAFEAPI StringCbCopyW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:166
#define PF_3DNOW_INSTRUCTIONS_AVAILABLE
#define WM_INITDIALOG
Definition: winuser.h:1721
#define IDC_MODEL
Definition: resource.h:6
#define PF_MMX_INSTRUCTIONS_AVAILABLE

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 
52  if(PropPageRequest->PageRequested != SPPSR_ENUM_ADV_DEVICE_PROPERTIES)
53  return FALSE;
54 
55  if ((!PropPageRequest->DeviceInfoSet) || (!PropPageRequest->DeviceInfoData))
56  return FALSE;
57 
59  PropSheetPage.dwSize = sizeof(PROPSHEETPAGE);
60  PropSheetPage.hInstance = g_hInstance;
62  PropSheetPage.pfnDlgProc = ProcessorDlgProc;
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 }
HINSTANCE g_hInstance
Definition: processor.c:24
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define TRUE
Definition: types.h:120
BOOL WINAPI DestroyPropertySheetPage(HPROPSHEETPAGE hPropPage)
Definition: propsheet.c:3144
#define DLG_PROCESSORINFO
Definition: resource.h:3
#define ZeroMemory
Definition: winbase.h:1648
PSP_DEVINFO_DATA DeviceInfoData
Definition: setupapi.h:1099
#define FALSE
Definition: types.h:117
struct _PSP * HPROPSHEETPAGE
Definition: mstask.idl:90
INT_PTR CALLBACK ProcessorDlgProc(HWND hDlg, UINT uMessage, WPARAM wParam, LPARAM lParam)
Definition: processor.c:87
#define CreatePropertySheetPage
Definition: prsht.h:399
#define SPPSR_ENUM_ADV_DEVICE_PROPERTIES
Definition: setupapi.h:610
LPARAM lParam
Definition: combotst.c:139
#define PROPSHEETPAGE
Definition: prsht.h:389

Variable Documentation

◆ g_hInstance

HINSTANCE g_hInstance = NULL

Definition at line 24 of file processor.c.

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