diff options
Diffstat (limited to '')
-rw-r--r-- | src/util/Error.cxx | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/util/Error.cxx b/src/util/Error.cxx index ef8282329..92b2cc5d0 100644 --- a/src/util/Error.cxx +++ b/src/util/Error.cxx @@ -145,4 +145,30 @@ Error::SetLastError(const char *prefix) SetLastError(GetLastError(), prefix); } +void +Error::FormatLastError(DWORD _code, const char *fmt, ...) +{ + char buffer[1024]; + va_list ap; + va_start(ap, fmt); + vsnprintf(buffer, sizeof(buffer), fmt, ap); + va_end(ap); + + SetLastError(_code, buffer); +} + +void +Error::FormatLastError(const char *fmt, ...) +{ + DWORD _code = GetLastError(); + + char buffer[1024]; + va_list ap; + va_start(ap, fmt); + vsnprintf(buffer, sizeof(buffer), fmt, ap); + va_end(ap); + + SetLastError(_code, buffer); +} + #endif |