diff --git a/src/unlocker/main.cpp b/src/unlocker/main.cpp index 2c3676b..4ff889b 100644 --- a/src/unlocker/main.cpp +++ b/src/unlocker/main.cpp @@ -71,6 +71,21 @@ void StartWatchdog() bool run() { + /* + mutex check before running + */ + HANDLE mtx = CreateMutexA(NULL, TRUE, "Global\\HexUnlocked"); + if (mtx == NULL) return false; + if (GetLastError() == ERROR_ALREADY_EXISTS) + { + MessageBoxA(NULL, "Program is already running", "Hex: Unlocked", MB_OK | MB_ICONERROR | MB_ICONINFORMATION); + CloseHandle(mtx); + return false; + } + + /* + init + */ seallib::Logger mainLog("Main"); mainLog.addSink(std::make_shared());