2 * DEC 93 Erik Bos <erik@xs4all.nl>
4 * Copyright 1996 Marcus Meissner
6 * Mar 31, 1999. Ove Kåven <ovek@arcticnet.no>
7 * - Implemented buffers and EnableCommNotification.
9 * Apr 3, 1999. Lawson Whitney <lawson_whitney@juno.com>
10 * - Fixed the modem control part of EscapeCommFunction16.
12 * Mar 3, 1999. Ove Kåven <ovek@arcticnet.no>
13 * - Use port indices instead of unixfds for win16
14 * - Moved things around (separated win16 and win32 routines)
15 * - Added some hints on how to implement buffers and EnableCommNotification.
17 * May 26, 1997. Fixes and comments by Rick Richardson <rick@dgii.com> [RER]
18 * - ptr->fd wasn't getting cleared on close.
19 * - GetCommEventMask() and GetCommError() didn't do much of anything.
20 * IMHO, they are still wrong, but they at least implement the RXCHAR
21 * event and return I/O queue sizes, which makes the app I'm interested
22 * in (analog devices EZKIT DSP development system) work.
24 * August 12, 1997. Take a bash at SetCommEventMask - Lawson Whitney
25 * <lawson_whitney@juno.com>
26 * July 6, 1998. Fixes and comments by Valentijn Sessink
27 * <vsessink@ic.uva.nl> [V]
28 * Oktober 98, Rein Klazes [RHK]
29 * A program that wants to monitor the modem status line (RLSD/DCD) may
30 * poll the modem status register in the commMask structure. I update the bit
31 * in GetCommError, waiting for an implementation of communication events.
36 #include "wine/port.h"
49 #ifdef HAVE_SYS_FILIO_H
50 # include <sys/filio.h>
52 #include <sys/ioctl.h>
55 #ifdef HAVE_SYS_MODEM_H
56 # include <sys/modem.h>
58 #ifdef HAVE_SYS_STRTIO_H
59 # include <sys/strtio.h>
65 #include "wine/server.h"
69 #include "debugtools.h"
71 DEFAULT_DEBUG_CHANNEL(comm);
73 #if !defined(TIOCINQ) && defined(FIONREAD)
74 #define TIOCINQ FIONREAD
77 static int COMM_WhackModem(int fd, unsigned int andy, unsigned int orrie)
79 unsigned int mstat, okay;
80 okay = ioctl(fd, TIOCMGET, &mstat);
81 if (okay) return okay;
82 if (andy) mstat &= andy;
84 return ioctl(fd, TIOCMSET, &mstat);
87 /***********************************************************************
88 * COMM_BuildOldCommDCB (Internal)
90 * Build a DCB using the old style settings string eg: "COMx:96,n,8,1"
91 * We ignore the COM port index, since we can support more than 4 ports.
93 BOOL WINAPI COMM_BuildOldCommDCB(LPCSTR device, LPDCB lpdcb)
97 char *ptr, temp[256], last;
100 TRACE("(%s), ptr %p\n", device, lpdcb);
102 if (strncasecmp(device,"COM",3))
108 if (*(device+4) != ':')
111 strcpy(temp,device+5);
112 last=temp[strlen(temp)-1];
113 ptr = strtok(temp, ", ");
115 /* DOS/Windows only compares the first two numbers
116 * and assigns an appropriate baud rate.
117 * You can supply 961324245, it still returns 9600 ! */
120 WARN("Unknown baudrate string '%s' !\n", ptr);
121 return FALSE; /* error: less than 2 chars */
142 WARN("Unknown baudrate indicator %d !\n", rate);
146 lpdcb->BaudRate = rate;
147 TRACE("baudrate (%ld)\n", lpdcb->BaudRate);
149 ptr = strtok(NULL, ", ");
151 *ptr = toupper(*ptr);
153 TRACE("parity (%c)\n", *ptr);
154 lpdcb->fParity = TRUE;
157 lpdcb->Parity = NOPARITY;
158 lpdcb->fParity = FALSE;
161 lpdcb->Parity = EVENPARITY;
164 lpdcb->Parity = MARKPARITY;
167 lpdcb->Parity = ODDPARITY;
170 WARN("Unknown parity `%c'!\n", *ptr);
174 ptr = strtok(NULL, ", ");
175 TRACE("charsize (%c)\n", *ptr);
176 lpdcb->ByteSize = *ptr - '0';
178 ptr = strtok(NULL, ", ");
179 TRACE("stopbits (%c)\n", *ptr);
182 lpdcb->StopBits = ONESTOPBIT;
185 lpdcb->StopBits = TWOSTOPBITS;
188 WARN("Unknown # of stopbits `%c'!\n", *ptr);
195 lpdcb->fOutxCtsFlow = FALSE;
196 lpdcb->fOutxDsrFlow = FALSE;
197 lpdcb->fDtrControl = DTR_CONTROL_ENABLE;
198 lpdcb->fRtsControl = RTS_CONTROL_ENABLE;
199 } else if (last=='p') {
201 lpdcb->fOutX = FALSE;
202 lpdcb->fOutxCtsFlow = TRUE;
203 lpdcb->fOutxDsrFlow = TRUE;
204 lpdcb->fDtrControl = DTR_CONTROL_HANDSHAKE;
205 lpdcb->fRtsControl = RTS_CONTROL_HANDSHAKE;
208 lpdcb->fOutX = FALSE;
209 lpdcb->fOutxCtsFlow = FALSE;
210 lpdcb->fOutxDsrFlow = FALSE;
211 lpdcb->fDtrControl = DTR_CONTROL_ENABLE;
212 lpdcb->fRtsControl = RTS_CONTROL_ENABLE;
218 /**************************************************************************
219 * BuildCommDCBA (KERNEL32.@)
221 * Updates a device control block data structure with values from an
222 * ascii device control string. The device control string has two forms
223 * normal and extended, it must be exclusively in one or the other form.
227 * True on success, false on an malformed control string.
229 BOOL WINAPI BuildCommDCBA(
230 LPCSTR device, /* [in] The ascii device control string used to update the DCB. */
231 LPDCB lpdcb) /* [out] The device control block to be updated. */
233 return BuildCommDCBAndTimeoutsA(device,lpdcb,NULL);
236 /**************************************************************************
237 * BuildCommDCBAndTimeoutsA (KERNEL32.@)
239 * Updates a device control block data structure with values from an
240 * ascii device control string. Taking time out values from a time outs
241 * struct if desired by the control string.
245 * True on success, false bad handles etc
247 BOOL WINAPI BuildCommDCBAndTimeoutsA(
248 LPCSTR device, /* [in] The ascii device control string. */
249 LPDCB lpdcb, /* [out] The device control block to be updated. */
250 LPCOMMTIMEOUTS lptimeouts) /* [in] The time outs to use if asked to set them by the control string. */
255 TRACE("(%s,%p,%p)\n",device,lpdcb,lptimeouts);
257 if (!strncasecmp(device,"COM",3)) {
260 ERR("BUG! COM0 can't exist!\n");
263 if (*(device+4)!=':')
265 temp=(LPSTR)(device+5);
269 memset(lpdcb,0,sizeof (DCB));
270 lpdcb->DCBlength = sizeof(DCB);
271 if (strchr(temp,',')) { /* old style */
273 return COMM_BuildOldCommDCB(device,lpdcb);
275 ptr=strtok(temp," ");
280 if (!strncmp("baud=",ptr,5)) {
281 if (!sscanf(ptr+5,"%ld",&x))
282 WARN("Couldn't parse %s\n",ptr);
286 if (!strncmp("stop=",ptr,5)) {
287 if (!sscanf(ptr+5,"%ld",&x))
288 WARN("Couldn't parse %s\n",ptr);
292 if (!strncmp("data=",ptr,5)) {
293 if (!sscanf(ptr+5,"%ld",&x))
294 WARN("Couldn't parse %s\n",ptr);
298 if (!strncmp("parity=",ptr,7)) {
299 lpdcb->fParity = TRUE;
302 lpdcb->fParity = FALSE;
303 lpdcb->Parity = NOPARITY;
306 lpdcb->Parity = EVENPARITY;
309 lpdcb->Parity = ODDPARITY;
312 lpdcb->Parity = MARKPARITY;
318 ERR("Unhandled specifier '%s', please report.\n",ptr);
319 ptr=strtok(NULL," ");
321 if (lpdcb->BaudRate==110)
326 /**************************************************************************
327 * BuildCommDCBAndTimeoutsW (KERNEL32.@)
329 * Updates a device control block data structure with values from an
330 * unicode device control string. Taking time out values from a time outs
331 * struct if desired by the control string.
335 * True on success, false bad handles etc.
337 BOOL WINAPI BuildCommDCBAndTimeoutsW(
338 LPCWSTR devid, /* [in] The unicode device control string. */
339 LPDCB lpdcb, /* [out] The device control block to be updated. */
340 LPCOMMTIMEOUTS lptimeouts) /* [in] The time outs to use if asked to set them by the control string. */
345 TRACE("(%p,%p,%p)\n",devid,lpdcb,lptimeouts);
346 devidA = HEAP_strdupWtoA( GetProcessHeap(), 0, devid );
349 ret=BuildCommDCBAndTimeoutsA(devidA,lpdcb,lptimeouts);
350 HeapFree( GetProcessHeap(), 0, devidA );
355 /**************************************************************************
356 * BuildCommDCBW (KERNEL32.@)
358 * Updates a device control block structure with values from an
359 * unicode device control string. The device control string has two forms
360 * normal and extended, it must be exclusively in one or the other form.
364 * True on success, false on an malformed control string.
366 BOOL WINAPI BuildCommDCBW(
367 LPCWSTR devid, /* [in] The unicode device control string. */
368 LPDCB lpdcb) /* [out] The device control block to be updated. */
370 return BuildCommDCBAndTimeoutsW(devid,lpdcb,NULL);
373 static BOOL COMM_SetCommError(HANDLE handle, DWORD error)
377 SERVER_START_REQ( set_serial_info )
379 req->handle = handle;
380 req->flags = SERIALINFO_SET_ERROR;
381 req->commerror = error;
382 ret = !SERVER_CALL_ERR();
388 static BOOL COMM_GetCommError(HANDLE handle, LPDWORD lperror)
395 SERVER_START_REQ( get_serial_info )
397 req->handle = handle;
398 ret = !SERVER_CALL_ERR();
399 *lperror = req->commerror;
406 /*****************************************************************************
407 * SetCommBreak (KERNEL32.@)
409 * Halts the transmission of characters to a communications device.
413 * True on success, and false if the communications device could not be found,
414 * the control is not supported.
418 * Only TIOCSBRK and TIOCCBRK are supported.
420 BOOL WINAPI SetCommBreak(
421 HANDLE handle) /* [in] The communictions device to suspend. */
423 #if defined(TIOCSBRK) && defined(TIOCCBRK) /* check if available for compilation */
426 fd = FILE_GetUnixHandle( handle, GENERIC_READ );
428 TRACE("FILE_GetUnixHandle failed\n");
431 result = ioctl(fd,TIOCSBRK,0);
435 TRACE("ioctl failed\n");
436 SetLastError(ERROR_NOT_SUPPORTED);
441 FIXME("ioctl not available\n");
442 SetLastError(ERROR_NOT_SUPPORTED);
447 /*****************************************************************************
448 * ClearCommBreak (KERNEL32.@)
450 * Resumes character transmission from a communication device.
454 * True on success and false if the communications device could not be found.
458 * Only TIOCSBRK and TIOCCBRK are supported.
460 BOOL WINAPI ClearCommBreak(
461 HANDLE handle) /* [in] The halted communication device whose character transmission is to be resumed. */
463 #if defined(TIOCSBRK) && defined(TIOCCBRK) /* check if available for compilation */
466 fd = FILE_GetUnixHandle( handle, GENERIC_READ );
468 TRACE("FILE_GetUnixHandle failed\n");
471 result = ioctl(fd,TIOCCBRK,0);
475 TRACE("ioctl failed\n");
476 SetLastError(ERROR_NOT_SUPPORTED);
481 FIXME("ioctl not available\n");
482 SetLastError(ERROR_NOT_SUPPORTED);
487 /*****************************************************************************
488 * EscapeCommFunction (KERNEL32.@)
490 * Directs a communication device to perform an extended function.
494 * True or requested data on successful completion of the command,
495 * false if the device is not present cannot execute the command
496 * or the command failed.
498 BOOL WINAPI EscapeCommFunction(
499 HANDLE handle, /* [in] The communication device to perform the extended function. */
500 UINT nFunction) /* [in] The extended function to be performed. */
502 int fd,direct=FALSE,result=FALSE;
505 TRACE("handle %d, function=%d\n", handle, nFunction);
506 fd = FILE_GetUnixHandle( handle, GENERIC_READ );
508 FIXME("handle %d not found.\n",handle);
512 if (tcgetattr(fd,&port) == -1) {
513 COMM_SetCommError(handle,CE_IOE);
527 result= COMM_WhackModem(fd, ~TIOCM_DTR, 0);
535 result= COMM_WhackModem(fd, ~TIOCM_RTS, 0);
543 result= COMM_WhackModem(fd, 0, TIOCM_DTR);
551 result= COMM_WhackModem(fd, 0, TIOCM_RTS);
557 port.c_iflag |= IXOFF;
562 port.c_iflag |= IXON;
568 result = ioctl(fd,TIOCSBRK,0);
575 result = ioctl(fd,TIOCCBRK,0);
579 WARN("(handle=%d,nFunction=%d): Unknown function\n",
585 if (tcsetattr(fd, TCSADRAIN, &port) == -1) {
587 COMM_SetCommError(handle,CE_IOE);
596 COMM_SetCommError(handle,CE_IOE);
605 /********************************************************************
606 * PurgeComm (KERNEL32.@)
608 * Terminates pending operations and/or discards buffers on a
609 * communication resource.
613 * True on success and false if the communications handle is bad.
615 BOOL WINAPI PurgeComm(
616 HANDLE handle, /* [in] The communication resource to be purged. */
617 DWORD flags) /* [in] Flags for clear pending/buffer on input/output. */
621 TRACE("handle %d, flags %lx\n", handle, flags);
623 fd = FILE_GetUnixHandle( handle, GENERIC_READ );
625 FIXME("no handle %d found\n",handle);
630 ** not exactly sure how these are different
631 ** Perhaps if we had our own internal queues, one flushes them
632 ** and the other flushes the kernel's buffers.
634 if(flags&PURGE_TXABORT)
635 tcflush(fd,TCOFLUSH);
636 if(flags&PURGE_RXABORT)
637 tcflush(fd,TCIFLUSH);
638 if(flags&PURGE_TXCLEAR)
639 tcflush(fd,TCOFLUSH);
640 if(flags&PURGE_RXCLEAR)
641 tcflush(fd,TCIFLUSH);
647 /*****************************************************************************
648 * ClearCommError (KERNEL32.@)
650 * Enables further I/O operations on a communications resource after
651 * supplying error and current status information.
655 * True on success, false if the communication resource handle is bad.
657 BOOL WINAPI ClearCommError(
658 HANDLE handle, /* [in] The communication resource with the error. */
659 LPDWORD errors, /* [out] Flags indicating error the resource experienced. */
660 LPCOMSTAT lpStat) /* [out] The status of the communication resource. */
664 fd=FILE_GetUnixHandle( handle, GENERIC_READ );
667 FIXME("no handle %d found\n",handle);
676 if(ioctl(fd, TIOCOUTQ, &lpStat->cbOutQue))
677 WARN("ioctl returned error\n");
679 lpStat->cbOutQue = 0; /* FIXME: find a different way to find out */
683 if(ioctl(fd, TIOCINQ, &lpStat->cbInQue))
684 WARN("ioctl returned error\n");
687 TRACE("handle %d cbInQue = %ld cbOutQue = %ld\n",
688 handle, lpStat->cbInQue, lpStat->cbOutQue);
693 COMM_GetCommError(handle, errors);
694 COMM_SetCommError(handle, 0);
699 /*****************************************************************************
700 * SetupComm (KERNEL32.@)
702 * Called after CreateFile to hint to the communication resource to use
703 * specified sizes for input and output buffers rather than the default values.
707 * True if successful, false if the communications resource handle is bad.
713 BOOL WINAPI SetupComm(
714 HANDLE handle, /* [in] The just created communication resource handle. */
715 DWORD insize, /* [in] The suggested size of the communication resources input buffer in bytes. */
716 DWORD outsize) /* [in] The suggested size of the communication resources output buffer in bytes. */
720 FIXME("insize %ld outsize %ld unimplemented stub\n", insize, outsize);
721 fd=FILE_GetUnixHandle( handle, GENERIC_READ );
723 FIXME("handle %d not found?\n",handle);
730 /*****************************************************************************
731 * GetCommMask (KERNEL32.@)
733 * Obtain the events associated with a communication device that will cause a call
734 * WaitCommEvent to return.
738 * True on success, fail on bad device handle etc.
740 BOOL WINAPI GetCommMask(
741 HANDLE handle, /* [in] The communications device. */
742 LPDWORD evtmask) /* [out] The events which cause WaitCommEvent to return. */
746 TRACE("handle %d, mask %p\n", handle, evtmask);
748 SERVER_START_REQ( get_serial_info )
750 req->handle = handle;
751 if ((ret = !SERVER_CALL_ERR()))
753 if (evtmask) *evtmask = req->eventmask;
760 /*****************************************************************************
761 * SetCommMask (KERNEL32.@)
763 * There be some things we need to hear about yon there communications device.
764 * (Set which events associated with a communication device should cause
765 * a call WaitCommEvent to return.)
769 * True on success, false on bad handle etc.
771 BOOL WINAPI SetCommMask(
772 HANDLE handle, /* [in] The communications device. */
773 DWORD evtmask) /* [in] The events that to be monitored. */
777 TRACE("handle %d, mask %lx\n", handle, evtmask);
779 SERVER_START_REQ( set_serial_info )
781 req->handle = handle;
782 req->flags = SERIALINFO_SET_MASK;
783 req->eventmask = evtmask;
784 ret = !SERVER_CALL_ERR();
790 /*****************************************************************************
791 * SetCommState (KERNEL32.@)
793 * Re-initializes all hardware and control settings of a communications device,
794 * with values from a device control block without effecting the input and output
799 * True on success, false on failure eg if the XonChar is equal to the XoffChar.
801 BOOL WINAPI SetCommState(
802 HANDLE handle, /* [in] The communications device. */
803 LPDCB lpdcb) /* [out] The device control block. */
806 int fd, bytesize, stopbits;
808 TRACE("handle %d, ptr %p\n", handle, lpdcb);
809 TRACE("bytesize %d baudrate %ld fParity %d Parity %d stopbits %d\n",
810 lpdcb->ByteSize,lpdcb->BaudRate,lpdcb->fParity, lpdcb->Parity,
811 (lpdcb->StopBits == ONESTOPBIT)?1:
812 (lpdcb->StopBits == TWOSTOPBITS)?2:0);
813 TRACE("%s %s\n",(lpdcb->fInX)?"IXON":"~IXON",
814 (lpdcb->fOutX)?"IXOFF":"~IXOFF");
816 fd = FILE_GetUnixHandle( handle, GENERIC_READ );
818 FIXME("no handle %d found\n",handle);
822 if ((tcgetattr(fd,&port)) == -1) {
823 int save_error = errno;
824 COMM_SetCommError(handle,CE_IOE);
826 ERR("tcgetattr error '%s'\n", strerror(save_error));
831 port.c_cc[VTIME] = 1;
834 port.c_iflag &= ~(ISTRIP|BRKINT|IGNCR|ICRNL|INLCR|IMAXBEL);
836 port.c_iflag &= ~(ISTRIP|BRKINT|IGNCR|ICRNL|INLCR);
838 port.c_iflag |= (IGNBRK);
840 port.c_oflag &= ~(OPOST);
842 port.c_cflag &= ~(HUPCL);
843 port.c_cflag |= CLOCAL | CREAD;
845 port.c_lflag &= ~(ICANON|ECHO|ISIG);
846 port.c_lflag |= NOFLSH;
849 port.c_cflag &= ~CBAUD;
850 switch (lpdcb->BaudRate) {
853 port.c_cflag |= B110;
857 port.c_cflag |= B300;
861 port.c_cflag |= B600;
865 port.c_cflag |= B1200;
869 port.c_cflag |= B2400;
873 port.c_cflag |= B4800;
877 port.c_cflag |= B9600;
881 port.c_cflag |= B19200;
885 port.c_cflag |= B38400;
889 port.c_cflag |= B57600;
894 port.c_cflag |= B115200;
899 port.c_cflag |= B230400;
904 port.c_cflag |= B460800;
908 COMM_SetCommError(handle,IE_BAUDRATE);
910 ERR("baudrate %ld\n",lpdcb->BaudRate);
913 #elif !defined(__EMX__)
914 switch (lpdcb->BaudRate) {
917 port.c_ospeed = B110;
921 port.c_ospeed = B300;
925 port.c_ospeed = B600;
929 port.c_ospeed = B1200;
933 port.c_ospeed = B2400;
937 port.c_ospeed = B4800;
941 port.c_ospeed = B9600;
945 port.c_ospeed = B19200;
949 port.c_ospeed = B38400;
952 COMM_SetCommError(handle,IE_BAUDRATE);
954 ERR("baudrate %ld\n",lpdcb->BaudRate);
957 port.c_ispeed = port.c_ospeed;
959 bytesize=lpdcb->ByteSize;
960 stopbits=lpdcb->StopBits;
963 port.c_cflag &= ~(PARENB | PARODD | CMSPAR);
965 port.c_cflag &= ~(PARENB | PARODD);
968 port.c_iflag |= INPCK;
970 port.c_iflag &= ~INPCK;
971 switch (lpdcb->Parity) {
975 port.c_cflag |= (PARENB | PARODD);
978 port.c_cflag |= PARENB;
981 /* Linux defines mark/space (stick) parity */
983 port.c_cflag |= (PARENB | CMSPAR);
986 port.c_cflag |= (PARENB | PARODD | CMSPAR);
989 /* try the POSIX way */
991 if( stopbits == ONESTOPBIT) {
992 stopbits = TWOSTOPBITS;
993 port.c_iflag &= ~INPCK;
995 COMM_SetCommError(handle,IE_BYTESIZE);
997 ERR("Cannot set MARK Parity\n");
1004 port.c_iflag &= ~INPCK;
1006 COMM_SetCommError(handle,IE_BYTESIZE);
1008 ERR("Cannot set SPACE Parity\n");
1014 COMM_SetCommError(handle,IE_BYTESIZE);
1021 port.c_cflag &= ~CSIZE;
1024 port.c_cflag |= CS5;
1027 port.c_cflag |= CS6;
1030 port.c_cflag |= CS7;
1033 port.c_cflag |= CS8;
1036 COMM_SetCommError(handle,IE_BYTESIZE);
1044 port.c_cflag &= ~CSTOPB;
1046 case ONE5STOPBITS: /* wil be selected if bytesize is 5 */
1048 port.c_cflag |= CSTOPB;
1051 COMM_SetCommError(handle,IE_BYTESIZE);
1057 if ( lpdcb->fOutxCtsFlow ||
1058 lpdcb->fRtsControl == RTS_CONTROL_ENABLE
1061 port.c_cflag |= CRTSCTS;
1066 if (lpdcb->fDtrControl == DTR_CONTROL_ENABLE)
1068 WARN("DSR/DTR flow control not supported\n");
1072 port.c_iflag |= IXON;
1074 port.c_iflag &= ~IXON;
1076 port.c_iflag |= IXOFF;
1078 port.c_iflag &= ~IXOFF;
1080 if (tcsetattr(fd,TCSANOW,&port)==-1) { /* otherwise it hangs with pending input*/
1081 int save_error=errno;
1082 COMM_SetCommError(handle,CE_IOE);
1084 ERR("tcsetattr error '%s'\n", strerror(save_error));
1087 COMM_SetCommError(handle,0);
1094 /*****************************************************************************
1095 * GetCommState (KERNEL32.@)
1097 * Fills in a device control block with information from a communications device.
1101 * True on success, false if the communication device handle is bad etc
1105 * XonChar and XoffChar are not set.
1107 BOOL WINAPI GetCommState(
1108 HANDLE handle, /* [in] The communications device. */
1109 LPDCB lpdcb) /* [out] The device control block. */
1111 struct termios port;
1114 TRACE("handle %d, ptr %p\n", handle, lpdcb);
1116 fd = FILE_GetUnixHandle( handle, GENERIC_READ );
1119 ERR("FILE_GetUnixHandle failed\n");
1122 if (tcgetattr(fd, &port) == -1) {
1123 int save_error=errno;
1124 ERR("tcgetattr error '%s'\n", strerror(save_error));
1125 COMM_SetCommError(handle,CE_IOE);
1132 speed= (port.c_cflag & CBAUD);
1134 speed= (cfgetospeed(&port));
1138 lpdcb->BaudRate = 110;
1141 lpdcb->BaudRate = 300;
1144 lpdcb->BaudRate = 600;
1147 lpdcb->BaudRate = 1200;
1150 lpdcb->BaudRate = 2400;
1153 lpdcb->BaudRate = 4800;
1156 lpdcb->BaudRate = 9600;
1159 lpdcb->BaudRate = 19200;
1162 lpdcb->BaudRate = 38400;
1166 lpdcb->BaudRate = 57600;
1171 lpdcb->BaudRate = 115200;
1176 lpdcb->BaudRate = 230400;
1181 lpdcb->BaudRate = 460800;
1185 ERR("unknown speed %x \n",speed);
1188 switch (port.c_cflag & CSIZE) {
1190 lpdcb->ByteSize = 5;
1193 lpdcb->ByteSize = 6;
1196 lpdcb->ByteSize = 7;
1199 lpdcb->ByteSize = 8;
1202 ERR("unknown size %x \n",port.c_cflag & CSIZE);
1205 if(port.c_iflag & INPCK)
1206 lpdcb->fParity = TRUE;
1208 lpdcb->fParity = FALSE;
1210 switch (port.c_cflag & (PARENB | PARODD | CMSPAR))
1212 switch (port.c_cflag & (PARENB | PARODD))
1216 lpdcb->Parity = NOPARITY;
1219 lpdcb->Parity = EVENPARITY;
1221 case (PARENB | PARODD):
1222 lpdcb->Parity = ODDPARITY;
1225 case (PARENB | CMSPAR):
1226 lpdcb->Parity = MARKPARITY;
1228 case (PARENB | PARODD | CMSPAR):
1229 lpdcb->Parity = SPACEPARITY;
1234 if (port.c_cflag & CSTOPB)
1235 if(lpdcb->ByteSize == 5)
1236 lpdcb->StopBits = ONE5STOPBITS;
1238 lpdcb->StopBits = TWOSTOPBITS;
1240 lpdcb->StopBits = ONESTOPBIT;
1245 /* termios does not support DTR/DSR flow control */
1246 lpdcb->fOutxDsrFlow = 0;
1247 lpdcb->fDtrControl = DTR_CONTROL_DISABLE;
1251 if (port.c_cflag & CRTSCTS) {
1252 lpdcb->fRtsControl = RTS_CONTROL_ENABLE;
1253 lpdcb->fOutxCtsFlow = 1;
1257 lpdcb->fRtsControl = RTS_CONTROL_DISABLE;
1258 lpdcb->fOutxCtsFlow = 0;
1260 if (port.c_iflag & IXON)
1265 if (port.c_iflag & IXOFF)
1274 lpdcb->XoffLim = 10;
1276 COMM_SetCommError(handle,0);
1280 TRACE("bytesize %d baudrate %ld fParity %d Parity %d stopbits %d\n",
1281 lpdcb->ByteSize,lpdcb->BaudRate,lpdcb->fParity, lpdcb->Parity,
1282 (lpdcb->StopBits == ONESTOPBIT)?1:
1283 (lpdcb->StopBits == TWOSTOPBITS)?2:0);
1284 TRACE("%s %s\n",(lpdcb->fInX)?"IXON":"~IXON",
1285 (lpdcb->fOutX)?"IXOFF":"~IXOFF");
1287 if ( lpdcb->fOutxCtsFlow ||
1288 lpdcb->fDtrControl == DTR_CONTROL_ENABLE||
1289 lpdcb->fRtsControl == RTS_CONTROL_ENABLE
1293 if (lpdcb->fDtrControl == DTR_CONTROL_DISABLE)
1294 TRACE("~CRTSCTS\n");
1300 /*****************************************************************************
1301 * TransmitCommChar (KERNEL32.@)
1303 * Transmits a single character in front of any pending characters in the
1304 * output buffer. Usually used to send an interrupt character to a host.
1308 * True if the call succeeded, false if the previous command character to the
1309 * same device has not been sent yet the handle is bad etc.
1315 BOOL WINAPI TransmitCommChar(
1316 HANDLE hComm, /* [in] The communication device in need of a command character. */
1317 CHAR chTransmit) /* [in] The character to transmit. */
1319 FIXME("(%x,'%c'), use win32 handle!\n",hComm,chTransmit);
1323 /*****************************************************************************
1324 * GetCommTimeouts (KERNEL32.@)
1326 * Obtains the request time out values for the communications device.
1330 * True on success, false if communications device handle is bad
1331 * or the target structure is null.
1333 BOOL WINAPI GetCommTimeouts(
1334 HANDLE hComm, /* [in] The communications device. */
1335 LPCOMMTIMEOUTS lptimeouts) /* [out] The struct of request time outs. */
1339 TRACE("(%x,%p)\n",hComm,lptimeouts);
1343 SetLastError(ERROR_INVALID_PARAMETER);
1347 SERVER_START_REQ( get_serial_info )
1349 req->handle = hComm;
1350 if ((ret = !SERVER_CALL_ERR()))
1352 lptimeouts->ReadIntervalTimeout = req->readinterval;
1353 lptimeouts->ReadTotalTimeoutMultiplier = req->readmult;
1354 lptimeouts->ReadTotalTimeoutConstant = req->readconst;
1355 lptimeouts->WriteTotalTimeoutMultiplier = req->writemult;
1356 lptimeouts->WriteTotalTimeoutConstant = req->writeconst;
1363 /*****************************************************************************
1364 * SetCommTimeouts (KERNEL32.@)
1366 * Sets the timeouts used when reading and writing data to/from COMM ports.
1368 * ReadIntervalTimeout
1369 * - converted and passes to linux kernel as c_cc[VTIME]
1370 * ReadTotalTimeoutMultiplier, ReadTotalTimeoutConstant
1371 * - used in ReadFile to calculate GetOverlappedResult's timeout
1372 * WriteTotalTimeoutMultiplier, WriteTotalTimeoutConstant
1373 * - used in WriteFile to calculate GetOverlappedResult's timeout
1377 * True if the time outs were set, false otherwise.
1379 BOOL WINAPI SetCommTimeouts(
1380 HANDLE hComm, /* [in] handle of COMM device */
1381 LPCOMMTIMEOUTS lptimeouts) /* [in] pointer to COMMTIMEOUTS structure */
1385 struct termios tios;
1387 TRACE("(%x,%p)\n",hComm,lptimeouts);
1391 SetLastError(ERROR_INVALID_PARAMETER);
1395 SERVER_START_REQ( set_serial_info )
1397 req->handle = hComm;
1398 req->flags = SERIALINFO_SET_TIMEOUTS;
1399 req->readinterval = lptimeouts->ReadIntervalTimeout ;
1400 req->readmult = lptimeouts->ReadTotalTimeoutMultiplier ;
1401 req->readconst = lptimeouts->ReadTotalTimeoutConstant ;
1402 req->writemult = lptimeouts->WriteTotalTimeoutMultiplier ;
1403 req->writeconst = lptimeouts->WriteTotalTimeoutConstant ;
1404 ret = !SERVER_CALL_ERR();
1407 if (!ret) return FALSE;
1409 /* FIXME: move this stuff to the server */
1410 fd = FILE_GetUnixHandle( hComm, GENERIC_READ );
1412 FIXME("no fd for handle = %0x!.\n",hComm);
1416 if (-1==tcgetattr(fd,&tios)) {
1417 FIXME("tcgetattr on fd %d failed!\n",fd);
1421 /* VTIME is in 1/10 seconds */
1423 unsigned int ux_timeout;
1425 if(lptimeouts->ReadIntervalTimeout == 0) /* 0 means no timeout */
1431 ux_timeout = (lptimeouts->ReadIntervalTimeout+99)/100;
1434 ux_timeout = 1; /* must be at least some timeout */
1437 tios.c_cc[VTIME] = ux_timeout;
1440 if (-1==tcsetattr(fd,0,&tios)) {
1441 FIXME("tcsetattr on fd %d failed!\n",fd);
1448 /***********************************************************************
1449 * GetCommModemStatus (KERNEL32.@)
1451 * Obtains the four control register bits if supported by the hardware.
1455 * True if the communications handle was good and for hardware that
1456 * control register access, false otherwise.
1458 BOOL WINAPI GetCommModemStatus(
1459 HANDLE hFile, /* [in] The communications device. */
1460 LPDWORD lpModemStat) /* [out] The control register bits. */
1462 int fd,mstat, result=FALSE;
1466 fd = FILE_GetUnixHandle( hFile, GENERIC_READ );
1469 result = ioctl(fd, TIOCMGET, &mstat);
1473 WARN("ioctl failed\n");
1477 if (mstat & TIOCM_CTS)
1478 *lpModemStat |= MS_CTS_ON;
1481 if (mstat & TIOCM_DSR)
1482 *lpModemStat |= MS_DSR_ON;
1485 if (mstat & TIOCM_RNG)
1486 *lpModemStat |= MS_RING_ON;
1489 /*FIXME: Not really sure about RLSD UB 990810*/
1490 if (mstat & TIOCM_CAR)
1491 *lpModemStat |= MS_RLSD_ON;
1493 TRACE("%04x -> %s%s%s%s\n", mstat,
1494 (*lpModemStat &MS_RLSD_ON)?"MS_RLSD_ON ":"",
1495 (*lpModemStat &MS_RING_ON)?"MS_RING_ON ":"",
1496 (*lpModemStat &MS_DSR_ON)?"MS_DSR_ON ":"",
1497 (*lpModemStat &MS_CTS_ON)?"MS_CTS_ON ":"");
1504 /***********************************************************************
1505 * COMM_WaitCommEventService (INTERNAL)
1507 * This function is called while the client is waiting on the
1508 * server, so we can't make any server calls here.
1510 static void COMM_WaitCommEventService(async_private *ovp, int events)
1512 LPOVERLAPPED lpOverlapped = ovp->lpOverlapped;
1514 TRACE("overlapped %p wait complete %p <- %x\n",lpOverlapped,ovp->buffer,events);
1517 lpOverlapped->Internal = STATUS_HANDLES_CLOSED;
1523 *ovp->buffer = EV_RXCHAR;
1526 lpOverlapped->Internal = STATUS_SUCCESS;
1531 /***********************************************************************
1532 * COMM_WaitCommEvent (INTERNAL)
1534 * This function must have an lpOverlapped.
1536 static BOOL COMM_WaitCommEvent(
1537 HANDLE hFile, /* [in] handle of comm port to wait for */
1538 LPDWORD lpdwEvents, /* [out] event(s) that were detected */
1539 LPOVERLAPPED lpOverlapped) /* [in/out] for Asynchronous waiting */
1546 SetLastError(ERROR_INVALID_PARAMETER);
1550 if(NtResetEvent(lpOverlapped->hEvent,NULL))
1553 lpOverlapped->Internal = STATUS_PENDING;
1554 lpOverlapped->InternalHigh = 0;
1555 lpOverlapped->Offset = 0;
1556 lpOverlapped->OffsetHigh = 0;
1558 /* start an ASYNCHRONOUS WaitCommEvent */
1559 SERVER_START_REQ( create_async )
1561 req->file_handle = hFile;
1563 req->type = ASYNC_TYPE_WAIT;
1565 ret=SERVER_CALL_ERR();
1572 fd = FILE_GetUnixHandle( hFile, GENERIC_WRITE );
1576 ovp = (async_private *) HeapAlloc(GetProcessHeap(), 0, sizeof (async_private));
1582 ovp->lpOverlapped = lpOverlapped;
1585 ovp->tv.tv_usec = 0;
1586 ovp->event = POLLIN;
1587 ovp->func = COMM_WaitCommEventService;
1588 ovp->buffer = (char *)lpdwEvents;
1591 ovp->completion_func = 0;
1593 ovp->next = NtCurrentTeb()->pending_list;
1596 ovp->next->prev=ovp;
1597 NtCurrentTeb()->pending_list = ovp;
1599 SetLastError(ERROR_IO_PENDING);
1604 /***********************************************************************
1605 * WaitCommEvent (KERNEL32.@)
1607 * Wait until something interesting happens on a COMM port.
1608 * Interesting things (events) are set by calling SetCommMask before
1609 * this function is called.
1612 * TRUE if successful
1615 * The set of detected events will be written to *lpdwEventMask
1616 * ERROR_IO_PENDING will be returned the overlapped structure was passed
1619 * Only supports EV_RXCHAR and EV_TXEMPTY
1621 BOOL WINAPI WaitCommEvent(
1622 HANDLE hFile, /* [in] handle of comm port to wait for */
1623 LPDWORD lpdwEvents, /* [out] event(s) that were detected */
1624 LPOVERLAPPED lpOverlapped) /* [in/out] for Asynchronous waiting */
1629 TRACE("(%x %p %p )\n",hFile, lpdwEvents,lpOverlapped);
1632 return COMM_WaitCommEvent(hFile, lpdwEvents, lpOverlapped);
1634 /* if there is no overlapped structure, create our own */
1635 ov.hEvent = CreateEventA(NULL,FALSE,FALSE,NULL);
1637 COMM_WaitCommEvent(hFile, lpdwEvents, &ov);
1639 if(GetLastError()!=STATUS_PENDING)
1641 CloseHandle(ov.hEvent);
1645 /* wait for the overlapped to complete */
1646 ret = GetOverlappedResult(hFile, &ov, NULL, TRUE);
1647 CloseHandle(ov.hEvent);
1652 /***********************************************************************
1653 * GetCommProperties (KERNEL32.@)
1655 * This function fills in a structure with the capabilities of the
1656 * communications port driver.
1660 * TRUE on success, FALSE on failure
1661 * If successful, the lpCommProp structure be filled in with
1662 * properties of the comm port.
1664 BOOL WINAPI GetCommProperties(
1665 HANDLE hFile, /* [in] handle of the comm port */
1666 LPCOMMPROP lpCommProp) /* [out] pointer to struct to be filled */
1668 FIXME("(%d %p )\n",hFile,lpCommProp);
1673 * These values should be valid for LINUX's serial driver
1674 * FIXME: Perhaps they deserve an #ifdef LINUX
1676 memset(lpCommProp,0,sizeof(COMMPROP));
1677 lpCommProp->wPacketLength = 1;
1678 lpCommProp->wPacketVersion = 1;
1679 lpCommProp->dwServiceMask = SP_SERIALCOMM;
1680 lpCommProp->dwReserved1 = 0;
1681 lpCommProp->dwMaxTxQueue = 4096;
1682 lpCommProp->dwMaxRxQueue = 4096;
1683 lpCommProp->dwMaxBaud = BAUD_115200;
1684 lpCommProp->dwProvSubType = PST_RS232;
1685 lpCommProp->dwProvCapabilities = PCF_DTRDSR | PCF_PARITY_CHECK | PCF_RTSCTS ;
1686 lpCommProp->dwSettableParams = SP_BAUD | SP_DATABITS | SP_HANDSHAKING |
1687 SP_PARITY | SP_PARITY_CHECK | SP_STOPBITS ;
1688 lpCommProp->dwSettableBaud = BAUD_075 | BAUD_110 | BAUD_134_5 | BAUD_150 |
1689 BAUD_300 | BAUD_600 | BAUD_1200 | BAUD_1800 | BAUD_2400 | BAUD_4800 |
1690 BAUD_9600 | BAUD_19200 | BAUD_38400 | BAUD_57600 | BAUD_115200 ;
1691 lpCommProp->wSettableData = DATABITS_5 | DATABITS_6 | DATABITS_7 | DATABITS_8 ;
1692 lpCommProp->wSettableStopParity = STOPBITS_10 | STOPBITS_15 | STOPBITS_20 |
1693 PARITY_NONE | PARITY_ODD |PARITY_EVEN | PARITY_MARK | PARITY_SPACE;
1694 lpCommProp->dwCurrentTxQueue = lpCommProp->dwMaxTxQueue;
1695 lpCommProp->dwCurrentRxQueue = lpCommProp->dwMaxRxQueue;
1700 /***********************************************************************
1702 * The functionality of CommConfigDialogA, GetDefaultCommConfig and
1703 * SetDefaultCommConfig is implemented in a DLL (usually SERIALUI.DLL).
1704 * This is dependent on the type of COMM port, but since it is doubtful
1705 * anybody will get around to implementing support for fancy serial
1706 * ports in WINE, this is hardcoded for the time being. The name of
1707 * this DLL should be stored in and read from the system registry in
1708 * the hive HKEY_LOCAL_MACHINE, key
1709 * System\\CurrentControlSet\\Services\\Class\\Ports\\????
1710 * where ???? is the port number... that is determined by PNP
1711 * The DLL should be loaded when the COMM port is opened, and closed
1712 * when the COMM port is closed. - MJM 20 June 2000
1713 ***********************************************************************/
1714 static CHAR lpszSerialUI[] = "serialui.dll";
1717 /***********************************************************************
1718 * CommConfigDialogA (KERNEL32.@)
1720 * Raises a dialog that allows the user to configure a comm port.
1721 * Fills the COMMCONFIG struct with information specified by the user.
1722 * This function should call a similar routine in the COMM driver...
1726 * TRUE on success, FALSE on failure
1727 * If successful, the lpCommConfig structure will contain a new
1728 * configuration for the comm port, as specified by the user.
1731 * The library with the CommConfigDialog code is never unloaded.
1732 * Perhaps this should be done when the comm port is closed?
1734 BOOL WINAPI CommConfigDialogA(
1735 LPCSTR lpszDevice, /* [in] name of communications device */
1736 HANDLE hWnd, /* [in] parent window for the dialog */
1737 LPCOMMCONFIG lpCommConfig) /* [out] pointer to struct to fill */
1739 FARPROC lpfnCommDialog;
1740 HMODULE hConfigModule;
1743 TRACE("(%p %x %p)\n",lpszDevice, hWnd, lpCommConfig);
1745 hConfigModule = LoadLibraryA(lpszSerialUI);
1749 lpfnCommDialog = GetProcAddress(hConfigModule, (LPCSTR)3L);
1754 r = lpfnCommDialog(lpszDevice,hWnd,lpCommConfig);
1756 /* UnloadLibrary(hConfigModule); */
1761 /***********************************************************************
1762 * CommConfigDialogW (KERNEL32.@)
1764 * see CommConfigDialogA for more info
1766 BOOL WINAPI CommConfigDialogW(
1767 LPCWSTR lpszDevice, /* [in] name of communications device */
1768 HANDLE hWnd, /* [in] parent window for the dialog */
1769 LPCOMMCONFIG lpCommConfig) /* [out] pointer to struct to fill */
1774 lpDeviceA = HEAP_strdupWtoA( GetProcessHeap(), 0, lpszDevice );
1777 r = CommConfigDialogA(lpDeviceA,hWnd,lpCommConfig);
1778 HeapFree( GetProcessHeap(), 0, lpDeviceA );
1782 /***********************************************************************
1783 * GetCommConfig (KERNEL32.@)
1785 * Fill in the COMMCONFIG structure for the comm port hFile
1789 * TRUE on success, FALSE on failure
1790 * If successful, lpCommConfig contains the comm port configuration.
1794 * The signature is missing a the parameter for the size of the COMMCONFIG
1795 * structure/buffer it should be
1796 * BOOL WINAPI GetCommConfig(HANDLE hFile,LPCOMMCONFIG lpCommConfig,LPDWORD lpdwSize)
1798 BOOL WINAPI GetCommConfig(
1799 HANDLE hFile, /* [in] The communications device. */
1800 LPCOMMCONFIG lpCommConfig, /* [out] The communications configuration of the device (if it fits). */
1801 LPDWORD lpdwSize) /* [in/out] Initially the size of the configuration buffer/structure,
1802 afterwards the number of bytes copied to the buffer or
1803 the needed size of the buffer. */
1807 TRACE("(%x %p)\n",hFile,lpCommConfig);
1809 if(lpCommConfig == NULL)
1812 r = *lpdwSize < sizeof(COMMCONFIG);
1813 *lpdwSize = sizeof(COMMCONFIG);
1817 lpCommConfig->dwSize = sizeof(COMMCONFIG);
1818 lpCommConfig->wVersion = 1;
1819 lpCommConfig->wReserved = 0;
1820 r = GetCommState(hFile,&lpCommConfig->dcb);
1821 lpCommConfig->dwProviderSubType = PST_RS232;
1822 lpCommConfig->dwProviderOffset = 0;
1823 lpCommConfig->dwProviderSize = 0;
1828 /***********************************************************************
1829 * SetCommConfig (KERNEL32.@)
1831 * Sets the configuration of the commications device.
1835 * True on success, false if the handle was bad is not a communications device.
1837 BOOL WINAPI SetCommConfig(
1838 HANDLE hFile, /* [in] The communications device. */
1839 LPCOMMCONFIG lpCommConfig, /* [in] The desired configuration. */
1840 DWORD dwSize) /* [in] size of the lpCommConfig struct */
1842 TRACE("(%x %p)\n",hFile,lpCommConfig);
1843 return SetCommState(hFile,&lpCommConfig->dcb);
1846 /***********************************************************************
1847 * SetDefaultCommConfigA (KERNEL32.@)
1849 * Initializes the default configuration for the specified communication
1854 * True if the device was found and the defaults set, false otherwise
1856 BOOL WINAPI SetDefaultCommConfigA(
1857 LPCSTR lpszDevice, /* [in] The ascii name of the device targeted for configuration. */
1858 LPCOMMCONFIG lpCommConfig, /* [in] The default configuration for the device. */
1859 DWORD dwSize) /* [in] The number of bytes in the configuration structure. */
1861 FARPROC lpfnSetDefaultCommConfig;
1862 HMODULE hConfigModule;
1865 TRACE("(%p %p %lx)\n",lpszDevice, lpCommConfig, dwSize);
1867 hConfigModule = LoadLibraryA(lpszSerialUI);
1871 lpfnSetDefaultCommConfig = GetProcAddress(hConfigModule, (LPCSTR)4L);
1873 if(! lpfnSetDefaultCommConfig)
1876 r = lpfnSetDefaultCommConfig(lpszDevice, lpCommConfig, dwSize);
1878 /* UnloadLibrary(hConfigModule); */
1884 /***********************************************************************
1885 * SetDefaultCommConfigW (KERNEL32.@)
1887 * Initializes the default configuration for the specified
1888 * communication device. (unicode)
1893 BOOL WINAPI SetDefaultCommConfigW(
1894 LPCWSTR lpszDevice, /* [in] The unicode name of the device targeted for configuration. */
1895 LPCOMMCONFIG lpCommConfig, /* [in] The default configuration for the device. */
1896 DWORD dwSize) /* [in] The number of bytes in the configuration structure. */
1901 TRACE("(%s %p %lx)\n",debugstr_w(lpszDevice),lpCommConfig,dwSize);
1903 lpDeviceA = HEAP_strdupWtoA( GetProcessHeap(), 0, lpszDevice );
1906 r = SetDefaultCommConfigA(lpDeviceA,lpCommConfig,dwSize);
1907 HeapFree( GetProcessHeap(), 0, lpDeviceA );
1912 /***********************************************************************
1913 * GetDefaultCommConfigA (KERNEL32.@)
1915 * Acquires the default configuration of the specified communication device. (unicode)
1919 * True on successful reading of the default configuration,
1920 * if the device is not found or the buffer is too small.
1922 BOOL WINAPI GetDefaultCommConfigA(
1923 LPCSTR lpszName, /* [in] The ascii name of the device targeted for configuration. */
1924 LPCOMMCONFIG lpCC, /* [out] The default configuration for the device. */
1925 LPDWORD lpdwSize) /* [in/out] Initially the size of the default configuration buffer,
1926 afterwards the number of bytes copied to the buffer or
1927 the needed size of the buffer. */
1929 LPDCB lpdcb = &(lpCC->dcb);
1932 if (strncasecmp(lpszName,"COM",3)) {
1933 ERR("not implemented for <%s>\n", lpszName);
1937 TRACE("(%s %p %ld)\n", lpszName, lpCC, *lpdwSize );
1938 if (*lpdwSize < sizeof(COMMCONFIG)) {
1939 *lpdwSize = sizeof(COMMCONFIG);
1943 *lpdwSize = sizeof(COMMCONFIG);
1945 lpCC->dwSize = sizeof(COMMCONFIG);
1947 lpCC->dwProviderSubType = PST_RS232;
1948 lpCC->dwProviderOffset = 0L;
1949 lpCC->dwProviderSize = 0L;
1951 (void) sprintf( temp, "COM%c:38400,n,8,1", lpszName[3]);
1952 FIXME("setting %s as default\n", temp);
1954 return BuildCommDCBA( temp, lpdcb);
1957 /**************************************************************************
1958 * GetDefaultCommConfigW (KERNEL32.@)
1960 * Acquires the default configuration of the specified communication device. (unicode)
1964 * True on successful reading of the default configuration,
1965 * if the device is not found or the buffer is too small.
1967 BOOL WINAPI GetDefaultCommConfigW(
1968 LPCWSTR lpszName, /* [in] The unicode name of the device targeted for configuration. */
1969 LPCOMMCONFIG lpCC, /* [out] The default configuration for the device. */
1970 LPDWORD lpdwSize) /* [in/out] Initially the size of the default configuration buffer,
1971 afterwards the number of bytes copied to the buffer or
1972 the needed size of the buffer. */
1977 TRACE("(%p,%p,%ld)\n",lpszName,lpCC,*lpdwSize);
1978 lpszNameA = HEAP_strdupWtoA( GetProcessHeap(), 0, lpszName );
1981 ret=GetDefaultCommConfigA(lpszNameA,lpCC,lpdwSize);
1982 HeapFree( GetProcessHeap(), 0, lpszNameA );