]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/dynamic.cpp
Fix mistakenly using Clang instead of GCC on older FreeBSD versions.
[user/henk/code/inspircd.git] / src / dynamic.cpp
index b17f131904a165234fc7b69810af4ecf8daeefba..3a6a151cb5d047db124b4caca75d1a8063c0a1bf 100644 (file)
@@ -97,8 +97,10 @@ std::string DLLManager::GetVersion()
 #ifdef _WIN32
 void DLLManager::RetrieveLastError()
 {
-       CHAR errmsg[100];
-       FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, 0, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), errmsg, 100, 0);
+       char errmsg[500];
+       DWORD dwErrorCode = GetLastError();
+       if (FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, dwErrorCode, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPSTR)errmsg, _countof(errmsg), NULL) == 0)
+               sprintf_s(errmsg, _countof(errmsg), "Error code: %u", dwErrorCode);
        SetLastError(ERROR_SUCCESS);
        err = errmsg;