[SYSDM] Fix Re-sizing License Prompt (#1789)
[reactos.git] / dll / cpl / sysdm / advanced.c
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
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
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
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 break;
109 }
110
111 return FALSE;
112 }
113
114
115 /* Property page dialog callback */
116 INT_PTR CALLBACK
117 AdvancedPageProc(HWND hwndDlg,
118 UINT uMsg,
119 WPARAM wParam,
120 LPARAM lParam)
121 {
122 UNREFERENCED_PARAMETER(lParam);
123
124 switch (uMsg)
125 {
126 case WM_INITDIALOG:
127 break;
128
129 case WM_COMMAND:
130 {
131 switch (LOWORD(wParam))
132 {
133 case IDC_PERFOR:
134 DialogBox(hApplet,
135 MAKEINTRESOURCE(IDD_VIRTMEM),
136 hwndDlg,
137 VirtMemDlgProc);
138 break;
139
140 case IDC_USERPROFILE:
141 DialogBox(hApplet,
142 MAKEINTRESOURCE(IDD_USERPROFILE),
143 hwndDlg,
144 UserProfileDlgProc);
145 break;
146
147 case IDC_STAREC:
148 DialogBox(hApplet,
149 MAKEINTRESOURCE(IDD_STARTUPRECOVERY),
150 hwndDlg,
151 StartRecDlgProc);
152 break;
153
154 case IDC_SYSSETTINGS:
155 DialogBox(hApplet,
156 MAKEINTRESOURCE(IDD_SYSSETTINGS),
157 hwndDlg,
158 SysSettingsDlgProc);
159 break;
160
161 case IDC_ENVVAR:
162 DialogBox(hApplet,
163 MAKEINTRESOURCE(IDD_ENVIRONMENT_VARIABLES),
164 hwndDlg,
165 EnvironmentDlgProc);
166 break;
167
168 case IDC_ERRORREPORT:
169 ShellExecute(NULL,
170 _T("open"),
171 BugLink,
172 NULL,
173 NULL,
174 SW_SHOWNORMAL);
175 break;
176 }
177 }
178
179 break;
180 }
181
182 return FALSE;
183 }