Reverted to the original GetLastError() method for CreateMutex(), as, it turns out, Microsoft lied. Even when the function fails, it returns non-NULL.

This commit is contained in:
Fatbag 2012-04-13 23:16:34 -05:00
parent c5117169b9
commit 64a5c0a425

View file

@ -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);