ReactOS  0.4.14-dev-384-g5b37caa
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
 

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.

Function Documentation

◆ FillResetComboBox()

static VOID FillResetComboBox ( HWND  hwnd)
static

Definition at line 104 of file general.c.

105 {
106  TCHAR szBuffer[32];
107  TCHAR szMinutes[20];
108  INT i;
109 
110  if (LoadString(hApplet, IDS_MINUTES, szMinutes, 20) == 0)
111  lstrcpy(szMinutes, L"Minutes");
112 
113  for (i = 0; i < 6; i++)
114  {
115  _stprintf(szBuffer, _T("%u %s"), (i + 1) * 5, szMinutes);
117  CB_ADDSTRING,
118  0,
119  (LPARAM)szBuffer);
120  }
121 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
HINSTANCE hApplet
Definition: access.c:17
int32_t INT
Definition: typedefs.h:56
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 CB_ADDSTRING
Definition: winuser.h:1918
LONG_PTR LPARAM
Definition: windef.h:208
char TCHAR
Definition: xmlstorage.h:189
#define _T(x)
Definition: vfdio.h:22
static const WCHAR L[]
Definition: oid.c:1250
#define _stprintf
Definition: utility.h:124
#define lstrcpy
Definition: winbase.h:3698
#define SendMessage
Definition: winuser.h:5744
#define LoadString
Definition: winuser.h:5720
#define IDS_MINUTES
Definition: resource.h:31

Referenced by GeneralPageProc().

◆ GeneralPageProc()

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

Definition at line 173 of file general.c.

177 {
178  PGLOBAL_DATA pGlobalData;
179  LPPSHNOTIFY lppsn;
180 
181  pGlobalData = (PGLOBAL_DATA)GetWindowLongPtr(hwndDlg, DWLP_USER);
182 
183  switch (uMsg)
184  {
185  case WM_INITDIALOG:
186  pGlobalData = (PGLOBAL_DATA)((LPPROPSHEETPAGE)lParam)->lParam;
187  if (pGlobalData == NULL)
188  return FALSE;
189 
190  SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pGlobalData);
191 
192  /* Set access timeout info */
193  CheckDlgButton(hwndDlg,
198  (pGlobalData->accessTimeout.iTimeOutMSec / 300000) - 1, 0);
200  pGlobalData->accessTimeout.dwFlags & ATF_TIMEOUTON ? TRUE : FALSE);
201 
202  CheckDlgButton(hwndDlg,
204  pGlobalData->bWarningSounds ? BST_CHECKED : BST_UNCHECKED);
205 
206  CheckDlgButton(hwndDlg,
208  pGlobalData->bSoundOnActivation ? BST_CHECKED : BST_UNCHECKED);
209 
210  /* Set serial keys info */
211  CheckDlgButton(hwndDlg,
215  pGlobalData->serialKeys.dwFlags & SERKF_AVAILABLE ? TRUE : FALSE);
217  pGlobalData->serialKeys.dwFlags & SERKF_AVAILABLE ? TRUE : FALSE);
218 
219  return TRUE;
220 
221  case WM_COMMAND:
222  switch (LOWORD(wParam))
223  {
224  case IDC_RESET_BOX:
225  pGlobalData->accessTimeout.dwFlags ^= ATF_TIMEOUTON;
227  pGlobalData->accessTimeout.dwFlags & ATF_TIMEOUTON ? TRUE : FALSE);
228  PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
229  break;
230 
231  case IDC_RESET_COMBO:
232  if (HIWORD(wParam) == CBN_CLOSEUP)
233  {
234  INT nSel;
235  nSel = SendDlgItemMessage(hwndDlg, IDC_RESET_COMBO, CB_GETCURSEL, 0, 0);
236  pGlobalData->accessTimeout.iTimeOutMSec = (ULONG)((nSel + 1) * 300000);
237  PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
238  }
239  break;
240 
242  pGlobalData->bWarningSounds = !pGlobalData->bWarningSounds;
243  PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
244  break;
245 
247  pGlobalData->bSoundOnActivation = !pGlobalData->bSoundOnActivation;
248  PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
249  break;
250 
251  case IDC_SERIAL_BOX:
252  pGlobalData->serialKeys.dwFlags ^= SERKF_SERIALKEYSON;
253  PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
254  break;
255 
256  case IDC_SERIAL_BUTTON:
259  hwndDlg,
261  (LPARAM)pGlobalData))
262  PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
263  break;
264 
265  case IDC_ADMIN_LOGON_BOX:
266  break;
267 
268  case IDC_ADMIN_USERS_BOX:
269  break;
270 
271  default:
272  break;
273  }
274  break;
275 
276  case WM_NOTIFY:
277  lppsn = (LPPSHNOTIFY)lParam;
278  if (lppsn->hdr.code == PSN_APPLY)
279  {
280  WriteGlobalData(pGlobalData);
281  return TRUE;
282  }
283  break;
284  }
285 
286  return FALSE;
287 }
#define MAKEINTRESOURCE
Definition: winuser.h:591
BOOL WINAPI CheckDlgButton(_In_ HWND, _In_ int, _In_ UINT)
#define TRUE
Definition: types.h:120
#define ATF_TIMEOUTON
Definition: winuser.h:1557
struct _PSHNOTIFY * LPPSHNOTIFY
static VOID WriteGlobalData(PGLOBAL_DATA pGlobalData)
Definition: general.c:125
#define IDD_SERIALKEYSOPTIONS
Definition: resource.h:21
DWORD iTimeOutMSec
Definition: winuser.h:2905
SERIALKEYS serialKeys
Definition: access.h:55
#define IDC_NOTIFICATION_MESSAGE
Definition: resource.h:53
HINSTANCE hApplet
Definition: access.c:17
BOOL bWarningSounds
Definition: access.h:58
#define SendDlgItemMessage
Definition: winuser.h:5743
#define PSN_APPLY
Definition: prsht.h:117
int32_t INT
Definition: typedefs.h:56
#define SetWindowLongPtr
Definition: treelist.c:70
#define CB_GETCURSEL
Definition: winuser.h:1925
WPARAM wParam
Definition: combotst.c:138
UINT code
Definition: winuser.h:3133
NMHDR hdr
Definition: prsht.h:312
#define IDC_SERIAL_BUTTON
Definition: resource.h:56
#define LPPROPSHEETPAGE
Definition: prsht.h:372
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define SERKF_SERIALKEYSON
Definition: winuser.h:2134
#define PropSheet_Changed(d, w)
Definition: prsht.h:326
#define IDC_NOTIFICATION_SOUND
Definition: resource.h:54
#define SERKF_AVAILABLE
Definition: winuser.h:2132
#define DialogBoxParam
Definition: winuser.h:5665
#define DWLP_USER
Definition: winuser.h:866
#define IDC_ADMIN_LOGON_BOX
Definition: resource.h:57
#define CB_SETCURSEL
Definition: winuser.h:1943
#define WM_COMMAND
Definition: winuser.h:1722
#define BST_UNCHECKED
Definition: winuser.h:199
#define IDC_RESET_BOX
Definition: resource.h:51
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define IDC_RESET_COMBO
Definition: resource.h:52
HWND WINAPI GetParent(_In_ HWND)
static VOID FillResetComboBox(HWND hwnd)
Definition: general.c:104
BOOL bSoundOnActivation
Definition: access.h:59
ACCESSTIMEOUT accessTimeout
Definition: access.h:54
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define BST_CHECKED
Definition: winuser.h:197
struct _GLOBAL_DATA * PGLOBAL_DATA
#define HIWORD(l)
Definition: typedefs.h:246
unsigned int ULONG
Definition: retypes.h:1
#define IDC_SERIAL_BOX
Definition: resource.h:55
#define GetWindowLongPtr
Definition: treelist.c:73
INT_PTR CALLBACK SerialKeysDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: general.c:17
#define CBN_CLOSEUP
Definition: winuser.h:1954
DWORD dwFlags
Definition: winuser.h:3446
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define WM_NOTIFY
Definition: richedit.h:61
#define IDC_ADMIN_USERS_BOX
Definition: resource.h:58

◆ SerialKeysDlgProc()

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

Definition at line 17 of file general.c.

21 {
22  PGLOBAL_DATA pGlobalData;
23  INT i, n;
24 
25  pGlobalData = (PGLOBAL_DATA)GetWindowLongPtr(hwndDlg, DWLP_USER);
26 
27  switch (uMsg)
28  {
29  case WM_INITDIALOG:
30  pGlobalData = (PGLOBAL_DATA)lParam;
31  SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pGlobalData);
32 
33  /* Add the COM-Ports 1 - 4 to the list */
34  for (i = 0; i < 4; i++)
35  {
36  TCHAR szBuffer[256];
37 
38  _stprintf(szBuffer, _T("COM%d"), i + 1);
40  }
41 
42  /* Determine the current port */
43  if (pGlobalData->serialKeys.lpszActivePort && pGlobalData->serialKeys.lpszActivePort[0])
44  {
45  i = pGlobalData->serialKeys.lpszActivePort[3] - '1';
46  if (i < 0 || i > 3)
47  i = 0;
48  }
49  else
50  {
51  /* Make COM1 the default port */
52  i = 0;
53  _tcscpy(pGlobalData->serialKeys.lpszActivePort, _T("COM1"));
54  }
55 
56  /* Set the current port */
58 
59  /* Determine the current baud rate */
60  n = 0;
61  for (i = 0; i < BAUDTICKS; i++)
62  {
63  TCHAR szBuffer[256];
64 
65  _stprintf(szBuffer, _T("%d Baud"), nBaudArray[i]);
67 
68  if (pGlobalData->serialKeys.iBaudRate == nBaudArray[i])
69  n = i;
70  }
71 
72  /* Set the current baud rate */
74  break;
75 
76  case WM_COMMAND:
77  switch (LOWORD(wParam))
78  {
79  case IDOK:
81  _stprintf(pGlobalData->serialKeys.lpszActivePort, _T("COM%d"), i);
82 
84  pGlobalData->serialKeys.iBaudRate = nBaudArray[i];
85 
86  EndDialog(hwndDlg, TRUE);
87  break;
88 
89  case IDCANCEL:
90  EndDialog(hwndDlg, FALSE);
91  break;
92 
93  default:
94  break;
95  }
96  break;
97  }
98 
99  return FALSE;
100 }
#define TRUE
Definition: types.h:120
#define IDOK
Definition: winuser.h:824
LPSTR lpszActivePort
Definition: winuser.h:3447
static UINT nBaudArray[BAUDTICKS]
Definition: general.c:13
GLdouble n
Definition: glext.h:7729
SERIALKEYS serialKeys
Definition: access.h:55
_TCHAR * _tcscpy(_TCHAR *to, const _TCHAR *from)
Definition: tcscpy.h:8
#define IDC_SERIAL_PORT_COMBO
Definition: resource.h:101
#define SendDlgItemMessage
Definition: winuser.h:5743
#define BAUDTICKS
Definition: general.c:12
int32_t INT
Definition: typedefs.h:56
#define SetWindowLongPtr
Definition: treelist.c:70
#define CB_GETCURSEL
Definition: winuser.h:1925
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
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
UINT iBaudRate
Definition: winuser.h:3449
#define CB_ADDSTRING
Definition: winuser.h:1918
LONG_PTR LPARAM
Definition: windef.h:208
char TCHAR
Definition: xmlstorage.h:189
#define _T(x)
Definition: vfdio.h:22
#define DWLP_USER
Definition: winuser.h:866
#define CB_SETCURSEL
Definition: winuser.h:1943
#define WM_COMMAND
Definition: winuser.h:1722
#define IDC_SERIAL_BAUD_COMBO
Definition: resource.h:102
#define _stprintf
Definition: utility.h:124
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
struct _GLOBAL_DATA * PGLOBAL_DATA
#define GetWindowLongPtr
Definition: treelist.c:73
#define IDCANCEL
Definition: winuser.h:825
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82

Referenced by GeneralPageProc().

◆ WriteGlobalData()

static VOID WriteGlobalData ( PGLOBAL_DATA  pGlobalData)
static

Definition at line 125 of file general.c.

126 {
127  DWORD dwDisposition;
128  HKEY hKey;
129  LONG lError;
130 
132  sizeof(ACCESSTIMEOUT),
133  &pGlobalData->accessTimeout,
135 
136  SystemParametersInfo(SPI_SETSERIALKEYS,
137  sizeof(SERIALKEYS),
138  &pGlobalData->serialKeys,
140 
142  _T("Control Panel\\Accessibility"),
143  0,
144  NULL,
147  NULL,
148  &hKey,
149  &dwDisposition);
150  if (lError != ERROR_SUCCESS)
151  return;
152 
153  RegSetValueEx(hKey,
154  _T("Warning Sounds"),
155  0,
156  REG_DWORD,
157  (LPBYTE)&pGlobalData->bWarningSounds,
158  sizeof(BOOL));
159 
160  RegSetValueEx(hKey,
161  _T("Sound On Activation"),
162  0,
163  REG_DWORD,
164  (LPBYTE)&pGlobalData->bSoundOnActivation,
165  sizeof(BOOL));
166 
167  RegCloseKey(hKey);
168 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define KEY_SET_VALUE
Definition: nt_native.h:1017
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define SPI_SETACCESSTIMEOUT
Definition: winuser.h:1392
#define SystemParametersInfo
Definition: winuser.h:5759
SERIALKEYS serialKeys
Definition: access.h:55
BOOL bWarningSounds
Definition: access.h:58
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
#define REG_OPTION_NON_VOLATILE
Definition: nt_native.h:1057
#define _T(x)
Definition: vfdio.h:22
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SPIF_UPDATEINIFILE
Definition: winuser.h:1553
BOOL bSoundOnActivation
Definition: access.h:59
ACCESSTIMEOUT accessTimeout
Definition: access.h:54
#define SPIF_SENDCHANGE
Definition: winuser.h:1554
#define REG_DWORD
Definition: sdbapi.c:596
#define RegSetValueEx
Definition: winreg.h:533
#define RegCreateKeyEx
Definition: winreg.h:501

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().