util/Error: use FormatMessage() instead of g_win32_error_message()

This commit is contained in:
Max Kellermann 2014-12-05 00:05:00 +01:00
parent ee3610a2d2
commit ad4e597f74

View File

@ -32,7 +32,7 @@
#include "Domain.hxx" #include "Domain.hxx"
#ifdef WIN32 #ifdef WIN32
#include <glib.h> #include <windows.h>
#endif #endif
#include <errno.h> #include <errno.h>
@ -135,7 +135,11 @@ Error::FormatErrno(const char *fmt, ...)
void void
Error::SetLastError(DWORD _code, const char *prefix) Error::SetLastError(DWORD _code, const char *prefix)
{ {
const char *msg = g_win32_error_message(_code); char msg[256];
FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
nullptr, _code, 0, msg, sizeof(msg), nullptr);
Format(win32_domain, int(_code), "%s: %s", prefix, msg); Format(win32_domain, int(_code), "%s: %s", prefix, msg);
} }