From 64a5c0a425efc8bc1985bcb0738db74a83e172b6 Mon Sep 17 00:00:00 2001 From: Fatbag Date: Fri, 13 Apr 2012 23:16:34 -0500 Subject: [PATCH] Reverted to the original GetLastError() method for CreateMutex(), as, it turns out, Microsoft lied. Even when the function fails, it returns non-NULL. --- Client/Client.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Client/Client.cpp b/Client/Client.cpp index ada110f..d49c2fa 100644 --- a/Client/Client.cpp +++ b/Client/Client.cpp @@ -25,7 +25,8 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int) int result; //Disallow multiple instances of the game from running - if(CreateMutex(NULL, TRUE, "TSO_NIOTSO_MUTEX") == NULL){ + CreateMutex(NULL, TRUE, "Global\\TSO_NIOTSO_MUTEX"); + if(GetLastError() == ERROR_ALREADY_EXISTS){ HWND hWnd = FindWindow("TSO_NIOTSO", "The Sims Online"); if(hWnd != NULL){ ShowWindow(hWnd, SW_RESTORE);