ReactOS  0.4.13-dev-544-gede3fdd
advanced.c
Go to the documentation of this file.
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,
26  0,
27  0) == BST_CHECKED);
28 
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
52 {
53  HKEY hKey;
54  DWORD dwVal;
55  DWORD dwType = REG_DWORD;
56  DWORD cbData = sizeof(DWORD);
57 
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,
78  0);
79  }
80  }
81 
82  RegCloseKey(hKey);
83  }
84 }
85 
88  UINT uMsg,
89  WPARAM wParam,
90  LPARAM lParam)
91 {
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 */
118  UINT uMsg,
119  WPARAM wParam,
120  LPARAM lParam)
121 {
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:
136  hwndDlg,
138  break;
139 
140  case IDC_USERPROFILE:
143  hwndDlg,
145  break;
146 
147  case IDC_STAREC:
150  hwndDlg,
152  break;
153 
154  case IDC_SYSSETTINGS:
157  hwndDlg,
159  break;
160 
161  case IDC_ENVVAR:
164  hwndDlg,
166  break;
167 
168  case IDC_ERRORREPORT:
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 }
#define RegQueryValueEx
Definition: winreg.h:524
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define TRUE
Definition: types.h:120
#define IDOK
Definition: winuser.h:824
#define IDC_USERPROFILE
Definition: resource.h:92
#define IDD_STARTUPRECOVERY
Definition: resource.h:155
#define IDC_PERFOR
Definition: resource.h:91
#define ERROR_SUCCESS
Definition: deptool.c:10
static TCHAR ReportAsWorkstationKey[]
Definition: advanced.c:14
#define KEY_READ
Definition: nt_native.h:1023
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
#define IDD_ENVIRONMENT_VARIABLES
Definition: resource.h:122
#define CALLBACK
Definition: compat.h:27
#define IDD_SYSSETTINGS
Definition: resource.h:96
HINSTANCE hApplet
Definition: access.c:17
UINT_PTR WPARAM
Definition: windef.h:207
int32_t INT_PTR
Definition: typedefs.h:62
#define DWORD
Definition: nt_native.h:44
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
INT_PTR CALLBACK UserProfileDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: userprofile.c:602
#define DialogBox
Definition: winuser.h:5627
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
static TCHAR BugLink[]
Definition: advanced.c:13
#define ShellExecute
Definition: shellapi.h:689
INT_PTR CALLBACK EnvironmentDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: environment.c:685
smooth NULL
Definition: ftsmooth.c:416
#define IDD_USERPROFILE
Definition: resource.h:100
static VOID OnOK(HWND hwndDlg)
Definition: advanced.c:18
LONG_PTR LPARAM
Definition: windef.h:208
#define BM_GETCHECK
Definition: winuser.h:1879
#define IDC_ENVVAR
Definition: resource.h:89
INT_PTR CALLBACK StartRecDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: startrec.c:688
#define KEY_WRITE
Definition: nt_native.h:1031
char TCHAR
Definition: xmlstorage.h:189
#define BM_SETCHECK
Definition: winuser.h:1882
#define _T(x)
Definition: vfdio.h:22
INT_PTR CALLBACK VirtMemDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: virtmem.c:664
unsigned long DWORD
Definition: ntddk_ex.h:95
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static VOID OnInitSysSettingsDialog(HWND hwndDlg)
Definition: advanced.c:51
#define IDC_REPORTASWORKSTATION
Definition: resource.h:97
#define WM_COMMAND
Definition: winuser.h:1716
INT_PTR CALLBACK SysSettingsDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: advanced.c:87
#define RegOpenKeyEx
Definition: winreg.h:520
#define SW_SHOWNORMAL
Definition: winuser.h:764
unsigned int UINT
Definition: ndis.h:50
#define BST_CHECKED
Definition: winuser.h:197
#define REG_DWORD
Definition: sdbapi.c:596
#define WM_INITDIALOG
Definition: winuser.h:1715
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
INT_PTR CALLBACK AdvancedPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: advanced.c:423
#define RegSetValueEx
Definition: winreg.h:533
#define RegCreateKeyEx
Definition: winreg.h:501
#define IDC_ERRORREPORT
Definition: resource.h:93
#define IDD_VIRTMEM
Definition: resource.h:138
#define IDC_STAREC
Definition: resource.h:90
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define IDC_SYSSETTINGS
Definition: resource.h:88