util/Error: use FormatMessage() instead of g_win32_error_message()
This commit is contained in:
parent
ee3610a2d2
commit
ad4e597f74
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user