Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:53:47

0001 /*
0002  * Copyright 2010 Vicente J. Botet Escriba
0003  * Copyright 2015 Andrey Semashev
0004  *
0005  * Distributed under the Boost Software License, Version 1.0.
0006  * See http://www.boost.org/LICENSE_1_0.txt
0007  */
0008 
0009 #ifndef BOOST_WINAPI_SECURITY_HPP_INCLUDED_
0010 #define BOOST_WINAPI_SECURITY_HPP_INCLUDED_
0011 
0012 #include <boost/winapi/basic_types.hpp>
0013 
0014 #ifdef BOOST_HAS_PRAGMA_ONCE
0015 #pragma once
0016 #endif
0017 
0018 #if BOOST_WINAPI_PARTITION_APP_SYSTEM
0019 
0020 #include <boost/winapi/detail/header.hpp>
0021 
0022 #if !defined( BOOST_USE_WINDOWS_H )
0023 extern "C" {
0024 struct _ACL;
0025 struct _SECURITY_DESCRIPTOR;
0026 #if defined( BOOST_WINAPI_IS_MINGW )
0027 typedef _SECURITY_DESCRIPTOR *PSECURITY_DESCRIPTOR;
0028 #else
0029 typedef boost::winapi::PVOID_ PSECURITY_DESCRIPTOR;
0030 #endif
0031 
0032 BOOST_WINAPI_IMPORT boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC
0033 InitializeSecurityDescriptor(
0034     PSECURITY_DESCRIPTOR pSecurityDescriptor,
0035     boost::winapi::DWORD_ dwRevision);
0036 BOOST_WINAPI_IMPORT boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC
0037 SetSecurityDescriptorDacl(
0038     PSECURITY_DESCRIPTOR pSecurityDescriptor,
0039     boost::winapi::BOOL_ bDaclPresent,
0040     ::_ACL* pDacl,
0041     boost::winapi::BOOL_ bDaclDefaulted);
0042 }
0043 #endif
0044 
0045 namespace boost {
0046 namespace winapi {
0047 
0048 typedef PVOID_ PSID_;
0049 typedef WORD_ SECURITY_DESCRIPTOR_CONTROL_, *PSECURITY_DESCRIPTOR_CONTROL_;
0050 
0051 typedef struct BOOST_MAY_ALIAS _ACL {
0052     BYTE_ AclRevision;
0053     BYTE_ Sbz1;
0054     WORD_ AclSize;
0055     WORD_ AceCount;
0056     WORD_ Sbz2;
0057 } ACL_, *PACL_;
0058 
0059 typedef struct BOOST_MAY_ALIAS _SECURITY_DESCRIPTOR {
0060     BYTE_ Revision;
0061     BYTE_ Sbz1;
0062     SECURITY_DESCRIPTOR_CONTROL_ Control;
0063     PSID_ Owner;
0064     PSID_ Group;
0065     PACL_ Sacl;
0066     PACL_ Dacl;
0067 } SECURITY_DESCRIPTOR_, *PISECURITY_DESCRIPTOR_;
0068 
0069 // To abstract away the different ::PSECURITY_DESCRIPTOR on MinGW, we use PVOID_ universally here
0070 // and cast the pointers to ::PSECURITY_DESCRIPTOR in wrapper functions.
0071 typedef PVOID_ PSECURITY_DESCRIPTOR_;
0072 
0073 BOOST_FORCEINLINE BOOL_ InitializeSecurityDescriptor(PSECURITY_DESCRIPTOR_ pSecurityDescriptor, DWORD_ dwRevision)
0074 {
0075     return ::InitializeSecurityDescriptor(reinterpret_cast< ::PSECURITY_DESCRIPTOR >(pSecurityDescriptor), dwRevision);
0076 }
0077 
0078 BOOST_FORCEINLINE BOOL_ SetSecurityDescriptorDacl(PSECURITY_DESCRIPTOR_ pSecurityDescriptor, BOOL_ bDaclPresent, PACL_ pDacl, BOOL_ bDaclDefaulted)
0079 {
0080     return ::SetSecurityDescriptorDacl(reinterpret_cast< ::PSECURITY_DESCRIPTOR >(pSecurityDescriptor), bDaclPresent, reinterpret_cast< ::_ACL* >(pDacl), bDaclDefaulted);
0081 }
0082 
0083 }
0084 }
0085 
0086 #include <boost/winapi/detail/footer.hpp>
0087 
0088 #endif // BOOST_WINAPI_PARTITION_APP_SYSTEM
0089 #endif // BOOST_WINAPI_SECURITY_HPP_INCLUDED_