Warning, file /include/boost/process/v1/detail/windows/file_in.hpp was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef BOOST_PROCESS_DETAIL_WINDOWS_FILE_IN_HPP
0011 #define BOOST_PROCESS_DETAIL_WINDOWS_FILE_IN_HPP
0012
0013 #include <boost/winapi/process.hpp>
0014 #include <boost/winapi/handles.hpp>
0015 #include <boost/process/v1/detail/handler_base.hpp>
0016 #include <boost/process/v1/detail/used_handles.hpp>
0017 #include <boost/process/v1/detail/windows/file_descriptor.hpp>
0018 #include <io.h>
0019
0020 namespace boost { namespace process { BOOST_PROCESS_V1_INLINE namespace v1 { namespace detail { namespace windows {
0021
0022 struct file_in : public ::boost::process::v1::detail::handler_base,
0023 ::boost::process::v1::detail::uses_handles
0024 {
0025 file_descriptor file;
0026 ::boost::winapi::HANDLE_ handle = file.handle();
0027
0028 ::boost::winapi::HANDLE_ get_used_handles() const { return handle; }
0029
0030 template<typename T>
0031 file_in(T&& t) : file(std::forward<T>(t), file_descriptor::read) {}
0032 file_in(FILE * f) : handle(reinterpret_cast<::boost::winapi::HANDLE_>(_get_osfhandle(_fileno(f)))) {}
0033
0034 template <class WindowsExecutor>
0035 void on_setup(WindowsExecutor &e) const
0036 {
0037 boost::winapi::SetHandleInformation(handle,
0038 boost::winapi::HANDLE_FLAG_INHERIT_,
0039 boost::winapi::HANDLE_FLAG_INHERIT_);
0040 e.startup_info.hStdInput = handle;
0041 e.startup_info.dwFlags |= boost::winapi::STARTF_USESTDHANDLES_;
0042 e.inherit_handles = true;
0043 }
0044 };
0045
0046 }}}}}
0047
0048 #endif