diff --git a/plugins/win-capture/graphics-hook-info.h b/plugins/win-capture/graphics-hook-info.h index 128fc97e5..bb61482f7 100644 --- a/plugins/win-capture/graphics-hook-info.h +++ b/plugins/win-capture/graphics-hook-info.h @@ -101,6 +101,8 @@ struct hook_info { #pragma pack(pop) +#define GC_MAPPING_FLAGS (FILE_MAP_READ | FILE_MAP_WRITE) + static inline HANDLE get_hook_info(DWORD id) { HANDLE handle; @@ -111,7 +113,7 @@ static inline HANDLE get_hook_info(DWORD id) PAGE_READWRITE, 0, sizeof(struct hook_info), new_name); if (!handle && GetLastError() == ERROR_ALREADY_EXISTS) { - handle = OpenFileMappingA(FILE_MAP_ALL_ACCESS, false, + handle = OpenFileMappingA(GC_MAPPING_FLAGS, false, new_name); } diff --git a/plugins/win-capture/graphics-hook/graphics-hook.c b/plugins/win-capture/graphics-hook/graphics-hook.c index 15b96efe0..e994b26d3 100644 --- a/plugins/win-capture/graphics-hook/graphics-hook.c +++ b/plugins/win-capture/graphics-hook/graphics-hook.c @@ -88,7 +88,7 @@ static HANDLE init_mutex(const char *name, DWORD pid) sprintf(new_name, "%s%lu", name, pid); - handle = OpenMutexA(MUTEX_ALL_ACCESS, false, new_name); + handle = OpenMutexA(SYNCHRONIZE, false, new_name); if (!handle) hlog("Failed to open mutex '%s': %lu", name, GetLastError()); return handle; diff --git a/plugins/win-capture/graphics-hook/graphics-hook.h b/plugins/win-capture/graphics-hook/graphics-hook.h index 17f1e8e58..3bf58b653 100644 --- a/plugins/win-capture/graphics-hook/graphics-hook.h +++ b/plugins/win-capture/graphics-hook/graphics-hook.h @@ -143,7 +143,7 @@ static inline HMODULE load_system_library(const char *name) static inline bool capture_alive(void) { - HANDLE event = OpenEventA(EVENT_ALL_ACCESS, false, keepalive_name); + HANDLE event = OpenEventA(GC_EVENT_FLAGS, false, keepalive_name); if (event) { CloseHandle(event); return true; diff --git a/plugins/win-capture/hook-helpers.h b/plugins/win-capture/hook-helpers.h index b7febd483..561d4c04c 100644 --- a/plugins/win-capture/hook-helpers.h +++ b/plugins/win-capture/hook-helpers.h @@ -4,11 +4,14 @@ #define inline __inline #endif +#define GC_EVENT_FLAGS (EVENT_MODIFY_STATE | SYNCHRONIZE) +#define GC_MUTEX_FLAGS (SYNCHRONIZE) + static inline HANDLE get_event(const char *name) { HANDLE event = CreateEventA(NULL, false, false, name); if (!event) - event = OpenEventA(EVENT_ALL_ACCESS, false, name); + event = OpenEventA(GC_EVENT_FLAGS, false, name); return event; } @@ -17,7 +20,7 @@ static inline HANDLE get_mutex(const char *name) { HANDLE event = CreateMutexA(NULL, false, name); if (!event) - event = OpenMutexA(MUTEX_ALL_ACCESS, false, name); + event = OpenMutexA(GC_MUTEX_FLAGS, false, name); return event; }