[ros-dev] kernel32\comm.c improvements

Saveliy Tretiakov saveliyt at mail.ru
Thu Mar 24 19:14:06 CET 2005


Hi. This is what I've changed:
1. Implement ClearCommError. I din't test it too much, but it should be ok.
   I've reveresed WinXP's ClearCommError to ensure that my 
implementation is correct :)
2. Correct badly implemented apis. For Example:

ClearCommBreak(HANDLE hFile)
{
    BOOL result = FALSE;
    DWORD dwBytesReturned;

    if (hFile == INVALID_HANDLE_VALUE) {
        return FALSE;
    }
    result = DeviceIoControl(hFile, IOCTL_SERIAL_SET_BREAK_OFF, NULL, 0, 
NULL, 0, &dwBytesReturned, NULL);
    return TRUE;
}

Check for INVALID_HANDLE_VALUE is not needed here. I removed all these 
checks from
everywhere in comm.c. Function will return TRUE even if DeviceIoControl 
fails. This is wrong.

Modified functions:
  ClearCommBreak, EscapeCommFunction, GetCommMask, GetCommModemStatus
  GetCommState, GetCommTimeouts, PurgeComm, SetCommBreak, SetCommMask,
  SetCommTimeouts, SetCommState, SetupComm, TransmitCommChar, WaitCommEvent
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kernel32.zip
Type: application/zip
Size: 2723 bytes
Desc: not available
Url : http://reactos.com:8080/pipermail/ros-dev/attachments/20050324/11e10e64/kernel32.zip


More information about the Ros-dev mailing list