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>
10 #define WIN32_NO_STATUS
12 #define COM_NO_WINDOWS_H
23 HINSTANCE g_hInstance
= NULL
;
24 INT_PTR CALLBACK
ProcessorDlgProc (HWND hDlg
, UINT uMessage
, WPARAM wParam
, LPARAM lParam
);
28 DllMain (HANDLE hInstance
, DWORD dwReason
, LPVOID lpReserved
)
32 case DLL_THREAD_ATTACH
:
33 case DLL_THREAD_DETACH
:
34 case DLL_PROCESS_ATTACH
:
35 case DLL_PROCESS_DETACH
:
39 g_hInstance
= (HINSTANCE
) hInstance
;
46 PropSheetExtProc(PSP_PROPSHEETPAGE_REQUEST PropPageRequest
, LPFNADDPROPSHEETPAGE fAddFunc
, LPARAM lParam
)
48 PROPSHEETPAGE PropSheetPage
;
49 HPROPSHEETPAGE hPropSheetPage
;
51 if(PropPageRequest
->PageRequested
!= SPPSR_ENUM_ADV_DEVICE_PROPERTIES
)
54 if ((!PropPageRequest
->DeviceInfoSet
) || (!PropPageRequest
->DeviceInfoData
))
57 ZeroMemory(&PropSheetPage
, sizeof(PROPSHEETPAGE
));
58 PropSheetPage
.dwSize
= sizeof(PROPSHEETPAGE
);
59 PropSheetPage
.hInstance
= g_hInstance
;
60 PropSheetPage
.pszTemplate
= MAKEINTRESOURCE(DLG_PROCESSORINFO
);
61 PropSheetPage
.pfnDlgProc
= ProcessorDlgProc
;
63 hPropSheetPage
= CreatePropertySheetPage(&PropSheetPage
);
67 if(!(fAddFunc
)(hPropSheetPage
, lParam
)) {
68 DestroyPropertySheetPage (hPropSheetPage
);
76 AddFeature(WCHAR
* szFeatures
, WCHAR
* Feature
, BOOL
* bFirst
)
79 wcscat(szFeatures
, L
", ");
81 wcscat(szFeatures
, Feature
);
86 ProcessorDlgProc (HWND hDlg
, UINT uMessage
, WPARAM wParam
, LPARAM lParam
)
91 WCHAR szFeatures
[MAX_PATH
] = L
"";
94 WCHAR szCurrentMhz
[10];
96 SYSTEM_INFO SystemInfo
;
97 PROCESSOR_POWER_INFORMATION PowerInfo
;
99 if (IsProcessorFeaturePresent(PF_MMX_INSTRUCTIONS_AVAILABLE
))
100 AddFeature(szFeatures
, L
"MMX", &bFirst
);
101 if (IsProcessorFeaturePresent(PF_XMMI_INSTRUCTIONS_AVAILABLE
))
102 AddFeature(szFeatures
, L
"SSE", &bFirst
);
103 if (IsProcessorFeaturePresent(PF_XMMI64_INSTRUCTIONS_AVAILABLE
))
104 AddFeature(szFeatures
, L
"SSE2", &bFirst
);
105 /*if (IsProcessorFeaturePresent(PF_SSE3_INSTRUCTIONS_AVAILABLE))
106 AddFeature(szFeatures, L"SSE3", &bFirst); */
107 if (IsProcessorFeaturePresent(PF_3DNOW_INSTRUCTIONS_AVAILABLE
))
108 AddFeature(szFeatures
, L
"3DNOW", &bFirst
);
110 SetDlgItemTextW(hDlg
, IDC_FEATURES
, szFeatures
);
112 GetSystemInfo(&SystemInfo
);
114 wsprintf(szModel
, L
"%x", HIBYTE(SystemInfo
.wProcessorRevision
));
115 wsprintf(szStepping
, L
"%d", LOBYTE(SystemInfo
.wProcessorRevision
));
117 SetDlgItemTextW(hDlg
, IDC_MODEL
, szModel
);
118 SetDlgItemTextW(hDlg
, IDC_STEPPING
, szStepping
);
120 CallNtPowerInformation(11, NULL
, 0, &PowerInfo
, sizeof(PowerInfo
));
121 wsprintf(szCurrentMhz
, L
"%ld %s", PowerInfo
.CurrentMhz
, L
"MHz");
122 SetDlgItemTextW(hDlg
, IDC_CORESPEED
, szCurrentMhz
);