Panoptes 1.0.0
Endpoint Detection and Response
Loading...
Searching...
No Matches
Functions | Variables
mutex.cpp File Reference
#include "mutex.hpp"

Go to the source code of this file.

Functions

ERRORCODE SetEnvironmentMutex ()
 
ERRORCODE MutexExist ()
 
ERRORCODE DestroyMutex ()
 

Variables

HANDLE g_mutex
 

Function Documentation

◆ DestroyMutex()

ERRORCODE DestroyMutex ( )

Definition at line 33 of file mutex.cpp.

33 {
34 if (!ReleaseMutex(g_mutex))
35 return CLEAN_HANDLE;
36
37 return PANO_SUCCESS;
38}
#define PANO_SUCCESS
#define CLEAN_HANDLE
HANDLE g_mutex
Definition mutex.cpp:3

References CLEAN_HANDLE, g_mutex, and PANO_SUCCESS.

Referenced by CleanupWithError().

◆ MutexExist()

ERRORCODE MutexExist ( )

Definition at line 19 of file mutex.cpp.

19 {
20 g_mutex = OpenMutexA(
21 SYNCHRONIZE, // Request full access
22 FALSE, // Do not inherit handle
23 SERVICE_MUTEX // Name of the mutex
24 );
25 if (g_mutex == NULL)
26 {
27 return MUTEX_NOT_SET;
28 }
29
30 return PANO_SUCCESS;
31}
#define MUTEX_NOT_SET
#define SERVICE_MUTEX

References g_mutex, MUTEX_NOT_SET, PANO_SUCCESS, and SERVICE_MUTEX.

Referenced by WinMain().

◆ SetEnvironmentMutex()

ERRORCODE SetEnvironmentMutex ( )

Definition at line 5 of file mutex.cpp.

5 {
6 g_mutex = CreateMutexA(
7 NULL,
8 FALSE,
10 );
11 if (g_mutex == NULL)
12 {
13 return INVALID_INPUT;
14 }
15
16 return PANO_SUCCESS;
17}
#define INVALID_INPUT

References g_mutex, INVALID_INPUT, PANO_SUCCESS, and SERVICE_MUTEX.

Referenced by WinMain().

Variable Documentation

◆ g_mutex

HANDLE g_mutex

Definition at line 3 of file mutex.cpp.

Referenced by DestroyMutex(), MutexExist(), and SetEnvironmentMutex().