msvcr120_app: Add forwarding dll.
[wine.git] / dlls / serialui / confdlg.c
blobda14472e3ec6a4b67d8e810426db4cde9e83b795
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;
78 return TRUE;
82 /***********************************************************************
83 * EnumPropPages (SERIALUI.2)
85 * Called by the device manager to add prop sheets in Control Panel ???
86 * Pointed to in Win98 registry by
87 * \System\CurrentControlSet\Services\Class\ports\0000\EnumPropPages =
88 * "serialui.dll,EnumPropPages"
90 typedef LPVOID LPDEVICE_INFO;
91 typedef LPVOID LPFNADDPROPSHEETPAGE;
92 BOOL WINAPI EnumPropPages(LPDEVICE_INFO pdi, LPFNADDPROPSHEETPAGE pfnAdd, LPARAM lParam )
94 FIXME("(%p %p %lx)\n",pdi,pfnAdd,lParam);
95 return FALSE;
99 * These data structures are convert from values used in fields of a DCB
100 * to strings used in the CommConfigDialog.
102 typedef struct tagPARAM2STRDATA
104 DWORD val;
105 const CHAR *name;
106 } PARAM2STRDATA, *LPPARAM2STRDATA;
108 typedef struct tagPARAM2STR
110 DWORD dwSize;
111 LPPARAM2STRDATA data;
112 } PARAM2STR, *LPPARAM2STR;
113 typedef const PARAM2STR *LPCPARAM2STR;
115 #define SERIALUI_TABLESIZE(x) ((sizeof (x))/(sizeof (x[0])))
117 static PARAM2STRDATA SERIALUI_Baud2StrData[]={
118 {110, "110"}, {300, "300"}, {600, "600"}, {1200, "1200"},
119 {2400, "2400"}, {4800, "4800"}, {9600, "9600"}, {14400, "14400"},
120 {19200, "19200"}, {38400L, "38400"}, {56000L, "56000"}, {57600L, "57600"},
121 {115200L, "115200"}, {128000L, "128000"}, {256000L, "256000"}
123 static PARAM2STR SERIALUI_Baud2Str={ SERIALUI_TABLESIZE(SERIALUI_Baud2StrData),SERIALUI_Baud2StrData };
125 static PARAM2STRDATA SERIALUI_Parity2StrData[]={
126 {NOPARITY,"None"}, {ODDPARITY,"Odd"}, {EVENPARITY,"Even"}, {MARKPARITY,"Mark"},
127 {SPACEPARITY,"Space"}
129 static PARAM2STR SERIALUI_Parity2Str={ SERIALUI_TABLESIZE(SERIALUI_Parity2StrData),SERIALUI_Parity2StrData };
131 static PARAM2STRDATA SERIALUI_Stop2StrData[]={
132 {ONESTOPBIT,"1"}, {ONE5STOPBITS,"1.5"}, {TWOSTOPBITS,"2"}
134 static PARAM2STR SERIALUI_Stop2Str={ SERIALUI_TABLESIZE(SERIALUI_Stop2StrData),SERIALUI_Stop2StrData };
136 static PARAM2STRDATA SERIALUI_Data2StrData[]={
137 {5,"5"}, {6,"6"}, {7,"7"}, {8, "8"}, {16,"16"}
139 static PARAM2STR SERIALUI_Data2Str={ SERIALUI_TABLESIZE(SERIALUI_Data2StrData),SERIALUI_Data2StrData };
141 static PARAM2STRDATA SERIALUI_Flow2StrData[]={
142 {0,"None"}, {1,"Hardware (RTS/CTS)"}, {2,"Software (XON/XOFF)"}
144 static PARAM2STR SERIALUI_Flow2Str={ SERIALUI_TABLESIZE(SERIALUI_Flow2StrData),SERIALUI_Flow2StrData };
147 * Add all the fields to a combo box and highlight the current value
149 static void SERIALUI_AddConfItems(HWND hDlg, DWORD id, LPCPARAM2STR table, DWORD dwVal)
151 unsigned int i;
152 int n;
153 HWND hControl = GetDlgItem(hDlg,id);
155 if(!hControl)
156 return;
158 for(i=0; i<table->dwSize; i++)
160 n = SendMessageA(hControl, CB_ADDSTRING, 0L, (LPARAM)table->data[i].name);
161 if(dwVal == table->data[i].val)
163 SendMessageA(hControl, CB_SETCURSEL, n, 0);
169 * Get the current selection of the given combo box and set a DCB field to
170 * the value matching that selection.
172 static BOOL SERIALUI_GetConfItems(HWND hDlg, DWORD id, LPCPARAM2STR table, LPDWORD lpdwVal)
174 DWORD i;
175 CHAR lpEntry[20];
176 HWND hControl = GetDlgItem(hDlg,id);
178 if( (!hControl) || (!lpdwVal))
180 TRACE("Couldn't get window handle for item %x\n",id);
181 return FALSE;
184 if(!GetWindowTextA(hControl, &lpEntry[0], sizeof(lpEntry)))
186 TRACE("Couldn't get window text for item %x\n",id);
187 return FALSE;
189 /* TRACE("%ld contains %s\n",id, lpEntry); */
191 for(i=0; i<table->dwSize; i++)
193 if(!lstrcmpA(table->data[i].name,lpEntry))
195 *lpdwVal = table->data[i].val;
196 return TRUE;
200 return FALSE;
204 * Both the enumerated values CBR_XXXX and integer baud rates are valid
205 * dcb.BaudRate. This code is to convert back and forth between CBR_ style
206 * and integers. The dialog box uses integer values.
208 static const DWORD SERIALUI_BaudConvertTable[] = {
209 CBR_110, 110, CBR_300, 300, CBR_600, 600, CBR_1200, 1200,
210 CBR_2400, 2400, CBR_4800, 4800, CBR_9600, 9600, CBR_14400, 14400,
211 CBR_19200, 19200, CBR_38400, 38400, CBR_56000, 56000, CBR_57600, 57600,
212 CBR_115200, 115200, CBR_128000, 128000, CBR_256000, 256000
215 static BOOL SERIALUI_MakeBaudDword(LPDWORD lpdwBaudRate)
217 unsigned int i;
219 for(i=0; i<(sizeof(SERIALUI_BaudConvertTable)/sizeof(DWORD)); i+=2)
221 if(*lpdwBaudRate == SERIALUI_BaudConvertTable[i])
223 *lpdwBaudRate = SERIALUI_BaudConvertTable[i+1];
224 return TRUE;
227 return FALSE;
230 static BOOL SERIALUI_MakeBaudEnum(LPDWORD lpdwBaudRate)
232 unsigned int i;
234 for(i=0; i<(sizeof(SERIALUI_BaudConvertTable)/sizeof(DWORD)); i+=2)
236 if(*lpdwBaudRate == SERIALUI_BaudConvertTable[i+1])
238 *lpdwBaudRate = SERIALUI_BaudConvertTable[i];
239 return TRUE;
242 return FALSE;
245 typedef struct tagSERIALUI_DialogInfo
247 LPCWSTR lpszDevice;
248 LPCOMMCONFIG lpCommConfig;
249 BOOL bConvert; /* baud rate was converted to a DWORD */
250 DWORD dwFlowControl; /* old flow control */
251 } SERIALUI_DialogInfo;
253 static void SERIALUI_DCBToDialogInfo(HWND hDlg, SERIALUI_DialogInfo *info)
255 DWORD dwBaudRate, dwStopBits, dwParity, dwByteSize, dwFlowControl;
256 LPDCB lpdcb = &info->lpCommConfig->dcb;
258 /* pass integer pointers to SERIALUI_ dialog config fns */
259 dwBaudRate = lpdcb->BaudRate;
260 dwStopBits = lpdcb->StopBits;
261 dwParity = lpdcb->Parity;
262 dwByteSize = lpdcb->ByteSize;
264 /* map flow control state, if it looks normal */
265 if((lpdcb->fRtsControl == RTS_CONTROL_HANDSHAKE) ||
266 (lpdcb->fOutxCtsFlow)) {
267 dwFlowControl = 1;
268 } else if(lpdcb->fOutX || lpdcb->fInX) {
269 dwFlowControl = 2;
270 } else {
271 dwFlowControl = 0;
274 info->bConvert = SERIALUI_MakeBaudDword(&dwBaudRate);
276 SERIALUI_AddConfItems( hDlg, IDC_BAUD, &SERIALUI_Baud2Str ,dwBaudRate);
277 SERIALUI_AddConfItems( hDlg, IDC_STOP, &SERIALUI_Stop2Str ,dwStopBits);
278 SERIALUI_AddConfItems( hDlg, IDC_PARITY, &SERIALUI_Parity2Str ,dwParity);
279 SERIALUI_AddConfItems( hDlg, IDC_DATA, &SERIALUI_Data2Str ,dwByteSize);
280 SERIALUI_AddConfItems( hDlg, IDC_FLOW, &SERIALUI_Flow2Str, dwFlowControl );
282 info->dwFlowControl = dwFlowControl;
285 static void SERIALUI_DialogInfoToDCB(HWND hDlg, SERIALUI_DialogInfo *info)
287 DWORD dwBaudRate, dwStopBits, dwParity, dwByteSize, dwFlowControl;
288 LPDCB lpdcb = &info->lpCommConfig->dcb;
290 SERIALUI_GetConfItems( hDlg, IDC_BAUD, &SERIALUI_Baud2Str, &dwBaudRate);
291 SERIALUI_GetConfItems( hDlg, IDC_STOP, &SERIALUI_Stop2Str, &dwStopBits);
292 SERIALUI_GetConfItems( hDlg, IDC_PARITY, &SERIALUI_Parity2Str, &dwParity);
293 SERIALUI_GetConfItems( hDlg, IDC_DATA, &SERIALUI_Data2Str, &dwByteSize);
294 SERIALUI_GetConfItems( hDlg, IDC_FLOW, &SERIALUI_Flow2Str, &dwFlowControl );
296 TRACE("baud=%d stop=%d parity=%d data=%d flow=%d\n",
297 dwBaudRate, dwStopBits, dwParity, dwByteSize, dwFlowControl);
299 lpdcb->BaudRate = dwBaudRate;
300 lpdcb->StopBits = dwStopBits;
301 lpdcb->Parity = dwParity;
302 lpdcb->ByteSize = dwByteSize;
304 /* try not to change flow control if the user didn't change it */
305 if(info->dwFlowControl != dwFlowControl)
307 switch(dwFlowControl)
309 case 0:
310 lpdcb->fOutxCtsFlow = FALSE;
311 lpdcb->fOutxDsrFlow = FALSE;
312 lpdcb->fDtrControl = DTR_CONTROL_DISABLE;
313 lpdcb->fOutX = FALSE;
314 lpdcb->fInX = FALSE;
315 lpdcb->fRtsControl = RTS_CONTROL_DISABLE;
316 break;
317 case 1: /* CTS/RTS */
318 lpdcb->fOutxCtsFlow = TRUE;
319 lpdcb->fOutxDsrFlow = FALSE;
320 lpdcb->fDtrControl = DTR_CONTROL_DISABLE;
321 lpdcb->fOutX = FALSE;
322 lpdcb->fInX = FALSE;
323 lpdcb->fRtsControl = RTS_CONTROL_HANDSHAKE;
324 break;
325 case 2:
326 lpdcb->fOutxCtsFlow = FALSE;
327 lpdcb->fOutxDsrFlow = FALSE;
328 lpdcb->fDtrControl = DTR_CONTROL_DISABLE;
329 lpdcb->fOutX = TRUE;
330 lpdcb->fInX = TRUE;
331 lpdcb->fRtsControl = RTS_CONTROL_DISABLE;
332 break;
336 if(info->bConvert)
337 SERIALUI_MakeBaudEnum(&lpdcb->BaudRate);
340 /***********************************************************************
341 * SERIALUI_ConfigDialogProc
343 * Shows a dialog for configuring a COMM port
345 static INT_PTR CALLBACK SERIALUI_ConfigDialogProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
347 WCHAR szTitle[128], format[40];
348 SERIALUI_DialogInfo *info;
350 switch (uMsg)
352 case WM_INITDIALOG:
353 info = (SERIALUI_DialogInfo*) lParam;
354 if(!info)
355 return FALSE;
356 SetWindowLongPtrW(hWnd, DWLP_USER, lParam);
357 GetWindowTextW(hWnd, format, sizeof(format)/sizeof(WCHAR));
358 snprintfW( szTitle, sizeof(szTitle)/sizeof(WCHAR), format, info->lpszDevice );
359 SetWindowTextW(hWnd, szTitle);
360 SERIALUI_DCBToDialogInfo(hWnd, info);
361 return TRUE;
363 case WM_COMMAND:
365 WORD wID = LOWORD(wParam);
367 info = (SERIALUI_DialogInfo *) GetWindowLongPtrW(hWnd, DWLP_USER);
368 if(!info)
369 EndDialog(hWnd,0);
370 switch (wID)
372 case IDOK:
373 SERIALUI_DialogInfoToDCB(hWnd,info);
374 EndDialog(hWnd, ERROR_SUCCESS);
375 return TRUE;
376 case IDCANCEL:
377 EndDialog(hWnd, ERROR_CANCELLED);
378 return TRUE;
379 /* test code for Get/SetDefaultCommConfig begins */
380 case ID_GETDEFAULT:
382 DWORD r,dwConfSize = sizeof (COMMCONFIG);
383 r = GetDefaultCommConfigW(info->lpszDevice,
384 info->lpCommConfig, &dwConfSize);
385 if(!r)
386 MessageBoxA(hWnd,"Failed","GetDefaultCommConfig",MB_OK);
388 SERIALUI_DCBToDialogInfo(hWnd, info);
389 break;
390 case ID_SETDEFAULT:
392 DWORD r;
393 SERIALUI_DialogInfoToDCB(hWnd,info);
394 r = SetDefaultCommConfigW(info->lpszDevice,
395 info->lpCommConfig, sizeof (COMMCONFIG));
396 if(!r)
397 MessageBoxA(hWnd,"Failed","GetDefaultCommConfig",MB_OK);
399 break;
400 /* test code for Get/SetDefaultCommConfig ends */
403 default:
404 return FALSE;
408 static LPWSTR SERIALUI_strdup( LPCSTR str )
410 DWORD len;
411 LPWSTR strW;
413 if (!str)
414 return NULL;
415 len = MultiByteToWideChar( CP_ACP, 0, str, -1, NULL, 0 );
416 strW = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) );
417 MultiByteToWideChar( CP_ACP, 0, str, -1, strW, len );
418 return strW;
421 static VOID SERIALUI_strfree( LPWSTR strW )
423 HeapFree( GetProcessHeap(), 0, strW );
426 /***********************************************************************
427 * drvCommConfigDialogW (SERIALUI.@)
429 * Show a dialog for configuring a Serial Port.
432 DWORD WINAPI drvCommConfigDialogW(LPCWSTR lpszName, HWND hWndParent, LPCOMMCONFIG lpCommConfig)
434 SERIALUI_DialogInfo info;
435 INT res;
437 info.lpCommConfig = lpCommConfig;
438 info.lpszDevice = lpszName;
439 info.bConvert = FALSE;
440 info.dwFlowControl = 0;
442 if ((!lpCommConfig) || (!lpszName))
443 return ERROR_INVALID_PARAMETER;
445 if (lpCommConfig->dwSize < sizeof(COMMCONFIG))
446 return ERROR_INSUFFICIENT_BUFFER;
448 if (!lpszName[0])
449 return ERROR_BADKEY;
451 res = DialogBoxParamW( SERIALUI_hModule,
452 MAKEINTRESOURCEW(IDD_SERIALUICONFIG),
453 hWndParent,
454 SERIALUI_ConfigDialogProc,
455 (LPARAM)&info);
457 return (res == -1) ? GetLastError() : res ;
460 /***********************************************************************
461 * drvCommConfigDialogA (SERIALUI.@)
463 DWORD WINAPI drvCommConfigDialogA(LPCSTR lpszName, HWND hWndParent, LPCOMMCONFIG lpCommConfig)
465 LPWSTR strW = SERIALUI_strdup( lpszName );
466 DWORD r = drvCommConfigDialogW( strW, hWndParent, lpCommConfig );
467 SERIALUI_strfree( strW );
468 return r;
471 static const WCHAR lpszCommKey[] = {
472 'S','y','s','t','e','m','\\',
473 'C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\',
474 'S','e','r','v','i','c','e','s','\\',
475 'C','l','a','s','s','\\','P','o','r','t','s',0
477 static const WCHAR lpszDCB[] = {'D','C','B',0};
479 /***********************************************************************
480 * drvSetDefaultCommConfigW (SERIALUI.@)
482 * Used by Win98 KERNEL to set the default config for a COMM port
483 * FIXME: uses the wrong registry key... should use a digit, not
484 * the comm port name.
486 BOOL WINAPI drvSetDefaultCommConfigW(
487 LPCWSTR lpszDevice, LPCOMMCONFIG lpCommConfig, DWORD dwSize)
489 HKEY hKeyReg=0, hKeyPort=0;
490 WCHAR szKeyName[100];
491 DWORD r,dwDCBSize;
492 static const WCHAR fmt[] = {'%','s','\\','%','s',0 };
494 TRACE("%p %p %x\n",lpszDevice,lpCommConfig,dwSize);
496 if(!lpCommConfig)
497 return FALSE;
499 if(dwSize < sizeof (COMMCONFIG))
500 return FALSE;
502 r = RegConnectRegistryW(NULL, HKEY_LOCAL_MACHINE, &hKeyReg);
503 if(r != ERROR_SUCCESS)
504 return FALSE;
506 snprintfW(szKeyName, sizeof(szKeyName)/sizeof(WCHAR), fmt, lpszCommKey ,lpszDevice);
507 r = RegCreateKeyW(hKeyReg, szKeyName, &hKeyPort);
508 if(r == ERROR_SUCCESS)
510 dwDCBSize = sizeof (DCB);
511 r = RegSetValueExW( hKeyPort, lpszDCB, 0, REG_BINARY,
512 (LPBYTE)&lpCommConfig->dcb,dwDCBSize);
513 TRACE("write key r=%d\n",r);
514 RegCloseKey(hKeyPort);
517 RegCloseKey(hKeyReg);
519 return (r==ERROR_SUCCESS);
522 /***********************************************************************
523 * drvSetDefaultCommConfigA (SERIALUI.@)
525 BOOL WINAPI drvSetDefaultCommConfigA(
526 LPCSTR lpszDevice, LPCOMMCONFIG lpCommConfig, DWORD dwSize)
528 LPWSTR strW = SERIALUI_strdup( lpszDevice );
529 BOOL r = drvSetDefaultCommConfigW( strW, lpCommConfig, dwSize );
530 SERIALUI_strfree( strW );
531 return r;
534 /***********************************************************************
535 * drvGetDefaultCommConfigW (SERIALUI.@)
537 * Used by Win9x KERNEL to get the default config for a COMM port
538 * FIXME: uses the wrong registry key... should use a digit, not
539 * the comm port name.
541 DWORD WINAPI drvGetDefaultCommConfigW(
542 LPCWSTR lpszDevice, LPCOMMCONFIG lpCommConfig, LPDWORD lpdwSize)
544 HKEY hKeyReg, hKeyPort;
545 WCHAR szKeyName[100];
546 DWORD r,dwSize,dwType;
547 static const WCHAR fmt[] = {'%','s','\\','%','s',0 };
549 TRACE("(%s, %p, %p) *lpdwSize: %u\n", debugstr_w(lpszDevice), lpCommConfig, lpdwSize, lpdwSize ? *lpdwSize : 0);
551 if ((!lpszDevice) || (!lpCommConfig) || (!lpdwSize)) {
552 return ERROR_INVALID_PARAMETER;
555 if (*lpdwSize < sizeof (COMMCONFIG)) {
556 *lpdwSize = sizeof (COMMCONFIG);
557 return ERROR_INSUFFICIENT_BUFFER;
560 /* only "com1" - "com9" is allowed */
561 r = sizeof(comW) / sizeof(WCHAR); /* len of "com\0" */
562 lstrcpynW(szKeyName, lpszDevice, r); /* simulate a lstrcmpnW */
563 r--;
565 if( lstrcmpiW(szKeyName, comW) ||
566 (lpszDevice[r] < '1') || (lpszDevice[r] > '9') || lpszDevice[r+1]) {
567 return ERROR_BADKEY;
570 *lpdwSize = sizeof (COMMCONFIG);
571 memset(lpCommConfig, 0 , sizeof (COMMCONFIG));
572 lpCommConfig->dwSize = sizeof (COMMCONFIG);
573 lpCommConfig->wVersion = 1;
574 lpCommConfig->dwProviderSubType = PST_RS232;
576 r = RegConnectRegistryW(NULL, HKEY_LOCAL_MACHINE, &hKeyReg);
577 if(r != ERROR_SUCCESS) return r;
579 snprintfW(szKeyName, sizeof(szKeyName)/sizeof(WCHAR), fmt, lpszCommKey ,lpszDevice);
580 r = RegOpenKeyW(hKeyReg, szKeyName, &hKeyPort);
581 if(r == ERROR_SUCCESS)
583 dwSize = sizeof (DCB);
584 dwType = 0;
585 r = RegQueryValueExW( hKeyPort, lpszDCB, NULL,
586 &dwType, (LPBYTE)&lpCommConfig->dcb, &dwSize);
588 RegCloseKey(hKeyPort);
589 if ((r!=ERROR_SUCCESS) || (dwType != REG_BINARY) || (dwSize != sizeof(DCB))) {
590 RegCloseKey(hKeyReg);
591 return ERROR_INVALID_PARAMETER;
595 else
597 /* FIXME: default to a hardcoded commconfig */
598 lpCommConfig->dcb.DCBlength = sizeof(DCB);
599 lpCommConfig->dcb.BaudRate = 9600;
600 lpCommConfig->dcb.fBinary = TRUE;
601 lpCommConfig->dcb.fParity = FALSE;
602 lpCommConfig->dcb.ByteSize = 8;
603 lpCommConfig->dcb.Parity = NOPARITY;
604 lpCommConfig->dcb.StopBits = ONESTOPBIT;
605 return ERROR_SUCCESS;
608 RegCloseKey(hKeyReg);
610 return r;
613 /***********************************************************************
614 * drvGetDefaultCommConfigA (SERIALUI.@)
616 DWORD WINAPI drvGetDefaultCommConfigA(
617 LPCSTR lpszDevice, LPCOMMCONFIG lpCommConfig, LPDWORD lpdwSize)
619 LPWSTR strW = SERIALUI_strdup( lpszDevice );
620 DWORD r = drvGetDefaultCommConfigW( strW, lpCommConfig, lpdwSize );
621 SERIALUI_strfree( strW );
622 return r;