ReactOS  0.4.11-dev-946-g431643b
generalpage.c
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS Applications
3  * LICENSE: LGPL - See COPYING in the top level directory
4  * FILE: base/applications/msconfig_new/generalpage.c
5  * PURPOSE: General page message handler
6  * COPYRIGHT: Copyright 2005-2006 Christoph von Wittich <Christoph@ApiViewer.de>
7  * Copyright 2011-2012 Hermes BELUSCA - MAITO <hermes.belusca@sfr.fr>
8  */
9 
10 #include "precomp.h"
11 #include "fileutils.h"
12 #include "utils.h"
13 #include "comctl32supp.h"
14 #include "fileextractdialog.h"
15 
16 static LPCWSTR lpszRestoreProgPath1 = L"%SystemRoot%\\System32\\rstrui.exe";
17 static LPCWSTR lpszRestoreProgPath2 = L"%SystemRoot%\\System32\\restore\\rstrui.exe";
18 
21 // static BOOL bIsStartupNotModified = TRUE;
22 
24 {
25  assert(hGeneralPage);
26 
27  EnableWindow(GetDlgItem(hGeneralPage, IDC_CBX_LOAD_SYSTEM_SERVICES), bEnable);
28  EnableWindow(GetDlgItem(hGeneralPage, IDC_CBX_LOAD_STARTUP_ITEMS) , bEnable);
29 
30  EnableWindow(GetDlgItem(hGeneralPage, IDC_CBX_USE_ORIGINAL_BOOTCFG), bEnable);
31 
32  // EnableWindow(GetDlgItem(hGeneralPage, IDC_RB_USE_ORIGINAL_BOOTCAT), bEnable);
33  // EnableWindow(GetDlgItem(hGeneralPage, IDC_RB_USE_MODIFIED_BOOTCAT), (bEnable ? !bIsOriginalBootIni : FALSE));
34 
35  EnableWindow(GetDlgItem(hGeneralPage, IDC_CBX_SYSTEM_INI), bEnable);
36  EnableWindow(GetDlgItem(hGeneralPage, IDC_CBX_WIN_INI) , bEnable);
37 
38  return;
39 }
40 
42 {
43  assert(hGeneralPage);
44 
46  Button_SetCheck(GetDlgItem(hGeneralPage, IDC_CBX_LOAD_STARTUP_ITEMS) , (bCheck ? BST_CHECKED : BST_UNCHECKED));
47  Button_SetCheck(GetDlgItem(hGeneralPage, IDC_CBX_USE_ORIGINAL_BOOTCFG), (bCheck ? BST_CHECKED : BST_UNCHECKED));
48  Button_SetCheck(GetDlgItem(hGeneralPage, IDC_CBX_SYSTEM_INI) , (bCheck ? BST_CHECKED : BST_UNCHECKED));
49  Button_SetCheck(GetDlgItem(hGeneralPage, IDC_CBX_WIN_INI) , (bCheck ? BST_CHECKED : BST_UNCHECKED));
50 
51  return;
52 }
53 
56 {
57  UNREFERENCED_PARAMETER(lParam);
58 
59  switch (message)
60  {
61  case WM_INITDIALOG:
62  {
63  hGeneralPage = hDlg;
64  PropSheet_UnChanged(GetParent(hGeneralPage), hGeneralPage);
65 
66  /* Search for the restore program and enable its button if needed */
70  else
72 
73 #if 0
74  /* FIXME */
77 #endif
78 
79  return TRUE;
80  }
81 
82  case WM_COMMAND:
83  {
84  switch (LOWORD(wParam))
85  {
87  {
88  /* Be sure that only this button is activated and the others are not */
90 
94 
96 
97  PropSheet_Changed(GetParent(hGeneralPage), hGeneralPage);
98  break;
99  }
100 
102  {
103  /* Be sure that only this button is activated and the others are not */
105 
108 
109  PropSheet_Changed(GetParent(hGeneralPage), hGeneralPage);
110  break;
111  }
112 
114  {
115  /* Be sure that only this button is activated and the others are not */
117 
119  PropSheet_Changed(GetParent(hGeneralPage), hGeneralPage);
120 
121  break;
122  }
123 
125  {
127 
130 
131  PropSheet_Changed(GetParent(hGeneralPage), hGeneralPage);
132 
133  break;
134  }
135 
137  {
138  // NOTE: 'err' variable defined for debugging purposes only.
140  if (err == ERROR_FILE_NOT_FOUND)
142 
143  break;
144  }
145 
147  DialogBoxW(hInst, MAKEINTRESOURCEW(IDD_FILE_EXTRACT_DIALOG), hGeneralPage /* GetParent(hGeneralPage) */, FileExtractDialogWndProc);
148  break;
149 
150  default:
151  //break;
152  return FALSE;
153  }
154  break;
155  }
156 
157  case WM_NOTIFY:
158  {
159  switch (((LPNMHDR)lParam)->code)
160  {
161  case PSN_APPLY:
162  {
163  // TODO: Try to apply the modifications to the system.
164  PropSheet_UnChanged(GetParent(hGeneralPage), hGeneralPage);
165  return TRUE;
166  }
167 
168  case PSN_HELP:
169  {
170  MessageBoxW(hGeneralPage, L"Help not implemented yet!", L"Help", MB_ICONINFORMATION | MB_OK);
171  return TRUE;
172  }
173 
174  case PSN_KILLACTIVE: // Is going to lose activation.
175  {
176  // Changes are always valid of course.
177  SetWindowLongPtr(hGeneralPage, DWLP_MSGRESULT, FALSE);
178  return TRUE;
179  }
180 
181  case PSN_QUERYCANCEL:
182  {
183  // Allows cancellation.
184  SetWindowLongPtr(hGeneralPage, DWLP_MSGRESULT, FALSE);
185  return TRUE;
186  }
187 
189  {
190  // SetWindowLongPtr(hGeneralPage, DWLP_MSGRESULT,
191  // (LONG_PTR)GetDlgItem(hGeneralPage, (bIsOriginalBootIni ? IDC_RB_NORMAL_STARTUP : IDC_RB_SELECTIVE_STARTUP)));
192  return TRUE;
193  }
194 
195  //
196  // DO NOT TOUCH THESE NEXT MESSAGES, THEY ARE OK LIKE THIS...
197  //
198  case PSN_RESET: // Perform final cleaning, called before WM_DESTROY.
199  return TRUE;
200 
201  case PSN_SETACTIVE: // Is going to gain activation.
202  {
203  SetWindowLongPtr(hGeneralPage, DWLP_MSGRESULT, 0);
204  return TRUE;
205  }
206 
207  default:
208  break;
209  }
210 
211  return FALSE;
212  }
213 
214  default:
215  return FALSE;
216  }
217 
218  return FALSE;
219 }
Definition: tftpd.h:59
#define TRUE
Definition: types.h:120
#define IDC_CBX_LOAD_STARTUP_ITEMS
Definition: resource.h:28
DWORD RunCommand(IN LPCWSTR lpszCommand, IN LPCWSTR lpszParameters, IN INT nShowCmd)
Definition: utils.c:132
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
#define PSN_HELP
Definition: prsht.h:119
#define IDC_RB_DIAGNOSTIC_STARTUP
Definition: resource.h:23
#define IDC_RB_SELECTIVE_STARTUP
Definition: resource.h:24
#define CALLBACK
Definition: compat.h:27
VOID EnableCheckboxControls(HWND hDlg, BOOL bEnable)
Definition: generalpage.c:16
static LPCWSTR lpszRestoreProgPath1
Definition: generalpage.c:16
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define IDC_BTN_SYSTEM_RESTORE_START
Definition: resource.h:30
#define assert(x)
Definition: debug.h:53
#define Button_Enable(hwndCtl, fEnable)
Definition: windowsx.h:5
#define SendDlgItemMessage
Definition: winuser.h:5708
#define PSN_APPLY
Definition: prsht.h:117
int32_t INT_PTR
Definition: typedefs.h:62
#define PSN_SETACTIVE
Definition: prsht.h:115
#define SetWindowLongPtr
Definition: treelist.c:70
WPARAM wParam
Definition: combotst.c:138
#define DWLP_MSGRESULT
Definition: winuser.h:864
UINT_PTR WPARAM
Definition: windef.h:207
#define PSN_QUERYCANCEL
Definition: prsht.h:123
#define IDC_RB_NORMAL_STARTUP
Definition: resource.h:22
#define IDC_CBX_WIN_INI
Definition: resource.h:26
#define PSN_KILLACTIVE
Definition: prsht.h:116
LONG_PTR LPARAM
Definition: windef.h:208
smooth NULL
Definition: ftsmooth.c:416
#define IDD_FILE_EXTRACT_DIALOG
Definition: resource.h:16
#define IDC_CBX_USE_ORIGINAL_BOOTCFG
Definition: resource.h:29
#define SW_SHOW
Definition: winuser.h:769
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
#define DialogBoxW(i, t, p, f)
Definition: winuser.h:4268
static BOOL bIsOriginalBootIni
Definition: generalpage.c:20
#define BM_SETCHECK
Definition: winuser.h:1882
unsigned int BOOL
Definition: ntddk_ex.h:94
static VOID EnableSelectiveStartupControls(BOOL bEnable)
Definition: generalpage.c:23
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
#define PropSheet_UnChanged(d, w)
Definition: prsht.h:340
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define PropSheet_Changed(d, w)
Definition: prsht.h:326
#define IDC_CBX_LOAD_SYSTEM_SERVICES
Definition: resource.h:27
unsigned int UINT
Definition: ndis.h:50
unsigned long DWORD
Definition: ntddk_ex.h:95
#define MB_ICONINFORMATION
Definition: winuser.h:796
BOOL MyFileExists(IN LPCWSTR lpszFilePath, OUT PWIN32_FIND_DATAW pFindData OPTIONAL)
Definition: fileutils.c:18
static const WCHAR L[]
Definition: oid.c:1087
static VOID CheckSelectiveStartupControls(BOOL bCheck)
Definition: generalpage.c:41
static LPCWSTR lpszRestoreProgPath2
Definition: generalpage.c:17
#define err(...)
#define WM_COMMAND
Definition: winuser.h:1716
#define BST_UNCHECKED
Definition: winuser.h:199
#define IDC_CBX_SYSTEM_INI
Definition: resource.h:27
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
HWND WINAPI GetParent(_In_ HWND)
HWND hGeneralPage
Definition: generalpage.c:12
HINSTANCE hInst
Definition: dxdiag.c:13
_In_ BOOL bEnable
Definition: winddi.h:3426
#define IDC_BTN_FILE_EXTRACTION
Definition: resource.h:31
#define PSN_RESET
Definition: prsht.h:118
#define MB_OK
Definition: winuser.h:784
INT_PTR CALLBACK FileExtractDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
#define BST_CHECKED
Definition: winuser.h:197
#define Button_SetCheck(hwndCtl, check)
Definition: windowsx.h:10
BOOL WINAPI CheckRadioButton(_In_ HWND, _In_ int, _In_ int, _In_ int)
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
INT_PTR CALLBACK GeneralPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
Definition: generalpage.c:25
#define WM_INITDIALOG
Definition: winuser.h:1715
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define PSN_QUERYINITIALFOCUS
Definition: settings.cpp:98
#define WM_NOTIFY
Definition: richedit.h:61