Author: weiden
Date: Sat Sep 22 22:48:02 2007
New Revision: 29146
URL:
http://svn.reactos.org/svn/reactos?rev=29146&view=rev
Log:
- Don't change the current power scheme when displaying the dialog
- Load additional pages provided by shell extensions
Modified:
trunk/reactos/dll/cpl/powercfg/powercfg.c
trunk/reactos/dll/cpl/powercfg/powercfg.h
trunk/reactos/dll/cpl/powercfg/powercfg.rbuild
trunk/reactos/dll/cpl/powercfg/powershemes.c
Modified: trunk/reactos/dll/cpl/powercfg/powercfg.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/powercfg/powercfg.…
==============================================================================
--- trunk/reactos/dll/cpl/powercfg/powercfg.c (original)
+++ trunk/reactos/dll/cpl/powercfg/powercfg.c Sat Sep 22 22:48:02 2007
@@ -11,6 +11,8 @@
#include <windows.h>
#include <commctrl.h>
+#include <shlobj.h>
+#include <regstr.h>
#include <cpl.h>
#include "resource.h"
@@ -79,15 +81,30 @@
return TRUE;
}
+static BOOL CALLBACK
+PropSheetAddPage(HPROPSHEETPAGE hpage, LPARAM lParam)
+{
+ PROPSHEETHEADER *ppsh = (PROPSHEETHEADER *)lParam;
+ if (ppsh != NULL && ppsh->nPages < MAX_POWER_PAGES)
+ {
+ ppsh->phpage[ppsh->nPages++] = hpage;
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
/* First Applet */
static LONG APIENTRY
Applet1(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam)
{
- PROPSHEETPAGE psp[5];
+ PROPSHEETPAGE psp[MAX_POWER_PAGES];
PROPSHEETHEADER psh;
+ HPSXA hpsxa = NULL;
TCHAR Caption[1024];
SYSTEM_POWER_CAPABILITIES spc;
INT i=0;
+ LONG ret;
UNREFERENCED_PARAMETER(hwnd);
UNREFERENCED_PARAMETER(uMsg);
@@ -120,8 +137,18 @@
}
InitPropSheetPage(&psp[i++], IDD_PROPPAGEADVANCED, (DLGPROC) advancedProc);
InitPropSheetPage(&psp[i++], IDD_PROPPAGEHIBERNATE, (DLGPROC) hibernateProc);
-
- return (LONG)(PropertySheet(&psh) != -1);
+
+ /* Load additional pages provided by shell extensions */
+ hpsxa = SHCreatePropSheetExtArray(HKEY_LOCAL_MACHINE, REGSTR_PATH_CONTROLSFOLDER
TEXT("\\Power"), MAX_POWER_PAGES - psh.nPages);
+ if (hpsxa != NULL)
+ SHAddFromPropSheetExtArray(hpsxa, PropSheetAddPage, (LPARAM)&psh);
+
+ ret = (LONG)(PropertySheet(&psh) != -1);
+
+ if (hpsxa != NULL)
+ SHDestroyPropSheetExtArray(hpsxa);
+
+ return ret;
}
/* Control Panel Callback */
Modified: trunk/reactos/dll/cpl/powercfg/powercfg.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/powercfg/powercfg.…
==============================================================================
--- trunk/reactos/dll/cpl/powercfg/powercfg.h (original)
+++ trunk/reactos/dll/cpl/powercfg/powercfg.h Sat Sep 22 22:48:02 2007
@@ -16,6 +16,8 @@
extern POWER_POLICY gPP[];
extern UINT guiIndex;
+#define MAX_POWER_PAGES 32
+
#endif /* __CPL_SAMPLE_H */
/* EOF */
Modified: trunk/reactos/dll/cpl/powercfg/powercfg.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/powercfg/powercfg.…
==============================================================================
--- trunk/reactos/dll/cpl/powercfg/powercfg.rbuild (original)
+++ trunk/reactos/dll/cpl/powercfg/powercfg.rbuild Sat Sep 22 22:48:02 2007
@@ -12,6 +12,7 @@
<library>user32</library>
<library>powrprof</library>
<library>comctl32</library>
+ <library>shell32</library>
<library>msvcrt</library>
<file>powercfg.c</file>
<file>powershemes.c</file>
Modified: trunk/reactos/dll/cpl/powercfg/powershemes.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/powercfg/powershem…
==============================================================================
--- trunk/reactos/dll/cpl/powercfg/powershemes.c (original)
+++ trunk/reactos/dll/cpl/powercfg/powershemes.c Sat Sep 22 22:48:02 2007
@@ -287,9 +287,11 @@
if (!ValidatePowerPolicies(&gGPP,0))
return FALSE;
+/*
if (!SetActivePwrScheme(aps,&gGPP,&pp))
return FALSE;
-
+*/
+
if (!GetPwrCapabilities(&spc))
return FALSE;