Commit d7257ad4 authored by Don Gagne's avatar Don Gagne

Better Windows error reporting

parent e8b45972
......@@ -164,17 +164,15 @@ void QextSerialPortPrivate::translateError(ulong error)
lastOSErr = error;
lastErr = E_OS_SPECIFIC;
LPVOID lpMsgBuf;
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
char buf[256];
FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
error,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR) &lpMsgBuf,
0, NULL);
lastOSErrString = QString((char*)lpMsgBuf);
LocalFree(lpMsgBuf);
buf, sizeof(buf),
NULL);
lastOSErrString = buf;
}
/*
......@@ -204,8 +202,8 @@ qint64 QextSerialPortPrivate::readData_sys(char *data, qint64 maxSize)
if (!failed)
return (qint64)bytesRead;
lastErr = E_READ_FAILED;
return -1;
translateError(GetLastError());
return -1;
}
/*
......@@ -249,7 +247,7 @@ qint64 QextSerialPortPrivate::writeData_sys(const char *data, qint64 maxSize)
if (!failed)
return (qint64)bytesWritten;
lastErr = E_WRITE_FAILED;
translateError(GetLastError());
return -1;
}
......
......@@ -102,11 +102,6 @@ void PX4FirmwareUpgradeThreadWorker::_findBoardOnce(void)
portName = info.systemLocation();
portDescription = info.description();
#ifdef Q_OS_WIN
// Stupid windows fixes
portName.prepend("\\\\.\\");
#endif
_closeFind();
emit foundBoard(_findBoardFirstAttempt, portName, portDescription);
return;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment