9
3

security.hpp 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. */
  8. #ifndef BOOST_WINAPI_SECURITY_HPP_INCLUDED_
  9. #define BOOST_WINAPI_SECURITY_HPP_INCLUDED_
  10. #include <boost/winapi/basic_types.hpp>
  11. #ifdef BOOST_HAS_PRAGMA_ONCE
  12. #pragma once
  13. #endif
  14. #if BOOST_WINAPI_PARTITION_APP_SYSTEM
  15. #if !defined( BOOST_USE_WINDOWS_H )
  16. extern "C" {
  17. struct _ACL;
  18. struct _SECURITY_DESCRIPTOR;
  19. #if defined( BOOST_WINAPI_IS_MINGW )
  20. typedef _SECURITY_DESCRIPTOR *PSECURITY_DESCRIPTOR;
  21. #else
  22. typedef boost::winapi::PVOID_ PSECURITY_DESCRIPTOR;
  23. #endif
  24. BOOST_SYMBOL_IMPORT boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC
  25. InitializeSecurityDescriptor(
  26. PSECURITY_DESCRIPTOR pSecurityDescriptor,
  27. boost::winapi::DWORD_ dwRevision);
  28. BOOST_SYMBOL_IMPORT boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC
  29. SetSecurityDescriptorDacl(
  30. PSECURITY_DESCRIPTOR pSecurityDescriptor,
  31. boost::winapi::BOOL_ bDaclPresent,
  32. ::_ACL* pDacl,
  33. boost::winapi::BOOL_ bDaclDefaulted);
  34. }
  35. #endif
  36. namespace boost {
  37. namespace winapi {
  38. typedef PVOID_ PSID_;
  39. typedef WORD_ SECURITY_DESCRIPTOR_CONTROL_, *PSECURITY_DESCRIPTOR_CONTROL_;
  40. typedef struct BOOST_MAY_ALIAS _ACL {
  41. BYTE_ AclRevision;
  42. BYTE_ Sbz1;
  43. WORD_ AclSize;
  44. WORD_ AceCount;
  45. WORD_ Sbz2;
  46. } ACL_, *PACL_;
  47. typedef struct BOOST_MAY_ALIAS _SECURITY_DESCRIPTOR {
  48. BYTE_ Revision;
  49. BYTE_ Sbz1;
  50. SECURITY_DESCRIPTOR_CONTROL_ Control;
  51. PSID_ Owner;
  52. PSID_ Group;
  53. PACL_ Sacl;
  54. PACL_ Dacl;
  55. } SECURITY_DESCRIPTOR_, *PISECURITY_DESCRIPTOR_;
  56. typedef ::PSECURITY_DESCRIPTOR PSECURITY_DESCRIPTOR_;
  57. using ::InitializeSecurityDescriptor;
  58. BOOST_FORCEINLINE BOOL_ SetSecurityDescriptorDacl(PSECURITY_DESCRIPTOR_ pSecurityDescriptor, BOOL_ bDaclPresent, PACL_ pDacl, BOOL_ bDaclDefaulted)
  59. {
  60. return ::SetSecurityDescriptorDacl(pSecurityDescriptor, bDaclPresent, reinterpret_cast< ::_ACL* >(pDacl), bDaclDefaulted);
  61. }
  62. }
  63. }
  64. #endif // BOOST_WINAPI_PARTITION_APP_SYSTEM
  65. #endif // BOOST_WINAPI_SECURITY_HPP_INCLUDED_