2 * PROJECT: ReactOS Shell Extensions
3 * LICENSE: LGPL - See COPYING in the top level directory
4 * FILE: dll\win32\shellext\devcpux\processor.c
6 * COPYRIGHT: Copyright 2007 Christoph von Wittich <Christoph_vW@ReactOS.org>
16 HINSTANCE g_hInstance
= NULL
;
17 INT_PTR CALLBACK
ProcessorDlgProc (HWND hDlg
, UINT uMessage
, WPARAM wParam
, LPARAM lParam
);
21 DllMain (HANDLE hInstance
, DWORD dwReason
, LPVOID lpReserved
)
25 case DLL_THREAD_ATTACH
:
26 case DLL_THREAD_DETACH
:
27 case DLL_PROCESS_ATTACH
:
28 case DLL_PROCESS_DETACH
:
32 g_hInstance
= (HINSTANCE
) hInstance
;
39 PropSheetExtProc(PSP_PROPSHEETPAGE_REQUEST PropPageRequest
, LPFNADDPROPSHEETPAGE fAddFunc
, LPARAM lParam
)
41 PROPSHEETPAGE PropSheetPage
;
42 HPROPSHEETPAGE hPropSheetPage
;
44 if(PropPageRequest
->PageRequested
!= SPPSR_ENUM_ADV_DEVICE_PROPERTIES
)
47 if ((!PropPageRequest
->DeviceInfoSet
) || (!PropPageRequest
->DeviceInfoData
))
50 ZeroMemory(&PropSheetPage
, sizeof(PROPSHEETPAGE
));
51 PropSheetPage
.dwSize
= sizeof(PROPSHEETPAGE
);
52 PropSheetPage
.hInstance
= g_hInstance
;
53 PropSheetPage
.pszTemplate
= MAKEINTRESOURCE(DLG_PROCESSORINFO
);
54 PropSheetPage
.pfnDlgProc
= ProcessorDlgProc
;
56 hPropSheetPage
= CreatePropertySheetPage(&PropSheetPage
);
60 if(!(fAddFunc
)(hPropSheetPage
, lParam
)) {
61 DestroyPropertySheetPage (hPropSheetPage
);
69 AddFeature(WCHAR
* szFeatures
, WCHAR
* Feature
, BOOL
* bFirst
)
72 wcscat(szFeatures
, L
", ");
74 wcscat(szFeatures
, Feature
);
79 ProcessorDlgProc (HWND hDlg
, UINT uMessage
, WPARAM wParam
, LPARAM lParam
)
84 WCHAR szFeatures
[MAX_PATH
] = L
"";
87 WCHAR szCurrentMhz
[10];
89 SYSTEM_INFO SystemInfo
;
90 PROCESSOR_POWER_INFORMATION PowerInfo
;
92 if (IsProcessorFeaturePresent(PF_MMX_INSTRUCTIONS_AVAILABLE
))
93 AddFeature(szFeatures
, L
"MMX", &bFirst
);
94 if (IsProcessorFeaturePresent(PF_XMMI_INSTRUCTIONS_AVAILABLE
))
95 AddFeature(szFeatures
, L
"SSE", &bFirst
);
96 if (IsProcessorFeaturePresent(PF_XMMI64_INSTRUCTIONS_AVAILABLE
))
97 AddFeature(szFeatures
, L
"SSE2", &bFirst
);
98 /*if (IsProcessorFeaturePresent(PF_SSE3_INSTRUCTIONS_AVAILABLE))
99 AddFeature(szFeatures, L"SSE3", &bFirst); */
100 if (IsProcessorFeaturePresent(PF_3DNOW_INSTRUCTIONS_AVAILABLE
))
101 AddFeature(szFeatures
, L
"3DNOW", &bFirst
);
103 SetDlgItemTextW(hDlg
, IDC_FEATURES
, szFeatures
);
105 GetSystemInfo(&SystemInfo
);
107 wsprintf(szModel
, L
"%x", HIBYTE(SystemInfo
.wProcessorRevision
));
108 wsprintf(szStepping
, L
"%d", LOBYTE(SystemInfo
.wProcessorRevision
));
110 SetDlgItemTextW(hDlg
, IDC_MODEL
, szModel
);
111 SetDlgItemTextW(hDlg
, IDC_STEPPING
, szStepping
);
113 CallNtPowerInformation(11, NULL
, 0, &PowerInfo
, sizeof(PowerInfo
));
114 wsprintf(szCurrentMhz
, L
"%ld %s", PowerInfo
.CurrentMhz
, L
"MHz");
115 SetDlgItemTextW(hDlg
, IDC_CORESPEED
, szCurrentMhz
);