From daa782cd9287221b0a1c2bc73433ebcb537291cd Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Sun, 7 Jun 2020 15:22:10 +0300 Subject: [PATCH 1/2] Fix compilation error on MinGW. MinGW has nonstandard definition of PSECURITY_DESCRIPTOR, which requires a cast when calling WinAPI functions InitializeSecurityDescriptor and SetSecurityDescriptorDacl. This is done by Boost.WinAPI wrapper functions. Fixes https://github.com/boostorg/interprocess/issues/118. --- include/boost/interprocess/detail/win32_api.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/boost/interprocess/detail/win32_api.hpp b/include/boost/interprocess/detail/win32_api.hpp index 76bd15930..1bff8c378 100644 --- a/include/boost/interprocess/detail/win32_api.hpp +++ b/include/boost/interprocess/detail/win32_api.hpp @@ -716,9 +716,9 @@ class interprocess_all_access_security interprocess_all_access_security() : initialized(false) { - if(!InitializeSecurityDescriptor(&sd, security_descriptor_revision)) + if(!boost::winapi::InitializeSecurityDescriptor(&sd, security_descriptor_revision)) return; - if(!::SetSecurityDescriptorDacl(&sd, true, 0, false)) + if(!boost::winapi::SetSecurityDescriptorDacl(&sd, true, 0, false)) return; sa.lpSecurityDescriptor = &sd; sa.nLength = sizeof(interprocess_security_attributes); From b89b22c0ea7e78b5ec2471d5cf14b67ef407d43d Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Sun, 7 Jun 2020 15:26:02 +0300 Subject: [PATCH 2/2] Fixed initialized flag not being set correctly. --- include/boost/interprocess/detail/win32_api.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/interprocess/detail/win32_api.hpp b/include/boost/interprocess/detail/win32_api.hpp index 1bff8c378..897b44001 100644 --- a/include/boost/interprocess/detail/win32_api.hpp +++ b/include/boost/interprocess/detail/win32_api.hpp @@ -723,7 +723,7 @@ class interprocess_all_access_security sa.lpSecurityDescriptor = &sd; sa.nLength = sizeof(interprocess_security_attributes); sa.bInheritHandle = false; - initialized = false; + initialized = true; } interprocess_security_attributes *get_attributes()