Skip to content

Commit

Permalink
Merge pull request #3124 from dolphin-emu/shuffle2-patch-1
Browse files Browse the repository at this point in the history
Fix WiiSockMan::DecodeError
  • Loading branch information
shuffle2 committed Oct 3, 2015
2 parents 5464e69 + f33fae5 commit b4be34b
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions Source/Core/Core/IPC_HLE/WII_Socket.cpp
Expand Up @@ -24,13 +24,14 @@
char* WiiSockMan::DecodeError(s32 ErrorCode)
{
#ifdef _WIN32
// NOT THREAD SAFE
static char Message[1024];
// If this program was multi-threaded, we'd want to use FORMAT_MESSAGE_ALLOCATE_BUFFER
// instead of a static buffer here.
// (And of course, free the buffer when we were done with it)
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS |
FORMAT_MESSAGE_MAX_WIDTH_MASK, nullptr, ErrorCode,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPWSTR)Message, 1024, nullptr);

FormatMessageA(
FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_MAX_WIDTH_MASK,
nullptr, ErrorCode, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), Message,
sizeof(Message), nullptr);

return Message;
#else
return strerror(ErrorCode);
Expand Down

0 comments on commit b4be34b

Please sign in to comment.