| 10 | } |
| 11 | |
| 12 | HRESULT InstanceMutex::Init() |
| 13 | { |
| 14 | #ifdef DISABLE_SINGLE_INSTANCE |
| 15 | return 0; |
| 16 | #else |
| 17 | |
| 18 | m_handle = CreateMutex(NULL, TRUE, TEXT("DiscordMessenger")); |
| 19 | |
| 20 | const DWORD error = GetLastError(); |
| 21 | if (error == ERROR_ALREADY_EXISTS) |
| 22 | Close(); |
| 23 | |
| 24 | return error; |
| 25 | #endif |
| 26 | } |
| 27 | |
| 28 | InstanceMutex::~InstanceMutex() |
| 29 | { |
no outgoing calls
no test coverage detected