Author: hbelusca
Date: Sat Oct 31 21:00:32 2015
New Revision: 69761
URL:
http://svn.reactos.org/svn/reactos?rev=69761&view=rev
Log:
[MSCONFIG_NEW]
- Reimplement the SYSTEM.INI/WIN.INI tabs (they should be seen as 2 different instances of
the same window; this would be cleaner to do in C++) with all the expected functionality
working.
- Add TreeView helpers for moving/deleting branches.
- Add TreeView helpers for 3-state checkboxes, with support for Windows 2k3 and Vista+
with and without manifest, depending on the comctl32.dll version used by msconfig at
runtime. In particular, take advantage of the TVS_EX_PARTIALCHECKBOXES extended style
introduced on Windows Vista+.
- Just initialize once the uxtheme function pointers.
- Create the msconfig dialog box hidden and center it on screen before showing it (removes
the flickering caused by the quick move).
- Use the correct 16x16 icon for the dialog title icon, adapted from a patch by Jared
Smudde with suggestions by Ismael Ferreras Morezuelas.
CORE-9333
Added:
trunk/reactos/base/applications/msconfig_new/comctl32ex/comctl32supp.c (with props)
trunk/reactos/base/applications/msconfig_new/comctl32ex/comctl32supp.h
- copied, changed from r69759,
trunk/reactos/base/applications/msconfig_new/comctl32ex/commctrldefs.h
trunk/reactos/base/applications/msconfig_new/comctl32ex/listview.c
- copied, changed from r69759,
trunk/reactos/base/applications/msconfig_new/comctl32ex/listviewfuncs.c
trunk/reactos/base/applications/msconfig_new/comctl32ex/listview.h
- copied, changed from r69759,
trunk/reactos/base/applications/msconfig_new/comctl32ex/listviewfuncs.h
trunk/reactos/base/applications/msconfig_new/comctl32ex/treeview.c (with props)
trunk/reactos/base/applications/msconfig_new/comctl32ex/treeview.h (with props)
trunk/reactos/base/applications/msconfig_new/res/2k3check.bmp (with props)
trunk/reactos/base/applications/msconfig_new/res/v7check.bmp (with props)
trunk/reactos/base/applications/msconfig_new/systempage.cpp (with props)
Removed:
trunk/reactos/base/applications/msconfig_new/comctl32ex/commctrldefs.h
trunk/reactos/base/applications/msconfig_new/comctl32ex/listviewfuncs.c
trunk/reactos/base/applications/msconfig_new/comctl32ex/listviewfuncs.h
Modified:
trunk/reactos/base/applications/msconfig_new/CMakeLists.txt
trunk/reactos/base/applications/msconfig_new/comctl32ex/uxthemesupp.c
trunk/reactos/base/applications/msconfig_new/fileextractdialog.c
trunk/reactos/base/applications/msconfig_new/freeldrpage.c
trunk/reactos/base/applications/msconfig_new/generalpage.c
trunk/reactos/base/applications/msconfig_new/msconfig.c
trunk/reactos/base/applications/msconfig_new/msconfig.rc
trunk/reactos/base/applications/msconfig_new/resource.h
trunk/reactos/base/applications/msconfig_new/srvpage.cpp
trunk/reactos/base/applications/msconfig_new/systempage.h
trunk/reactos/base/applications/msconfig_new/toolspage.cpp
Modified: trunk/reactos/base/applications/msconfig_new/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/msconfig…
==============================================================================
--- trunk/reactos/base/applications/msconfig_new/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/reactos/base/applications/msconfig_new/CMakeLists.txt [iso-8859-1] Sat Oct 31
21:00:32 2015
@@ -10,7 +10,9 @@
${REACTOS_SOURCE_DIR}/lib/atl)
list(APPEND C_SOURCE
- comctl32ex/listviewfuncs.c
+ comctl32ex/comctl32supp.c
+ comctl32ex/listview.c
+ comctl32ex/treeview.c
comctl32ex/uxthemesupp.c
fileextractdialog.c
fileutils.c
@@ -18,12 +20,12 @@
generalpage.c
msconfig.c
regutils.c
- # systempage.c
# startuppage.c
stringutils.c
utils.c)
list(APPEND CPP_SOURCE
+ systempage.cpp
srvpage.cpp
toolspage.cpp
xmldomparser.cpp
Added: trunk/reactos/base/applications/msconfig_new/comctl32ex/comctl32supp.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/msconfig…
==============================================================================
--- trunk/reactos/base/applications/msconfig_new/comctl32ex/comctl32supp.c (added)
+++ trunk/reactos/base/applications/msconfig_new/comctl32ex/comctl32supp.c [iso-8859-1]
Sat Oct 31 21:00:32 2015
@@ -0,0 +1,76 @@
+/*
+ * PROJECT: ReactOS Applications
+ * LICENSE: LGPL - See COPYING in the top level directory
+ * FILE: base/applications/msconfig_new/comctl32ex/comctl32supp.c
+ * PURPOSE: Common Controls helper functions.
+ * COPYRIGHT: Copyright 2011-2012 Hermes BELUSCA - MAITO <hermes.belusca(a)sfr.fr>
+ */
+
+#include "precomp.h"
+
+HRESULT GetComCtl32Version(OUT PDWORD pdwMajor, OUT PDWORD pdwMinor, OUT PDWORD
pdwBuild)
+{
+ HRESULT hr = S_OK;
+ HINSTANCE hDll;
+ DLLGETVERSIONPROC pDllGetVersion;
+ DLLVERSIONINFO dvi;
+
+ *pdwMajor = 0;
+ *pdwMinor = 0;
+ *pdwBuild = 0;
+
+ /*
+ * WARNING! DISCLAIMER!
+ *
+ * This method of retrieving a handle to an already loaded comctl32.dll
+ * is known to not be reliable in case the program is using SxS, or if
+ * this code is used from inside a DLL.
+ */
+
+ /*
+ * See:
https://msdn.microsoft.com/en-us/library/windows/desktop/hh298349(v=vs.85).…
+ * and:
http://www.geoffchappell.com/studies/windows/shell/comctl32/history/
+ * for the possible version values to be returned.
+ */
+
+ /* Get a handle to comctl32.dll that must already be loaded */
+ hDll = GetModuleHandleW(L"comctl32.dll"); // NOTE: We must not call
FreeLibrary on the returned handle!
+ if (!hDll) return E_FAIL;
+
+ pDllGetVersion = (DLLGETVERSIONPROC)GetProcAddress(hDll, "DllGetVersion");
+ if (pDllGetVersion)
+ {
+ ZeroMemory(&dvi, sizeof(dvi));
+ dvi.cbSize = sizeof(dvi);
+
+ hr = (*pDllGetVersion)(&dvi);
+ if (SUCCEEDED(hr))
+ {
+ *pdwMajor = dvi.dwMajorVersion;
+ *pdwMinor = dvi.dwMinorVersion;
+ *pdwBuild = dvi.dwBuildNumber;
+
+#if 0
+// #include "stringutils.h"
+
+ LPWSTR strVersion =
+ FormatString(L"ComCtl32 version %d.%d, Build %d, Platform %d",
+ dvi.dwMajorVersion, dvi.dwMinorVersion, dvi.dwBuildNumber,
dvi.dwPlatformID);
+ MessageBoxW(NULL, strVersion, L"ComCtl32 version", MB_OK);
+ MemFree(strVersion);
+#endif
+ }
+ }
+ else
+ {
+ /*
+ * If GetProcAddress failed, the DLL is a version
+ * previous to the one shipped with IE 3.x.
+ */
+ *pdwMajor = 4;
+ *pdwMinor = 0;
+ *pdwBuild = 0;
+ }
+
+ return hr;
+}
Propchange: trunk/reactos/base/applications/msconfig_new/comctl32ex/comctl32supp.c
------------------------------------------------------------------------------
svn:eol-style = native
Copied: trunk/reactos/base/applications/msconfig_new/comctl32ex/comctl32supp.h (from
r69759, trunk/reactos/base/applications/msconfig_new/comctl32ex/commctrldefs.h)
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/msconfig…
==============================================================================
--- trunk/reactos/base/applications/msconfig_new/comctl32ex/commctrldefs.h [iso-8859-1]
(original)
+++ trunk/reactos/base/applications/msconfig_new/comctl32ex/comctl32supp.h [iso-8859-1]
Sat Oct 31 21:00:32 2015
@@ -1,13 +1,13 @@
/*
* PROJECT: ReactOS Applications
* LICENSE: LGPL - See COPYING in the top level directory
- * FILE: base/applications/msconfig_new/comctl32ex/commctrldefs.h
+ * FILE: base/applications/msconfig_new/comctl32ex/comctl32supp.h
* PURPOSE: Common Controls helper functions.
* COPYRIGHT: Copyright 2011-2012 Hermes BELUSCA - MAITO <hermes.belusca(a)sfr.fr>
*/
-#ifndef __COMMCTRLDEFS_H__
-#define __COMMCTRLDEFS_H__
+#ifndef __COMCTL32SUPP_H__
+#define __COMCTL32SUPP_H__
#include <windowsx.h>
/*
@@ -15,6 +15,25 @@
#define GET_Y_LPARAM(lp) ((int)(short)HIWORD(lp))
*/
+#define Button_IsEnabled(hwndCtl) IsWindowEnabled((hwndCtl))
+
#define UM_CHECKSTATECHANGE (WM_USER + 100)
-#endif // __COMMCTRLDEFS_H__
+#if 0
+// this typedef, present in newer include files,
+// supports the building tokenmon on older systems
+typedef struct _DLLVERSIONINFO
+{
+ DWORD cbSize;
+ DWORD dwMajorVersion;
+ DWORD dwMinorVersion;
+ DWORD dwBuildNumber;
+ DWORD dwPlatformID;
+} DLLVERSIONINFO, *PDLLVERSIONINFO;
+// Version information function
+typedef HRESULT (WINAPI* DLLGETVERSIONPROC)(PDLLVERSIONINFO);
+#endif
+
+HRESULT GetComCtl32Version(OUT PDWORD pdwMajor, OUT PDWORD pdwMinor, OUT PDWORD
pdwBuild);
+
+#endif // __COMCTL32SUPP_H__
Removed: trunk/reactos/base/applications/msconfig_new/comctl32ex/commctrldefs.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/msconfig…
==============================================================================
--- trunk/reactos/base/applications/msconfig_new/comctl32ex/commctrldefs.h [iso-8859-1]
(original)
+++ trunk/reactos/base/applications/msconfig_new/comctl32ex/commctrldefs.h (removed)
@@ -1,20 +0,0 @@
-/*
- * PROJECT: ReactOS Applications
- * LICENSE: LGPL - See COPYING in the top level directory
- * FILE: base/applications/msconfig_new/comctl32ex/commctrldefs.h
- * PURPOSE: Common Controls helper functions.
- * COPYRIGHT: Copyright 2011-2012 Hermes BELUSCA - MAITO <hermes.belusca(a)sfr.fr>
- */
-
-#ifndef __COMMCTRLDEFS_H__
-#define __COMMCTRLDEFS_H__
-
-#include <windowsx.h>
-/*
-#define GET_X_LPARAM(lp) ((int)(short)LOWORD(lp))
-#define GET_Y_LPARAM(lp) ((int)(short)HIWORD(lp))
-*/
-
-#define UM_CHECKSTATECHANGE (WM_USER + 100)
-
-#endif // __COMMCTRLDEFS_H__
Copied: trunk/reactos/base/applications/msconfig_new/comctl32ex/listview.c (from r69759,
trunk/reactos/base/applications/msconfig_new/comctl32ex/listviewfuncs.c)
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/msconfig…
==============================================================================
--- trunk/reactos/base/applications/msconfig_new/comctl32ex/listviewfuncs.c [iso-8859-1]
(original)
+++ trunk/reactos/base/applications/msconfig_new/comctl32ex/listview.c [iso-8859-1] Sat
Oct 31 21:00:32 2015
@@ -1,13 +1,13 @@
/*
* PROJECT: ReactOS Applications
* LICENSE: LGPL - See COPYING in the top level directory
- * FILE: base/applications/msconfig_new/comctl32ex/listviewfuncs.c
+ * FILE: base/applications/msconfig_new/comctl32ex/listview.c
* PURPOSE: List-View helper functions.
* COPYRIGHT: Copyright 2011-2012 Hermes BELUSCA - MAITO <hermes.belusca(a)sfr.fr>
*/
#include "precomp.h"
-#include "listviewfuncs.h"
+#include "listview.h"
///////////// ListView Sorting /////////////
Copied: trunk/reactos/base/applications/msconfig_new/comctl32ex/listview.h (from r69759,
trunk/reactos/base/applications/msconfig_new/comctl32ex/listviewfuncs.h)
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/msconfig…
==============================================================================
--- trunk/reactos/base/applications/msconfig_new/comctl32ex/listviewfuncs.h [iso-8859-1]
(original)
+++ trunk/reactos/base/applications/msconfig_new/comctl32ex/listview.h [iso-8859-1] Sat
Oct 31 21:00:32 2015
@@ -1,13 +1,13 @@
/*
* PROJECT: ReactOS Applications
* LICENSE: LGPL - See COPYING in the top level directory
- * FILE: base/applications/msconfig_new/comctl32ex/listviewfuncs.h
+ * FILE: base/applications/msconfig_new/comctl32ex/listview.h
* PURPOSE: List-View helper functions.
* COPYRIGHT: Copyright 2011-2012 Hermes BELUSCA - MAITO <hermes.belusca(a)sfr.fr>
*/
-#ifndef __LISTVIEWFUNCS_H__
-#define __LISTVIEWFUNCS_H__
+#ifndef __LISTVIEW_H__
+#define __LISTVIEW_H__
#pragma once
@@ -15,7 +15,7 @@
extern "C" {
#endif
-#include "commctrldefs.h"
+#include "comctl32supp.h"
///////////// ListView Sorting /////////////
@@ -38,6 +38,6 @@
} // extern "C"
#endif
-#endif // __LISTVIEWFUNCS_H__
+#endif // __LISTVIEW_H__
/* EOF */
Removed: trunk/reactos/base/applications/msconfig_new/comctl32ex/listviewfuncs.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/msconfig…
==============================================================================
--- trunk/reactos/base/applications/msconfig_new/comctl32ex/listviewfuncs.c [iso-8859-1]
(original)
+++ trunk/reactos/base/applications/msconfig_new/comctl32ex/listviewfuncs.c (removed)
@@ -1,86 +0,0 @@
-/*
- * PROJECT: ReactOS Applications
- * LICENSE: LGPL - See COPYING in the top level directory
- * FILE: base/applications/msconfig_new/comctl32ex/listviewfuncs.c
- * PURPOSE: List-View helper functions.
- * COPYRIGHT: Copyright 2011-2012 Hermes BELUSCA - MAITO <hermes.belusca(a)sfr.fr>
- */
-
-#include "precomp.h"
-#include "listviewfuncs.h"
-
-///////////// ListView Sorting /////////////
-
-typedef struct __tagSort
-{
- HWND hList;
- int nClickedColumn;
- BOOL bSortAsc;
-} Sort, *PSort;
-
-int CALLBACK
-SortListView(LPARAM lItemParam1,
- LPARAM lItemParam2,
- LPARAM lPSort_S)
-{
- PSort pSort = (PSort)lPSort_S;
-
- int iItem1 = (int)lItemParam1;
- int iItem2 = (int)lItemParam2;
-
- WCHAR strItem1[MAX_VALUE_NAME];
- WCHAR strItem2[MAX_VALUE_NAME];
-
- ListView_GetItemText(pSort->hList, iItem1, pSort->nClickedColumn, strItem1,
MAX_VALUE_NAME);
- ListView_GetItemText(pSort->hList, iItem2, pSort->nClickedColumn, strItem2,
MAX_VALUE_NAME);
-
- // StrCmpLogicalW helps in comparing numbers intelligently, 10 is greater that 2,
other
- // wise string comparison will always return 2 is greater that 10...
- return ( pSort->bSortAsc ? StrCmpLogicalW(strItem1, strItem2) :
StrCmpLogicalW(strItem2, strItem1) );
-}
-
-BOOL
-ListView_SortEx(HWND hListView,
- int iSortingColumn,
- int iSortedColumn)
-{
- HWND hHeader;
- HDITEM hColumn;
- BOOL bSortAsc;
- Sort sort;
-
- if ((GetWindowLongPtr(hListView, GWL_STYLE) & ~LVS_NOSORTHEADER) == 0)
- return TRUE;
-
- hHeader = ListView_GetHeader(hListView);
- SecureZeroMemory(&hColumn, sizeof(hColumn));
-
- if ( (iSortedColumn != -1) && (iSortedColumn != iSortingColumn) )
- {
- hColumn.mask = HDI_FORMAT | HDI_LPARAM;
- Header_GetItem(hHeader, iSortedColumn, &hColumn);
- hColumn.fmt &= ~HDF_SORTUP & ~HDF_SORTDOWN;
- hColumn.lParam = 0; // 0: deactivated, 1: false, 2: true.
- Header_SetItem(hHeader, iSortedColumn, &hColumn);
- }
-
- hColumn.mask = HDI_FORMAT | HDI_LPARAM;
- Header_GetItem(hHeader, iSortingColumn, &hColumn);
-
- bSortAsc = !(hColumn.lParam == 2); // 0: deactivated, 1: false, 2: true.
-
- hColumn.fmt &= (bSortAsc ? ~HDF_SORTDOWN : ~HDF_SORTUP );
- hColumn.fmt |= (bSortAsc ? HDF_SORTUP : HDF_SORTDOWN);
- hColumn.lParam = (LPARAM)(bSortAsc ? 2 : 1);
- Header_SetItem(hHeader, iSortingColumn, &hColumn);
-
- /* Sort the list */
- sort.bSortAsc = bSortAsc;
- sort.hList = hListView;
- sort.nClickedColumn = iSortingColumn;
- return ListView_SortItemsEx(hListView, SortListView, (LPARAM)&sort);
-}
-
-//////////////////////////////////////////////
-
-/* EOF */
Removed: trunk/reactos/base/applications/msconfig_new/comctl32ex/listviewfuncs.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/msconfig…
==============================================================================
--- trunk/reactos/base/applications/msconfig_new/comctl32ex/listviewfuncs.h [iso-8859-1]
(original)
+++ trunk/reactos/base/applications/msconfig_new/comctl32ex/listviewfuncs.h (removed)
@@ -1,43 +0,0 @@
-/*
- * PROJECT: ReactOS Applications
- * LICENSE: LGPL - See COPYING in the top level directory
- * FILE: base/applications/msconfig_new/comctl32ex/listviewfuncs.h
- * PURPOSE: List-View helper functions.
- * COPYRIGHT: Copyright 2011-2012 Hermes BELUSCA - MAITO <hermes.belusca(a)sfr.fr>
- */
-
-#ifndef __LISTVIEWFUNCS_H__
-#define __LISTVIEWFUNCS_H__
-
-#pragma once
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "commctrldefs.h"
-
-///////////// ListView Sorting /////////////
-
-int CALLBACK
-SortListView(LPARAM lItemParam1,
- LPARAM lItemParam2,
- LPARAM lPSort_S);
-
-BOOL
-ListView_SortEx(HWND hListView,
- int iSortingColumn,
- int iSortedColumn);
-
-#define ListView_Sort(hListView, iSortingColumn) \
- ListView_SortEx((hListView), (iSortingColumn), -1)
-
-//////////////////////////////////////////////
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // __LISTVIEWFUNCS_H__
-
-/* EOF */
Added: trunk/reactos/base/applications/msconfig_new/comctl32ex/treeview.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/msconfig…
==============================================================================
--- trunk/reactos/base/applications/msconfig_new/comctl32ex/treeview.c (added)
+++ trunk/reactos/base/applications/msconfig_new/comctl32ex/treeview.c [iso-8859-1] Sat
Oct 31 21:00:32 2015
@@ -0,0 +1,281 @@
+/*
+ * PROJECT: ReactOS Applications
+ * LICENSE: LGPL - See COPYING in the top level directory
+ * FILE: base/applications/msconfig/treeview.c
+ * PURPOSE: Tree-View helper functions.
+ * COPYRIGHT: Copyright 2011-2012 Hermes BELUSCA - MAITO <hermes.belusca(a)sfr.fr>
+ */
+
+// For TVIF_EXPANDEDIMAGE and TVIF_STATEEX (are they really useful ?)
+#if !defined(_WIN32_IE) || (_WIN32_IE < 0x0600)
+ #define _WIN32_IE 0x0600
+#endif
+
+// Fake _WIN32_WINNT to 0x0600 in order to get Vista+ style flags
+#undef _WIN32_WINNT
+#define _WIN32_WINNT 0x0600
+
+#include "precomp.h"
+#include "treeview.h"
+
+#include <wingdi.h> // For RGB macro
+
+
+void TreeView_Set3StateCheck(HWND hTree)
+{
+ LONG_PTR lStyle;
+ DWORD dwExStyle;
+
+ DWORD Major, Minor, Build;
+ GetComCtl32Version(&Major, &Minor, &Build);
+
+ /*
+ * Choose the best way to handle 3-state TreeView checkboxes
+ * according to the version of comctl32.dll we are running against.
+ *
+ * Starting version comctl32 version 6.10 (Vista+, via SxS)
+ * we have native 3-state checkboxes available.
+ * Only when comctl32 version 5.82 (no SxS) is available,
+ * use its build number to know whether we should use 2k3-style
+ * or Vista+ style check-boxes.
+ */
+ if (Major > 6 || (Major == 6 && Minor >= 10))
+ {
+ /*
+ * NOTE: As explained in the following link:
+ *
http://stackoverflow.com/questions/31488233/treeview-setextendedstyle-does-…
+ * the TreeView control should have the extended check-box style set
+ * *BEFORE* actually setting the check-box window style, because it is
+ * only at that step that the TreeView control builds its image list
+ * containing the three check-box states. Indeed, if the extended
+ * check-box style was applied after setting the window style, then
+ * the image list would be already built with the default two states
+ * and would not be updated.
+ *
+ * The MSDN documentation is not very clear on that point.
+ *
+ * Let me also take this opportunity to document what those
+ * extended check-box state styles look like on Windows Vista+ :
+ *
+ * - TVS_EX_DIMMEDCHECKBOXES creates a grey tone version of the normal checked
box state.
+ * - TVS_EX_EXCLUSIONCHECKBOXES creates a red 'X'-style cross check-box
state.
+ * - TVS_EX_PARTIALCHECKBOXES creates a filled box.
+ */
+ dwExStyle = TreeView_GetExtendedStyle(hTree);
+ TreeView_SetExtendedStyle(hTree, dwExStyle | TVS_EX_PARTIALCHECKBOXES, 0);
+
+ lStyle = GetWindowLongPtr(hTree, GWL_STYLE);
+ SetWindowLongPtr(hTree, GWL_STYLE, lStyle | TVS_CHECKBOXES);
+ }
+ else
+ {
+ lStyle = GetWindowLongPtr(hTree, GWL_STYLE);
+ SetWindowLongPtr(hTree, GWL_STYLE, lStyle | TVS_CHECKBOXES);
+
+ // TODO: Implement this function which should build at runtime
+ // the image list with either two or three check-box states
+ // (as it is done by the real common control TreeView), instead
+ // of storing resource bitmaps.
+ //
+ // hCheckImageList = CreateCheckBoxImagelist(NULL, TRUE, TRUE, FALSE);
+ TreeView_SetImageList(hTree,
+ ImageList_LoadBitmap(hInst, (Build >= 6000 ?
MAKEINTRESOURCEW(IDB_V7CHECK) : MAKEINTRESOURCEW(IDB_2K3CHECK)), 16, 4, RGB(255, 255,
255)),
+ TVSIL_STATE);
+ }
+}
+
+void TreeView_Cleanup(HWND hTree)
+{
+ // FIXME: Should we do it always, or only when the custom image list was set?
+ ImageList_Destroy(TreeView_GetImageList(hTree, TVSIL_STATE));
+}
+
+
+HTREEITEM
+InsertItem(HWND hTree,
+ LPCWSTR szName,
+ HTREEITEM hParent,
+ HTREEITEM hInsertAfter)
+{
+ TVINSERTSTRUCTW tvis;
+ SecureZeroMemory(&tvis, sizeof(tvis));
+
+ tvis.hParent = hParent;
+ tvis.hInsertAfter = hInsertAfter;
+ tvis.itemex.mask = TVIF_TEXT;
+ tvis.itemex.pszText = (LPWSTR)szName;
+
+ return (tvis.itemex.hItem = TreeView_InsertItem(hTree, &tvis));
+}
+
+UINT TreeView_GetRealSubtreeState(HWND hTree, HTREEITEM htiSubtreeItem)
+{
+#define OP(a, b) ((a) == (b) ? (a) : 2)
+
+ HTREEITEM htiIterator = TreeView_GetChild(hTree, htiSubtreeItem);
+ UINT uRealSubtreeState = TreeView_GetCheckState(hTree, htiIterator);
+ /*
+ while (htiIterator)
+ {
+ UINT temp = TreeView_GetCheckState(hTree, htiIterator);
+ uRealSubtreeState = OP(uRealSubtreeState, temp);
+
+ htiIterator = TreeView_GetNextSibling(hTree, htiIterator);
+ }
+ */
+ while ( htiIterator && ( (htiIterator = TreeView_GetNextSibling(hTree,
htiIterator)) != NULL ) )
+ {
+ UINT temp = TreeView_GetCheckState(hTree, htiIterator);
+ uRealSubtreeState = OP(uRealSubtreeState, temp);
+ }
+
+ return uRealSubtreeState;
+}
+
+void TreeView_PropagateStateOfItemToParent(HWND hTree, HTREEITEM htiItem)
+{
+ HTREEITEM htiParent;
+ UINT uGlobalSiblingsCheckState;
+
+ if (!hTree || !htiItem /* || htiItem == TVI_ROOT */)
+ return;
+
+ htiParent = TreeView_GetParent(hTree, htiItem);
+ if (!htiParent)
+ return;
+
+ uGlobalSiblingsCheckState = TreeView_GetRealSubtreeState(hTree, htiParent);
+ TreeView_SetItemState(hTree, htiParent,
INDEXTOSTATEIMAGEMASK(uGlobalSiblingsCheckState + 1), TVIS_STATEIMAGEMASK);
+ TreeView_PropagateStateOfItemToParent(hTree, htiParent);
+
+ return;
+}
+
+HTREEITEM Tree_Item_Copy(HWND hTree, HTREEITEM hSourceItem, HTREEITEM hParent, HTREEITEM
hInsertAfter)
+{
+ HTREEITEM htiIterator;
+ TVINSERTSTRUCTW tvis;
+ WCHAR label[MAX_VALUE_NAME] = L"";
+
+ if (!hTree || !hSourceItem || !hInsertAfter)
+ return NULL;
+
+ // 1- Retrieve properties.
+ SecureZeroMemory(&tvis, sizeof(tvis));
+
+ tvis.itemex.hItem = hSourceItem; // Handle of the item to be retrieved.
+ tvis.itemex.mask = TVIF_HANDLE | TVIF_TEXT | TVIF_STATE |
+ TVIF_CHILDREN | TVIF_DI_SETITEM | TVIF_EXPANDEDIMAGE |
+ TVIF_IMAGE | TVIF_INTEGRAL | TVIF_PARAM | TVIF_SELECTEDIMAGE |
TVIF_STATEEX;
+ tvis.itemex.pszText = label;
+ tvis.itemex.cchTextMax = MAX_VALUE_NAME;
+ TreeView_GetItem(hTree, &tvis.itemex);
+
+ // 2- Now, copy to destination.
+ tvis.hParent = hParent;
+ tvis.hInsertAfter = hInsertAfter;
+ tvis.itemex.stateMask = tvis.itemex.state;
+ tvis.itemex.hItem = TreeView_InsertItem(hTree, &tvis);
+
+ for (htiIterator = TreeView_GetChild(hTree, hSourceItem) ; htiIterator ; htiIterator
= TreeView_GetNextSibling(hTree, htiIterator))
+ Tree_Item_Copy(hTree, htiIterator, tvis.itemex.hItem, TVI_LAST);
+
+ return tvis.itemex.hItem;
+}
+
+void TreeView_DownItem(HWND hTree, HTREEITEM htiItemToDown)
+{
+ HTREEITEM htiNextItem, htiNewItem;
+
+ if (!hTree || !htiItemToDown)
+ return;
+
+ htiNextItem = TreeView_GetNextSibling(hTree, htiItemToDown);
+ if (!htiNextItem)
+ htiNextItem = TVI_LAST;
+
+ htiNewItem = Tree_Item_Copy(hTree, htiItemToDown, TreeView_GetParent(hTree,
htiItemToDown), htiNextItem);
+ TreeView_DeleteItem(hTree, htiItemToDown); // Delete the item and ALL its children.
+ TreeView_SelectItem(hTree, htiNewItem);
+
+ return;
+}
+
+void TreeView_UpItem(HWND hTree, HTREEITEM htiItemToUp)
+{
+ HTREEITEM htiPrevItem, htiPrevPrevItem, htiNewItem;
+
+ if (!hTree || !htiItemToUp)
+ return;
+
+ htiPrevItem = TreeView_GetPrevSibling(hTree, htiItemToUp);
+ htiPrevPrevItem = TreeView_GetPrevSibling(hTree, htiPrevItem);
+ if (!htiPrevPrevItem)
+ htiPrevPrevItem = TVI_FIRST;
+ // if htiPrevItem == NULL , htiPrevPrevItem == NULL.
+
+ htiNewItem = Tree_Item_Copy(hTree, htiItemToUp, TreeView_GetParent(hTree,
htiItemToUp), htiPrevPrevItem);
+ TreeView_DeleteItem(hTree, htiItemToUp); // Delete the item and ALL its children.
+ TreeView_SelectItem(hTree, htiNewItem);
+
+ return;
+}
+
+HTREEITEM TreeView_GetFirst(HWND hTree)
+{
+ return TreeView_GetRoot(hTree);
+}
+
+HTREEITEM TreeView_GetLastFromItem(HWND hTree, HTREEITEM hItem)
+{
+ HTREEITEM htiRet = NULL;
+ HTREEITEM htiIterator;
+
+ for (htiIterator = hItem ; htiIterator ; htiIterator = TreeView_GetNextSibling(hTree,
htiIterator))
+ htiRet = htiIterator;
+
+ return htiRet;
+}
+
+HTREEITEM TreeView_GetLast(HWND hTree)
+{
+ return TreeView_GetLastFromItem(hTree, TreeView_GetRoot(hTree));
+}
+
+HTREEITEM TreeView_GetPrev(HWND hTree, HTREEITEM hItem)
+{
+ HTREEITEM hPrev, hTmp;
+
+ if (!hTree)
+ return NULL;
+
+ hPrev = TreeView_GetPrevSibling(hTree, hItem);
+ if (!hPrev)
+ return TreeView_GetParent(hTree, hItem);
+
+ hTmp = TreeView_GetChild(hTree, hPrev);
+ if (hTmp)
+ return TreeView_GetLastFromItem(hTree, hTmp);
+ else
+ return hPrev;
+}
+
+HTREEITEM TreeView_GetNext(HWND hTree, HTREEITEM hItem)
+{
+ HTREEITEM hNext;
+
+ if (!hTree)
+ return NULL;
+
+ hNext = TreeView_GetChild(hTree, hItem);
+ if (hNext)
+ return hNext;
+
+ hNext = TreeView_GetNextSibling(hTree, hItem);
+ if (hNext)
+ return hNext;
+ else
+ return TreeView_GetNextSibling(hTree, TreeView_GetParent(hTree, hItem));
+}
+
+/* EOF */
Propchange: trunk/reactos/base/applications/msconfig_new/comctl32ex/treeview.c
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/reactos/base/applications/msconfig_new/comctl32ex/treeview.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/msconfig…
==============================================================================
--- trunk/reactos/base/applications/msconfig_new/comctl32ex/treeview.h (added)
+++ trunk/reactos/base/applications/msconfig_new/comctl32ex/treeview.h [iso-8859-1] Sat
Oct 31 21:00:32 2015
@@ -0,0 +1,81 @@
+/*
+ * PROJECT: ReactOS Applications
+ * LICENSE: LGPL - See COPYING in the top level directory
+ * FILE: base/applications/msconfig/treeview.h
+ * PURPOSE: Tree-View helper functions.
+ * COPYRIGHT: Copyright 2011-2012 Hermes BELUSCA - MAITO <hermes.belusca(a)sfr.fr>
+ */
+
+#ifndef __TREEVIEW_H__
+#define __TREEVIEW_H__
+
+#pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "comctl32supp.h"
+
+
+//
+// Should be present in commctrl.h
+// defined for Windows Vista+
+//
+
+#if (_WIN32_WINNT >= 0x0600)
+
+#define TVS_EX_MULTISELECT 0x0002
+#define TVS_EX_DOUBLEBUFFER 0x0004
+#define TVS_EX_NOINDENTSTATE 0x0008
+#define TVS_EX_RICHTOOLTIP 0x0010
+#define TVS_EX_AUTOHSCROLL 0x0020
+#define TVS_EX_FADEINOUTEXPANDOS 0x0040
+#define TVS_EX_PARTIALCHECKBOXES 0x0080
+#define TVS_EX_EXCLUSIONCHECKBOXES 0x0100
+#define TVS_EX_DIMMEDCHECKBOXES 0x0200
+#define TVS_EX_DRAWIMAGEASYNC 0x0400
+
+#endif
+
+
+#if (_WIN32_WINNT >= 0x0501)
+
+#define TVM_SETEXTENDEDSTYLE (TV_FIRST + 44)
+#define TreeView_SetExtendedStyle(hwnd, dw, mask) \
+ (DWORD)SNDMSG((hwnd), TVM_SETEXTENDEDSTYLE, mask, dw)
+
+#define TVM_GETEXTENDEDSTYLE (TV_FIRST + 45)
+#define TreeView_GetExtendedStyle(hwnd) \
+ (DWORD)SNDMSG((hwnd), TVM_GETEXTENDEDSTYLE, 0, 0)
+
+#endif
+
+
+void TreeView_Set3StateCheck(HWND hTree);
+
+void TreeView_Cleanup(HWND hTree);
+
+HTREEITEM
+InsertItem(HWND hTree,
+ LPCWSTR szName,
+ HTREEITEM hParent,
+ HTREEITEM hInsertAfter);
+
+UINT TreeView_GetRealSubtreeState(HWND hTree, HTREEITEM htiSubtreeItem);
+void TreeView_PropagateStateOfItemToParent(HWND hTree, HTREEITEM htiItem);
+void TreeView_DownItem(HWND hTree, HTREEITEM htiItemToDown);
+void TreeView_UpItem(HWND hTree, HTREEITEM htiItemToUp);
+HTREEITEM TreeView_GetFirst(HWND hTree);
+HTREEITEM TreeView_GetLastFromItem(HWND hTree, HTREEITEM hItem);
+HTREEITEM TreeView_GetLast(HWND hTree);
+HTREEITEM TreeView_GetPrev(HWND hTree, HTREEITEM hItem);
+HTREEITEM TreeView_GetNext(HWND hTree, HTREEITEM hItem);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // __TREEVIEW_H__
+
+/* EOF */
Propchange: trunk/reactos/base/applications/msconfig_new/comctl32ex/treeview.h
------------------------------------------------------------------------------
svn:eol-style = native
Modified: trunk/reactos/base/applications/msconfig_new/comctl32ex/uxthemesupp.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/msconfig…
==============================================================================
--- trunk/reactos/base/applications/msconfig_new/comctl32ex/uxthemesupp.c [iso-8859-1]
(original)
+++ trunk/reactos/base/applications/msconfig_new/comctl32ex/uxthemesupp.c [iso-8859-1] Sat
Oct 31 21:00:32 2015
@@ -11,17 +11,26 @@
static HMODULE hUxTheme = NULL;
+typedef HRESULT (WINAPI* ETDTProc)(HWND, DWORD);
+static ETDTProc fnEnableThemeDialogTexture = NULL;
+
+typedef HRESULT (WINAPI* SWTProc)(HWND, LPCWSTR, LPCWSTR);
+static SWTProc fnSetWindowTheme = NULL;
+
+
static BOOL
InitUxTheme(VOID)
{
- static BOOL Initialized = FALSE;
-
- if (Initialized) return TRUE;
+ if (hUxTheme) return TRUE;
hUxTheme = LoadLibraryW(L"uxtheme.dll");
if (hUxTheme == NULL) return FALSE;
- Initialized = TRUE;
+ fnEnableThemeDialogTexture =
+ (ETDTProc)GetProcAddress(hUxTheme, "EnableThemeDialogTexture");
+ fnSetWindowTheme =
+ (SWTProc)GetProcAddress(hUxTheme, "SetWindowTheme");
+
return TRUE;
}
@@ -31,7 +40,6 @@
{
FreeLibrary(hUxTheme);
hUxTheme = NULL;
- // Initialized = FALSE;
}
#endif
@@ -42,28 +50,19 @@
// Copyright (c) 2002 by J Brown
//
-typedef HRESULT (WINAPI* ETDTProc)(HWND, DWORD);
-
HRESULT
WINAPI
EnableThemeDialogTexture(_In_ HWND hwnd,
_In_ DWORD dwFlags)
{
- ETDTProc fnEnableThemeDialogTexture;
-
if (!InitUxTheme())
return HRESULT_FROM_WIN32(GetLastError());
- fnEnableThemeDialogTexture =
- (ETDTProc)GetProcAddress(hUxTheme, "EnableThemeDialogTexture");
if (!fnEnableThemeDialogTexture)
return HRESULT_FROM_WIN32(GetLastError());
return fnEnableThemeDialogTexture(hwnd, dwFlags);
}
-
-
-typedef HRESULT (WINAPI* SWTProc)(HWND, LPCWSTR, LPCWSTR);
HRESULT
WINAPI
@@ -71,13 +70,9 @@
_In_ LPCWSTR pszSubAppName,
_In_ LPCWSTR pszSubIdList)
{
- SWTProc fnSetWindowTheme;
-
if (!InitUxTheme())
return HRESULT_FROM_WIN32(GetLastError());
- fnSetWindowTheme =
- (SWTProc)GetProcAddress(hUxTheme, "SetWindowTheme");
if (!fnSetWindowTheme)
return HRESULT_FROM_WIN32(GetLastError());
Modified: trunk/reactos/base/applications/msconfig_new/fileextractdialog.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/msconfig…
==============================================================================
--- trunk/reactos/base/applications/msconfig_new/fileextractdialog.c [iso-8859-1]
(original)
+++ trunk/reactos/base/applications/msconfig_new/fileextractdialog.c [iso-8859-1] Sat Oct
31 21:00:32 2015
@@ -17,7 +17,7 @@
// #include <setupapi.h>
#include "fileextractdialog.h"
-#include "commctrldefs.h"
+#include "comctl32supp.h"
#include "utils.h"
// #include "callbacks.h"
Modified: trunk/reactos/base/applications/msconfig_new/freeldrpage.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/msconfig…
==============================================================================
--- trunk/reactos/base/applications/msconfig_new/freeldrpage.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/msconfig_new/freeldrpage.c [iso-8859-1] Sat Oct 31
21:00:32 2015
@@ -12,7 +12,7 @@
#include <share.h>
#include <wingdi.h>
-#include "commctrldefs.h"
+#include "comctl32supp.h"
#include "utils.h"
@@ -70,41 +70,38 @@
hFont = (HFONT)SendMessageW(hDlgCtrl, WM_GETFONT, 0, 0);
hOldFont = (HFONT)SelectObject(hDC, hFont);
- while (!feof(file))
+ while (!feof(file) && fgetws(szBuffer, ARRAYSIZE(szBuffer), file))
{
- if (fgetws(szBuffer, ARRAYSIZE(szBuffer), file))
+ length = wcslen(szBuffer);
+ if (length > 1)
{
- length = wcslen(szBuffer);
- if (length > 1)
+ /* Remove \r\n */
+ szBuffer[length-1] = szBuffer[length] = L'\0';
+
+ pos = ListBox_AddString(hDlgCtrl, szBuffer);
+
+ GetTextExtentPoint32W(hDC, szBuffer, (int)wcslen(szBuffer), &size);
+ horzExt = max((LONG)ListBox_GetHorizontalExtent(hDlgCtrl), size.cx + 5); // 5
to have a little room between the text and the end of the list box.
+ ListBox_SetHorizontalExtent(hDlgCtrl, horzExt);
+
+ if (szBuffer[0] == L'[')
+ continue;
+
+ if (!_wcsnicmp(szBuffer, L"timeout=", 8))
{
- /* Remove \r\n */
- szBuffer[length-1] = szBuffer[length] = L'\0';
+ Settings.TimeOut = _wtoi(&szBuffer[8]);
+ continue;
+ }
- pos = ListBox_AddString(hDlgCtrl, szBuffer);
+ if (!_wcsnicmp(szBuffer, L"default=", 8))
+ {
+ wcscpy(Settings.szDefaultOS, &szBuffer[8]);
+ continue;
+ }
+ if (pos != LB_ERR)
+ ListBox_SetItemData(hDlgCtrl, pos, 1); // indicate that this item is a
boot entry
- GetTextExtentPoint32W(hDC, szBuffer, (int)wcslen(szBuffer), &size);
- horzExt = max((LONG)ListBox_GetHorizontalExtent(hDlgCtrl), size.cx + 5);
// 5 to have a little room between the text and the end of the list box.
- ListBox_SetHorizontalExtent(hDlgCtrl, horzExt);
-
- if (szBuffer[0] == L'[')
- continue;
-
- if (!_wcsnicmp(szBuffer, L"timeout=", 8))
- {
- Settings.TimeOut = _wtoi(&szBuffer[8]);
- continue;
- }
-
- if (!_wcsnicmp(szBuffer, L"default=", 8))
- {
- wcscpy(Settings.szDefaultOS, &szBuffer[8]);
- continue;
- }
- if (pos != LB_ERR)
- ListBox_SetItemData(hDlgCtrl, pos, 1); // indicate that this item is
a boot entry
-
- Settings.OSConfigurationCount++;
- }
+ Settings.OSConfigurationCount++;
}
}
Modified: trunk/reactos/base/applications/msconfig_new/generalpage.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/msconfig…
==============================================================================
--- trunk/reactos/base/applications/msconfig_new/generalpage.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/msconfig_new/generalpage.c [iso-8859-1] Sat Oct 31
21:00:32 2015
@@ -10,7 +10,7 @@
#include "precomp.h"
#include "fileutils.h"
#include "utils.h"
-#include "commctrldefs.h"
+#include "comctl32supp.h"
#include "fileextractdialog.h"
static LPCWSTR lpszRestoreProgPath1 = L"%SystemRoot%\\System32\\rstrui.exe";
Modified: trunk/reactos/base/applications/msconfig_new/msconfig.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/msconfig…
==============================================================================
--- trunk/reactos/base/applications/msconfig_new/msconfig.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/msconfig_new/msconfig.c [iso-8859-1] Sat Oct 31
21:00:32 2015
@@ -11,7 +11,7 @@
#include "utils.h"
#include "generalpage.h"
-// #include "systempage.h"
+#include "systempage.h"
#include "freeldrpage.h"
#include "srvpage.h"
// #include "startuppage.h"
@@ -40,9 +40,8 @@
LPWSTR szAppName = NULL;
HWND hMainWnd; /* Main Window */
-HWND hTabWnd; /* Tab Control Window */
-// HICON hDialogIcon = NULL;
-HICON hIcon = NULL;
+HWND hTabWnd; /* Tab Control Window */
+HICON hIcon = NULL, hIconSm = NULL;
WNDPROC wpOrigEditProc = NULL;
@@ -100,22 +99,13 @@
// return FALSE;
}
-#if 0
- case WM_SYSCOLORCHANGE:
- /* Forward WM_SYSCOLORCHANGE to common controls */
- SendMessage(hServicesListCtrl, WM_SYSCOLORCHANGE, 0, 0);
- SendMessage(hStartupListCtrl, WM_SYSCOLORCHANGE, 0, 0);
- SendMessage(hToolsListCtrl, WM_SYSCOLORCHANGE, 0, 0);
- break;
-#endif
-
case WM_DESTROY:
{
- if (hIcon)
- DestroyIcon(hIcon);
-
if (wpOrigEditProc)
SetWindowLongPtr(hWnd, DWLP_DLGPROC, (LONG_PTR)wpOrigEditProc);
+
+ if (hIcon) DestroyIcon(hIcon);
+ if (hIconSm) DestroyIcon(hIconSm);
}
default:
@@ -146,31 +136,6 @@
} DLGTEMPLATEEX, *LPDLGTEMPLATEEX;
#include <poppack.h>
-
-VOID ModifySystemMenu(HWND hWnd)
-{
- WCHAR szMenuString[255];
-
- /* Customize the window's system menu, add items before the "Close"
item */
- HMENU hSysMenu = GetSystemMenu(hWnd, FALSE);
- assert(hSysMenu);
-
- /* New entries... */
- if (LoadStringW(hInst,
- IDS_ABOUT,
- szMenuString,
- ARRAYSIZE(szMenuString)) > 0)
- {
- /* "About" menu */
- InsertMenuW(hSysMenu, SC_CLOSE, MF_BYCOMMAND | MF_ENABLED | MF_STRING, IDM_ABOUT,
szMenuString);
- /* Separator */
- InsertMenuW(hSysMenu, SC_CLOSE, MF_BYCOMMAND | MF_SEPARATOR , 0 ,
NULL);
- }
-
- DrawMenuBar(hWnd);
- return;
-}
-
int CALLBACK PropSheetCallback(HWND hDlg, UINT message, LPARAM lParam)
{
switch (message)
@@ -180,20 +145,24 @@
LPDLGTEMPLATE dlgTemplate = (LPDLGTEMPLATE)lParam;
LPDLGTEMPLATEEX dlgTemplateEx = (LPDLGTEMPLATEEX)lParam;
+ // MFC : DS_MODALFRAME | DS_3DLOOK | DS_CONTEXTHELP | DS_SETFONT | WS_POPUP |
WS_VISIBLE | WS_CAPTION;
+ DWORD style = DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX |
WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU;
+ // DS_SHELLFONT | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP |
WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME;
+ DWORD exStyle = WS_EX_CONTROLPARENT | WS_EX_APPWINDOW;
+
+ /* Hide the dialog by default; we will center it on screen later, and then
show it */
+ style &= ~WS_VISIBLE;
+
/* Set the styles of the property sheet dialog */
if (dlgTemplateEx->signature == 0xFFFF)
{
- //// MFC : DS_MODALFRAME | DS_3DLOOK | DS_CONTEXTHELP | DS_SETFONT |
WS_POPUP | WS_VISIBLE | WS_CAPTION;
-
- dlgTemplateEx->style = DS_SHELLFONT | DS_MODALFRAME | DS_CENTER |
WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU;
- // dlgTemplateEx->style = DS_SHELLFONT | DS_CENTER | WS_MINIMIZEBOX
| WS_POPUP | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME;
- dlgTemplateEx->exStyle = WS_EX_CONTROLPARENT | WS_EX_APPWINDOW;
+ dlgTemplateEx->style = style;
+ dlgTemplateEx->exStyle = exStyle;
}
else
{
- dlgTemplate->style = DS_SHELLFONT | DS_MODALFRAME |
DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU;
- // dlgTemplate->style = DS_SHELLFONT | DS_CENTER |
WS_MINIMIZEBOX | WS_POPUP | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_CAPTION | WS_SYSMENU |
WS_THICKFRAME;
- dlgTemplate->dwExtendedStyle = WS_EX_CONTROLPARENT | WS_EX_APPWINDOW;
+ dlgTemplate->style = style;
+ dlgTemplate->dwExtendedStyle = exStyle;
}
break;
@@ -201,13 +170,28 @@
case PSCB_INITIALIZED:
{
- /* Modify the system menu of the property sheet dialog */
- ModifySystemMenu(hDlg);
+ /* Customize the window's system menu, add items before the
"Close" item */
+ LPWSTR szMenuString;
+ HMENU hSysMenu = GetSystemMenu(hDlg, FALSE);
+ assert(hSysMenu);
+
+ szMenuString = LoadResourceString(hInst, IDS_ABOUT);
+ if (szMenuString)
+ {
+ /* "About" menu */
+ InsertMenuW(hSysMenu, SC_CLOSE, MF_BYCOMMAND | MF_ENABLED | MF_STRING,
IDM_ABOUT, szMenuString);
+ /* Separator */
+ InsertMenuW(hSysMenu, SC_CLOSE, MF_BYCOMMAND | MF_SEPARATOR , 0
, NULL);
+
+ MemFree(szMenuString);
+ }
+ DrawMenuBar(hDlg);
/* Set the dialog icons */
- hIcon = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_APPICON), IMAGE_ICON, 0,
0, LR_DEFAULTSIZE);
+ hIcon = (HICON)LoadImageW(hInst, MAKEINTRESOURCEW(IDI_APPICON), IMAGE_ICON,
0, 0, LR_SHARED | LR_DEFAULTSIZE);
+ hIconSm = (HICON)CopyImage(hIcon, IMAGE_ICON, GetSystemMetrics(SM_CXSMICON),
GetSystemMetrics(SM_CYSMICON), LR_COPYFROMRESOURCE);
SendMessage(hDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
- SendMessage(hDlg, WM_SETICON, ICON_SMALL, (LPARAM)hIcon);
+ SendMessage(hDlg, WM_SETICON, ICON_SMALL, (LPARAM)hIconSm);
/* Sub-class the property sheet window procedure */
wpOrigEditProc = (WNDPROC)SetWindowLongPtr(hDlg, DWLP_DLGPROC,
(LONG_PTR)MainWndProc);
@@ -234,22 +218,21 @@
psh.dwFlags = PSH_PROPSHEETPAGE | PSH_MODELESS | /*PSH_USEICONID |*/ PSH_HASHELP
| /*PSH_NOCONTEXTHELP |*/ PSH_USECALLBACK;
psh.hInstance = hInstance;
psh.hwndParent = hwndOwner;
- //psh.pszIcon = MAKEINTRESOURCE(IDI_APPICON); // It's crap... Only works for
the small icon and not the big...
+ // psh.pszIcon = MAKEINTRESOURCEW(IDI_APPICON); // Disabled because it only sets
the small icon; the big icon is a stretched version of the small one.
psh.pszCaption = lpszTitle;
psh.nStartPage = 0;
psh.ppsp = psp;
- psh.pfnCallback = (PFNPROPSHEETCALLBACK)PropSheetCallback;
+ psh.pfnCallback = PropSheetCallback;
/* General page */
psp[nPages].dwSize = sizeof(PROPSHEETPAGEW);
psp[nPages].dwFlags = PSP_HASHELP;
psp[nPages].hInstance = hInstance;
- psp[nPages].pszTemplate = MAKEINTRESOURCE(IDD_GENERAL_PAGE);
- psp[nPages].pfnDlgProc = (DLGPROC)GeneralPageWndProc;
+ psp[nPages].pszTemplate = MAKEINTRESOURCEW(IDD_GENERAL_PAGE);
+ psp[nPages].pfnDlgProc = GeneralPageWndProc;
++nPages;
-#if 0
- if (bIsWindows && bIsOSVersionLessThanVista)
+ // if (bIsOSVersionLessThanVista)
{
/* SYSTEM.INI page */
if (MyFileExists(lpszSystemIni, NULL))
@@ -257,9 +240,9 @@
psp[nPages].dwSize = sizeof(PROPSHEETPAGEW);
psp[nPages].dwFlags = PSP_HASHELP | PSP_USETITLE;
psp[nPages].hInstance = hInstance;
- psp[nPages].pszTitle = MAKEINTRESOURCE(IDS_TAB_SYSTEM);
- psp[nPages].pszTemplate = MAKEINTRESOURCE(IDD_SYSTEM_PAGE);
- psp[nPages].pfnDlgProc = (DLGPROC)SystemPageWndProc;
+ psp[nPages].pszTitle = MAKEINTRESOURCEW(IDS_TAB_SYSTEM);
+ psp[nPages].pszTemplate = MAKEINTRESOURCEW(IDD_SYSTEM_PAGE);
+ psp[nPages].pfnDlgProc = SystemPageWndProc;
psp[nPages].lParam = (LPARAM)lpszSystemIni;
++nPages;
@@ -272,16 +255,15 @@
psp[nPages].dwSize = sizeof(PROPSHEETPAGEW);
psp[nPages].dwFlags = PSP_HASHELP | PSP_USETITLE;
psp[nPages].hInstance = hInstance;
- psp[nPages].pszTitle = MAKEINTRESOURCE(IDS_TAB_WIN);
- psp[nPages].pszTemplate = MAKEINTRESOURCE(IDD_SYSTEM_PAGE);
- psp[nPages].pfnDlgProc = (DLGPROC)WinPageWndProc;
+ psp[nPages].pszTitle = MAKEINTRESOURCEW(IDS_TAB_WIN);
+ psp[nPages].pszTemplate = MAKEINTRESOURCEW(IDD_SYSTEM_PAGE);
+ psp[nPages].pfnDlgProc = WinPageWndProc;
psp[nPages].lParam = (LPARAM)lpszWinIni;
++nPages;
BackupIniFile(lpszWinIni);
}
}
-#endif
/* FreeLdr page */
// TODO: Program the interface for Vista: "light" BCD editor...
@@ -305,9 +287,9 @@
psp[nPages].dwSize = sizeof(PROPSHEETPAGEW);
psp[nPages].dwFlags = PSP_HASHELP | PSP_USETITLE;
psp[nPages].hInstance = hInstance;
- psp[nPages].pszTitle = MAKEINTRESOURCE(dwTabNameId);
- psp[nPages].pszTemplate = MAKEINTRESOURCE(IDD_FREELDR_PAGE);
- psp[nPages].pfnDlgProc = (DLGPROC)FreeLdrPageWndProc;
+ psp[nPages].pszTitle = MAKEINTRESOURCEW(dwTabNameId);
+ psp[nPages].pszTemplate = MAKEINTRESOURCEW(IDD_FREELDR_PAGE);
+ psp[nPages].pfnDlgProc = FreeLdrPageWndProc;
psp[nPages].lParam = (LPARAM)lpszLoaderIniFile;
++nPages;
@@ -319,8 +301,8 @@
psp[nPages].dwSize = sizeof(PROPSHEETPAGEW);
psp[nPages].dwFlags = PSP_HASHELP;
psp[nPages].hInstance = hInstance;
- psp[nPages].pszTemplate = MAKEINTRESOURCE(IDD_SERVICES_PAGE);
- psp[nPages].pfnDlgProc = (DLGPROC)ServicesPageWndProc;
+ psp[nPages].pszTemplate = MAKEINTRESOURCEW(IDD_SERVICES_PAGE);
+ psp[nPages].pfnDlgProc = ServicesPageWndProc;
++nPages;
#if 0
@@ -328,8 +310,8 @@
psp[nPages].dwSize = sizeof(PROPSHEETPAGEW);
psp[nPages].dwFlags = PSP_HASHELP;
psp[nPages].hInstance = hInstance;
- psp[nPages].pszTemplate = MAKEINTRESOURCE(IDD_STARTUP_PAGE);
- psp[nPages].pfnDlgProc = (DLGPROC)StartupPageWndProc;
+ psp[nPages].pszTemplate = MAKEINTRESOURCEW(IDD_STARTUP_PAGE);
+ psp[nPages].pfnDlgProc = StartupPageWndProc;
++nPages;
#endif
@@ -337,21 +319,20 @@
psp[nPages].dwSize = sizeof(PROPSHEETPAGEW);
psp[nPages].dwFlags = PSP_HASHELP;
psp[nPages].hInstance = hInstance;
- psp[nPages].pszTemplate = MAKEINTRESOURCE(IDD_TOOLS_PAGE);
- psp[nPages].pfnDlgProc = (DLGPROC)ToolsPageWndProc;
+ psp[nPages].pszTemplate = MAKEINTRESOURCEW(IDD_TOOLS_PAGE);
+ psp[nPages].pfnDlgProc = ToolsPageWndProc;
++nPages;
/* Set the total number of created pages */
psh.nPages = nPages;
/* Create the property sheet */
- hPropSheet = (HWND)PropertySheet(&psh);
+ hPropSheet = (HWND)PropertySheetW(&psh);
if (hPropSheet)
{
- /* Center the property sheet on the desktop */
- //ShowWindow(hPropSheet, SW_HIDE);
+ /* Center the property sheet on the desktop and show it */
ClipOrCenterWindowToMonitor(hPropSheet, MONITOR_WORKAREA | MONITOR_CENTER);
- //ShowWindow(hPropSheet, SW_SHOWNORMAL);
+ ShowWindow(hPropSheet, SW_SHOWNORMAL);
}
return hPropSheet;
@@ -452,10 +433,10 @@
return -1;
}
- hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDR_MSCONFIG));
+ hAccelTable = LoadAcceleratorsW(hInstance, MAKEINTRESOURCEW(IDR_MSCONFIG));
/* Message loop */
- while (IsWindow(hMainWnd) && GetMessage(&msg, NULL, 0, 0))
+ while (IsWindow(hMainWnd) && GetMessageW(&msg, NULL, 0, 0))
{
/*
* PropSheet_GetCurrentPageHwnd returns NULL when the user clicks the OK or
Cancel button
@@ -466,7 +447,7 @@
break;
/* Process the accelerator table */
- if (!TranslateAccelerator(hMainWnd, hAccelTable, &msg))
+ if (!TranslateAcceleratorW(hMainWnd, hAccelTable, &msg))
{
/*
* If e.g. an item on the tree view is being edited,
@@ -477,7 +458,7 @@
if (/*g_bDisableDialogDispatch ||*/ !PropSheet_IsDialogMessage(hMainWnd,
&msg))
{
TranslateMessage(&msg);
- DispatchMessage(&msg);
+ DispatchMessageW(&msg);
}
}
}
Modified: trunk/reactos/base/applications/msconfig_new/msconfig.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/msconfig…
==============================================================================
--- trunk/reactos/base/applications/msconfig_new/msconfig.rc [iso-8859-1] (original)
+++ trunk/reactos/base/applications/msconfig_new/msconfig.rc [iso-8859-1] Sat Oct 31
21:00:32 2015
@@ -13,7 +13,9 @@
#define REACTOS_STR_ORIGINAL_FILENAME "msconfig.exe"
#include <reactos/version.rc>
-IDI_APPICON ICON "res/msconfig.ico"
+IDI_APPICON ICON "res/msconfig.ico"
+IDB_2K3CHECK BITMAP "res/2k3check.bmp"
+IDB_V7CHECK BITMAP "res/v7check.bmp"
IDR_MSCONFIG ACCELERATORS
BEGIN
Added: trunk/reactos/base/applications/msconfig_new/res/2k3check.bmp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/msconfig…
==============================================================================
Binary file - no diff available.
Propchange: trunk/reactos/base/applications/msconfig_new/res/2k3check.bmp
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: trunk/reactos/base/applications/msconfig_new/res/v7check.bmp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/msconfig…
==============================================================================
Binary file - no diff available.
Propchange: trunk/reactos/base/applications/msconfig_new/res/v7check.bmp
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Modified: trunk/reactos/base/applications/msconfig_new/resource.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/msconfig…
==============================================================================
--- trunk/reactos/base/applications/msconfig_new/resource.h [iso-8859-1] (original)
+++ trunk/reactos/base/applications/msconfig_new/resource.h [iso-8859-1] Sat Oct 31
21:00:32 2015
@@ -148,6 +148,9 @@
#define IDS_MSCONFIG_2 3001
#define IDI_APPICON 3010
+#define IDB_2K3CHECK 3011
+#define IDB_V7CHECK 3012
+
#define IDR_MSCONFIG 3020
#define IDM_ABOUT 3030
Modified: trunk/reactos/base/applications/msconfig_new/srvpage.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/msconfig…
==============================================================================
--- trunk/reactos/base/applications/msconfig_new/srvpage.cpp [iso-8859-1] (original)
+++ trunk/reactos/base/applications/msconfig_new/srvpage.cpp [iso-8859-1] Sat Oct 31
21:00:32 2015
@@ -13,7 +13,7 @@
#include "regutils.h"
#include "stringutils.h"
// #include "CmdLineParser.h"
-#include "listviewfuncs.h"
+#include "listview.h"
#include "uxthemesupp.h"
#include <winsvc.h>
Added: trunk/reactos/base/applications/msconfig_new/systempage.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/msconfig…
==============================================================================
--- trunk/reactos/base/applications/msconfig_new/systempage.cpp (added)
+++ trunk/reactos/base/applications/msconfig_new/systempage.cpp [iso-8859-1] Sat Oct 31
21:00:32 2015
@@ -0,0 +1,895 @@
+/*
+ * PROJECT: ReactOS Applications
+ * LICENSE: LGPL - See COPYING in the top level directory
+ * FILE: base/applications/msconfig_new/systempage.c
+ * PURPOSE: System page message handler
+ * COPYRIGHT: Copyright 2005-2006 Christoph von Wittich <Christoph(a)ApiViewer.de>
+ * 2011 Gregor Schneider
<Gregor.Schneider(a)reactos.org>
+ * Copyright 2011-2012 Hermes BELUSCA - MAITO <hermes.belusca(a)sfr.fr>
+ */
+
+#include "precomp.h"
+#include <share.h>
+
+#include "treeview.h"
+#include "uxthemesupp.h"
+
+#include "regutils.h"
+#include "utils.h"
+
+
+extern "C" {
+
+LPCWSTR lpszSystemIni = L"%SystemRoot%\\system.ini"; // or: %windir%\\... ?
+LPCWSTR lpszWinIni = L"%SystemRoot%\\win.ini"; // or: %windir%\\... ?
+
+}
+
+static LPCWSTR szMSConfigTok = L";msconfig "; // Note the trailing whitespace
+static const size_t MSConfigTokLen = 10;
+
+
+extern "C" {
+
+DWORD GetSystemIniActivation(VOID)
+{
+ DWORD dwSystemIni = 0;
+ RegGetDWORDValue(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Shared
Tools\\MSConfig\\state", L"system.ini", &dwSystemIni);
+ return dwSystemIni;
+}
+
+DWORD GetWinIniActivation(VOID)
+{
+ DWORD dwWinIni = 0;
+ RegGetDWORDValue(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Shared
Tools\\MSConfig\\state", L"win.ini", &dwWinIni);
+ return dwWinIni;
+}
+
+}
+
+
+
+static HWND hTree = NULL;
+static WCHAR szSearchString[MAX_VALUE_NAME] = L"";
+static BOOL bMatchExactText = FALSE;
+static BOOL bSearchSense = TRUE; // TRUE == down, FALSE == up.
+static BOOL bCaseSensitive = FALSE;
+
+static void
+ToLower(LPWSTR lpszString)
+{
+ if (!lpszString)
+ return;
+
+ while (*lpszString)
+ {
+ *lpszString = towlower(*lpszString);
+ ++lpszString;
+ }
+}
+
+INT_PTR CALLBACK
+FindDialogWndProc(HWND hDlg,
+ UINT message,
+ WPARAM wParam,
+ LPARAM lParam)
+{
+ UNREFERENCED_PARAMETER(lParam);
+
+ switch (message)
+ {
+ case WM_INITDIALOG:
+ {
+ hTree = (HWND)lParam;
+
+ Button_SetCheck(GetDlgItem(hDlg, IDC_CBX_FIND_WHOLE_WORD_ONLY),
(bMatchExactText ? BST_CHECKED : BST_UNCHECKED));
+ Button_SetCheck(GetDlgItem(hDlg, IDC_RB_FIND_DOWN), (bSearchSense ?
BST_CHECKED : BST_UNCHECKED)); // TRUE == down, FALSE == up.
+ Button_SetCheck(GetDlgItem(hDlg, IDC_RB_FIND_UP ), (bSearchSense ?
BST_UNCHECKED : BST_CHECKED )); // TRUE == down, FALSE == up.
+ Button_SetCheck(GetDlgItem(hDlg, IDC_CBX_FIND_MATCH_CASE), (bCaseSensitive ?
BST_CHECKED : BST_UNCHECKED));
+
+ Edit_SetText(GetDlgItem(hDlg, IDC_TXT_FIND_TEXT), szSearchString);
+ SetFocus(GetDlgItem(hDlg, IDC_TXT_FIND_TEXT));
+ Edit_SetSel(GetDlgItem(hDlg, IDC_TXT_FIND_TEXT), 0, -1);
+
+ return TRUE;
+ }
+
+ case WM_COMMAND:
+ {
+ switch (LOWORD(wParam))
+ {
+ case IDOK:
+ {
+ TVITEMEXW tvItemEx;
+ HTREEITEM htiIterator;
+ WCHAR label[MAX_VALUE_NAME] = L"";
+ WCHAR szTemp[MAX_VALUE_NAME];
+
+ bMatchExactText = (Button_GetCheck(GetDlgItem(hDlg,
IDC_CBX_FIND_WHOLE_WORD_ONLY)) == BST_CHECKED);
+ bSearchSense = ((Button_GetCheck(GetDlgItem(hDlg,
IDC_RB_FIND_DOWN)) == BST_CHECKED) &&
+ (Button_GetCheck(GetDlgItem(hDlg, IDC_RB_FIND_UP
)) == BST_UNCHECKED)); // TRUE == down, FALSE == up.
+ bCaseSensitive = (Button_GetCheck(GetDlgItem(hDlg,
IDC_CBX_FIND_MATCH_CASE)) == BST_CHECKED);
+
+ Edit_GetText(GetDlgItem(hDlg, IDC_TXT_FIND_TEXT), szSearchString,
_ARRAYSIZE(szSearchString));
+ wcscpy(szTemp, szSearchString);
+ if (!bCaseSensitive)
+ ToLower(szTemp);
+
+ for (htiIterator = ((Button_GetCheck(GetDlgItem(hDlg,
IDC_CBX_FIND_FROM_BEGINNING)) == BST_CHECKED) ? (bSearchSense ? TreeView_GetFirst(hTree)
+
: TreeView_GetLast(hTree))
+
: (bSearchSense ? TreeView_GetNext(hTree,
TreeView_GetSelection(hTree))
+
: TreeView_GetPrev(hTree,
TreeView_GetSelection(hTree))));
+ htiIterator ;
+ htiIterator = (bSearchSense ? TreeView_GetNext(hTree,
htiIterator)
+ : TreeView_GetPrev(hTree,
htiIterator)))
+ {
+ SecureZeroMemory(&tvItemEx, sizeof(tvItemEx));
+
+ tvItemEx.hItem = htiIterator; // Handle of the item to be
retrieved
+ tvItemEx.mask = TVIF_HANDLE | TVIF_TEXT;
+ tvItemEx.pszText = label;
+ tvItemEx.cchTextMax = MAX_VALUE_NAME;
+ TreeView_GetItem(hTree, &tvItemEx);
+ if (!bCaseSensitive)
+ ToLower(label);
+
+ if (bMatchExactText ? (_tcscmp(label, szTemp) == 0) :
!!_tcsstr(label, szTemp)) // <-- hackish. A arranger.
+ {
+ TreeView_SelectItem(hTree, htiIterator);
+ EndDialog(hDlg, LOWORD(wParam));
+ return TRUE;
+ }
+ //MessageBox(NULL, label, _T("Info"),
MB_ICONINFORMATION | MB_OK);
+ }
+
+ // FIXME: Localize!
+ MessageBoxW(hDlg, L"No correspondence found.", szAppName,
MB_ICONINFORMATION | MB_OK);
+ SetFocus(GetDlgItem(hDlg, IDC_TXT_FIND_TEXT));
+ Edit_SetSel(GetDlgItem(hDlg, IDC_TXT_FIND_TEXT), 0, -1);
+ //EndDialog(hDlg, LOWORD(wParam));
+ return TRUE;
+ }
+
+ case IDCANCEL:
+ EndDialog(hDlg, LOWORD(wParam));
+ return TRUE;
+
+ default:
+ //break;
+ return FALSE;
+ }
+ }
+ }
+
+ return FALSE;
+}
+
+
+
+static void
+TreeView_SetBOOLCheck(HWND hTree, HTREEITEM htiItem, BOOL bState, BOOL
bPropagateStateToParent)
+{
+ if (!hTree || !htiItem)
+ return;
+
+ TreeView_SetCheckState(hTree, htiItem, bState);
+
+ /*
+ * Add or remove the token for tree leaves only.
+ */
+ if (!TreeView_GetChild(hTree, htiItem))
+ {
+ /* 1- Retrieve properties */
+ TVITEMEXW tvItemEx;
+ SecureZeroMemory(&tvItemEx, sizeof(tvItemEx));
+
+ tvItemEx.hItem = htiItem; // Handle of the item to be retrieved.
+ tvItemEx.mask = TVIF_HANDLE | TVIF_TEXT;
+ WCHAR label[MAX_VALUE_NAME] = L"";
+ tvItemEx.pszText = label;
+ tvItemEx.cchTextMax = MAX_VALUE_NAME;
+ TreeView_GetItem(hTree, &tvItemEx);
+
+ if (!bState)
+ {
+ /* 2- Add the token IF NEEDED */
+ if ((wcslen(tvItemEx.pszText) < MSConfigTokLen) ||
(_wcsnicmp(tvItemEx.pszText, szMSConfigTok, MSConfigTokLen) != 0))
+ {
+ LPWSTR newLabel = (LPWSTR)MemAlloc(0, (_tcslen(tvItemEx.pszText) +
MSConfigTokLen + 1) * sizeof(WCHAR));
+ wcscpy(newLabel, szMSConfigTok);
+ wcscat(newLabel, tvItemEx.pszText);
+ tvItemEx.pszText = newLabel;
+
+ TreeView_SetItem(hTree, &tvItemEx);
+
+ MemFree(newLabel);
+ }
+ }
+ else
+ {
+ /* 2- Remove the token IF NEEDED */
+ if ((wcslen(tvItemEx.pszText) >= MSConfigTokLen) &&
(_wcsnicmp(tvItemEx.pszText, szMSConfigTok, MSConfigTokLen) == 0))
+ {
+ LPWSTR newLabel = (LPWSTR)MemAlloc(0, (_tcslen(tvItemEx.pszText) -
MSConfigTokLen + 1) * sizeof(WCHAR));
+ wcscpy(newLabel, tvItemEx.pszText + MSConfigTokLen);
+ tvItemEx.pszText = newLabel;
+
+ TreeView_SetItem(hTree, &tvItemEx);
+
+ // TODO: if one finds tvItemEx.pszText == L"", one can
+ // directly remove the item (cf. message TVN_ENDLABELEDIT).
+
+ MemFree(newLabel);
+ }
+ }
+ }
+ ////////////////////////
+
+ for (HTREEITEM htiIterator = TreeView_GetChild(hTree, htiItem) ; htiIterator ;
htiIterator = TreeView_GetNextSibling(hTree, htiIterator))
+ TreeView_SetBOOLCheck(hTree, htiIterator, bState, FALSE);
+
+ if (bPropagateStateToParent)
+ TreeView_PropagateStateOfItemToParent(hTree, htiItem);
+
+ return;
+}
+
+static void
+LoadIniFile(HWND hTree, LPCWSTR lpszIniFile)
+{
+ // Ouverture en lecture (sans création de fichier si celui-ci n'esistait pas
déjà)
+ // d'un flux en mode texte, avec permission de lecture seule.
+ DWORD dwNumOfChars = ExpandEnvironmentStringsW(lpszIniFile, NULL, 0);
+ LPWSTR lpszFileName = (LPWSTR)MemAlloc(0, dwNumOfChars * sizeof(WCHAR));
+ ExpandEnvironmentStringsW(lpszIniFile, lpszFileName, dwNumOfChars);
+
+ FILE* ini_file = _wfsopen(lpszFileName, L"rt", _SH_DENYWR); // r+t <--
read write text ; rt <-- read text
+ MemFree(lpszFileName);
+
+ if (!ini_file)
+ return; // error
+
+ WCHAR szLine[MAX_VALUE_NAME] = L"";
+ TVINSERTSTRUCT tvis;
+ HTREEITEM hParent = TVI_ROOT;
+ BOOL bIsSection = FALSE;
+ LPWSTR lpsz1 = NULL;
+ LPWSTR lpsz2 = NULL;
+
+ while (!feof(ini_file) && fgetws(szLine, _ARRAYSIZE(szLine), ini_file))
+ {
+ /* Skip hypothetical starting spaces or newline characters */
+ lpsz1 = szLine;
+ while (*lpsz1 == L' ' || *lpsz1 == L'\r' || *lpsz1 ==
L'\n')
+ ++lpsz1;
+
+ /* Skip empty lines */
+ if (!*lpsz1)
+ continue;
+
+ /* Find the last newline character (if exists) and replace it by the NULL
terminator */
+ lpsz2 = lpsz1;
+ while (*lpsz2)
+ {
+ if (*lpsz2 == L'\r' || *lpsz2 == L'\n')
+ {
+ *lpsz2 = L'\0';
+ break;
+ }
+
+ ++lpsz2;
+ }
+
+ /* Check for new sections. They should be parent of ROOT. */
+ if (*lpsz1 == L'[')
+ {
+ bIsSection = TRUE;
+ hParent = TVI_ROOT;
+ }
+
+ SecureZeroMemory(&tvis, sizeof(tvis));
+ tvis.hParent = hParent;
+ tvis.hInsertAfter = TVI_LAST;
+ tvis.itemex.mask = TVIF_TEXT; // TVIF_HANDLE | TVIF_TEXT;
+ tvis.itemex.pszText = lpsz1;
+ tvis.itemex.hItem = TreeView_InsertItem(hTree, &tvis);
+
+ /* The special ";msconfig " token disables the line */
+ if (!bIsSection && _wcsnicmp(lpsz1, szMSConfigTok, MSConfigTokLen) == 0)
+ TreeView_SetBOOLCheck(hTree, tvis.itemex.hItem, FALSE, TRUE);
+ else
+ TreeView_SetBOOLCheck(hTree, tvis.itemex.hItem, TRUE, TRUE);
+
+ /*
+ * Now, all the elements will be children of this section,
+ * until we create a new one.
+ */
+ if (bIsSection)
+ {
+ bIsSection = FALSE;
+ hParent = tvis.itemex.hItem;
+ }
+ }
+
+ fclose(ini_file);
+ return;
+
+ //// Test code for the TreeView ////
+ /*
+ HTREEITEM hItem[16];
+
+ hItem[0] = InsertItem(hTree, _T("B"),TVI_ROOT,TVI_LAST);
+ hItem[1] = InsertItem(hTree, _T("C"),TVI_ROOT,TVI_LAST);
+ hItem[2] = InsertItem(hTree, _T("A"),TVI_ROOT,TVI_LAST);
+ hItem[3] = InsertItem(hTree, _T("D"),TVI_ROOT,TVI_LAST);
+ hItem[4] = InsertItem(hTree, _T("D-1"),hItem[3] ,TVI_LAST);
+ hItem[5] = InsertItem(hTree, _T("D-2"),hItem[3] ,TVI_LAST);
+ hItem[9] = InsertItem(hTree, _T("D-2-1"),hItem[5],TVI_LAST);
+ hItem[6] = InsertItem(hTree, _T("D-3"),hItem[3] ,TVI_LAST);
+ hItem[7] = InsertItem(hTree, _T("D-3-1"),hItem[6],TVI_LAST);
+ hItem[10] = InsertItem(hTree,
_T("D-3-1-1"),hItem[7],TVI_LAST);
+ hItem[11] = InsertItem(hTree,
_T("D-3-1-2"),hItem[7],TVI_LAST);
+ hItem[12] = InsertItem(hTree,
_T("D-3-1-3"),hItem[7],TVI_LAST);
+ hItem[13] = InsertItem(hTree,
_T("D-3-1-4"),hItem[7],TVI_LAST);
+ hItem[14] = InsertItem(hTree,
_T("D-3-1-5"),hItem[7],TVI_LAST);
+ hItem[15] = InsertItem(hTree,
_T("D-3-1-6"),hItem[7],TVI_LAST);
+ hItem[13] = InsertItem(hTree, _T("E"),TVI_ROOT,TVI_LAST);
+ */
+ ////////////////////////////////////
+
+}
+
+static void
+WriteIniFile(HWND hTree, LPCWSTR lpszIniFile)
+{
+ // Ouverture en écriture (avec création de fichier si celui-ci n'esistait pas
déjà)
+ // d'un flux en mode texte, avec permission de lecture seule.
+#if 0
+ DWORD dwNumOfChars = ExpandEnvironmentStringsW(lpszIniFile, NULL, 0);
+ LPWSTR lpszFileName = MemAlloc(0, dwNumOfChars * sizeof(WCHAR));
+ ExpandEnvironmentStringsW(lpszIniFile, lpszFileName, dwNumOfChars);
+#else
+ // HACK: delete these following lines when the program will be ready.
+ DWORD dwNumOfChars = ExpandEnvironmentStringsW(lpszIniFile, NULL, 0) + 11;
+ LPWSTR lpszFileName = (LPWSTR)MemAlloc(0, dwNumOfChars * sizeof(WCHAR));
+ ExpandEnvironmentStringsW(lpszIniFile, lpszFileName, dwNumOfChars);
+ wcscat(lpszFileName, L"__tests.ini");
+ // END HACK.
+#endif
+
+ FILE* ini_file = _wfsopen(lpszFileName, L"wt", _SH_DENYRW); // w+t <--
write read text ; wt <-- write text
+ MemFree(lpszFileName);
+
+ if (!ini_file)
+ return; // error
+
+
+ TVITEMEXW tvItemEx;
+ WCHAR label[MAX_VALUE_NAME] = L"";
+ // WCHAR szLine[MAX_VALUE_NAME] = L"";
+
+ // for (HTREEITEM htiIterator = TreeView_GetRoot(hTree) ; htiIterator ; htiIterator =
TreeView_GetNextSibling(hTree, htiIterator))
+ for (HTREEITEM htiIterator = TreeView_GetFirst(hTree) ; htiIterator ; htiIterator =
TreeView_GetNext(hTree, htiIterator))
+ {
+ SecureZeroMemory(&tvItemEx, sizeof(tvItemEx));
+
+ tvItemEx.hItem = htiIterator; // Handle of the item to be retrieved.
+ tvItemEx.mask = TVIF_HANDLE | TVIF_TEXT;
+ tvItemEx.pszText = label;
+ tvItemEx.cchTextMax = MAX_VALUE_NAME;
+ TreeView_GetItem(hTree, &tvItemEx);
+
+ // Write into the file.
+ wcscat(label, L"\n");
+ fputws(label, ini_file);
+ }
+
+ fclose(ini_file);
+ return;
+}
+
+static void
+Update_Btn_States(HWND hDlg)
+{
+ HWND hTree = GetDlgItem(hDlg, IDC_SYSTEM_TREE);
+
+ HTREEITEM hti = TreeView_GetSelection(hTree);
+ HTREEITEM htiPrev = TreeView_GetPrevSibling(hTree, hti);
+ HTREEITEM htiNext = TreeView_GetNextSibling(hTree, hti);
+
+ //
+ // "Up" / "Down" buttons.
+ //
+ if (htiPrev)
+ EnableWindow(GetDlgItem(hDlg, IDC_BTN_SYSTEM_UP), TRUE);
+ else
+ EnableWindow(GetDlgItem(hDlg, IDC_BTN_SYSTEM_UP), FALSE);
+
+ if (htiNext)
+ EnableWindow(GetDlgItem(hDlg, IDC_BTN_SYSTEM_DOWN), TRUE);
+ else
+ EnableWindow(GetDlgItem(hDlg, IDC_BTN_SYSTEM_DOWN), FALSE);
+
+ //
+ // "Enable" / "Disable" buttons.
+ //
+ UINT uCheckState = TreeView_GetCheckState(hTree, hti);
+ if (uCheckState == 0)
+ {
+ EnableWindow(GetDlgItem(hDlg, IDC_BTN_SYSTEM_ENABLE) , TRUE);
+ EnableWindow(GetDlgItem(hDlg, IDC_BTN_SYSTEM_DISABLE), FALSE);
+ }
+ else if (uCheckState == 1)
+ {
+ EnableWindow(GetDlgItem(hDlg, IDC_BTN_SYSTEM_ENABLE) , FALSE);
+ EnableWindow(GetDlgItem(hDlg, IDC_BTN_SYSTEM_DISABLE), TRUE);
+ }
+ else if (uCheckState == 2)
+ {
+ EnableWindow(GetDlgItem(hDlg, IDC_BTN_SYSTEM_ENABLE) , TRUE);
+ EnableWindow(GetDlgItem(hDlg, IDC_BTN_SYSTEM_DISABLE), TRUE);
+ }
+ else
+ {
+ EnableWindow(GetDlgItem(hDlg, IDC_BTN_SYSTEM_ENABLE) , FALSE);
+ EnableWindow(GetDlgItem(hDlg, IDC_BTN_SYSTEM_DISABLE), FALSE);
+ }
+
+ //
+ // "Enable all" / "Disable all" buttons.
+ //
+ UINT uRootCheckState = TreeView_GetRealSubtreeState(hTree, TVI_ROOT);
+ if (uRootCheckState == 0)
+ {
+ EnableWindow(GetDlgItem(hDlg, IDC_BTN_SYSTEM_ENABLE_ALL) , TRUE);
+ EnableWindow(GetDlgItem(hDlg, IDC_BTN_SYSTEM_DISABLE_ALL), FALSE);
+ }
+ else if (uRootCheckState == 1)
+ {
+ EnableWindow(GetDlgItem(hDlg, IDC_BTN_SYSTEM_ENABLE_ALL) , FALSE);
+ EnableWindow(GetDlgItem(hDlg, IDC_BTN_SYSTEM_DISABLE_ALL), TRUE);
+ }
+ else if (uRootCheckState == 2)
+ {
+ EnableWindow(GetDlgItem(hDlg, IDC_BTN_SYSTEM_ENABLE_ALL) , TRUE);
+ EnableWindow(GetDlgItem(hDlg, IDC_BTN_SYSTEM_DISABLE_ALL), TRUE);
+ }
+ else
+ {
+ EnableWindow(GetDlgItem(hDlg, IDC_BTN_SYSTEM_ENABLE_ALL) , FALSE);
+ EnableWindow(GetDlgItem(hDlg, IDC_BTN_SYSTEM_DISABLE_ALL), FALSE);
+ }
+
+ //
+ // "Search" / "Edit" / "Delete" buttons.
+ //
+ if (TreeView_GetRoot(hTree))
+ {
+ EnableWindow(GetDlgItem(hDlg, IDC_BTN_SYSTEM_FIND) , TRUE);
+ EnableWindow(GetDlgItem(hDlg, IDC_BTN_SYSTEM_EDIT) , TRUE);
+ EnableWindow(GetDlgItem(hDlg, IDC_BTN_SYSTEM_DELETE), TRUE);
+ }
+ else
+ {
+ EnableWindow(GetDlgItem(hDlg, IDC_BTN_SYSTEM_FIND) , FALSE);
+ EnableWindow(GetDlgItem(hDlg, IDC_BTN_SYSTEM_EDIT) , FALSE);
+ EnableWindow(GetDlgItem(hDlg, IDC_BTN_SYSTEM_DELETE), FALSE);
+ }
+
+ return;
+}
+
+
+INT_PTR
+CommonWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
+{
+ UNREFERENCED_PARAMETER(lParam);
+ UNREFERENCED_PARAMETER(wParam);
+
+ switch (message)
+ {
+ case WM_INITDIALOG:
+ {
+ HWND hSystemTree = GetDlgItem(hDlg, IDC_SYSTEM_TREE);
+
+ //
+ // Initialize the styles.
+ //
+ TreeView_Set3StateCheck(hSystemTree);
+ SetWindowTheme(hSystemTree, L"Explorer", NULL);
+
+ TreeView_SetIndent(hSystemTree, TreeView_GetIndent(hSystemTree) + 2);
+
+ /* Load data */
+ LoadIniFile(hSystemTree, (LPCWSTR)((LPPROPSHEETPAGE)lParam)->lParam);
+
+ /* Select the first item */
+ TreeView_SelectItem(hSystemTree, TreeView_GetRoot(hSystemTree)); // Is it
really necessary?
+ SetFocus(hSystemTree);
+
+ Update_Btn_States(hDlg);
+
+ return TRUE;
+ }
+
+ case WM_DESTROY:
+ {
+ TreeView_Cleanup(GetDlgItem(hDlg, IDC_SYSTEM_TREE));
+ return FALSE;
+ }
+
+ case WM_COMMAND:
+ {
+ HWND hSystemTree = GetDlgItem(hDlg, IDC_SYSTEM_TREE);
+
+ switch (LOWORD(wParam))
+ {
+ case IDC_BTN_SYSTEM_UP:
+ {
+ TreeView_UpItem(hSystemTree, TreeView_GetSelection(hSystemTree));
+ PropSheet_Changed(GetParent(hDlg), hDlg);
+ return TRUE;
+ }
+
+ case IDC_BTN_SYSTEM_DOWN:
+ {
+ TreeView_DownItem(hSystemTree, TreeView_GetSelection(hSystemTree));
+ PropSheet_Changed(GetParent(hDlg), hDlg);
+ return TRUE;
+ }
+
+ case IDC_BTN_SYSTEM_ENABLE:
+ {
+ HTREEITEM hItem = TreeView_GetSelection(hSystemTree);
+ TreeView_SetBOOLCheck(hSystemTree, hItem, TRUE, TRUE);
+ TreeView_SelectItem(hSystemTree, hItem);
+ Update_Btn_States(hDlg);
+
+ PropSheet_Changed(GetParent(hDlg), hDlg);
+
+ return TRUE;
+ }
+
+ case IDC_BTN_SYSTEM_ENABLE_ALL:
+ {
+ for (HTREEITEM htiIterator = TreeView_GetRoot(hSystemTree) ;
htiIterator ; htiIterator = TreeView_GetNextSibling(hSystemTree, htiIterator))
+ TreeView_SetBOOLCheck(hSystemTree, htiIterator, TRUE, TRUE);
+
+ Update_Btn_States(hDlg);
+
+ PropSheet_Changed(GetParent(hDlg), hDlg);
+
+ return TRUE;
+ }
+
+ case IDC_BTN_SYSTEM_DISABLE:
+ {
+ HTREEITEM hItem = TreeView_GetSelection(hSystemTree);
+ TreeView_SetBOOLCheck(hSystemTree, hItem, FALSE, TRUE);
+ TreeView_SelectItem(hSystemTree, hItem);
+
+ Update_Btn_States(hDlg);
+
+ PropSheet_Changed(GetParent(hDlg), hDlg);
+
+ return TRUE;
+ }
+
+ case IDC_BTN_SYSTEM_DISABLE_ALL:
+ {
+ for (HTREEITEM htiIterator = TreeView_GetRoot(hSystemTree) ;
htiIterator ; htiIterator = TreeView_GetNextSibling(hSystemTree, htiIterator))
+ TreeView_SetBOOLCheck(hSystemTree, htiIterator, FALSE, TRUE);
+
+ Update_Btn_States(hDlg);
+
+ PropSheet_Changed(GetParent(hDlg), hDlg);
+
+ return TRUE;
+ }
+
+ case IDC_BTN_SYSTEM_FIND:
+ {
+ DialogBoxParamW(hInst, MAKEINTRESOURCEW(IDD_FIND_DIALOG), hDlg /*
hMainWnd */, FindDialogWndProc, (LPARAM)hSystemTree);
+ return TRUE;
+ }
+
+ case IDC_BTN_SYSTEM_NEW:
+ {
+ HTREEITEM hInsertAfter = TreeView_GetSelection(hSystemTree);
+ HTREEITEM hNewItem = InsertItem(hSystemTree, L"",
TreeView_GetParent(hSystemTree, hInsertAfter), hInsertAfter);
+ TreeView_EditLabel(hSystemTree, hNewItem);
+ TreeView_SelectItem(hSystemTree, hNewItem);
+
+ PropSheet_Changed(GetParent(hDlg), hDlg);
+
+ return TRUE;
+ }
+
+ case IDC_BTN_SYSTEM_EDIT:
+ {
+ TreeView_EditLabel(hSystemTree, TreeView_GetSelection(hSystemTree));
+ return TRUE;
+ }
+
+ case IDC_BTN_SYSTEM_DELETE:
+ {
+ TreeView_DeleteItem(hSystemTree,
TreeView_GetSelection(hSystemTree));
+ Update_Btn_States(hDlg);
+ PropSheet_Changed(GetParent(hDlg), hDlg);
+ return TRUE;
+ }
+
+ default:
+ return FALSE;
+ }
+ // return FALSE;
+ }
+
+ case UM_CHECKSTATECHANGE:
+ {
+ HWND hSystemTree = GetDlgItem(hDlg, IDC_SYSTEM_TREE);
+
+ /* Retrieve the new checked state of the item and handle the notification */
+ HTREEITEM hItemChanged = (HTREEITEM)lParam;
+
+ //
+ // State before | State after
+ // -------------------------------
+ // 0 (unchecked) | 1 (checked)
+ // 1 (checked) | 0 (unchecked)
+ // 2 (grayed) | 1 (checked) --> this case corresponds to the former
+ // | with 0 == 2 mod 2.
+ //
+ UINT uiCheckState = TreeView_GetCheckState(hSystemTree, hItemChanged) % 2;
+ TreeView_SetBOOLCheck(hSystemTree, hItemChanged, uiCheckState ? FALSE : TRUE,
TRUE);
+ TreeView_SelectItem(hSystemTree, hItemChanged);
+ Update_Btn_States(hDlg);
+
+ PropSheet_Changed(GetParent(hDlg), hDlg);
+
+ return TRUE;
+ }
+
+ case WM_NOTIFY:
+ {
+ if (((LPNMHDR)lParam)->idFrom == IDC_SYSTEM_TREE)
+ {
+ switch (((LPNMHDR)lParam)->code)
+ {
+ case NM_CLICK:
+ {
+ HWND hSystemTree = GetDlgItem(hDlg, IDC_SYSTEM_TREE);
+
+ DWORD dwpos = GetMessagePos();
+ TVHITTESTINFO ht = {};
+ ht.pt.x = GET_X_LPARAM(dwpos);
+ ht.pt.y = GET_Y_LPARAM(dwpos);
+ MapWindowPoints(HWND_DESKTOP /*NULL*/, hSystemTree, &ht.pt,
1);
+
+ TreeView_HitTest(hSystemTree, &ht);
+
+ if (TVHT_ONITEMSTATEICON & ht.flags)
+ {
+ PostMessage(hDlg, UM_CHECKSTATECHANGE, 0, (LPARAM)ht.hItem);
+
+ // Disable default behaviour. Needed for the
UM_CHECKSTATECHANGE
+ // custom notification to work as expected.
+ SetWindowLongPtr(hDlg, DWLP_MSGRESULT, TRUE);
+ }
+ /*
+ else
+ SetWindowLongPtr(hDlg, DWLP_MSGRESULT, FALSE);
+ */
+
+ return TRUE;
+ }
+
+ case TVN_KEYDOWN:
+ {
+ if (((LPNMTVKEYDOWN)lParam)->wVKey == VK_SPACE)
+ {
+ HWND hSystemTree = GetDlgItem(hDlg, IDC_SYSTEM_TREE);
+
+ HTREEITEM hti = TreeView_GetSelection(hSystemTree);
+
+ // Hack the tree item state. This is needed because whether
or not
+ // TRUE is being returned, the default implementation of
SysTreeView32
+ // is always being processed for a key down !
+ if (GetWindowLongPtr(hSystemTree, GWL_STYLE) &
TVS_CHECKBOXES)
+ {
+ TreeView_SetItemState(hSystemTree, hti,
INDEXTOSTATEIMAGEMASK(TreeView_GetCheckState(hSystemTree, hti)), TVIS_STATEIMAGEMASK);
+ }
+
+ PostMessage(hDlg, UM_CHECKSTATECHANGE, 0, (LPARAM)hti);
+
+ // Disable default behaviour. Needed for the
UM_CHECKSTATECHANGE
+ // custom notification to work as expected.
+ SetWindowLongPtr(hDlg, DWLP_MSGRESULT, TRUE);
+ }
+
+ return TRUE;
+ }
+
+ case TVN_ENDLABELEDIT:
+ {
+ HWND hSystemTree = GetDlgItem(hDlg, IDC_SYSTEM_TREE);
+
+ /*
+ * Ehh yes, we have to deal with a "dialog proc", which
is quite different from a "window proc":
+ *
+ * (excerpt from: MSDN library
http://msdn.microsoft.com/en-us/library/ms645469(VS.85).aspx)
+ *
+ * Return Value
+ * ============
+ * INT_PTR
+ *
+ * Typically, the dialog box procedure should return TRUE if it
processed the message, and FALSE if it did not.
+ * If the dialog box procedure returns FALSE, the dialog manager
performs the default dialog operation in response
+ * to the message.
+ *
+ * If the dialog box procedure processes a message that requires
a specific return value, the dialog box procedure
+ * should set the desired return value by calling
SetWindowLong(hwndDlg, DWL_MSGRESULT, lResult) immediately before
+ * returning TRUE. Note that you must call SetWindowLong
immediately before returning TRUE; doing so earlier may result
+ * in the DWL_MSGRESULT value being overwritten by a nested
dialog box message.
+ *
+ * [...]
+ *
+ * Remarks
+ * =======
+ * You should use the dialog box procedure only if you use the
dialog box class for the dialog box. This is the default
+ * class and is used when no explicit class is specified in the
dialog box template. Although the dialog box procedure
+ * is similar to a window procedure, it must not call the
DefWindowProc function to process unwanted messages. Unwanted
+ * messages are processed internally by the dialog box window
procedure.
+ *
+ */
+
+ // A arranger un peu ???? Certainement.
+ TVITEMW truc = ((LPNMTVDISPINFO)lParam)->item;
+ if (truc.pszText)
+ {
+ if (!*truc.pszText)
+ TreeView_DeleteItem(hSystemTree, truc.hItem);
+
+ PropSheet_Changed(GetParent(hDlg), hDlg);
+
+ SetWindowLongPtr(hDlg, DWLP_MSGRESULT, TRUE);
+ }
+ else
+ SetWindowLongPtr(hDlg, DWLP_MSGRESULT, FALSE);
+
+ Update_Btn_States(hDlg);
+ return TRUE;
+ }
+
+ case TVN_SELCHANGED:
+ Update_Btn_States(hDlg);
+ return TRUE;
+
+ default:
+ return FALSE;
+ }
+ }
+ else
+ {
+ switch (((LPNMHDR)lParam)->code)
+ {
+ case PSN_APPLY:
+ {
+ // TODO: Enum the items.
+ // HWND hSystemTree = GetDlgItem(hDlg, IDC_SYSTEM_TREE);
+ //
+ PropSheet_CancelToClose(GetParent(hDlg));
+
+ /* TODO: see :
+ *
+ * dll/win32/devmgr/advprop.c:
PropSheet_RebootSystem(hwndDlg);
+ * include/psdk/prsht.h:#define PropSheet_RebootSystem(d)
SendMessage(d,PSM_REBOOTSYSTEM,0,0)
+ *
+ * dll/shellext/deskadp/deskadp.c:
PropSheet_RestartWindows(GetParent(This->hwndDlg));
+ * dll/shellext/deskmon/deskmon.c:
PropSheet_RestartWindows(GetParent(This->hwndDlg));
+ * include/psdk/prsht.h:#define PropSheet_RestartWindows(d)
SendMessage(d,PSM_RESTARTWINDOWS,0,0)
+ *
+ * for their usage.
+ */
+ PropSheet_RebootSystem(GetParent(hDlg));
+ //PropSheet_RestartWindows(GetParent(hDlg));
+
+ WriteIniFile(GetDlgItem(hDlg, IDC_SYSTEM_TREE),
(LPCWSTR)wParam);
+
+ // Since there are nothing to modify, applying modifications
+ // cannot return any error.
+ SetWindowLongPtr(hDlg, DWLP_MSGRESULT, PSNRET_NOERROR);
+ //PropSheet_UnChanged(GetParent(hDlg) /*hMainWnd*/, hDlg);
+ return TRUE;
+ }
+
+ case PSN_HELP:
+ {
+ MessageBox(hDlg, _T("Help not implemented yet!"),
_T("Help"), MB_ICONINFORMATION | MB_OK);
+ return TRUE;
+ }
+
+ case PSN_KILLACTIVE: // Is going to lose activation.
+ {
+ // Changes are always valid of course.
+ SetWindowLongPtr(hDlg, DWLP_MSGRESULT, FALSE);
+ return TRUE;
+ }
+
+ case PSN_QUERYCANCEL:
+ {
+ // Allows cancellation since there are nothing to cancel...
+ SetWindowLongPtr(hDlg, DWLP_MSGRESULT, FALSE);
+ return TRUE;
+ }
+
+ case PSN_QUERYINITIALFOCUS:
+ {
+ HWND hSystemTree = GetDlgItem(hDlg, IDC_SYSTEM_TREE);
+
+ // Give the focus on and select the first item.
+ ListView_SetItemState(hSystemTree, 0, LVIS_FOCUSED |
LVIS_SELECTED, LVIS_FOCUSED | LVIS_SELECTED);
+
+ SetWindowLongPtr(hDlg, DWLP_MSGRESULT, (LONG_PTR)hSystemTree);
+ return TRUE;
+ }
+
+ //
+ // DO NOT TOUCH THESE NEXT MESSAGES, THEY ARE OK LIKE THIS...
+ //
+ case PSN_RESET: // Perform final cleaning, called before WM_DESTROY.
+ return TRUE;
+
+ case PSN_SETACTIVE: // Is going to gain activation.
+ {
+ SetWindowLongPtr(hDlg, DWLP_MSGRESULT, 0);
+ return TRUE;
+ }
+
+ default:
+ break;
+ }
+ }
+
+ return FALSE;
+ }
+
+ default:
+ return FALSE;
+ }
+
+ // return FALSE;
+}
+
+
+extern "C" {
+
+INT_PTR CALLBACK
+SystemPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
+{
+ static LPCWSTR lpszIniFile = NULL;
+
+ if (message == WM_INITDIALOG)
+ lpszIniFile = (LPCWSTR)((LPPROPSHEETPAGE)lParam)->lParam;
+
+ if ( (message == WM_NOTIFY) && (((LPNMHDR)lParam)->code == PSN_APPLY) )
+ wParam = (WPARAM)lpszIniFile;
+
+ return CommonWndProc(hDlg, message, wParam, lParam);
+}
+
+INT_PTR CALLBACK
+WinPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
+{
+ static LPCWSTR lpszIniFile = NULL;
+
+ if (message == WM_INITDIALOG)
+ lpszIniFile = (LPCWSTR)((LPPROPSHEETPAGE)lParam)->lParam;
+
+ if ( (message == WM_NOTIFY) && (((LPNMHDR)lParam)->code == PSN_APPLY) )
+ wParam = (WPARAM)lpszIniFile;
+
+ return CommonWndProc(hDlg, message, wParam, lParam);
+}
+
+}
Propchange: trunk/reactos/base/applications/msconfig_new/systempage.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Modified: trunk/reactos/base/applications/msconfig_new/systempage.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/msconfig…
==============================================================================
--- trunk/reactos/base/applications/msconfig_new/systempage.h [iso-8859-1] (original)
+++ trunk/reactos/base/applications/msconfig_new/systempage.h [iso-8859-1] Sat Oct 31
21:00:32 2015
@@ -1,8 +1,23 @@
+/*
+ * PROJECT: ReactOS Applications
+ * LICENSE: LGPL - See COPYING in the top level directory
+ * FILE: base/applications/msconfig_new/systempage.h
+ * PURPOSE: System page message handler
+ * COPYRIGHT: Copyright 2005-2006 Christoph von Wittich <Christoph(a)ApiViewer.de>
+ * 2011 Gregor Schneider
<Gregor.Schneider(a)reactos.org>
+ * Copyright 2011-2012 Hermes BELUSCA - MAITO <hermes.belusca(a)sfr.fr>
+ */
+
#ifndef _SYSTEMPAGE_H_
#define _SYSTEMPAGE_H_
-extern HWND hSystemPage;
+extern LPCWSTR lpszSystemIni;
+extern LPCWSTR lpszWinIni;
+
+DWORD GetSystemIniActivation(VOID);
+DWORD GetWinIniActivation(VOID);
INT_PTR CALLBACK SystemPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM
lParam);
+INT_PTR CALLBACK WinPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
-#endif /* _SYSTEMPAGE_H_ */
+#endif
Modified: trunk/reactos/base/applications/msconfig_new/toolspage.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/msconfig…
==============================================================================
--- trunk/reactos/base/applications/msconfig_new/toolspage.cpp [iso-8859-1] (original)
+++ trunk/reactos/base/applications/msconfig_new/toolspage.cpp [iso-8859-1] Sat Oct 31
21:00:32 2015
@@ -10,7 +10,7 @@
#include "precomp.h"
#include "xmldomparser.hpp"
#include "utils.h"
-#include "listviewfuncs.h"
+#include "listview.h"
#include "uxthemesupp.h"
static HWND hToolsPage = NULL;
@@ -229,8 +229,6 @@
return numOfChars;
}
-
-#define Button_IsEnabled(hwndCtl) IsWindowEnabled((hwndCtl))
static void Update_States(int iSelectedItem)
{