Skip to content

Commit

Permalink
Prevent loading the DLL more than once
Browse files Browse the repository at this point in the history
  • Loading branch information
cathyjf committed Mar 15, 2023
1 parent 1aba135 commit 98fc0ee
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,14 @@ DWORD ExecuteAndWaitForExe(const FileData &&exeData) {
DWORD WINAPI ThreadProc(LPVOID lpParameter) {
const std::unique_ptr<ThreadData> pData{
reinterpret_cast<ThreadData *>(lpParameter)};
constexpr LPCWSTR lpMutexName{ L"Local\\SekiroFpsUnlockRunOnceMutex" };
auto &&hMutex{ CreateMutex(NULL, TRUE, lpMutexName) };
if (!hMutex) {
return 1;
}
if (WaitForSingleObject(hMutex, 0) != WAIT_OBJECT_0) {
return 1;
}
auto &&modulePath{ GetModulePath(pData->hModule) };
if (!modulePath) {
return 1;
Expand Down

0 comments on commit 98fc0ee

Please sign in to comment.