2023-02-28 01:15:26 +00:00
|
|
|
// AUTOGENERATED COPYRIGHT HEADER START
|
|
|
|
// Copyright (C) 2020-2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
|
|
|
|
// AUTOGENERATED COPYRIGHT HEADER END
|
2020-04-05 16:52:06 +00:00
|
|
|
|
2022-08-29 10:29:44 +00:00
|
|
|
#include "warning-disable.hpp"
|
2020-04-05 16:52:06 +00:00
|
|
|
#include <Windows.h>
|
2023-05-20 14:57:08 +00:00
|
|
|
#include <mutex>
|
2022-08-29 10:29:44 +00:00
|
|
|
#include "warning-enable.hpp"
|
2020-04-05 16:52:06 +00:00
|
|
|
|
2023-05-20 14:57:08 +00:00
|
|
|
std::shared_ptr<void> local_mutex;
|
|
|
|
std::shared_ptr<void> global_mutex;
|
|
|
|
|
|
|
|
BOOL WINAPI DllMain(HINSTANCE, DWORD dwReason, LPVOID)
|
2020-04-05 16:52:06 +00:00
|
|
|
{
|
2023-05-20 14:57:08 +00:00
|
|
|
if (dwReason == DLL_PROCESS_ATTACH) {
|
|
|
|
// Prevent installer from progressing while StreamFX is still active.
|
|
|
|
local_mutex = std::shared_ptr<void>(CreateMutexW(NULL, TRUE, L"Local\\StreamFX-Setup"), [](HANDLE p) {
|
|
|
|
ReleaseMutex(p);
|
|
|
|
CloseHandle(p);
|
|
|
|
});
|
|
|
|
global_mutex = std::shared_ptr<void>(CreateMutexW(NULL, TRUE, L"Global\\StreamFX-Setup"), [](HANDLE p) {
|
|
|
|
ReleaseMutex(p);
|
|
|
|
CloseHandle(p);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2020-04-05 16:52:06 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|