ReactOS 0.4.16-dev-197-g92996da
general.c File Reference
#include "access.h"
Include dependency graph for general.c:

Go to the source code of this file.

Macros

#define BAUDTICKS   6
 
#define FIVE_MINS_IN_MS   (5 * 60 * 1000)
 

Functions

INT_PTR CALLBACK SerialKeysDlgProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static VOID FillResetComboBox (HWND hwnd)
 
static VOID WriteGlobalData (PGLOBAL_DATA pGlobalData)
 
INT_PTR CALLBACK GeneralPageProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 

Variables

static UINT nBaudArray [BAUDTICKS] = {300, 1200, 2400, 4800, 9600, 19200}
 

Macro Definition Documentation

◆ BAUDTICKS

#define BAUDTICKS   6

Definition at line 12 of file general.c.

◆ FIVE_MINS_IN_MS

#define FIVE_MINS_IN_MS   (5 * 60 * 1000)

Definition at line 15 of file general.c.

Function Documentation

◆ FillResetComboBox()

static VOID FillResetComboBox ( HWND  hwnd)
static

Definition at line 105 of file general.c.

106{
107 TCHAR szBuffer[32];
108 TCHAR szMinutes[20];
109 INT i;
110
111 if (LoadString(hApplet, IDS_MINUTES, szMinutes, 20) == 0)
112 lstrcpy(szMinutes, L"Minutes");
113
114 for (i = 0; i < 6; i++)
115 {
116 _stprintf(szBuffer, _T("%u %s"), (i + 1) * 5, szMinutes);
119 0,
120 (LPARAM)szBuffer);
121 }
122}
HINSTANCE hApplet
Definition: access.c:17
#define IDS_MINUTES
Definition: resource.h:31
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define _stprintf
Definition: utility.h:124
#define L(x)
Definition: ntvdm.h:50
int32_t INT
Definition: typedefs.h:58
#define _T(x)
Definition: vfdio.h:22
#define lstrcpy
Definition: winbase.h:3898
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
LONG_PTR LPARAM
Definition: windef.h:208
#define CB_ADDSTRING
Definition: winuser.h:1939
#define SendMessage
Definition: winuser.h:5855
#define LoadString
Definition: winuser.h:5831
char TCHAR
Definition: xmlstorage.h:189

Referenced by GeneralPageProc().

◆ GeneralPageProc()

INT_PTR CALLBACK GeneralPageProc ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 174 of file general.c.

178{
179 PGLOBAL_DATA pGlobalData;
180 LPPSHNOTIFY lppsn;
181 INT iCurSel;
182
183 pGlobalData = (PGLOBAL_DATA)GetWindowLongPtr(hwndDlg, DWLP_USER);
184
185 switch (uMsg)
186 {
187 case WM_INITDIALOG:
188 pGlobalData = (PGLOBAL_DATA)((LPPROPSHEETPAGE)lParam)->lParam;
189 if (pGlobalData == NULL)
190 return FALSE;
191
192 SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pGlobalData);
193
194 /* Set access timeout info */
195 CheckDlgButton(hwndDlg,
200 iCurSel = (pGlobalData->accessTimeout.iTimeOutMSec / FIVE_MINS_IN_MS) - 1;
201 SendDlgItemMessage(hwndDlg, IDC_RESET_COMBO, CB_SETCURSEL, iCurSel, 0);
203 pGlobalData->accessTimeout.dwFlags & ATF_TIMEOUTON ? TRUE : FALSE);
204
205 CheckDlgButton(hwndDlg,
207 pGlobalData->bWarningSounds ? BST_CHECKED : BST_UNCHECKED);
208
209 CheckDlgButton(hwndDlg,
212
213 /* Set serial keys info */
214 CheckDlgButton(hwndDlg,
218 pGlobalData->serialKeys.dwFlags & SERKF_AVAILABLE ? TRUE : FALSE);
220 pGlobalData->serialKeys.dwFlags & SERKF_AVAILABLE ? TRUE : FALSE);
221
222 return TRUE;
223
224 case WM_COMMAND:
225 switch (LOWORD(wParam))
226 {
227 case IDC_RESET_BOX:
228 pGlobalData->accessTimeout.dwFlags ^= ATF_TIMEOUTON;
230 pGlobalData->accessTimeout.dwFlags & ATF_TIMEOUTON ? TRUE : FALSE);
231 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
232 break;
233
234 case IDC_RESET_COMBO:
235 if (HIWORD(wParam) == CBN_CLOSEUP)
236 {
237 INT nSel;
238 nSel = SendDlgItemMessage(hwndDlg, IDC_RESET_COMBO, CB_GETCURSEL, 0, 0);
239 pGlobalData->accessTimeout.iTimeOutMSec = (DWORD)((nSel + 1) * FIVE_MINS_IN_MS);
240 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
241 }
242 break;
243
245 pGlobalData->bWarningSounds = !pGlobalData->bWarningSounds;
246 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
247 break;
248
250 pGlobalData->bSoundOnActivation = !pGlobalData->bSoundOnActivation;
251 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
252 break;
253
254 case IDC_SERIAL_BOX:
255 pGlobalData->serialKeys.dwFlags ^= SERKF_SERIALKEYSON;
256 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
257 break;
258
262 hwndDlg,
264 (LPARAM)pGlobalData))
265 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
266 break;
267
269 break;
270
272 break;
273
274 default:
275 break;
276 }
277 break;
278
279 case WM_NOTIFY:
280 lppsn = (LPPSHNOTIFY)lParam;
281 if (lppsn->hdr.code == PSN_APPLY)
282 {
283 WriteGlobalData(pGlobalData);
284 return TRUE;
285 }
286 break;
287 }
288
289 return FALSE;
290}
struct _GLOBAL_DATA * PGLOBAL_DATA
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
INT_PTR CALLBACK SerialKeysDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: general.c:18
static VOID FillResetComboBox(HWND hwnd)
Definition: general.c:105
#define FIVE_MINS_IN_MS
Definition: general.c:15
static VOID WriteGlobalData(PGLOBAL_DATA pGlobalData)
Definition: general.c:126
#define IDC_ADMIN_USERS_BOX
Definition: resource.h:58
#define IDC_NOTIFICATION_MESSAGE
Definition: resource.h:53
#define IDC_ADMIN_LOGON_BOX
Definition: resource.h:57
#define IDD_SERIALKEYSOPTIONS
Definition: resource.h:21
#define IDC_SERIAL_BUTTON
Definition: resource.h:56
#define IDC_NOTIFICATION_SOUND
Definition: resource.h:54
#define IDC_RESET_COMBO
Definition: resource.h:52
#define IDC_RESET_BOX
Definition: resource.h:51
#define IDC_SERIAL_BOX
Definition: resource.h:55
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define DWORD
Definition: nt_native.h:44
#define LOWORD(l)
Definition: pedump.c:82
#define PropSheet_Changed(d, w)
Definition: prsht.h:344
#define PSN_APPLY
Definition: prsht.h:117
#define LPPROPSHEETPAGE
Definition: prsht.h:390
struct _PSHNOTIFY * LPPSHNOTIFY
#define WM_NOTIFY
Definition: richedit.h:61
ACCESSTIMEOUT accessTimeout
Definition: access.h:53
BOOL bWarningSounds
Definition: access.h:57
SERIALKEYS serialKeys
Definition: access.h:54
BOOL bSoundOnActivation
Definition: access.h:58
NMHDR hdr
Definition: prsht.h:330
DWORD iTimeOutMSec
Definition: winuser.h:2934
UINT code
Definition: winuser.h:3162
DWORD dwFlags
Definition: winuser.h:3475
#define max(a, b)
Definition: svc.c:63
#define GetWindowLongPtr
Definition: treelist.c:73
#define SetWindowLongPtr
Definition: treelist.c:70
#define HIWORD(l)
Definition: typedefs.h:247
#define DWLP_USER
Definition: winuser.h:875
BOOL WINAPI CheckDlgButton(_In_ HWND, _In_ int, _In_ UINT)
#define BST_UNCHECKED
Definition: winuser.h:199
#define SERKF_AVAILABLE
Definition: winuser.h:2160
#define WM_COMMAND
Definition: winuser.h:1743
#define CB_SETCURSEL
Definition: winuser.h:1964
#define DialogBoxParam
Definition: winuser.h:5776
#define WM_INITDIALOG
Definition: winuser.h:1742
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define CBN_CLOSEUP
Definition: winuser.h:1975
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
HWND WINAPI GetParent(_In_ HWND)
#define SERKF_SERIALKEYSON
Definition: winuser.h:2162
#define CB_GETCURSEL
Definition: winuser.h:1946
#define ATF_TIMEOUTON
Definition: winuser.h:1578
#define SendDlgItemMessage
Definition: winuser.h:5854
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define BST_CHECKED
Definition: winuser.h:197

◆ SerialKeysDlgProc()

INT_PTR CALLBACK SerialKeysDlgProc ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 18 of file general.c.

22{
23 PGLOBAL_DATA pGlobalData;
24 INT i, n;
25
26 pGlobalData = (PGLOBAL_DATA)GetWindowLongPtr(hwndDlg, DWLP_USER);
27
28 switch (uMsg)
29 {
30 case WM_INITDIALOG:
31 pGlobalData = (PGLOBAL_DATA)lParam;
32 SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pGlobalData);
33
34 /* Add the COM-Ports 1 - 4 to the list */
35 for (i = 0; i < 4; i++)
36 {
37 TCHAR szBuffer[256];
38
39 _stprintf(szBuffer, _T("COM%d"), i + 1);
41 }
42
43 /* Determine the current port */
44 if (pGlobalData->serialKeys.lpszActivePort && pGlobalData->serialKeys.lpszActivePort[0])
45 {
46 i = pGlobalData->serialKeys.lpszActivePort[3] - '1';
47 if (i < 0 || i > 3)
48 i = 0;
49 }
50 else
51 {
52 /* Make COM1 the default port */
53 i = 0;
54 _tcscpy(pGlobalData->serialKeys.lpszActivePort, _T("COM1"));
55 }
56
57 /* Set the current port */
59
60 /* Determine the current baud rate */
61 n = 0;
62 for (i = 0; i < BAUDTICKS; i++)
63 {
64 TCHAR szBuffer[256];
65
66 _stprintf(szBuffer, _T("%d Baud"), nBaudArray[i]);
68
69 if (pGlobalData->serialKeys.iBaudRate == nBaudArray[i])
70 n = i;
71 }
72
73 /* Set the current baud rate */
75 break;
76
77 case WM_COMMAND:
78 switch (LOWORD(wParam))
79 {
80 case IDOK:
82 _stprintf(pGlobalData->serialKeys.lpszActivePort, _T("COM%d"), i);
83
85 pGlobalData->serialKeys.iBaudRate = nBaudArray[i];
86
87 EndDialog(hwndDlg, TRUE);
88 break;
89
90 case IDCANCEL:
91 EndDialog(hwndDlg, FALSE);
92 break;
93
94 default:
95 break;
96 }
97 break;
98 }
99
100 return FALSE;
101}
#define BAUDTICKS
Definition: general.c:12
static UINT nBaudArray[BAUDTICKS]
Definition: general.c:13
#define IDC_SERIAL_PORT_COMBO
Definition: resource.h:101
#define IDC_SERIAL_BAUD_COMBO
Definition: resource.h:102
GLdouble n
Definition: glext.h:7729
#define _tcscpy
Definition: tchar.h:623
UINT iBaudRate
Definition: winuser.h:3478
LPSTR lpszActivePort
Definition: winuser.h:3476
#define IDCANCEL
Definition: winuser.h:834
#define IDOK
Definition: winuser.h:833
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)

Referenced by GeneralPageProc().

◆ WriteGlobalData()

static VOID WriteGlobalData ( PGLOBAL_DATA  pGlobalData)
static

Definition at line 126 of file general.c.

127{
128 DWORD dwDisposition;
129 HKEY hKey;
130 LONG lError;
131
133 sizeof(ACCESSTIMEOUT),
134 &pGlobalData->accessTimeout,
136
137 SystemParametersInfo(SPI_SETSERIALKEYS,
138 sizeof(SERIALKEYS),
139 &pGlobalData->serialKeys,
141
143 _T("Control Panel\\Accessibility"),
144 0,
145 NULL,
148 NULL,
149 &hKey,
150 &dwDisposition);
151 if (lError != ERROR_SUCCESS)
152 return;
153
155 _T("Warning Sounds"),
156 0,
157 REG_DWORD,
158 (LPBYTE)&pGlobalData->bWarningSounds,
159 sizeof(BOOL));
160
162 _T("Sound On Activation"),
163 0,
164 REG_DWORD,
165 (LPBYTE)&pGlobalData->bSoundOnActivation,
166 sizeof(BOOL));
167
169}
#define RegCloseKey(hKey)
Definition: registry.h:49
#define ERROR_SUCCESS
Definition: deptool.c:10
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
FxAutoRegKey hKey
#define REG_OPTION_NON_VOLATILE
Definition: nt_native.h:1057
#define KEY_SET_VALUE
Definition: nt_native.h:1017
long LONG
Definition: pedump.c:60
#define REG_DWORD
Definition: sdbapi.c:596
unsigned char * LPBYTE
Definition: typedefs.h:53
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define RegSetValueEx
Definition: winreg.h:533
#define RegCreateKeyEx
Definition: winreg.h:501
#define SPI_SETACCESSTIMEOUT
Definition: winuser.h:1413
#define SPIF_SENDCHANGE
Definition: winuser.h:1575
#define SPIF_UPDATEINIFILE
Definition: winuser.h:1574
#define SystemParametersInfo
Definition: winuser.h:5870

Referenced by GeneralPageProc().

Variable Documentation

◆ nBaudArray

UINT nBaudArray[BAUDTICKS] = {300, 1200, 2400, 4800, 9600, 19200}
static

Definition at line 13 of file general.c.

Referenced by SerialKeysDlgProc().