ReactOS 0.4.15-dev-7677-g8209aa5
serialui.h File Reference
#include <stdarg.h>
#include <windef.h>
#include <winbase.h>
#include <winuser.h>
#include <winnls.h>
#include "resource.h"
Include dependency graph for serialui.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _DIALOG_INFO
 
struct  _PARITY_INFO
 
struct  _STOPBIT_INFO
 

Macros

#define WIN32_NO_STATUS
 
#define _INC_WINDOWS
 
#define COM_NO_WINDOWS_H
 
#define UNIMPLEMENTED    return ERROR_CALL_NOT_IMPLEMENTED ;
 
#define DEFAULT_BAUD_INDEX   6
 
#define DEFAULT_BYTESIZE_INDEX   3
 
#define DEFAULT_PARITY_INDEX   2
 
#define DEFAULT_STOPBITS_INDEX   0
 

Typedefs

typedef struct _DIALOG_INFO DIALOG_INFO
 
typedef struct _DIALOG_INFOLPDIALOG_INFO
 
typedef struct _PARITY_INFO PARITY_INFO
 
typedef struct _PARITY_INFOPPARITY_INFO
 
typedef struct _STOPBIT_INFO STOPBIT_INFO
 
typedef struct _STOPBIT_INFOPSTOPBIT_INFO
 

Functions

DWORD WINAPI drvCommConfigDialogW (LPCWSTR lpszDevice, HWND hWnd, LPCOMMCONFIG lpCommConfig)
 
DWORD WINAPI drvCommConfigDialogA (LPCSTR lpszDevice, HWND hWnd, LPCOMMCONFIG lpCommConfig)
 
DWORD WINAPI drvSetDefaultCommConfigW (LPCWSTR lpszDevice, LPCOMMCONFIG lpCommConfig, DWORD dwSize)
 
DWORD WINAPI drvSetDefaultCommConfigA (LPCSTR lpszDevice, LPCOMMCONFIG lpCommConfig, DWORD dwSize)
 
DWORD WINAPI drvGetDefaultCommConfigW (LPCWSTR lpszDevice, LPCOMMCONFIG lpCommConfig, LPDWORD lpdwSize)
 
DWORD WINAPI drvGetDefaultCommConfigA (LPCSTR lpszDevice, LPCOMMCONFIG lpCommConfig, LPDWORD lpdwSize)
 
INT_PTR CALLBACK CommDlgProc (HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
 
VOID OkButton (HWND hDlg)
 

Macro Definition Documentation

◆ _INC_WINDOWS

#define _INC_WINDOWS

Definition at line 10 of file serialui.h.

◆ COM_NO_WINDOWS_H

#define COM_NO_WINDOWS_H

Definition at line 11 of file serialui.h.

◆ DEFAULT_BAUD_INDEX

#define DEFAULT_BAUD_INDEX   6

Definition at line 23 of file serialui.h.

◆ DEFAULT_BYTESIZE_INDEX

#define DEFAULT_BYTESIZE_INDEX   3

Definition at line 24 of file serialui.h.

◆ DEFAULT_PARITY_INDEX

#define DEFAULT_PARITY_INDEX   2

Definition at line 25 of file serialui.h.

◆ DEFAULT_STOPBITS_INDEX

#define DEFAULT_STOPBITS_INDEX   0

Definition at line 26 of file serialui.h.

◆ UNIMPLEMENTED

#define UNIMPLEMENTED    return ERROR_CALL_NOT_IMPLEMENTED ;

Definition at line 20 of file serialui.h.

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 9 of file serialui.h.

Typedef Documentation

◆ DIALOG_INFO

◆ LPDIALOG_INFO

◆ PARITY_INFO

◆ PPARITY_INFO

◆ PSTOPBIT_INFO

◆ STOPBIT_INFO

Function Documentation

◆ CommDlgProc()

INT_PTR CALLBACK CommDlgProc ( HWND  hDlg,
UINT  Msg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 191 of file serialui.c.

192{
193 LPDIALOG_INFO lpDlgInfo = NULL;
194 HWND hBox;
195
196 switch (Msg)
197 {
198
199 case WM_INITDIALOG:
200 {
201 WCHAR wstr[255];
202 RECT rc, rcDlg, rcOwner;
203 HWND hOwner;
204 INT i;
205
206 lpDlgInfo = (LPDIALOG_INFO)lParam;
207 SetWindowLongPtrW(hDlg, DWLP_USER, (LONG_PTR)lpDlgInfo);
208
209 /* Set title */
210 if(LoadStringW(hDllInstance, IDS_TITLE, wstr, sizeof(wstr) / sizeof(wstr[0])))
211 {
212 SetWindowTextW(hDlg, wstr);
213 }
214
215 /* FIXME - this won't work correctly systems with multiple monitors! */
216 if(!(hOwner = GetParent(hDlg)))
217 hOwner = GetDesktopWindow();
218
219 /* Position dialog in the center of owner window */
220 GetWindowRect(hOwner, &rcOwner);
221 GetWindowRect(hDlg, &rcDlg);
222 CopyRect(&rc, &rcOwner);
223 OffsetRect(&rcDlg, -rcDlg.left, -rcDlg.top);
224 OffsetRect(&rc, -rc.left, -rc.top);
225 OffsetRect(&rc, -rcDlg.right, -rcDlg.bottom);
227 rcOwner.left + (rc.right / 2),
228 rcOwner.top + (rc.bottom / 2),
229 0, 0, SWP_NOSIZE);
230
231 /* Initialize baud rate combo */
232 if(!(hBox = GetDlgItem(hDlg, IDC_BAUDRATE)))
234
235 for(i = 0; Bauds[i]; i++)
236 {
237 wsprintf(wstr, L"%d", Bauds[i]);
239 if(Bauds[i] == lpDlgInfo->lpCC->dcb.BaudRate)
240 SendMessageW(hBox, CB_SETCURSEL, (WPARAM)i, 0);
241 }
242
243 if(SendMessageW(hBox, CB_GETCURSEL, 0, 0) == CB_ERR)
245
246 /* Initialize byte size combo */
247 if(!(hBox = GetDlgItem(hDlg, IDC_BYTESIZE)))
249
250 for(i = 0; ByteSizes[i]; i++)
251 {
252 wsprintf(wstr, L"%d", Bauds[i]);
254 if(ByteSizes[i] == lpDlgInfo->lpCC->dcb.ByteSize)
255 SendMessageW(hBox, CB_SETCURSEL, (WPARAM)i, 0);
256 }
257
258 if(SendMessageW(hBox, CB_GETCURSEL, 0, 0) == CB_ERR)
260
261 /* Initialize parity combo */
262 if(!(hBox = GetDlgItem(hDlg, IDC_PARITY)))
264
265 for(i = 0; Parities[i].StrId; i++)
266 {
267 if(LoadStringW(hDllInstance, Parities[i].StrId, wstr, sizeof(wstr) / sizeof(wstr[0])))
268 {
270 if(Parities[i].Parity == lpDlgInfo->lpCC->dcb.Parity)
271 SendMessageW(hBox, CB_SETCURSEL, (WPARAM)i, 0);
272 }
273 }
274
275 if(SendMessageW(hBox, CB_GETCURSEL, 0, 0)==CB_ERR)
277
278 /* Initialize stop bits combo */
279 if(!(hBox = GetDlgItem(hDlg, IDC_STOPBITS)))
281
282 for(i = 0; StopBits[i].StrId; i++)
283 {
284 if(LoadStringW(hDllInstance, StopBits[i].StrId, wstr, sizeof(wstr) / sizeof(wstr[0])))
285 {
287 if(StopBits[i].StopBit == lpDlgInfo->lpCC->dcb.StopBits)
288 SendMessageW(hBox, CB_SETCURSEL, (WPARAM)i, 0);
289 }
290 }
291
292 if(SendMessageW(hBox, CB_GETCURSEL, 0, 0)==CB_ERR)
294
295 /* Initialize flow control combo */
296 if(!(hBox = GetDlgItem(hDlg, IDC_FLOW)))
298
299 if(LoadStringW(hDllInstance, IDS_FC_NO, wstr, sizeof(wstr) / sizeof(wstr[0])))
300 {
301 SendMessageW(hBox, CB_INSERTSTRING, 0, (LPARAM)wstr);
302 SendMessageW(hBox, CB_SETCURSEL, 0, 0);
303 lpDlgInfo->InitialFlowIndex = 0;
304 }
305
306
307 if(LoadStringW(hDllInstance, IDS_FC_CTSRTS, wstr, sizeof(wstr) / sizeof(wstr[0])))
308 {
309 SendMessageW(hBox, CB_INSERTSTRING, 1, (LPARAM)wstr);
310 if(lpDlgInfo->lpCC->dcb.fRtsControl == RTS_CONTROL_HANDSHAKE
311 || lpDlgInfo->lpCC->dcb.fOutxCtsFlow != FALSE)
312 {
313 SendMessageW(hBox, CB_SETCURSEL, 1, 0);
314 lpDlgInfo->InitialFlowIndex = 1;
315 }
316 }
317
318 if(LoadStringW(hDllInstance, IDS_FC_XONXOFF, wstr, sizeof(wstr) / sizeof(wstr[0])))
319 {
320 SendMessageW(hBox, CB_INSERTSTRING, 2, (LPARAM)wstr);
321 if(lpDlgInfo->lpCC->dcb.fOutX || lpDlgInfo->lpCC->dcb.fInX)
322 {
323 SendMessageW(hBox, CB_SETCURSEL, 2, 0);
324 lpDlgInfo->InitialFlowIndex = 2;
325 }
326 }
327
328 /* Set focus */
330
331 return FALSE;
332 } /* WM_INITDIALOG */
333
334 case WM_COMMAND:
335 {
336 switch(wParam)
337 {
338 case IDC_CANCELBTN:
340 break;
341 case IDC_OKBTN:
342 OkButton(hDlg);
344 break;
345 }
346 return TRUE;
347 } /* WM_COMMAND */
348
349 case WM_CLOSE:
350 {
352 return TRUE;
353 } /* WM_CLOSE */
354
355 default:
356 return FALSE;
357 }
358
359}
#define IDS_TITLE
Definition: resource.h:30
WPARAM wParam
Definition: combotst.c:138
struct @1628 Msg[]
LPARAM lParam
Definition: combotst.c:139
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define DEFAULT_PARITY_INDEX
Definition: serial.c:29
#define IDC_BAUDRATE
Definition: resource.h:29
#define IDC_BYTESIZE
Definition: resource.h:30
#define IDC_CANCELBTN
Definition: resource.h:22
#define IDS_FC_XONXOFF
Definition: resource.h:15
#define IDC_OKBTN
Definition: resource.h:21
#define IDS_FC_CTSRTS
Definition: resource.h:14
#define IDC_STOPBITS
Definition: resource.h:32
#define IDS_FC_NO
Definition: resource.h:13
#define IDC_FLOW
Definition: resource.h:33
#define IDC_PARITY
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
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define L(x)
Definition: ntvdm.h:50
const STOPBIT_INFO StopBits[]
Definition: serialui.c:59
VOID OkButton(HWND hDlg)
Definition: serialui.c:362
const DWORD Bauds[]
Definition: serialui.c:22
const PARITY_INFO Parities[]
Definition: serialui.c:50
const BYTE ByteSizes[]
Definition: serialui.c:41
static HINSTANCE hDllInstance
Definition: serialui.c:14
struct _DIALOG_INFO * LPDIALOG_INFO
#define DEFAULT_BYTESIZE_INDEX
Definition: serialui.h:24
#define DEFAULT_STOPBITS_INDEX
Definition: serialui.h:26
#define DEFAULT_BAUD_INDEX
Definition: serialui.h:23
DWORD fOutxCtsFlow
Definition: winbase.h:650
BYTE Parity
Definition: winbase.h:666
DWORD fRtsControl
Definition: winbase.h:659
DWORD BaudRate
Definition: winbase.h:647
DWORD fInX
Definition: winbase.h:656
BYTE ByteSize
Definition: winbase.h:665
DWORD fOutX
Definition: winbase.h:655
BYTE StopBits
Definition: winbase.h:667
LPCOMMCONFIG lpCC
Definition: serialui.h:32
UINT InitialFlowIndex
Definition: serialui.h:31
UINT StrId
Definition: serialui.h:38
UINT StrId
Definition: serialui.h:44
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
int32_t INT
Definition: typedefs.h:58
#define RTS_CONTROL_HANDSHAKE
Definition: winbase.h:538
LONG_PTR LPARAM
Definition: windef.h:208
UINT_PTR WPARAM
Definition: windef.h:207
#define ERROR_CANCELLED
Definition: winerror.h:726
BOOL WINAPI CopyRect(_Out_ LPRECT, _In_ LPCRECT)
#define WM_CLOSE
Definition: winuser.h:1620
#define DWLP_USER
Definition: winuser.h:871
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define WM_COMMAND
Definition: winuser.h:1739
#define CB_ERR
Definition: winuser.h:2434
#define CB_SETCURSEL
Definition: winuser.h:1960
#define SWP_NOSIZE
Definition: winuser.h:1244
#define WM_INITDIALOG
Definition: winuser.h:1738
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:656
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
#define HWND_TOP
Definition: winuser.h:1206
HWND WINAPI SetFocus(_In_opt_ HWND)
#define wsprintf
Definition: winuser.h:5864
HWND WINAPI GetParent(_In_ HWND)
BOOL WINAPI OffsetRect(_Inout_ LPRECT, _In_ int, _In_ int)
#define CB_INSERTSTRING
Definition: winuser.h:1956
#define CB_GETCURSEL
Definition: winuser.h:1942
#define SetWindowLongPtrW
Definition: winuser.h:5345
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by drvCommConfigDialogW().

◆ drvCommConfigDialogA()

DWORD WINAPI drvCommConfigDialogA ( LPCSTR  lpszDevice,
HWND  hWnd,
LPCOMMCONFIG  lpCommConfig 
)

Definition at line 122 of file serialui.c.

125{
126 BOOL result;
127 UINT len;
128 WCHAR *wstr;
129
130 len = MultiByteToWideChar(CP_ACP, 0, lpszDevice, -1, NULL, 0);
131 if((wstr = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR))))
132 {
133 MultiByteToWideChar(CP_ACP, 0, lpszDevice, -1, wstr, len);
134 result = drvCommConfigDialogW(wstr, hWnd, lpCommConfig);
135 HeapFree(GetProcessHeap(), 0, wstr);
136 return result;
137 }
138 else
140}
HWND hWnd
Definition: settings.c:17
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define GetProcessHeap()
Definition: compat.h:736
#define CP_ACP
Definition: compat.h:109
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
#define MultiByteToWideChar
Definition: compat.h:110
unsigned int BOOL
Definition: ntddk_ex.h:94
GLenum GLsizei len
Definition: glext.h:6722
GLuint64EXT * result
Definition: glext.h:11304
unsigned int UINT
Definition: ndis.h:50
DWORD WINAPI drvCommConfigDialogW(LPCWSTR lpszDevice, HWND hWnd, LPCOMMCONFIG lpCommConfig)
Definition: serialui.c:101

◆ drvCommConfigDialogW()

DWORD WINAPI drvCommConfigDialogW ( LPCWSTR  lpszDevice,
HWND  hWnd,
LPCOMMCONFIG  lpCommConfig 
)

Definition at line 101 of file serialui.c.

104{
105 DIALOG_INFO DialogInfo;
106
107 if(!lpszDevice || !lpCommConfig)
108 {
110 }
111
112 DialogInfo.lpszDevice = lpszDevice;
113 DialogInfo.lpCC = lpCommConfig;
114
116 hWnd, CommDlgProc, (LPARAM)&DialogInfo);
117}
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define IDD_COMMDLG
Definition: resource.h:19
INT_PTR CALLBACK CommDlgProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: serialui.c:191
LPCWSTR lpszDevice
Definition: serialui.h:30
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)

Referenced by drvCommConfigDialogA().

◆ drvGetDefaultCommConfigA()

DWORD WINAPI drvGetDefaultCommConfigA ( LPCSTR  lpszDevice,
LPCOMMCONFIG  lpCommConfig,
LPDWORD  lpdwSize 
)

Definition at line 175 of file serialui.c.

178{
180}
#define UNIMPLEMENTED
Definition: debug.h:115

◆ drvGetDefaultCommConfigW()

DWORD WINAPI drvGetDefaultCommConfigW ( LPCWSTR  lpszDevice,
LPCOMMCONFIG  lpCommConfig,
LPDWORD  lpdwSize 
)

Definition at line 165 of file serialui.c.

168{
170}

◆ drvSetDefaultCommConfigA()

DWORD WINAPI drvSetDefaultCommConfigA ( LPCSTR  lpszDevice,
LPCOMMCONFIG  lpCommConfig,
DWORD  dwSize 
)

Definition at line 155 of file serialui.c.

158{
160}

◆ drvSetDefaultCommConfigW()

DWORD WINAPI drvSetDefaultCommConfigW ( LPCWSTR  lpszDevice,
LPCOMMCONFIG  lpCommConfig,
DWORD  dwSize 
)

Definition at line 145 of file serialui.c.

148{
150}

◆ OkButton()

VOID OkButton ( HWND  hDlg)

Definition at line 362 of file serialui.c.

363{
364 LPDIALOG_INFO lpDlgInfo;
365 UINT Index;
366
367 lpDlgInfo = (LPDIALOG_INFO) GetWindowLongPtrW(hDlg, DWLP_USER);
368
369 /* Baud rate */
371 lpDlgInfo->lpCC->dcb.BaudRate = Bauds[Index];
372
373 /* Byte size */
375 lpDlgInfo->lpCC->dcb.ByteSize = ByteSizes[Index];
376
377 /* Parity */
379 lpDlgInfo->lpCC->dcb.Parity = Parities[Index].Parity;
380
381 /* Stop bits */
383 lpDlgInfo->lpCC->dcb.StopBits = StopBits[Index].StopBit;
384
385 /* Flow Control */
387 if(lpDlgInfo->InitialFlowIndex != Index)
388 {
389 switch(Index)
390 {
391 case 0: /* NO */
394 lpDlgInfo->lpCC->dcb.fOutxCtsFlow = FALSE;
395 lpDlgInfo->lpCC->dcb.fOutxDsrFlow = FALSE;
396 lpDlgInfo->lpCC->dcb.fOutX = FALSE;
397 lpDlgInfo->lpCC->dcb.fInX = FALSE;
398 break;
399 case 1: /* CTS/RTS */
402 lpDlgInfo->lpCC->dcb.fOutxCtsFlow = TRUE;
403 lpDlgInfo->lpCC->dcb.fOutxDsrFlow = FALSE;
404 lpDlgInfo->lpCC->dcb.fOutX = FALSE;
405 lpDlgInfo->lpCC->dcb.fInX = FALSE;
406 break;
407 case 2: /* XON/XOFF */
410 lpDlgInfo->lpCC->dcb.fOutxCtsFlow = FALSE;
411 lpDlgInfo->lpCC->dcb.fOutxDsrFlow = FALSE;
412 lpDlgInfo->lpCC->dcb.fOutX = TRUE;
413 lpDlgInfo->lpCC->dcb.fInX = TRUE;
414 break;
415 }
416 }
417}
DWORD fOutxDsrFlow
Definition: winbase.h:651
DWORD fDtrControl
Definition: winbase.h:652
BYTE Parity
Definition: serialui.h:37
BYTE StopBit
Definition: serialui.h:43
_In_ WDFCOLLECTION _In_ ULONG Index
#define DTR_CONTROL_DISABLE
Definition: winbase.h:533
#define RTS_CONTROL_DISABLE
Definition: winbase.h:536
#define GetWindowLongPtrW
Definition: winuser.h:4828

Referenced by CommDlgProc().