1 /*
2 * PROJECT: ReactOS System Control Panel Applet
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: dll/cpl/sysdm/advanced.c
5 * PURPOSE: Memory, start-up and profiles settings
6 * COPYRIGHT: Copyright Thomas Weidenmueller <w3seek@reactos.org>
7 Copyright 2006 - 2009 Ged Murphy <gedmurphy@reactos.org>
8 *
9 */
10
11 #include "precomp.h"
12
13 static TCHAR BugLink[] = _T("http://jira.reactos.org/");
14 static TCHAR ReportAsWorkstationKey[] = _T("SYSTEM\\CurrentControlSet\\Control\\ReactOS\\Settings\\Version");
15
16
17 static VOID
OnOK(HWND hwndDlg)18 OnOK(HWND hwndDlg)
19 {
20 HKEY hKey;
21 DWORD ReportAsWorkstation;
22
23 ReportAsWorkstation = (SendDlgItemMessageW(hwndDlg,
24 IDC_REPORTASWORKSTATION,
25 BM_GETCHECK,
26 0,
27 0) == BST_CHECKED);
28
29 if (RegCreateKeyEx(HKEY_LOCAL_MACHINE,
30 ReportAsWorkstationKey,
31 0,
32 NULL,
33 0,
34 KEY_WRITE,
35 NULL,
36 &hKey,
37 NULL) == ERROR_SUCCESS)
38 {
39 RegSetValueEx(hKey,
40 _T("ReportAsWorkstation"),
41 0,
42 REG_DWORD,
43 (LPBYTE)&ReportAsWorkstation,
44 sizeof(DWORD));
45
46 RegCloseKey(hKey);
47 }
48 }
49
50 static VOID
OnInitSysSettingsDialog(HWND hwndDlg)51 OnInitSysSettingsDialog(HWND hwndDlg)
52 {
53 HKEY hKey;
54 DWORD dwVal;
55 DWORD dwType = REG_DWORD;
56 DWORD cbData = sizeof(DWORD);
57
58 if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,
59 ReportAsWorkstationKey,
60 0,
61 KEY_READ,
62 &hKey) == ERROR_SUCCESS)
63 {
64 if (RegQueryValueEx(hKey,
65 _T("ReportAsWorkstation"),
66 0,
67 &dwType,
68 (LPBYTE)&dwVal,
69 &cbData) == ERROR_SUCCESS)
70 {
71 if (dwVal != FALSE)
72 {
73 // set the check box
74 SendDlgItemMessageW(hwndDlg,
75 IDC_REPORTASWORKSTATION,
76 BM_SETCHECK,
77 BST_CHECKED,
78 0);
79 }
80 }
81
82 RegCloseKey(hKey);
83 }
84 }
85
86 INT_PTR CALLBACK
SysSettingsDlgProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam)87 SysSettingsDlgProc(HWND hwndDlg,
88 UINT uMsg,
89 WPARAM wParam,
90 LPARAM lParam)
91 {
92 UNREFERENCED_PARAMETER(lParam);
93
94 switch (uMsg)
95 {
96 case WM_INITDIALOG:
97 OnInitSysSettingsDialog(hwndDlg);
98 break;
99
100 case WM_COMMAND:
101 switch (LOWORD(wParam))
102 {
103 case IDOK:
104 OnOK(hwndDlg);
105 EndDialog(hwndDlg, 0);
106 return TRUE;
107
108 case IDCANCEL:
109 EndDialog(hwndDlg, 0);
110 return TRUE;
111 }
112 break;
113 }
114
115 return FALSE;
116 }
117
118
119 /* Property page dialog callback */
120 INT_PTR CALLBACK
AdvancedPageProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam)121 AdvancedPageProc(HWND hwndDlg,
122 UINT uMsg,
123 WPARAM wParam,
124 LPARAM lParam)
125 {
126 UNREFERENCED_PARAMETER(lParam);
127
128 switch (uMsg)
129 {
130 case WM_INITDIALOG:
131 break;
132
133 case WM_COMMAND:
134 {
135 switch (LOWORD(wParam))
136 {
137 case IDC_PERFOR:
138 DialogBox(hApplet,
139 MAKEINTRESOURCE(IDD_VIRTMEM),
140 hwndDlg,
141 VirtMemDlgProc);
142 break;
143
144 case IDC_USERPROFILE:
145 DialogBox(hApplet,
146 MAKEINTRESOURCE(IDD_USERPROFILE),
147 hwndDlg,
148 UserProfileDlgProc);
149 break;
150
151 case IDC_STAREC:
152 DialogBox(hApplet,
153 MAKEINTRESOURCE(IDD_STARTUPRECOVERY),
154 hwndDlg,
155 StartRecDlgProc);
156 break;
157
158 case IDC_SYSSETTINGS:
159 DialogBox(hApplet,
160 MAKEINTRESOURCE(IDD_SYSSETTINGS),
161 hwndDlg,
162 SysSettingsDlgProc);
163 break;
164
165 case IDC_ENVVAR:
166 DialogBox(hApplet,
167 MAKEINTRESOURCE(IDD_ENVIRONMENT_VARIABLES),
168 hwndDlg,
169 EnvironmentDlgProc);
170 break;
171
172 case IDC_ERRORREPORT:
173 ShellExecute(NULL,
174 _T("open"),
175 BugLink,
176 NULL,
177 NULL,
178 SW_SHOWNORMAL);
179 break;
180 }
181 }
182
183 break;
184 }
185
186 return FALSE;
187 }
188