handles.hpp 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. // handles.hpp --------------------------------------------------------------//
  2. // Copyright 2010 Vicente J. Botet Escriba
  3. // Copyright 2015 Andrey Semashev
  4. // Distributed under the Boost Software License, Version 1.0.
  5. // See http://www.boost.org/LICENSE_1_0.txt
  6. #ifndef BOOST_DETAIL_WINAPI_HANDLES_HPP
  7. #define BOOST_DETAIL_WINAPI_HANDLES_HPP
  8. #include <boost/detail/winapi/basic_types.hpp>
  9. #ifdef BOOST_HAS_PRAGMA_ONCE
  10. #pragma once
  11. #endif
  12. #if !defined( BOOST_USE_WINDOWS_H )
  13. extern "C" {
  14. BOOST_SYMBOL_IMPORT boost::detail::winapi::BOOL_ WINAPI
  15. CloseHandle(boost::detail::winapi::HANDLE_ handle);
  16. BOOST_SYMBOL_IMPORT boost::detail::winapi::BOOL_ WINAPI
  17. DuplicateHandle(
  18. boost::detail::winapi::HANDLE_ hSourceProcessHandle,
  19. boost::detail::winapi::HANDLE_ hSourceHandle,
  20. boost::detail::winapi::HANDLE_ hTargetProcessHandle,
  21. boost::detail::winapi::HANDLE_* lpTargetHandle,
  22. boost::detail::winapi::DWORD_ dwDesiredAccess,
  23. boost::detail::winapi::BOOL_ bInheritHandle,
  24. boost::detail::winapi::DWORD_ dwOptions);
  25. }
  26. #endif
  27. namespace boost {
  28. namespace detail {
  29. namespace winapi {
  30. using ::CloseHandle;
  31. using ::DuplicateHandle;
  32. #if defined( BOOST_USE_WINDOWS_H )
  33. const DWORD_ DUPLICATE_CLOSE_SOURCE_ = DUPLICATE_CLOSE_SOURCE;
  34. const DWORD_ DUPLICATE_SAME_ACCESS_ = DUPLICATE_SAME_ACCESS;
  35. const HANDLE_ INVALID_HANDLE_VALUE_ = INVALID_HANDLE_VALUE;
  36. #else
  37. const DWORD_ DUPLICATE_CLOSE_SOURCE_ = 1;
  38. const DWORD_ DUPLICATE_SAME_ACCESS_ = 2;
  39. const HANDLE_ INVALID_HANDLE_VALUE_ = (HANDLE_)(-1);
  40. #endif
  41. const DWORD_ duplicate_close_source = DUPLICATE_CLOSE_SOURCE_;
  42. const DWORD_ duplicate_same_access = DUPLICATE_SAME_ACCESS_;
  43. const HANDLE_ invalid_handle_value = INVALID_HANDLE_VALUE_;
  44. }
  45. }
  46. }
  47. #endif // BOOST_DETAIL_WINAPI_HANDLES_HPP