File indexing completed on 2025-01-18 09:50:07
0001
0002
0003
0004
0005
0006 #ifndef BOOST_PROCESS_DETAIL_WINDOWS_COMPARE_HANDLES_HPP_
0007 #define BOOST_PROCESS_DETAIL_WINDOWS_COMPARE_HANDLES_HPP_
0008
0009 #include <boost/winapi/handles.hpp>
0010 #include <boost/winapi/file_management.hpp>
0011 #include <boost/process/detail/config.hpp>
0012
0013 namespace boost { namespace process { namespace detail { namespace windows {
0014
0015 inline bool compare_handles(boost::winapi::HANDLE_ lhs, boost::winapi::HANDLE_ rhs)
0016 {
0017 if ( (lhs == ::boost::winapi::INVALID_HANDLE_VALUE_)
0018 || (rhs == ::boost::winapi::INVALID_HANDLE_VALUE_))
0019 return false;
0020
0021 if (lhs == rhs)
0022 return true;
0023
0024 ::boost::winapi::BY_HANDLE_FILE_INFORMATION_ lhs_info{0,{0,0},{0,0},{0,0},0,0,0,0,0,0};
0025 ::boost::winapi::BY_HANDLE_FILE_INFORMATION_ rhs_info{0,{0,0},{0,0},{0,0},0,0,0,0,0,0};
0026
0027 if (!::boost::winapi::GetFileInformationByHandle(lhs, &lhs_info))
0028 ::boost::process::detail::throw_last_error("GetFileInformationByHandle");
0029
0030 if (!::boost::winapi::GetFileInformationByHandle(rhs, &rhs_info))
0031 ::boost::process::detail::throw_last_error("GetFileInformationByHandle");
0032
0033 return (lhs_info.nFileIndexHigh == rhs_info.nFileIndexHigh)
0034 && (lhs_info.nFileIndexLow == rhs_info.nFileIndexLow);
0035 }
0036
0037 }}}}
0038
0039
0040
0041 #endif