Author: cwittich
Date: Thu Sep 27 21:04:44 2007
New Revision: 29249
URL:
http://svn.reactos.org/svn/reactos?rev=29249&view=rev
Log:
add shell extension for displaying processor information in device manager
Added:
trunk/reactos/dll/win32/shellext/devcpux/
trunk/reactos/dll/win32/shellext/devcpux/devcpux.def (with props)
trunk/reactos/dll/win32/shellext/devcpux/devcpux.rbuild (with props)
trunk/reactos/dll/win32/shellext/devcpux/processor.c (with props)
trunk/reactos/dll/win32/shellext/devcpux/processor.rc (with props)
trunk/reactos/dll/win32/shellext/devcpux/resource.h (with props)
Modified:
trunk/reactos/dll/win32/shellext/shellext.rbuild
Added: trunk/reactos/dll/win32/shellext/devcpux/devcpux.def
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shellext/devcpux…
==============================================================================
--- trunk/reactos/dll/win32/shellext/devcpux/devcpux.def (added)
+++ trunk/reactos/dll/win32/shellext/devcpux/devcpux.def Thu Sep 27 21:04:44 2007
@@ -1,0 +1,7 @@
+LIBRARY devcpux.dll
+
+EXPORTS
+
+PropSheetExtProc@12
+
+; EOF
Propchange: trunk/reactos/dll/win32/shellext/devcpux/devcpux.def
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/reactos/dll/win32/shellext/devcpux/devcpux.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shellext/devcpux…
==============================================================================
--- trunk/reactos/dll/win32/shellext/devcpux/devcpux.rbuild (added)
+++ trunk/reactos/dll/win32/shellext/devcpux/devcpux.rbuild Thu Sep 27 21:04:44 2007
@@ -1,0 +1,19 @@
+<module name="devcpux" type="win32dll"
installbase="system32" installname="devcpux.dll">
+ <importlibrary definition="devcpux.def" />
+ <include base="devcpux">.</include>
+ <include base="ReactOS">include/reactos/wine</include>
+ <define name="UNICODE" />
+ <define name="_UNICODE" />
+ <define name="__REACTOS__" />
+ <define name="__USE_W32API" />
+ <define name="_WIN32_IE">0x600</define>
+ <define name="_WIN32_WINNT">0x501</define>
+ <define name="WINVER">0x501</define>
+ <library>kernel32</library>
+ <library>user32</library>
+ <library>ntdll</library>
+ <library>powrprof</library>
+ <library>comctl32</library>
+ <file>processor.c</file>
+ <file>processor.rc</file>
+</module>
Propchange: trunk/reactos/dll/win32/shellext/devcpux/devcpux.rbuild
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/reactos/dll/win32/shellext/devcpux/processor.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shellext/devcpux…
==============================================================================
--- trunk/reactos/dll/win32/shellext/devcpux/processor.c (added)
+++ trunk/reactos/dll/win32/shellext/devcpux/processor.c Thu Sep 27 21:04:44 2007
@@ -1,0 +1,121 @@
+/*
+ * PROJECT: ReactOS Shell Extensions
+ * LICENSE: LGPL - See COPYING in the top level directory
+ * FILE: dll\win32\shellext\devcpux\processor.c
+ * PURPOSE:
+ * COPYRIGHT: Copyright 2007 Christoph von Wittich <Christoph_vW(a)ReactOS.org>
+ *
+ */
+
+#include <windows.h>
+#include <setupapi.h>
+#include <powrprof.h>
+
+#include "resource.h"
+
+HINSTANCE g_hInstance = NULL;
+int APIENTRY ProcessorDlgProc (HWND hDlg, UINT uMessage, WPARAM wParam, LPARAM lParam);
+
+BOOL
+APIENTRY
+DllMain (HANDLE hInstance, DWORD dwReason, LPVOID lpReserved)
+{
+ switch (dwReason)
+ {
+ case DLL_THREAD_ATTACH:
+ case DLL_THREAD_DETACH:
+ case DLL_PROCESS_ATTACH:
+ case DLL_PROCESS_DETACH:
+ break;
+ }
+
+ g_hInstance = (HINSTANCE) hInstance;
+ return TRUE;
+}
+
+
+BOOL
+APIENTRY
+PropSheetExtProc(PSP_PROPSHEETPAGE_REQUEST PropPageRequest, LPFNADDPROPSHEETPAGE
fAddFunc, LPARAM lParam)
+{
+ PROPSHEETPAGE PropSheetPage;
+ HPROPSHEETPAGE hPropSheetPage;
+
+ if(PropPageRequest->PageRequested != SPPSR_ENUM_ADV_DEVICE_PROPERTIES)
+ return FALSE;
+
+ if ((!PropPageRequest->DeviceInfoSet) || (!PropPageRequest->DeviceInfoData))
+ return FALSE;
+
+ ZeroMemory(&PropSheetPage, sizeof(PROPSHEETPAGE));
+ PropSheetPage.dwSize = sizeof(PROPSHEETPAGE);
+ PropSheetPage.hInstance = g_hInstance;
+ PropSheetPage.pszTemplate = MAKEINTRESOURCE(DLG_PROCESSORINFO);
+ PropSheetPage.pfnDlgProc = ProcessorDlgProc;
+
+ hPropSheetPage = CreatePropertySheetPage(&PropSheetPage);
+ if(hPropSheetPage)
+ return FALSE;
+
+ if(!(*fAddFunc)(hPropSheetPage, lParam)) {
+ DestroyPropertySheetPage (hPropSheetPage);
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+void
+AddFeature(WCHAR* szFeatures, WCHAR* Feature, BOOL* bFirst)
+{
+ if (!*bFirst)
+ wcscat(szFeatures, L", ");
+ *bFirst = FALSE;
+ wcscat(szFeatures, Feature);
+}
+
+int
+APIENTRY
+ProcessorDlgProc (HWND hDlg, UINT uMessage, WPARAM wParam, LPARAM lParam)
+{
+ switch (uMessage) {
+ case WM_INITDIALOG:
+ {
+ WCHAR szFeatures[MAX_PATH] = L"";
+ WCHAR szModel[3];
+ WCHAR szStepping[3];
+ WCHAR szCurrentMhz[10];
+ BOOL bFirst = TRUE;
+ SYSTEM_INFO SystemInfo;
+ PROCESSOR_POWER_INFORMATION PowerInfo;
+
+ if (IsProcessorFeaturePresent(PF_MMX_INSTRUCTIONS_AVAILABLE))
+ AddFeature(szFeatures, L"MMX", &bFirst);
+ if (IsProcessorFeaturePresent(PF_XMMI_INSTRUCTIONS_AVAILABLE))
+ AddFeature(szFeatures, L"SSE", &bFirst);
+ if (IsProcessorFeaturePresent(PF_XMMI64_INSTRUCTIONS_AVAILABLE))
+ AddFeature(szFeatures, L"SSE2", &bFirst);
+ /*if (IsProcessorFeaturePresent(PF_SSE3_INSTRUCTIONS_AVAILABLE))
+ AddFeature(szFeatures, L"SSE3", &bFirst); */
+ if (IsProcessorFeaturePresent(PF_3DNOW_INSTRUCTIONS_AVAILABLE))
+ AddFeature(szFeatures, L"3DNOW", &bFirst);
+
+ SetDlgItemTextW(hDlg, IDC_FEATURES, szFeatures);
+
+ GetSystemInfo(&SystemInfo);
+
+ wsprintf(szModel, L"%x", HIBYTE(SystemInfo.wProcessorRevision));
+ wsprintf(szStepping, L"%d", LOBYTE(SystemInfo.wProcessorRevision));
+
+ SetDlgItemTextW(hDlg, IDC_MODEL, szModel);
+ SetDlgItemTextW(hDlg, IDC_STEPPING, szStepping);
+
+ CallNtPowerInformation(11, NULL, 0, &PowerInfo, sizeof(PowerInfo));
+ wsprintf(szCurrentMhz, L"%ld %s", PowerInfo.CurrentMhz, L"MHz");
+ SetDlgItemTextW(hDlg, IDC_CORESPEED, szCurrentMhz);
+
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
Propchange: trunk/reactos/dll/win32/shellext/devcpux/processor.c
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/reactos/dll/win32/shellext/devcpux/processor.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shellext/devcpux…
==============================================================================
--- trunk/reactos/dll/win32/shellext/devcpux/processor.rc (added)
+++ trunk/reactos/dll/win32/shellext/devcpux/processor.rc Thu Sep 27 21:04:44 2007
@@ -1,0 +1,31 @@
+#include <windows.h>
+#include "resource.h"
+
+#define REACTOS_VERSION_DLL
+#define REACTOS_STR_FILE_DESCRIPTION "ReactOS Processor Shell Extension\0"
+#define REACTOS_STR_INTERNAL_NAME "processorext\0"
+#define REACTOS_STR_ORIGINAL_FILENAME "processorext.dll\0"
+#include <reactos/version.rc>
+
+
+DLG_PROCESSORINFO DIALOG DISCARDABLE 0, 0, 200, 220
+STYLE WS_POPUP | WS_POPUP | WS_CAPTION | WS_SYSMENU |
+ WS_THICKFRAME
+CAPTION "CPU"
+FONT 8, "MS Shell Dlg"
+BEGIN
+ LTEXT "Features:",-1,5,23,50,51
+ LTEXT "Test",IDC_FEATURES,50,23,80,51
+
+ LTEXT "Model:",-1,5,33,50,51
+ LTEXT "test",IDC_MODEL,50,33,80,51
+
+ LTEXT "Stepping:",-1,5,43,50,51
+ LTEXT "test",IDC_STEPPING,50,43,80,51
+
+
+ LTEXT "Core Speed:",-1,5,53,50,51
+ LTEXT "test",IDC_CORESPEED,50,53,80,51
+
+
+END
Propchange: trunk/reactos/dll/win32/shellext/devcpux/processor.rc
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/reactos/dll/win32/shellext/devcpux/resource.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shellext/devcpux…
==============================================================================
--- trunk/reactos/dll/win32/shellext/devcpux/resource.h (added)
+++ trunk/reactos/dll/win32/shellext/devcpux/resource.h Thu Sep 27 21:04:44 2007
@@ -1,0 +1,6 @@
+#define DLG_PROCESSORINFO 201
+
+#define IDC_FEATURES 301
+#define IDC_MODEL 302
+#define IDC_STEPPING 303
+#define IDC_CORESPEED 304
Propchange: trunk/reactos/dll/win32/shellext/devcpux/resource.h
------------------------------------------------------------------------------
svn:eol-style = native
Modified: trunk/reactos/dll/win32/shellext/shellext.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shellext/shellex…
==============================================================================
--- trunk/reactos/dll/win32/shellext/shellext.rbuild (original)
+++ trunk/reactos/dll/win32/shellext/shellext.rbuild Thu Sep 27 21:04:44 2007
@@ -10,4 +10,7 @@
<directory name="deskmon">
<xi:include href="deskmon/deskmon.rbuild" />
</directory>
+ <directory name="devcpux">
+ <xi:include href="devcpux/devcpux.rbuild" />
+ </directory>
</group>