Commit d1bc46ff authored by Max Kellermann's avatar Max Kellermann

util/Error: add SetLastError() overload with "DWORD code" parameter

parent 32e5848f
...@@ -133,11 +133,16 @@ Error::FormatErrno(const char *fmt, ...) ...@@ -133,11 +133,16 @@ Error::FormatErrno(const char *fmt, ...)
#ifdef WIN32 #ifdef WIN32
void void
Error::SetLastError(const char *prefix) Error::SetLastError(DWORD _code, const char *prefix)
{ {
DWORD _code = GetLastError();
const char *msg = g_win32_error_message(_code); const char *msg = g_win32_error_message(_code);
Format(win32_domain, int(_code), "%s: %s", prefix, msg); Format(win32_domain, int(_code), "%s: %s", prefix, msg);
} }
void
Error::SetLastError(const char *prefix)
{
SetLastError(GetLastError(), prefix);
}
#endif #endif
...@@ -166,6 +166,7 @@ public: ...@@ -166,6 +166,7 @@ public:
void FormatErrno(int e, const char *prefix, ...); void FormatErrno(int e, const char *prefix, ...);
#ifdef WIN32 #ifdef WIN32
void SetLastError(DWORD _code, const char *prefix);
void SetLastError(const char *prefix); void SetLastError(const char *prefix);
#endif #endif
}; };
......
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