Commit ad4e597f authored by Max Kellermann's avatar Max Kellermann

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

parent ee3610a2
...@@ -32,7 +32,7 @@ ...@@ -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, ...) ...@@ -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);
} }
......
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