fallout2-ce/src/autorun.cc

41 lines
710 B
C++
Raw Normal View History

2022-05-19 01:51:26 -07:00
#include "autorun.h"
2022-06-18 05:47:34 -07:00
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#define NOMINMAX
#include <windows.h>
#endif
2022-05-29 12:08:13 -07:00
#ifdef _WIN32
2022-05-19 01:51:26 -07:00
// 0x530010
2022-06-18 05:47:34 -07:00
static HANDLE gInterplayGenericAutorunMutex;
2022-05-29 12:08:13 -07:00
#endif
2022-05-19 01:51:26 -07:00
2022-09-23 05:43:44 -07:00
namespace fallout {
2022-05-19 01:51:26 -07:00
// 0x4139C0
bool autorunMutexCreate()
{
2022-05-29 12:08:13 -07:00
#ifdef _WIN32
2022-05-19 01:51:26 -07:00
gInterplayGenericAutorunMutex = CreateMutexA(NULL, FALSE, "InterplayGenericAutorunMutex");
if (GetLastError() == ERROR_ALREADY_EXISTS) {
CloseHandle(gInterplayGenericAutorunMutex);
return false;
}
2022-05-29 12:08:13 -07:00
#endif
2022-05-19 01:51:26 -07:00
return true;
}
// 0x413A00
void autorunMutexClose()
{
2022-05-29 12:08:13 -07:00
#ifdef _WIN32
2022-05-19 01:51:26 -07:00
if (gInterplayGenericAutorunMutex != NULL) {
CloseHandle(gInterplayGenericAutorunMutex);
}
2022-05-29 12:08:13 -07:00
#endif
2022-05-19 01:51:26 -07:00
}
2022-09-23 05:43:44 -07:00
} // namespace fallout