page_protection_flags.hpp 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. * Copyright 2016 Andrey Semashev
  3. *
  4. * Distributed under the Boost Software License, Version 1.0.
  5. * See http://www.boost.org/LICENSE_1_0.txt
  6. */
  7. #ifndef BOOST_WINAPI_PAGE_PROTECTION_FLAGS_HPP_INCLUDED_
  8. #define BOOST_WINAPI_PAGE_PROTECTION_FLAGS_HPP_INCLUDED_
  9. #include <boost/winapi/basic_types.hpp>
  10. #ifdef BOOST_HAS_PRAGMA_ONCE
  11. #pragma once
  12. #endif
  13. namespace boost {
  14. namespace winapi {
  15. #if defined( BOOST_USE_WINDOWS_H )
  16. BOOST_CONSTEXPR_OR_CONST DWORD_ PAGE_NOACCESS_ = PAGE_NOACCESS;
  17. BOOST_CONSTEXPR_OR_CONST DWORD_ PAGE_READONLY_ = PAGE_READONLY;
  18. BOOST_CONSTEXPR_OR_CONST DWORD_ PAGE_READWRITE_ = PAGE_READWRITE;
  19. BOOST_CONSTEXPR_OR_CONST DWORD_ PAGE_WRITECOPY_ = PAGE_WRITECOPY;
  20. BOOST_CONSTEXPR_OR_CONST DWORD_ PAGE_GUARD_ = PAGE_GUARD;
  21. BOOST_CONSTEXPR_OR_CONST DWORD_ PAGE_NOCACHE_ = PAGE_NOCACHE;
  22. BOOST_CONSTEXPR_OR_CONST DWORD_ PAGE_WRITECOMBINE_ = PAGE_WRITECOMBINE;
  23. #else // defined( BOOST_USE_WINDOWS_H )
  24. BOOST_CONSTEXPR_OR_CONST DWORD_ PAGE_NOACCESS_ = 0x01;
  25. BOOST_CONSTEXPR_OR_CONST DWORD_ PAGE_READONLY_ = 0x02;
  26. BOOST_CONSTEXPR_OR_CONST DWORD_ PAGE_READWRITE_ = 0x04;
  27. BOOST_CONSTEXPR_OR_CONST DWORD_ PAGE_WRITECOPY_ = 0x08;
  28. BOOST_CONSTEXPR_OR_CONST DWORD_ PAGE_GUARD_ = 0x100;
  29. BOOST_CONSTEXPR_OR_CONST DWORD_ PAGE_NOCACHE_ = 0x200;
  30. BOOST_CONSTEXPR_OR_CONST DWORD_ PAGE_WRITECOMBINE_ = 0x400;
  31. #endif // defined( BOOST_USE_WINDOWS_H )
  32. // The PAGE_EXECUTE flags were put into the DESKTOP UWP partition in Windows SDK 8.0 and 8.1
  33. // and then moved to be globally available again in SDK 10.0. Due to this, we simply define
  34. // them unconditionally to work around the issue and consider the 8.x SDKs in error.
  35. BOOST_CONSTEXPR_OR_CONST DWORD_ PAGE_EXECUTE_ = 0x10;
  36. BOOST_CONSTEXPR_OR_CONST DWORD_ PAGE_EXECUTE_READ_ = 0x20;
  37. BOOST_CONSTEXPR_OR_CONST DWORD_ PAGE_EXECUTE_READWRITE_ = 0x40;
  38. BOOST_CONSTEXPR_OR_CONST DWORD_ PAGE_EXECUTE_WRITECOPY_ = 0x80;
  39. }
  40. }
  41. #endif // BOOST_WINAPI_PAGE_PROTECTION_FLAGS_HPP_INCLUDED_