Page MenuHomePhabricator

The return value in mitkSerialCommunication::Send is inconsistent under Microsoft Windows Platforms
Closed, ResolvedPublic


The return value of mitkSerialCommunication::Send is incosistent in Windows. That function returns 1 for Ok and 0 for an error condition, but if the WriteFile fails (it it returns FALSE), Send returns the GetLastError() value. In general GetLastError will return values > 0 for error codes, possibly not a 1 (ERROR_INVALID_FUNCTION) for the WriteFile call, but surely a 5 (ERROR_ACCESS_DENIED) when the serial port is physically unplugged while sending data.

I propose to replace the calls to GetLastError() for ERROR_VALUE.