mirror of
https://github.com/Xaymar/obs-StreamFX
synced 2024-11-27 13:53:01 +00:00
9d0233a740
Might fix the problem where people uninstall StreamFX while they still have OBS Studio open with StreamFX loaded. InnoSetup appears to ignore this in /VERYSILENT, so this is an additional guard against that.
28 lines
841 B
C++
28 lines
841 B
C++
// AUTOGENERATED COPYRIGHT HEADER START
|
|
// Copyright (C) 2020-2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
|
|
// AUTOGENERATED COPYRIGHT HEADER END
|
|
|
|
#include "warning-disable.hpp"
|
|
#include <Windows.h>
|
|
#include <mutex>
|
|
#include "warning-enable.hpp"
|
|
|
|
std::shared_ptr<void> local_mutex;
|
|
std::shared_ptr<void> global_mutex;
|
|
|
|
BOOL WINAPI DllMain(HINSTANCE, DWORD dwReason, LPVOID)
|
|
{
|
|
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);
|
|
});
|
|
}
|
|
|
|
return TRUE;
|
|
}
|