summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/dynamic.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/dynamic.cpp b/src/dynamic.cpp
index b17f13190..3a6a151cb 100644
--- a/src/dynamic.cpp
+++ b/src/dynamic.cpp
@@ -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;