dmusic: Support creating default ports with GUID_NULL.
[wine.git] / dlls / serialui / confdlg.c
blobc5107146551d9567ee3ff1f7233ea6520ff544c9
1 /*
2 * This DLL contains the user interface for the serial driver.
3 * a dialog box to configure the specified COMM port
4 * an interface to the control panel (??)
5 * functions to load and save default configuration
7 * Eventually the 32 bit comm port driver could be moved into here
8 * and interfaced to KERNEL32 using the WIN95 or WINNT comm driver interface.
9 * This way, different driver DLLS could be written to support other
10 * serial interfaces, such as X.25, etc.
12 * Basic structure copied from COMCTL32 code.
14 * Copyright 2000, 2004 Mike McCormack
16 * This library is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU Lesser General Public
18 * License as published by the Free Software Foundation; either
19 * version 2.1 of the License, or (at your option) any later version.
21 * This library is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24 * Lesser General Public License for more details.
26 * You should have received a copy of the GNU Lesser General Public
27 * License along with this library; if not, write to the Free Software
28 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
31 #include "config.h"
32 #include "wine/port.h"
33 #include "wine/unicode.h"
35 #include <string.h>
36 #include <stdarg.h>
37 #include <stdio.h>
39 #include "windef.h"
40 #include "winbase.h"
41 #include "winreg.h"
42 #include "wingdi.h"
43 #include "winuser.h"
44 #include "wine/debug.h"
45 #include "serialui.h"
46 #include "winerror.h"
48 WINE_DEFAULT_DEBUG_CHANNEL(comm);
50 static HMODULE SERIALUI_hModule;
52 static const WCHAR comW[] = {'c','o','m',0 };
54 /***********************************************************************
55 * DllMain [Internal] Initializes the internal 'SERIALUI.DLL'.
57 * PARAMS
58 * hinstDLL [I] handle to the DLL's instance
59 * fdwReason [I]
60 * lpvReserved [I] reserved, must be NULL
62 * RETURNS
63 * Success: TRUE
64 * Failure: FALSE
67 BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
69 TRACE("%p,%x,%p\n", hinstDLL, fdwReason, lpvReserved);
71 switch (fdwReason) {
72 case DLL_PROCESS_ATTACH:
73 DisableThreadLibraryCalls(hinstDLL);
74 SERIALUI_hModule = hinstDLL;
75 break;
76 case DLL_PROCESS_DETACH:
77 break;
80 return TRUE;
84 /***********************************************************************
85 * EnumPropPages (SERIALUI.2)
87 * Called by the device manager to add prop sheets in Control Panel ???
88 * Pointed to in Win98 registry by
89 * \System\CurrentControlSet\Services\Class\ports\0000\EnumPropPages =
90 * "serialui.dll,EnumPropPages"
92 typedef LPVOID LPDEVICE_INFO;
93 typedef LPVOID LPFNADDPROPSHEETPAGE;
94 BOOL WINAPI EnumPropPages(LPDEVICE_INFO pdi, LPFNADDPROPSHEETPAGE pfnAdd, LPARAM lParam )
96 FIXME("(%p %p %lx)\n",pdi,pfnAdd,lParam);
97 return FALSE;
101 * These data structures are convert from values used in fields of a DCB
102 * to strings used in the CommConfigDialog.
104 typedef struct tagPARAM2STRDATA
106 DWORD val;
107 CONST CHAR *name;
108 } PARAM2STRDATA, *LPPARAM2STRDATA;
110 typedef struct tagPARAM2STR
112 DWORD dwSize;
113 LPPARAM2STRDATA data;
114 } PARAM2STR, *LPPARAM2STR;
115 typedef const PARAM2STR *LPCPARAM2STR;
117 #define SERIALUI_TABLESIZE(x) ((sizeof (x))/(sizeof (x[0])))
119 static PARAM2STRDATA SERIALUI_Baud2StrData[]={
120 {110, "110"}, {300, "300"}, {600, "600"}, {1200, "1200"},
121 {2400, "2400"}, {4800, "4800"}, {9600, "9600"}, {14400, "14400"},
122 {19200, "19200"}, {38400L, "38400"}, {56000L, "56000"}, {57600L, "57600"},
123 {115200L, "115200"}, {128000L, "128000"}, {256000L, "256000"}
125 static PARAM2STR SERIALUI_Baud2Str={ SERIALUI_TABLESIZE(SERIALUI_Baud2StrData),SERIALUI_Baud2StrData };
127 static PARAM2STRDATA SERIALUI_Parity2StrData[]={
128 {NOPARITY,"None"}, {ODDPARITY,"Odd"}, {EVENPARITY,"Even"}, {MARKPARITY,"Mark"},
129 {SPACEPARITY,"Space"}
131 static PARAM2STR SERIALUI_Parity2Str={ SERIALUI_TABLESIZE(SERIALUI_Parity2StrData),SERIALUI_Parity2StrData };
133 static PARAM2STRDATA SERIALUI_Stop2StrData[]={
134 {ONESTOPBIT,"1"}, {ONE5STOPBITS,"1.5"}, {TWOSTOPBITS,"2"}
136 static PARAM2STR SERIALUI_Stop2Str={ SERIALUI_TABLESIZE(SERIALUI_Stop2StrData),SERIALUI_Stop2StrData };
138 static PARAM2STRDATA SERIALUI_Data2StrData[]={
139 {5,"5"}, {6,"6"}, {7,"7"}, {8, "8"}, {16,"16"}
141 static PARAM2STR SERIALUI_Data2Str={ SERIALUI_TABLESIZE(SERIALUI_Data2StrData),SERIALUI_Data2StrData };
143 static PARAM2STRDATA SERIALUI_Flow2StrData[]={
144 {0,"None"}, {1,"Hardware (RTS/CTS)"}, {2,"Software (XON/XOFF)"}
146 static PARAM2STR SERIALUI_Flow2Str={ SERIALUI_TABLESIZE(SERIALUI_Flow2StrData),SERIALUI_Flow2StrData };
149 * Add all the fields to a combo box and highlight the current value
151 static void SERIALUI_AddConfItems(HWND hDlg, DWORD id, LPCPARAM2STR table, DWORD dwVal)
153 unsigned int i;
154 int n;
155 HWND hControl = GetDlgItem(hDlg,id);
157 if(!hControl)
158 return;
160 for(i=0; i<table->dwSize; i++)
162 n = SendMessageA(hControl, CB_ADDSTRING, 0L, (LPARAM)table->data[i].name);
163 if(dwVal == table->data[i].val)
165 SendMessageA(hControl, CB_SETCURSEL, n, 0);
171 * Get the current selection of the given combo box and set a DCB field to
172 * the value matching that selection.
174 static BOOL SERIALUI_GetConfItems(HWND hDlg, DWORD id, LPCPARAM2STR table, LPDWORD lpdwVal)
176 DWORD i;
177 CHAR lpEntry[20];
178 HWND hControl = GetDlgItem(hDlg,id);
180 if( (!hControl) || (!lpdwVal))
182 TRACE("Couldn't get window handle for item %x\n",id);
183 return FALSE;
186 if(!GetWindowTextA(hControl, &lpEntry[0], sizeof(lpEntry)))
188 TRACE("Couldn't get window text for item %x\n",id);
189 return FALSE;
191 /* TRACE("%ld contains %s\n",id, lpEntry); */
193 for(i=0; i<table->dwSize; i++)
195 if(!lstrcmpA(table->data[i].name,lpEntry))
197 *lpdwVal = table->data[i].val;
198 return TRUE;
202 return FALSE;
206 * Both the enumerated values CBR_XXXX and integer baud rates are valid
207 * dcb.BaudRate. This code is to convert back and forth between CBR_ style
208 * and integers. The dialog box uses integer values.
210 static const DWORD SERIALUI_BaudConvertTable[] = {
211 CBR_110, 110, CBR_300, 300, CBR_600, 600, CBR_1200, 1200,
212 CBR_2400, 2400, CBR_4800, 4800, CBR_9600, 9600, CBR_14400, 14400,
213 CBR_19200, 19200, CBR_38400, 38400, CBR_56000, 56000, CBR_57600, 57600,
214 CBR_115200, 115200, CBR_128000, 128000, CBR_256000, 256000
217 static BOOL SERIALUI_MakeBaudDword(LPDWORD lpdwBaudRate)
219 unsigned int i;
221 for(i=0; i<(sizeof(SERIALUI_BaudConvertTable)/sizeof(DWORD)); i+=2)
223 if(*lpdwBaudRate == SERIALUI_BaudConvertTable[i])
225 *lpdwBaudRate = SERIALUI_BaudConvertTable[i+1];
226 return TRUE;
229 return FALSE;
232 static BOOL SERIALUI_MakeBaudEnum(LPDWORD lpdwBaudRate)
234 unsigned int i;
236 for(i=0; i<(sizeof(SERIALUI_BaudConvertTable)/sizeof(DWORD)); i+=2)
238 if(*lpdwBaudRate == SERIALUI_BaudConvertTable[i+1])
240 *lpdwBaudRate = SERIALUI_BaudConvertTable[i];
241 return TRUE;
244 return FALSE;
247 typedef struct tagSERIALUI_DialogInfo
249 LPCWSTR lpszDevice;
250 LPCOMMCONFIG lpCommConfig;
251 BOOL bConvert; /* baud rate was converted to a DWORD */
252 DWORD dwFlowControl; /* old flow control */
253 } SERIALUI_DialogInfo;
255 static void SERIALUI_DCBToDialogInfo(HWND hDlg, SERIALUI_DialogInfo *info)
257 DWORD dwBaudRate, dwStopBits, dwParity, dwByteSize, dwFlowControl;
258 LPDCB lpdcb = &info->lpCommConfig->dcb;
260 /* pass integer pointers to SERIALUI_ dialog config fns */
261 dwBaudRate = lpdcb->BaudRate;
262 dwStopBits = lpdcb->StopBits;
263 dwParity = lpdcb->Parity;
264 dwByteSize = lpdcb->ByteSize;
266 /* map flow control state, if it looks normal */
267 if((lpdcb->fRtsControl == RTS_CONTROL_HANDSHAKE) ||
268 (lpdcb->fOutxCtsFlow)) {
269 dwFlowControl = 1;
270 } else if(lpdcb->fOutX || lpdcb->fInX) {
271 dwFlowControl = 2;
272 } else {
273 dwFlowControl = 0;
276 info->bConvert = SERIALUI_MakeBaudDword(&dwBaudRate);
278 SERIALUI_AddConfItems( hDlg, IDC_BAUD, &SERIALUI_Baud2Str ,dwBaudRate);
279 SERIALUI_AddConfItems( hDlg, IDC_STOP, &SERIALUI_Stop2Str ,dwStopBits);
280 SERIALUI_AddConfItems( hDlg, IDC_PARITY, &SERIALUI_Parity2Str ,dwParity);
281 SERIALUI_AddConfItems( hDlg, IDC_DATA, &SERIALUI_Data2Str ,dwByteSize);
282 SERIALUI_AddConfItems( hDlg, IDC_FLOW, &SERIALUI_Flow2Str, dwFlowControl );
284 info->dwFlowControl = dwFlowControl;
287 static void SERIALUI_DialogInfoToDCB(HWND hDlg, SERIALUI_DialogInfo *info)
289 DWORD dwBaudRate, dwStopBits, dwParity, dwByteSize, dwFlowControl;
290 LPDCB lpdcb = &info->lpCommConfig->dcb;
292 SERIALUI_GetConfItems( hDlg, IDC_BAUD, &SERIALUI_Baud2Str, &dwBaudRate);
293 SERIALUI_GetConfItems( hDlg, IDC_STOP, &SERIALUI_Stop2Str, &dwStopBits);
294 SERIALUI_GetConfItems( hDlg, IDC_PARITY, &SERIALUI_Parity2Str, &dwParity);
295 SERIALUI_GetConfItems( hDlg, IDC_DATA, &SERIALUI_Data2Str, &dwByteSize);
296 SERIALUI_GetConfItems( hDlg, IDC_FLOW, &SERIALUI_Flow2Str, &dwFlowControl );
298 TRACE("baud=%d stop=%d parity=%d data=%d flow=%d\n",
299 dwBaudRate, dwStopBits, dwParity, dwByteSize, dwFlowControl);
301 lpdcb->BaudRate = dwBaudRate;
302 lpdcb->StopBits = dwStopBits;
303 lpdcb->Parity = dwParity;
304 lpdcb->ByteSize = dwByteSize;
306 /* try not to change flow control if the user didn't change it */
307 if(info->dwFlowControl != dwFlowControl)
309 switch(dwFlowControl)
311 case 0:
312 lpdcb->fOutxCtsFlow = FALSE;
313 lpdcb->fOutxDsrFlow = FALSE;
314 lpdcb->fDtrControl = DTR_CONTROL_DISABLE;
315 lpdcb->fOutX = FALSE;
316 lpdcb->fInX = FALSE;
317 lpdcb->fRtsControl = RTS_CONTROL_DISABLE;
318 break;
319 case 1: /* CTS/RTS */
320 lpdcb->fOutxCtsFlow = TRUE;
321 lpdcb->fOutxDsrFlow = FALSE;
322 lpdcb->fDtrControl = DTR_CONTROL_DISABLE;
323 lpdcb->fOutX = FALSE;
324 lpdcb->fInX = FALSE;
325 lpdcb->fRtsControl = RTS_CONTROL_HANDSHAKE;
326 break;
327 case 2:
328 lpdcb->fOutxCtsFlow = FALSE;
329 lpdcb->fOutxDsrFlow = FALSE;
330 lpdcb->fDtrControl = DTR_CONTROL_DISABLE;
331 lpdcb->fOutX = TRUE;
332 lpdcb->fInX = TRUE;
333 lpdcb->fRtsControl = RTS_CONTROL_DISABLE;
334 break;
338 if(info->bConvert)
339 SERIALUI_MakeBaudEnum(&lpdcb->BaudRate);
342 /***********************************************************************
343 * SERIALUI_ConfigDialogProc
345 * Shows a dialog for configuring a COMM port
347 static INT_PTR CALLBACK SERIALUI_ConfigDialogProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
349 WCHAR szTitle[128], format[40];
350 SERIALUI_DialogInfo *info;
352 switch (uMsg)
354 case WM_INITDIALOG:
355 info = (SERIALUI_DialogInfo*) lParam;
356 if(!info)
357 return FALSE;
358 SetWindowLongPtrW(hWnd, DWLP_USER, lParam);
359 GetWindowTextW(hWnd, format, sizeof(format)/sizeof(WCHAR));
360 snprintfW( szTitle, sizeof(szTitle)/sizeof(WCHAR), format, info->lpszDevice );
361 SetWindowTextW(hWnd, szTitle);
362 SERIALUI_DCBToDialogInfo(hWnd, info);
363 return TRUE;
365 case WM_COMMAND:
367 WORD wID = LOWORD(wParam);
369 info = (SERIALUI_DialogInfo *) GetWindowLongPtrW(hWnd, DWLP_USER);
370 if(!info)
371 EndDialog(hWnd,0);
372 switch (wID)
374 case IDOK:
375 SERIALUI_DialogInfoToDCB(hWnd,info);
376 EndDialog(hWnd, ERROR_SUCCESS);
377 return TRUE;
378 case IDCANCEL:
379 EndDialog(hWnd, ERROR_CANCELLED);
380 return TRUE;
381 /* test code for Get/SetDefaultCommConfig begins */
382 case ID_GETDEFAULT:
384 DWORD r,dwConfSize = sizeof (COMMCONFIG);
385 r = GetDefaultCommConfigW(info->lpszDevice,
386 info->lpCommConfig, &dwConfSize);
387 if(!r)
388 MessageBoxA(hWnd,"Failed","GetDefaultCommConfig",MB_OK);
390 SERIALUI_DCBToDialogInfo(hWnd, info);
391 break;
392 case ID_SETDEFAULT:
394 DWORD r;
395 SERIALUI_DialogInfoToDCB(hWnd,info);
396 r = SetDefaultCommConfigW(info->lpszDevice,
397 info->lpCommConfig, sizeof (COMMCONFIG));
398 if(!r)
399 MessageBoxA(hWnd,"Failed","GetDefaultCommConfig",MB_OK);
401 break;
402 /* test code for Get/SetDefaultCommConfig ends */
405 default:
406 return FALSE;
410 static LPWSTR SERIALUI_strdup( LPCSTR str )
412 DWORD len;
413 LPWSTR strW;
415 if (!str)
416 return NULL;
417 len = MultiByteToWideChar( CP_ACP, 0, str, -1, NULL, 0 );
418 strW = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) );
419 MultiByteToWideChar( CP_ACP, 0, str, -1, strW, len );
420 return strW;
423 static VOID SERIALUI_strfree( LPWSTR strW )
425 HeapFree( GetProcessHeap(), 0, strW );
428 /***********************************************************************
429 * drvCommConfigDialogW (SERIALUI.@)
431 * Show a dialog for configuring a Serial Port.
434 DWORD WINAPI drvCommConfigDialogW(LPCWSTR lpszName, HWND hWndParent, LPCOMMCONFIG lpCommConfig)
436 SERIALUI_DialogInfo info;
437 INT res;
439 info.lpCommConfig = lpCommConfig;
440 info.lpszDevice = lpszName;
441 info.bConvert = FALSE;
442 info.dwFlowControl = 0;
444 if ((!lpCommConfig) || (!lpszName))
445 return ERROR_INVALID_PARAMETER;
447 if (lpCommConfig->dwSize < sizeof(COMMCONFIG))
448 return ERROR_INSUFFICIENT_BUFFER;
450 if (!lpszName[0])
451 return ERROR_BADKEY;
453 res = DialogBoxParamW( SERIALUI_hModule,
454 MAKEINTRESOURCEW(IDD_SERIALUICONFIG),
455 hWndParent,
456 SERIALUI_ConfigDialogProc,
457 (LPARAM)&info);
459 return (res == -1) ? GetLastError() : res ;
462 /***********************************************************************
463 * drvCommConfigDialogA (SERIALUI.@)
465 DWORD WINAPI drvCommConfigDialogA(LPCSTR lpszName, HWND hWndParent, LPCOMMCONFIG lpCommConfig)
467 LPWSTR strW = SERIALUI_strdup( lpszName );
468 DWORD r = drvCommConfigDialogW( strW, hWndParent, lpCommConfig );
469 SERIALUI_strfree( strW );
470 return r;
473 static const WCHAR lpszCommKey[] = {
474 'S','y','s','t','e','m','\\',
475 'C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\',
476 'S','e','r','v','i','c','e','s','\\',
477 'C','l','a','s','s','\\','P','o','r','t','s',0
479 static const WCHAR lpszDCB[] = {'D','C','B',0};
481 /***********************************************************************
482 * drvSetDefaultCommConfigW (SERIALUI.@)
484 * Used by Win98 KERNEL to set the default config for a COMM port
485 * FIXME: uses the wrong registry key... should use a digit, not
486 * the comm port name.
488 BOOL WINAPI drvSetDefaultCommConfigW(
489 LPCWSTR lpszDevice, LPCOMMCONFIG lpCommConfig, DWORD dwSize)
491 HKEY hKeyReg=0, hKeyPort=0;
492 WCHAR szKeyName[100];
493 DWORD r,dwDCBSize;
494 static const WCHAR fmt[] = {'%','s','\\','%','s',0 };
496 TRACE("%p %p %x\n",lpszDevice,lpCommConfig,dwSize);
498 if(!lpCommConfig)
499 return FALSE;
501 if(dwSize < sizeof (COMMCONFIG))
502 return FALSE;
504 r = RegConnectRegistryW(NULL, HKEY_LOCAL_MACHINE, &hKeyReg);
505 if(r != ERROR_SUCCESS)
506 return FALSE;
508 snprintfW(szKeyName, sizeof(szKeyName)/sizeof(WCHAR), fmt, lpszCommKey ,lpszDevice);
509 r = RegCreateKeyW(hKeyReg, szKeyName, &hKeyPort);
510 if(r == ERROR_SUCCESS)
512 dwDCBSize = sizeof (DCB);
513 r = RegSetValueExW( hKeyPort, lpszDCB, 0, REG_BINARY,
514 (LPBYTE)&lpCommConfig->dcb,dwDCBSize);
515 TRACE("write key r=%d\n",r);
516 RegCloseKey(hKeyPort);
519 RegCloseKey(hKeyReg);
521 return (r==ERROR_SUCCESS);
524 /***********************************************************************
525 * drvSetDefaultCommConfigA (SERIALUI.@)
527 BOOL WINAPI drvSetDefaultCommConfigA(
528 LPCSTR lpszDevice, LPCOMMCONFIG lpCommConfig, DWORD dwSize)
530 LPWSTR strW = SERIALUI_strdup( lpszDevice );
531 BOOL r = drvSetDefaultCommConfigW( strW, lpCommConfig, dwSize );
532 SERIALUI_strfree( strW );
533 return r;
536 /***********************************************************************
537 * drvGetDefaultCommConfigW (SERIALUI.@)
539 * Used by Win9x KERNEL to get the default config for a COMM port
540 * FIXME: uses the wrong registry key... should use a digit, not
541 * the comm port name.
543 DWORD WINAPI drvGetDefaultCommConfigW(
544 LPCWSTR lpszDevice, LPCOMMCONFIG lpCommConfig, LPDWORD lpdwSize)
546 HKEY hKeyReg, hKeyPort;
547 WCHAR szKeyName[100];
548 DWORD r,dwSize,dwType;
549 static const WCHAR fmt[] = {'%','s','\\','%','s',0 };
551 TRACE("(%s, %p, %p) *lpdwSize: %u\n", debugstr_w(lpszDevice), lpCommConfig, lpdwSize, lpdwSize ? *lpdwSize : 0);
553 if ((!lpszDevice) || (!lpCommConfig) || (!lpdwSize)) {
554 return ERROR_INVALID_PARAMETER;
557 if (*lpdwSize < sizeof (COMMCONFIG)) {
558 *lpdwSize = sizeof (COMMCONFIG);
559 return ERROR_INSUFFICIENT_BUFFER;
562 /* only "com1" - "com9" is allowed */
563 r = sizeof(comW) / sizeof(WCHAR); /* len of "com\0" */
564 lstrcpynW(szKeyName, lpszDevice, r); /* simulate a lstrcmpnW */
565 r--;
567 if( lstrcmpiW(szKeyName, comW) ||
568 (lpszDevice[r] < '1') || (lpszDevice[r] > '9') || lpszDevice[r+1]) {
569 return ERROR_BADKEY;
572 *lpdwSize = sizeof (COMMCONFIG);
573 memset(lpCommConfig, 0 , sizeof (COMMCONFIG));
574 lpCommConfig->dwSize = sizeof (COMMCONFIG);
575 lpCommConfig->wVersion = 1;
576 lpCommConfig->dwProviderSubType = PST_RS232;
578 r = RegConnectRegistryW(NULL, HKEY_LOCAL_MACHINE, &hKeyReg);
579 if(r != ERROR_SUCCESS) return r;
581 snprintfW(szKeyName, sizeof(szKeyName)/sizeof(WCHAR), fmt, lpszCommKey ,lpszDevice);
582 r = RegOpenKeyW(hKeyReg, szKeyName, &hKeyPort);
583 if(r == ERROR_SUCCESS)
585 dwSize = sizeof (DCB);
586 dwType = 0;
587 r = RegQueryValueExW( hKeyPort, lpszDCB, NULL,
588 &dwType, (LPBYTE)&lpCommConfig->dcb, &dwSize);
590 RegCloseKey(hKeyPort);
591 if ((r!=ERROR_SUCCESS) || (dwType != REG_BINARY) || (dwSize != sizeof(DCB))) {
592 RegCloseKey(hKeyReg);
593 return ERROR_INVALID_PARAMETER;
597 else
599 /* FIXME: default to a hardcoded commconfig */
600 lpCommConfig->dcb.DCBlength = sizeof(DCB);
601 lpCommConfig->dcb.BaudRate = 9600;
602 lpCommConfig->dcb.fBinary = TRUE;
603 lpCommConfig->dcb.fParity = FALSE;
604 lpCommConfig->dcb.ByteSize = 8;
605 lpCommConfig->dcb.Parity = NOPARITY;
606 lpCommConfig->dcb.StopBits = ONESTOPBIT;
607 return ERROR_SUCCESS;
610 RegCloseKey(hKeyReg);
612 return r;
615 /***********************************************************************
616 * drvGetDefaultCommConfigA (SERIALUI.@)
618 DWORD WINAPI drvGetDefaultCommConfigA(
619 LPCSTR lpszDevice, LPCOMMCONFIG lpCommConfig, LPDWORD lpdwSize)
621 LPWSTR strW = SERIALUI_strdup( lpszDevice );
622 DWORD r = drvGetDefaultCommConfigW( strW, lpCommConfig, lpdwSize );
623 SERIALUI_strfree( strW );
624 return r;