2015-09-05 10:37:36 +00:00
|
|
|
/*
|
|
|
|
* PROJECT: ReactOS Applications
|
|
|
|
* LICENSE: LGPL - See COPYING in the top level directory
|
2015-09-09 13:13:35 +00:00
|
|
|
* FILE: base/applications/msconfig_new/generalpage.c
|
2015-09-05 10:37:36 +00:00
|
|
|
* PURPOSE: General page message handler
|
|
|
|
* COPYRIGHT: Copyright 2005-2006 Christoph von Wittich <Christoph@ApiViewer.de>
|
2015-10-20 21:57:36 +00:00
|
|
|
* Copyright 2011-2012 Hermes BELUSCA - MAITO <hermes.belusca@sfr.fr>
|
2015-09-05 10:37:36 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "precomp.h"
|
2015-10-20 21:57:36 +00:00
|
|
|
#include "fileutils.h"
|
|
|
|
#include "utils.h"
|
2015-10-31 21:00:32 +00:00
|
|
|
#include "comctl32supp.h"
|
2015-10-20 23:59:28 +00:00
|
|
|
#include "fileextractdialog.h"
|
2015-09-05 10:37:36 +00:00
|
|
|
|
2015-10-20 21:57:36 +00:00
|
|
|
static LPCWSTR lpszRestoreProgPath1 = L"%SystemRoot%\\System32\\rstrui.exe";
|
|
|
|
static LPCWSTR lpszRestoreProgPath2 = L"%SystemRoot%\\System32\\restore\\rstrui.exe";
|
2015-09-06 17:19:40 +00:00
|
|
|
|
2015-10-20 21:57:36 +00:00
|
|
|
static HWND hGeneralPage = NULL;
|
|
|
|
static BOOL bIsOriginalBootIni = TRUE;
|
2015-10-20 23:59:28 +00:00
|
|
|
// static BOOL bIsStartupNotModified = TRUE;
|
2015-09-05 10:37:36 +00:00
|
|
|
|
2015-09-06 17:19:40 +00:00
|
|
|
static VOID EnableSelectiveStartupControls(BOOL bEnable)
|
2015-09-05 10:37:36 +00:00
|
|
|
{
|
2015-09-06 17:19:40 +00:00
|
|
|
assert(hGeneralPage);
|
|
|
|
|
|
|
|
EnableWindow(GetDlgItem(hGeneralPage, IDC_CBX_LOAD_SYSTEM_SERVICES), bEnable);
|
|
|
|
EnableWindow(GetDlgItem(hGeneralPage, IDC_CBX_LOAD_STARTUP_ITEMS) , bEnable);
|
|
|
|
|
|
|
|
EnableWindow(GetDlgItem(hGeneralPage, IDC_CBX_USE_ORIGINAL_BOOTCFG), bEnable);
|
|
|
|
|
|
|
|
// EnableWindow(GetDlgItem(hGeneralPage, IDC_RB_USE_ORIGINAL_BOOTCAT), bEnable);
|
|
|
|
// EnableWindow(GetDlgItem(hGeneralPage, IDC_RB_USE_MODIFIED_BOOTCAT), (bEnable ? !bIsOriginalBootIni : FALSE));
|
|
|
|
|
|
|
|
EnableWindow(GetDlgItem(hGeneralPage, IDC_CBX_SYSTEM_INI), bEnable);
|
|
|
|
EnableWindow(GetDlgItem(hGeneralPage, IDC_CBX_WIN_INI) , bEnable);
|
|
|
|
|
|
|
|
return;
|
2015-09-05 10:37:36 +00:00
|
|
|
}
|
|
|
|
|
2015-09-06 17:19:40 +00:00
|
|
|
static VOID CheckSelectiveStartupControls(BOOL bCheck)
|
|
|
|
{
|
|
|
|
assert(hGeneralPage);
|
|
|
|
|
|
|
|
Button_SetCheck(GetDlgItem(hGeneralPage, IDC_CBX_LOAD_SYSTEM_SERVICES), (bCheck ? BST_CHECKED : BST_UNCHECKED));
|
|
|
|
Button_SetCheck(GetDlgItem(hGeneralPage, IDC_CBX_LOAD_STARTUP_ITEMS) , (bCheck ? BST_CHECKED : BST_UNCHECKED));
|
|
|
|
Button_SetCheck(GetDlgItem(hGeneralPage, IDC_CBX_USE_ORIGINAL_BOOTCFG), (bCheck ? BST_CHECKED : BST_UNCHECKED));
|
|
|
|
Button_SetCheck(GetDlgItem(hGeneralPage, IDC_CBX_SYSTEM_INI) , (bCheck ? BST_CHECKED : BST_UNCHECKED));
|
|
|
|
Button_SetCheck(GetDlgItem(hGeneralPage, IDC_CBX_WIN_INI) , (bCheck ? BST_CHECKED : BST_UNCHECKED));
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
2015-09-05 10:37:36 +00:00
|
|
|
|
|
|
|
INT_PTR CALLBACK
|
|
|
|
GeneralPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
|
|
|
UNREFERENCED_PARAMETER(lParam);
|
|
|
|
|
|
|
|
switch (message)
|
|
|
|
{
|
2015-09-06 17:19:40 +00:00
|
|
|
case WM_INITDIALOG:
|
2015-09-05 10:37:36 +00:00
|
|
|
{
|
2015-09-06 17:19:40 +00:00
|
|
|
hGeneralPage = hDlg;
|
2015-10-20 21:57:36 +00:00
|
|
|
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);
|
2015-09-06 17:19:40 +00:00
|
|
|
|
|
|
|
#if 0
|
|
|
|
/* FIXME */
|
|
|
|
SendDlgItemMessage(hDlg, IDC_RB_NORMAL_STARTUP, BM_SETCHECK, BST_CHECKED, 0);
|
|
|
|
EnableCheckboxControls(hDlg, FALSE);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return TRUE;
|
2015-09-05 10:37:36 +00:00
|
|
|
}
|
2015-10-20 21:57:36 +00:00
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2015-10-20 23:59:28 +00:00
|
|
|
case IDC_BTN_FILE_EXTRACTION:
|
|
|
|
DialogBoxW(hInst, MAKEINTRESOURCEW(IDD_FILE_EXTRACT_DIALOG), hGeneralPage /* GetParent(hGeneralPage) */, FileExtractDialogWndProc);
|
|
|
|
break;
|
2015-10-20 21:57:36 +00:00
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
2015-10-26 23:03:21 +00:00
|
|
|
|
2015-10-20 21:57:36 +00:00
|
|
|
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;
|
2015-09-05 10:37:36 +00:00
|
|
|
}
|
2015-09-06 17:19:40 +00:00
|
|
|
|
|
|
|
return FALSE;
|
2015-09-05 10:37:36 +00:00
|
|
|
}
|