]>
Commit | Line | Data |
---|---|---|
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 | ||
7c673cae FG |
20 | #if !defined( BOOST_USE_WINDOWS_H ) |
21 | extern "C" { | |
22 | struct _ACL; | |
23 | struct _SECURITY_DESCRIPTOR; | |
24 | #if defined( BOOST_WINAPI_IS_MINGW ) | |
25 | typedef _SECURITY_DESCRIPTOR *PSECURITY_DESCRIPTOR; | |
26 | #else | |
b32b8144 | 27 | typedef boost::winapi::PVOID_ PSECURITY_DESCRIPTOR; |
7c673cae FG |
28 | #endif |
29 | ||
b32b8144 | 30 | BOOST_SYMBOL_IMPORT boost::winapi::BOOL_ WINAPI |
7c673cae FG |
31 | InitializeSecurityDescriptor( |
32 | PSECURITY_DESCRIPTOR pSecurityDescriptor, | |
b32b8144 FG |
33 | boost::winapi::DWORD_ dwRevision); |
34 | BOOST_SYMBOL_IMPORT boost::winapi::BOOL_ WINAPI | |
7c673cae FG |
35 | SetSecurityDescriptorDacl( |
36 | PSECURITY_DESCRIPTOR pSecurityDescriptor, | |
b32b8144 | 37 | boost::winapi::BOOL_ bDaclPresent, |
7c673cae | 38 | ::_ACL* pDacl, |
b32b8144 | 39 | boost::winapi::BOOL_ bDaclDefaulted); |
7c673cae FG |
40 | } |
41 | #endif | |
42 | ||
43 | namespace boost { | |
7c673cae FG |
44 | namespace winapi { |
45 | ||
46 | typedef PVOID_ PSID_; | |
47 | typedef WORD_ SECURITY_DESCRIPTOR_CONTROL_, *PSECURITY_DESCRIPTOR_CONTROL_; | |
48 | ||
b32b8144 | 49 | typedef struct BOOST_MAY_ALIAS _ACL { |
7c673cae FG |
50 | BYTE_ AclRevision; |
51 | BYTE_ Sbz1; | |
52 | WORD_ AclSize; | |
53 | WORD_ AceCount; | |
54 | WORD_ Sbz2; | |
55 | } ACL_, *PACL_; | |
56 | ||
b32b8144 | 57 | typedef struct BOOST_MAY_ALIAS _SECURITY_DESCRIPTOR { |
7c673cae FG |
58 | BYTE_ Revision; |
59 | BYTE_ Sbz1; | |
60 | SECURITY_DESCRIPTOR_CONTROL_ Control; | |
61 | PSID_ Owner; | |
62 | PSID_ Group; | |
63 | PACL_ Sacl; | |
64 | PACL_ Dacl; | |
65 | } SECURITY_DESCRIPTOR_, *PISECURITY_DESCRIPTOR_; | |
66 | ||
67 | typedef ::PSECURITY_DESCRIPTOR PSECURITY_DESCRIPTOR_; | |
68 | ||
69 | using ::InitializeSecurityDescriptor; | |
70 | ||
71 | BOOST_FORCEINLINE BOOL_ SetSecurityDescriptorDacl(PSECURITY_DESCRIPTOR_ pSecurityDescriptor, BOOL_ bDaclPresent, PACL_ pDacl, BOOL_ bDaclDefaulted) | |
72 | { | |
73 | return ::SetSecurityDescriptorDacl(pSecurityDescriptor, bDaclPresent, reinterpret_cast< ::_ACL* >(pDacl), bDaclDefaulted); | |
74 | } | |
75 | ||
7c673cae FG |
76 | } |
77 | } | |
78 | ||
b32b8144 FG |
79 | #endif // BOOST_WINAPI_PARTITION_APP_SYSTEM |
80 | #endif // BOOST_WINAPI_SECURITY_HPP_INCLUDED_ |