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