david-maw / StreamSSL

The StreamSSL sample described in CodeProject
Other
47 stars 24 forks source link

WinErrorMsg when does if (theMsg.empty()) case occure? #71

Closed 0ric1 closed 5 years ago

david-maw commented 5 years ago

Only if the caller passes an undefined error - and the WinErrorMsg code is broken for that case anyway, it should be:

        auto len = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM...
        theMsg.resize(len);
        if (theMsg.empty()) ...

To make it fail as an example: wcout << L"WinErrorMsg: " << WinErrorMsg(ERROR_HANDLE_DISK_FULL+1) << endl; I'll check in a fix for the bug.