diff options
| author | JosJuice <josjuice@gmail.com> | 2023-07-29 18:54:10 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-07-29 18:54:10 +0200 |
| commit | 30c4ac34b0aebd4462eb3e8ab188a0de6209784e (patch) | |
| tree | 6f97c3241e85df0272faa526f26d0c805a434de1 /Source/Core/Common/CommonFuncs.cpp | |
| parent | 163c97e24241dd8c67a1d44e33e2f9a67b91709b (diff) | |
| parent | fb9274c359d414f254da42f96323be64a5358217 (diff) | |
Merge pull request #12073 from AdmiralCurtiss/wiimote-win32error
WiimoteReal/IOWin: Use correct error type in the default case.
Diffstat (limited to 'Source/Core/Common/CommonFuncs.cpp')
| -rw-r--r-- | Source/Core/Common/CommonFuncs.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Source/Core/Common/CommonFuncs.cpp b/Source/Core/Common/CommonFuncs.cpp index a1e93455a2..0a546428b7 100644 --- a/Source/Core/Common/CommonFuncs.cpp +++ b/Source/Core/Common/CommonFuncs.cpp @@ -53,9 +53,15 @@ std::string LastStrerrorString() // This function might change the error code. std::string GetLastErrorString() { + return GetWin32ErrorString(GetLastError()); +} + +// Like GetLastErrorString() but if you have already queried the error code. +std::string GetWin32ErrorString(DWORD error_code) +{ char error_message[BUFFER_SIZE]; - FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, nullptr, GetLastError(), + FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, nullptr, error_code, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), error_message, BUFFER_SIZE, nullptr); return std::string(error_message); } |
