]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/boost/winapi/security.hpp
import quincy beta 17.1.0
[ceph.git] / ceph / src / boost / boost / winapi / security.hpp
CommitLineData
b32b8144
FG
1/*
2 * Copyright 2010 Vicente J. Botet Escriba
3 * Copyright 2015 Andrey Semashev
4 *
5 * Distributed under the Boost Software License, Version 1.0.
6 * See http://www.boost.org/LICENSE_1_0.txt
7 */
7c673cae 8
b32b8144
FG
9#ifndef BOOST_WINAPI_SECURITY_HPP_INCLUDED_
10#define BOOST_WINAPI_SECURITY_HPP_INCLUDED_
7c673cae 11
b32b8144 12#include <boost/winapi/basic_types.hpp>
7c673cae
FG
13
14#ifdef BOOST_HAS_PRAGMA_ONCE
15#pragma once
16#endif
17
b32b8144
FG
18#if BOOST_WINAPI_PARTITION_APP_SYSTEM
19
20effc67
TL
20#include <boost/winapi/detail/header.hpp>
21
7c673cae
FG
22#if !defined( BOOST_USE_WINDOWS_H )
23extern "C" {
24struct _ACL;
25struct _SECURITY_DESCRIPTOR;
26#if defined( BOOST_WINAPI_IS_MINGW )
27typedef _SECURITY_DESCRIPTOR *PSECURITY_DESCRIPTOR;
28#else
b32b8144 29typedef boost::winapi::PVOID_ PSECURITY_DESCRIPTOR;
7c673cae
FG
30#endif
31
20effc67 32BOOST_WINAPI_IMPORT boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC
7c673cae
FG
33InitializeSecurityDescriptor(
34 PSECURITY_DESCRIPTOR pSecurityDescriptor,
b32b8144 35 boost::winapi::DWORD_ dwRevision);
20effc67 36BOOST_WINAPI_IMPORT boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC
7c673cae
FG
37SetSecurityDescriptorDacl(
38 PSECURITY_DESCRIPTOR pSecurityDescriptor,
b32b8144 39 boost::winapi::BOOL_ bDaclPresent,
7c673cae 40 ::_ACL* pDacl,
b32b8144 41 boost::winapi::BOOL_ bDaclDefaulted);
7c673cae
FG
42}
43#endif
44
45namespace boost {
7c673cae
FG
46namespace winapi {
47
48typedef PVOID_ PSID_;
49typedef WORD_ SECURITY_DESCRIPTOR_CONTROL_, *PSECURITY_DESCRIPTOR_CONTROL_;
50
b32b8144 51typedef struct BOOST_MAY_ALIAS _ACL {
7c673cae
FG
52 BYTE_ AclRevision;
53 BYTE_ Sbz1;
54 WORD_ AclSize;
55 WORD_ AceCount;
56 WORD_ Sbz2;
57} ACL_, *PACL_;
58
b32b8144 59typedef struct BOOST_MAY_ALIAS _SECURITY_DESCRIPTOR {
7c673cae
FG
60 BYTE_ Revision;
61 BYTE_ Sbz1;
62 SECURITY_DESCRIPTOR_CONTROL_ Control;
63 PSID_ Owner;
64 PSID_ Group;
65 PACL_ Sacl;
66 PACL_ Dacl;
67} SECURITY_DESCRIPTOR_, *PISECURITY_DESCRIPTOR_;
68
20effc67
TL
69// To abstract away the different ::PSECURITY_DESCRIPTOR on MinGW, we use PVOID_ universally here
70// and cast the pointers to ::PSECURITY_DESCRIPTOR in wrapper functions.
71typedef PVOID_ PSECURITY_DESCRIPTOR_;
7c673cae 72
20effc67
TL
73BOOST_FORCEINLINE BOOL_ InitializeSecurityDescriptor(PSECURITY_DESCRIPTOR_ pSecurityDescriptor, DWORD_ dwRevision)
74{
75 return ::InitializeSecurityDescriptor(reinterpret_cast< ::PSECURITY_DESCRIPTOR >(pSecurityDescriptor), dwRevision);
76}
7c673cae
FG
77
78BOOST_FORCEINLINE BOOL_ SetSecurityDescriptorDacl(PSECURITY_DESCRIPTOR_ pSecurityDescriptor, BOOL_ bDaclPresent, PACL_ pDacl, BOOL_ bDaclDefaulted)
79{
20effc67 80 return ::SetSecurityDescriptorDacl(reinterpret_cast< ::PSECURITY_DESCRIPTOR >(pSecurityDescriptor), bDaclPresent, reinterpret_cast< ::_ACL* >(pDacl), bDaclDefaulted);
7c673cae
FG
81}
82
7c673cae
FG
83}
84}
85
20effc67
TL
86#include <boost/winapi/detail/footer.hpp>
87
b32b8144
FG
88#endif // BOOST_WINAPI_PARTITION_APP_SYSTEM
89#endif // BOOST_WINAPI_SECURITY_HPP_INCLUDED_