Author: hbelusca
Date: Tue Oct 20 21:57:36 2015
New Revision: 69630
URL:
http://svn.reactos.org/svn/reactos?rev=69630&view=rev
Log:
[MSCONFIG_NEW]
- Add some file utility functions, they will be used later for managing the startup
programs.
- Half-plement the general page controls.
- Simplify some code; fix file headers; remove the old toolspage.c (replaced by its c++
equivalent).
CORE-9333
Added:
trunk/reactos/base/applications/msconfig_new/fileutils.c (with props)
trunk/reactos/base/applications/msconfig_new/fileutils.h (with props)
Removed:
trunk/reactos/base/applications/msconfig_new/toolspage.c
Modified:
trunk/reactos/base/applications/msconfig_new/CMakeLists.txt
trunk/reactos/base/applications/msconfig_new/generalpage.c
trunk/reactos/base/applications/msconfig_new/generalpage.h
trunk/reactos/base/applications/msconfig_new/msconfig.c
trunk/reactos/base/applications/msconfig_new/toolspage.cpp
trunk/reactos/base/applications/msconfig_new/toolspage.h
trunk/reactos/base/applications/msconfig_new/utils.c
trunk/reactos/base/applications/msconfig_new/utils.h
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] Tue Oct 20
21:57:36 2015
@@ -10,11 +10,11 @@
list(APPEND C_SOURCE
comctl32ex/listviewfuncs.c
- # toolspage.c
# srvpage.c
# systempage.c
# startuppage.c
# freeldrpage.c
+ fileutils.c
generalpage.c
msconfig.c
stringutils.c
Added: trunk/reactos/base/applications/msconfig_new/fileutils.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/msconfig…
==============================================================================
--- trunk/reactos/base/applications/msconfig_new/fileutils.c (added)
+++ trunk/reactos/base/applications/msconfig_new/fileutils.c [iso-8859-1] Tue Oct 20
21:57:36 2015
@@ -0,0 +1,90 @@
+/*
+ * PROJECT: ReactOS Applications
+ * LICENSE: LGPL - See COPYING in the top level directory
+ * FILE: base/applications/msconfig_new/fileutils.c
+ * PURPOSE: File Utility Functions
+ * COPYRIGHT: Copyright 2011-2012 Hermes BELUSCA - MAITO <hermes.belusca(a)sfr.fr>
+ */
+
+#include "precomp.h"
+#include "utils.h"
+#include "fileutils.h"
+
+//
+// NOTE: A function called "FileExists" with the very same prototype
+// already exists in the PSDK headers (in setupapi.h)
+//
+BOOL
+MyFileExists(IN LPCWSTR lpszFilePath,
+ OUT PWIN32_FIND_DATAW pFindData OPTIONAL)
+{
+ BOOL bIsFound = FALSE;
+ WIN32_FIND_DATAW find_data;
+
+ DWORD dwNumOfChars;
+ LPWSTR lpszCmdLine;
+ HANDLE search;
+
+ dwNumOfChars = ExpandEnvironmentStringsW(lpszFilePath, NULL, 0);
+ lpszCmdLine = (LPWSTR)MemAlloc(0, dwNumOfChars * sizeof(WCHAR));
+ ExpandEnvironmentStringsW(lpszFilePath, lpszCmdLine, dwNumOfChars);
+
+ search = FindFirstFileW(lpszCmdLine, &find_data);
+ MemFree(lpszCmdLine);
+
+ bIsFound = (search != INVALID_HANDLE_VALUE);
+
+ FindClose(search);
+
+ if (bIsFound && pFindData)
+ *pFindData = find_data;
+
+ return bIsFound;
+}
+
+LRESULT
+FileQueryFiles(IN LPCWSTR Path,
+ IN LPCWSTR FileNamesQuery,
+ IN PQUERY_FILES_TABLE QueryTable,
+ IN PVOID Context)
+{
+ LRESULT res = ERROR_SUCCESS;
+ WIN32_FIND_DATAW find_data;
+
+ LPWSTR lpszQuery;
+ DWORD dwNumOfChars;
+ LPWSTR lpszExpandedQuery;
+ HANDLE search;
+
+ lpszQuery = (LPWSTR)MemAlloc(0, (wcslen(Path) + 1 + wcslen(FileNamesQuery) + 1) *
sizeof(WCHAR));
+ wcscpy(lpszQuery, Path);
+ wcscat(lpszQuery, L"\\");
+ wcscat(lpszQuery, FileNamesQuery);
+
+ dwNumOfChars = ExpandEnvironmentStringsW(lpszQuery, NULL, 0);
+ lpszExpandedQuery = (LPWSTR)MemAlloc(0, dwNumOfChars * sizeof(WCHAR));
+ ExpandEnvironmentStringsW(lpszQuery, lpszExpandedQuery, dwNumOfChars);
+ MemFree(lpszQuery);
+
+ search = FindFirstFileW(lpszExpandedQuery, &find_data);
+ if (search != INVALID_HANDLE_VALUE)
+ {
+ do
+ {
+ PQUERY_FILES_TABLE pTable = QueryTable;
+ while (pTable && pTable->QueryRoutine)
+ {
+ pTable->QueryRoutine(Path, FileNamesQuery, lpszExpandedQuery,
&find_data, Context, pTable->EntryContext);
+ ++pTable;
+ }
+ } while (/*res = */ FindNextFileW(search, &find_data));
+ }
+ else
+ res = ERROR_NO_MORE_FILES;
+
+ FindClose(search);
+
+ MemFree(lpszExpandedQuery);
+
+ return res;
+}
Propchange: trunk/reactos/base/applications/msconfig_new/fileutils.c
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/reactos/base/applications/msconfig_new/fileutils.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/msconfig…
==============================================================================
--- trunk/reactos/base/applications/msconfig_new/fileutils.h (added)
+++ trunk/reactos/base/applications/msconfig_new/fileutils.h [iso-8859-1] Tue Oct 20
21:57:36 2015
@@ -0,0 +1,62 @@
+/*
+ * PROJECT: ReactOS Applications
+ * LICENSE: LGPL - See COPYING in the top level directory
+ * FILE: base/applications/msconfig_new/fileutils.h
+ * PURPOSE: File Utility Functions
+ * COPYRIGHT: Copyright 2011-2012 Hermes BELUSCA - MAITO <hermes.belusca(a)sfr.fr>
+ */
+
+#ifndef __FILEUTILS_H__
+#define __FILEUTILS_H__
+
+#pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+//
+// NOTE: A function called "FileExists" with the very same prototype
+// already exists in the PSDK headers (in setupapi.h)
+//
+BOOL
+MyFileExists(IN LPCWSTR lpszFilePath,
+ OUT PWIN32_FIND_DATAW pFindData OPTIONAL);
+
+////////////////////////////////////////////////////////////////////////////////
+typedef LRESULT
+(*PQUERY_FILES_TABLE_ROUTINE)(IN LPCWSTR Path,
+ IN LPCWSTR FileNamesQuery,
+ IN LPCWSTR ExpandedFileNamesQuery,
+ IN PWIN32_FIND_DATAW pfind_data,
+ IN PVOID Context,
+ IN PVOID EntryContext);
+
+#define QUERY_FILES_TABLE_ROUTINE(fnName) \
+ LRESULT (fnName)(IN LPCWSTR Path, \
+ IN LPCWSTR FileNamesQuery, \
+ IN LPCWSTR ExpandedFileNamesQuery, \
+ IN PWIN32_FIND_DATAW pfind_data, \
+ IN PVOID Context, \
+ IN PVOID EntryContext)
+
+typedef struct __tagQUERY_FILES_TABLE
+{
+ PQUERY_FILES_TABLE_ROUTINE QueryRoutine;
+ PVOID EntryContext;
+ // Other fields ?
+} QUERY_FILES_TABLE, *PQUERY_FILES_TABLE;
+
+LRESULT
+FileQueryFiles(IN LPCWSTR Path,
+ IN LPCWSTR FileNamesQuery,
+ IN PQUERY_FILES_TABLE QueryTable,
+ IN PVOID Context);
+
+////////////////////////////////////////////////////////////////////////////////
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // __FILEUTILS_H__
Propchange: trunk/reactos/base/applications/msconfig_new/fileutils.h
------------------------------------------------------------------------------
svn:eol-style = native
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] Tue Oct 20
21:57:36 2015
@@ -4,17 +4,21 @@
* FILE: base/applications/msconfig_new/generalpage.c
* PURPOSE: General page message handler
* COPYRIGHT: Copyright 2005-2006 Christoph von Wittich <Christoph(a)ApiViewer.de>
- *
+ * Copyright 2011-2012 Hermes BELUSCA - MAITO <hermes.belusca(a)sfr.fr>
*/
#include "precomp.h"
-
-// static LPCWSTR lpszRestoreProgPath1 =
L"%SystemRoot%\\System32\\rstrui.exe";
-// static LPCWSTR lpszRestoreProgPath2 =
L"%SystemRoot%\\System32\\restore\\rstrui.exe";
-
-HWND hGeneralPage;
-
-#if 0 // TODO: Will be used later on...
+#include "fileutils.h"
+#include "utils.h"
+#include "commctrldefs.h"
+
+static LPCWSTR lpszRestoreProgPath1 = L"%SystemRoot%\\System32\\rstrui.exe";
+static LPCWSTR lpszRestoreProgPath2 =
L"%SystemRoot%\\System32\\restore\\rstrui.exe";
+
+static HWND hGeneralPage = NULL;
+static BOOL bIsOriginalBootIni = TRUE;
+static BOOL bIsStartupNotModified = TRUE;
+
static VOID EnableSelectiveStartupControls(BOOL bEnable)
{
assert(hGeneralPage);
@@ -45,7 +49,6 @@
return;
}
-#endif
INT_PTR CALLBACK
GeneralPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
@@ -57,7 +60,14 @@
case WM_INITDIALOG:
{
hGeneralPage = hDlg;
- PropSheet_UnChanged(hMainWnd, hGeneralPage);
+ PropSheet_UnChanged(GetParent(hGeneralPage), hGeneralPage);
+
+ /* Search for the restore program and enable its button if needed */
+ if ( MyFileExists(lpszRestoreProgPath1, NULL) ||
+ MyFileExists(lpszRestoreProgPath2, NULL) )
+ Button_Enable(GetDlgItem(hGeneralPage, IDC_BTN_SYSTEM_RESTORE_START),
TRUE);
+ else
+ Button_Enable(GetDlgItem(hGeneralPage, IDC_BTN_SYSTEM_RESTORE_START),
FALSE);
#if 0
/* FIXME */
@@ -67,6 +77,141 @@
return TRUE;
}
+
+ case WM_COMMAND:
+ {
+ switch (LOWORD(wParam))
+ {
+ case IDC_RB_NORMAL_STARTUP:
+ {
+ /* Be sure that only this button is activated and the others are not
*/
+ CheckRadioButton(hGeneralPage, IDC_RB_NORMAL_STARTUP,
IDC_RB_SELECTIVE_STARTUP, IDC_RB_NORMAL_STARTUP);
+
+ bIsOriginalBootIni = TRUE;
+ EnableSelectiveStartupControls(FALSE);
+ CheckSelectiveStartupControls(TRUE);
+
+ Button_SetCheck(GetDlgItem(hGeneralPage,
IDC_CBX_USE_ORIGINAL_BOOTCFG), (bIsOriginalBootIni ? BST_CHECKED : BST_UNCHECKED));
+
+ PropSheet_Changed(GetParent(hGeneralPage), hGeneralPage);
+ break;
+ }
+
+ case IDC_RB_DIAGNOSTIC_STARTUP:
+ {
+ /* Be sure that only this button is activated and the others are not
*/
+ CheckRadioButton(hGeneralPage, IDC_RB_NORMAL_STARTUP,
IDC_RB_SELECTIVE_STARTUP, IDC_RB_DIAGNOSTIC_STARTUP);
+
+ EnableSelectiveStartupControls(FALSE);
+ CheckSelectiveStartupControls(FALSE);
+
+ PropSheet_Changed(GetParent(hGeneralPage), hGeneralPage);
+ break;
+ }
+
+ case IDC_RB_SELECTIVE_STARTUP:
+ {
+ /* Be sure that only this button is activated and the others are not
*/
+ CheckRadioButton(hGeneralPage, IDC_RB_NORMAL_STARTUP,
IDC_RB_SELECTIVE_STARTUP, IDC_RB_SELECTIVE_STARTUP);
+
+ EnableSelectiveStartupControls(TRUE);
+ PropSheet_Changed(GetParent(hGeneralPage), hGeneralPage);
+
+ break;
+ }
+
+ case IDC_CBX_USE_ORIGINAL_BOOTCFG:
+ {
+ bIsOriginalBootIni = TRUE;
+
+ Button_SetCheck(GetDlgItem(hGeneralPage,
IDC_CBX_USE_ORIGINAL_BOOTCFG), (bIsOriginalBootIni ? BST_CHECKED : BST_UNCHECKED));
+ EnableWindow(GetDlgItem(hGeneralPage, IDC_CBX_USE_ORIGINAL_BOOTCFG),
!bIsOriginalBootIni /*FALSE*/);
+
+ PropSheet_Changed(GetParent(hGeneralPage), hGeneralPage);
+
+ break;
+ }
+
+ case IDC_BTN_SYSTEM_RESTORE_START:
+ {
+ // NOTE: 'err' variable defined for debugging purposes only.
+ DWORD err = RunCommand(lpszRestoreProgPath1, NULL, SW_SHOW);
+ if (err == ERROR_FILE_NOT_FOUND)
+ err = RunCommand(lpszRestoreProgPath2, NULL, SW_SHOW);
+
+ break;
+ }
+
+ // case IDC_BTN_FILE_EXTRACTION:
+ // DialogBox(hInst, MAKEINTRESOURCE(IDD_FILE_EXTRACT_DIALOG),
hGeneralPage /* GetParent(hGeneralPage) */, FileExtractDialogWndProc);
+ // break;
+
+ default:
+ //break;
+ return FALSE;
+ }
+ break;
+ }
+
+ case WM_NOTIFY:
+ {
+ switch (((LPNMHDR)lParam)->code)
+ {
+ case PSN_APPLY:
+ {
+ // TODO: Try to apply the modifications to the system.
+ PropSheet_UnChanged(GetParent(hGeneralPage), hGeneralPage);
+ return TRUE;
+ }
+
+ case PSN_HELP:
+ {
+ MessageBoxW(hGeneralPage, L"Help not implemented yet!",
L"Help", MB_ICONINFORMATION | MB_OK);
+ return TRUE;
+ }
+
+ case PSN_KILLACTIVE: // Is going to lose activation.
+ {
+ // Changes are always valid of course.
+ SetWindowLongPtr(hGeneralPage, DWLP_MSGRESULT, FALSE);
+ return TRUE;
+ }
+
+ case PSN_QUERYCANCEL:
+ {
+ // Allows cancellation.
+ SetWindowLongPtr(hGeneralPage, DWLP_MSGRESULT, FALSE);
+ return TRUE;
+ }
+
+ case PSN_QUERYINITIALFOCUS:
+ {
+ // SetWindowLongPtr(hGeneralPage, DWLP_MSGRESULT,
+ // (LONG_PTR)GetDlgItem(hGeneralPage,
(bIsOriginalBootIni ? IDC_RB_NORMAL_STARTUP : IDC_RB_SELECTIVE_STARTUP)));
+ 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(hGeneralPage, DWLP_MSGRESULT, 0);
+ return TRUE;
+ }
+
+ default:
+ break;
+ }
+
+ return FALSE;
+ }
+
+ default:
+ return FALSE;
}
return FALSE;
Modified: trunk/reactos/base/applications/msconfig_new/generalpage.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/msconfig…
==============================================================================
--- trunk/reactos/base/applications/msconfig_new/generalpage.h [iso-8859-1] (original)
+++ trunk/reactos/base/applications/msconfig_new/generalpage.h [iso-8859-1] Tue Oct 20
21:57:36 2015
@@ -1,7 +1,14 @@
+/*
+ * PROJECT: ReactOS Applications
+ * LICENSE: LGPL - See COPYING in the top level directory
+ * FILE: base/applications/msconfig_new/generalpage.c
+ * PURPOSE: General page message handler
+ * COPYRIGHT: Copyright 2005-2006 Christoph von Wittich <Christoph(a)ApiViewer.de>
+ * Copyright 2011-2012 Hermes BELUSCA - MAITO <hermes.belusca(a)sfr.fr>
+ */
+
#ifndef _GENERALPAGE_H_
#define _GENERALPAGE_H_
-
-extern HWND hGeneralPage;
INT_PTR CALLBACK GeneralPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM
lParam);
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] Tue Oct 20
21:57:36 2015
@@ -116,7 +116,7 @@
}
-/* Message handler for dialog box. */
+/* Message handler for dialog box */
LRESULT CALLBACK MainWndProc(HWND hWnd, UINT uMessage, WPARAM wParam, LPARAM lParam)
{
switch (uMessage)
Removed: trunk/reactos/base/applications/msconfig_new/toolspage.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/msconfig…
==============================================================================
--- trunk/reactos/base/applications/msconfig_new/toolspage.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/msconfig_new/toolspage.c (removed)
@@ -1,189 +0,0 @@
-/*
- * PROJECT: ReactOS Applications
- * LICENSE: LGPL - See COPYING in the top level directory
- * FILE: base/applications/msconfig_new/toolspage.c
- * PURPOSE: Tools page message handler
- * COPYRIGHT: Copyright 2005-2006 Christoph von Wittich <Christoph(a)ApiViewer.de>
- *
- */
-
-#include "precomp.h"
-
-#include <shlwapi.h>
-
-HWND hToolsPage;
-HWND hToolsListCtrl;
-HWND hToolsDialog;
-
-void AddItem ( DWORD, DWORD, DWORD, DWORD, int );
-void FillListView ( void );
-
-DWORD ListItems_Cmds[20];
-DWORD ListItems_Params[20];
-DWORD ListItems_Locations[20];
-
-void AddItem ( DWORD name_id, DWORD descr_id, DWORD cmd_id , DWORD param_id, int csidl )
{
- TCHAR szTemp[256];
- LV_ITEM item;
-
- LoadString(hInst, name_id, szTemp, 256);
- memset(&item, 0, sizeof(LV_ITEM));
- item.mask = LVIF_TEXT;
- item.iImage = 0;
- item.pszText = szTemp;
- item.iItem = ListView_GetItemCount(hToolsListCtrl);
- item.lParam = 0;
- (void)ListView_InsertItem(hToolsListCtrl, &item);
-
- ListItems_Cmds[item.iItem] = cmd_id;
- ListItems_Params[item.iItem] = param_id;
- ListItems_Locations[item.iItem] = csidl;
-
- LoadString(hInst, descr_id, szTemp, 256);
- item.pszText = szTemp;
- item.iSubItem = 1;
- SendMessage(hToolsListCtrl, LVM_SETITEMTEXT, item.iItem, (LPARAM) &item);
-}
-
-void FillListView ( void ) {
- AddItem(IDS_TOOLS_CMD_NAME, IDS_TOOLS_CMD_DESCR, IDS_TOOLS_CMD_CMD,
IDS_TOOLS_CMD_PARAM, CSIDL_SYSTEM);
- AddItem(IDS_TOOLS_REGEDIT_NAME, IDS_TOOLS_REGEDIT_DESCR,
IDS_TOOLS_REGEDIT_CMD,IDS_TOOLS_REGEDIT_PARAM, CSIDL_WINDOWS);
- AddItem(IDS_TOOLS_SYSDM_NAME, IDS_TOOLS_SYSDM_DESCR, IDS_TOOLS_SYSDM_CMD,
IDS_TOOLS_SYSDM_PARAM, CSIDL_SYSTEM);
- AddItem(IDS_TOOLS_INFO_NAME, IDS_TOOLS_INFO_DESCR, IDS_TOOLS_INFO_CMD,
IDS_TOOLS_INFO_PARAM, CSIDL_SYSTEM);
-}
-
-INT_PTR CALLBACK
-ToolsPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
-{
- LV_COLUMN column;
- TCHAR szTemp[MAX_PATH*2];
- TCHAR szTemp2[256];
- TCHAR * Ptr = NULL;
- LPNMITEMACTIVATE lpnmitem;
- LPNMHDR nmh;
- DWORD dwStyle;
- PROCESS_INFORMATION pi;
- STARTUPINFO si;
-
- switch (message)
- {
- case WM_INITDIALOG:
- {
- hToolsListCtrl = GetDlgItem(hDlg, IDC_TOOLS_LIST);
- hToolsDialog = hDlg;
-
- dwStyle = (DWORD) SendMessage(hToolsListCtrl, LVM_GETEXTENDEDLISTVIEWSTYLE,
0, 0);
- dwStyle = dwStyle | LVS_EX_FULLROWSELECT;
- SendMessage(hToolsListCtrl, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, dwStyle);
-
- SetWindowPos(hDlg, NULL, 10, 32, 0, 0, SWP_NOACTIVATE | SWP_NOOWNERZORDER |
SWP_NOSIZE | SWP_NOZORDER);
-
- // Initialize the application page's controls
- column.mask = LVCF_TEXT | LVCF_WIDTH;
-
- LoadString(hInst, IDS_TOOLS_COLUMN_NAME, szTemp, 256);
- column.pszText = szTemp;
- column.cx = 150;
- (void)ListView_InsertColumn(hToolsListCtrl, 0, &column);
-
- column.mask = LVCF_TEXT | LVCF_WIDTH;
- LoadString(hInst, IDS_TOOLS_COLUMN_DESCR, szTemp, 256);
- column.pszText = szTemp;
- column.cx = 500;
- (void)ListView_InsertColumn(hToolsListCtrl, 1, &column);
-
- FillListView();
- return TRUE;
- }
- case WM_COMMAND:
- {
- switch (LOWORD(wParam))
- {
- case IDC_BTN_RUN:
- {
- if (ListView_GetSelectionMark(hToolsListCtrl) != -1)
- {
- if (SHGetSpecialFolderPath(NULL, szTemp,
ListItems_Locations[ListView_GetSelectionMark(hToolsListCtrl)], FALSE))
- Ptr = PathAddBackslash(szTemp);
-
- if (!Ptr)
- Ptr = szTemp;
-
- szTemp2[0] = _T('\0');
- LoadString(hInst,
ListItems_Cmds[ListView_GetSelectionMark(hToolsListCtrl)], Ptr, 256);
- LoadString(hInst,
ListItems_Params[ListView_GetSelectionMark(hToolsListCtrl)], szTemp2, 256);
- if (_tcslen(szTemp2))
- {
- _tcscat(szTemp, _T(" "));
- _tcscat(Ptr, szTemp2);
- }
- ZeroMemory(&si, sizeof(STARTUPINFO));
- si.cb = sizeof(STARTUPINFO);
- if (CreateProcess(NULL, szTemp, NULL, NULL, FALSE, 0, NULL, NULL,
&si, &pi))
- {
- CloseHandle(pi.hThread);
- CloseHandle(pi.hProcess);
- }
- }
- }
- }
- break;
- }
- case WM_NOTIFY:
- {
- nmh = (LPNMHDR) lParam;
- if (nmh->hwndFrom == hToolsListCtrl)
- {
- switch (nmh->code)
- {
- case LVN_ITEMCHANGED:
- {
- lpnmitem = (LPNMITEMACTIVATE) lParam;
- if (lpnmitem->iItem > -1)
- {
- LoadString(hInst, ListItems_Cmds[lpnmitem->iItem], szTemp,
256);
- szTemp2[0] = _T('\0');
- LoadString(hInst, ListItems_Params[lpnmitem->iItem],
szTemp2, 256);
- _tcscat(szTemp, _T(" "));
- _tcscat(szTemp, szTemp2);
- SendDlgItemMessage(hToolsDialog, IDC_TOOLS_CMDLINE,
WM_SETTEXT, 0, (LPARAM) szTemp);
- }
- break;
- }
- case NM_DBLCLK:
- {
- lpnmitem = (LPNMITEMACTIVATE) lParam;
- if (lpnmitem->iItem > -1)
- {
- if (SHGetSpecialFolderPath(NULL, szTemp,
ListItems_Locations[ListView_GetSelectionMark(hToolsListCtrl)], FALSE))
- Ptr = PathAddBackslash(szTemp);
-
- if (!Ptr)
- Ptr = szTemp;
-
- szTemp2[0] = _T('\0');
- LoadString(hInst, ListItems_Cmds[lpnmitem->iItem], Ptr,
256);
- LoadString(hInst, ListItems_Params[lpnmitem->iItem],
szTemp2, 256);
- if (_tcslen(szTemp2))
- {
- _tcscat(szTemp, _T(" "));
- _tcscat(Ptr, szTemp2);
- }
- ZeroMemory(&si, sizeof(STARTUPINFO));
- si.cb = sizeof(STARTUPINFO);
- if (CreateProcess(NULL, szTemp, NULL, NULL, FALSE, 0, NULL,
NULL, &si, &pi))
- {
- CloseHandle(pi.hThread);
- CloseHandle(pi.hProcess);
- }
- }
- break;
- }
- }
- }
- }
- break;
- }
- return 0;
-}
-
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] Tue Oct 20
21:57:36 2015
@@ -16,7 +16,7 @@
static HWND hToolsListCtrl = NULL;
static int iSortedColumn = 0;
-typedef struct TOOL
+struct TOOL
{
TOOL(const _bstr_t& Command,
const _bstr_t& DefParam,
@@ -37,8 +37,7 @@
_bstr_t m_Command;
_bstr_t m_DefParam;
_bstr_t m_AdvParam;
-
-} *PTOOL;
+};
static void AddTool(IXMLDOMElement*, BOOL);
@@ -120,7 +119,7 @@
}
static void
-AddItem(BOOL bIsStandard, const _bstr_t& name, const _bstr_t& descr, PTOOL tool)
+AddItem(BOOL bIsStandard, const _bstr_t& name, const _bstr_t& descr, TOOL* tool)
{
LPTSTR lpszStandard;
LVITEM item = {};
@@ -155,7 +154,7 @@
static void
AddTool(IXMLDOMElement* pXMLTool, BOOL bIsStandard)
{
- PTOOL tool;
+ TOOL* tool;
_variant_t varLocID, varName, varPath,
varDefOpt, varAdvOpt, varHelp;
@@ -234,7 +233,7 @@
static void Update_States(int iSelectedItem)
{
- PTOOL tool;
+ TOOL* tool;
LVITEM item = {};
assert(hToolsPage);
@@ -246,7 +245,7 @@
{
LPTSTR lpszCmdLine = NULL;
size_t numOfChars = 0;
- tool = reinterpret_cast<PTOOL>(item.lParam);
+ tool = reinterpret_cast<TOOL*>(item.lParam);
ListView_EnsureVisible(hToolsListCtrl, item.iItem, FALSE);
@@ -308,7 +307,7 @@
bUseAdvParams = FALSE;
// Values greater (strictly) than 32 indicate success (see MSDN documentation for
ShellExecute(...) API).
- bRetVal = (reinterpret_cast<PTOOL>(item.lParam)->Run(bUseAdvParams) >
32);
+ bRetVal = (reinterpret_cast<TOOL*>(item.lParam)->Run(bUseAdvParams) >
32);
}
return bRetVal;
@@ -386,7 +385,7 @@
ListView_GetItem(hToolsListCtrl, &lvitem);
- delete reinterpret_cast<PTOOL>(lvitem.lParam);
+ delete reinterpret_cast<TOOL*>(lvitem.lParam);
lvitem.lParam = NULL;
}
ListView_DeleteAllItems(hToolsListCtrl);
@@ -418,16 +417,16 @@
case WM_NOTIFY:
{
- if (reinterpret_cast<LPNMHDR>(lParam)->hwndFrom == hToolsListCtrl)
+ if (((LPNMHDR)lParam)->hwndFrom == hToolsListCtrl)
{
- switch (reinterpret_cast<LPNMHDR>(lParam)->code)
+ switch (((LPNMHDR)lParam)->code)
{
case LVN_ITEMCHANGED:
{
- if ( (reinterpret_cast<LPNMLISTVIEW>(lParam)->uChanged
& LVIF_STATE) && /* The state has changed */
- (reinterpret_cast<LPNMLISTVIEW>(lParam)->uNewState
& LVIS_SELECTED) /* The item has been (de)selected */ )
+ if ( (((LPNMLISTVIEW)lParam)->uChanged & LVIF_STATE)
&& /* The state has changed */
+ (((LPNMLISTVIEW)lParam)->uNewState & LVIS_SELECTED)
/* The item has been (de)selected */ )
{
-
Update_States(reinterpret_cast<LPNMLISTVIEW>(lParam)->iItem);
+ Update_States(((LPNMLISTVIEW)lParam)->iItem);
}
return TRUE;
@@ -442,7 +441,7 @@
case LVN_COLUMNCLICK:
{
- int iSortingColumn =
reinterpret_cast<LPNMLISTVIEW>(lParam)->iSubItem;
+ int iSortingColumn = ((LPNMLISTVIEW)lParam)->iSubItem;
ListView_SortEx(hToolsListCtrl, iSortingColumn, iSortedColumn);
iSortedColumn = iSortingColumn;
@@ -456,7 +455,7 @@
}
else
{
- switch (reinterpret_cast<LPNMHDR>(lParam)->code)
+ switch (((LPNMHDR)lParam)->code)
{
case PSN_APPLY:
{
@@ -469,7 +468,7 @@
case PSN_HELP:
{
- MessageBox(hToolsPage, _T("Help not implemented yet!"),
_T("Help"), MB_ICONINFORMATION | MB_OK);
+ MessageBoxW(hToolsPage, L"Help not implemented yet!",
L"Help", MB_ICONINFORMATION | MB_OK);
return TRUE;
}
Modified: trunk/reactos/base/applications/msconfig_new/toolspage.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/msconfig…
==============================================================================
--- trunk/reactos/base/applications/msconfig_new/toolspage.h [iso-8859-1] (original)
+++ trunk/reactos/base/applications/msconfig_new/toolspage.h [iso-8859-1] Tue Oct 20
21:57:36 2015
@@ -1,7 +1,7 @@
/*
* PROJECT: ReactOS Applications
* LICENSE: LGPL - See COPYING in the top level directory
- * FILE: base/applications/msconfig_new/toolspage.cpp
+ * FILE: base/applications/msconfig_new/toolspage.h
* PURPOSE: Tools page message handler
* COPYRIGHT: Copyright 2005-2006 Christoph von Wittich <Christoph(a)ApiViewer.de>
* Copyright 2011-2012 Hermes BELUSCA - MAITO <hermes.belusca(a)sfr.fr>
Modified: trunk/reactos/base/applications/msconfig_new/utils.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/msconfig…
==============================================================================
--- trunk/reactos/base/applications/msconfig_new/utils.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/msconfig_new/utils.c [iso-8859-1] Tue Oct 20 21:57:36
2015
@@ -1,3 +1,11 @@
+/*
+ * PROJECT: ReactOS Applications
+ * LICENSE: LGPL - See COPYING in the top level directory
+ * FILE: base/applications/msconfig_new/utils.c
+ * PURPOSE: Memory Management, Resources, ... Utility Functions
+ * COPYRIGHT: Copyright 2011-2012 Hermes BELUSCA - MAITO <hermes.belusca(a)sfr.fr>
+ */
+
#include "precomp.h"
#include "utils.h"
#include "stringutils.h"
Modified: trunk/reactos/base/applications/msconfig_new/utils.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/msconfig…
==============================================================================
--- trunk/reactos/base/applications/msconfig_new/utils.h [iso-8859-1] (original)
+++ trunk/reactos/base/applications/msconfig_new/utils.h [iso-8859-1] Tue Oct 20 21:57:36
2015
@@ -1,3 +1,11 @@
+/*
+ * PROJECT: ReactOS Applications
+ * LICENSE: LGPL - See COPYING in the top level directory
+ * FILE: base/applications/msconfig_new/utils.c
+ * PURPOSE: Memory Management, Resources, ... Utility Functions
+ * COPYRIGHT: Copyright 2011-2012 Hermes BELUSCA - MAITO <hermes.belusca(a)sfr.fr>
+ */
+
#ifndef __UTILS_H__
#define __UTILS_H__