feat: add mutex to prevent double runs
This commit is contained in:
@@ -71,6 +71,21 @@ void StartWatchdog()
|
|||||||
|
|
||||||
bool run()
|
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");
|
seallib::Logger mainLog("Main");
|
||||||
mainLog.addSink(std::make_shared<ConOutSink>());
|
mainLog.addSink(std::make_shared<ConOutSink>());
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user