diff --git a/include/boost/process.hpp b/include/boost/process.hpp index 5702e5b5..4a7f21f9 100644 --- a/include/boost/process.hpp +++ b/include/boost/process.hpp @@ -12,23 +12,18 @@ #ifndef BOOST_PROCESS_HPP #define BOOST_PROCESS_HPP -/** - * \file boost/process.hpp - * - * Convenience header which includes all public and platform-independent - * boost.process header files. - */ - -#if !defined(BOOST_PROCESS_VERSION) -#define BOOST_PROCESS_VERSION 1 -#endif - -#if BOOST_PROCESS_VERSION == 1 -#include -#elif BOOST_PROCESS_VERSION == 2 -#include -#else -#error "Unknown boost process version" -#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #endif diff --git a/include/boost/process/args.hpp b/include/boost/process/args.hpp deleted file mode 100644 index 09584fbb..00000000 --- a/include/boost/process/args.hpp +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) 2024 Klemens D. Morgenstern -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - - -#include -BOOST_HEADER_DEPRECATED("") -#include diff --git a/include/boost/process/async.hpp b/include/boost/process/async.hpp deleted file mode 100644 index 65137600..00000000 --- a/include/boost/process/async.hpp +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) 2024 Klemens D. Morgenstern -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - - -#include -BOOST_HEADER_DEPRECATED("") -#include diff --git a/include/boost/process/async_pipe.hpp b/include/boost/process/async_pipe.hpp deleted file mode 100644 index 1e91d28f..00000000 --- a/include/boost/process/async_pipe.hpp +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) 2024 Klemens D. Morgenstern -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - - -#include -BOOST_HEADER_DEPRECATED("") -#include diff --git a/include/boost/process/async_system.hpp b/include/boost/process/async_system.hpp deleted file mode 100644 index 86b96736..00000000 --- a/include/boost/process/async_system.hpp +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) 2024 Klemens D. Morgenstern -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - - -#include -BOOST_HEADER_DEPRECATED("") -#include diff --git a/include/boost/process/bind_launcher.hpp b/include/boost/process/bind_launcher.hpp new file mode 100644 index 00000000..b61e37d1 --- /dev/null +++ b/include/boost/process/bind_launcher.hpp @@ -0,0 +1 @@ +#include diff --git a/include/boost/process/child.hpp b/include/boost/process/child.hpp deleted file mode 100644 index ad02db72..00000000 --- a/include/boost/process/child.hpp +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) 2024 Klemens D. Morgenstern -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - - -#include -BOOST_HEADER_DEPRECATED("") -#include diff --git a/include/boost/process/cmd.hpp b/include/boost/process/cmd.hpp deleted file mode 100644 index ccf44fd2..00000000 --- a/include/boost/process/cmd.hpp +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) 2024 Klemens D. Morgenstern -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - - -#include -BOOST_HEADER_DEPRECATED("") -#include diff --git a/include/boost/process/cstring_ref.hpp b/include/boost/process/cstring_ref.hpp new file mode 100644 index 00000000..a35d2998 --- /dev/null +++ b/include/boost/process/cstring_ref.hpp @@ -0,0 +1 @@ +#include diff --git a/include/boost/process/default_launcher.hpp b/include/boost/process/default_launcher.hpp new file mode 100644 index 00000000..accced3c --- /dev/null +++ b/include/boost/process/default_launcher.hpp @@ -0,0 +1 @@ +#include diff --git a/include/boost/process/env.hpp b/include/boost/process/env.hpp deleted file mode 100644 index aa8145ae..00000000 --- a/include/boost/process/env.hpp +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) 2024 Klemens D. Morgenstern -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - - -#include -BOOST_HEADER_DEPRECATED("") -#include diff --git a/include/boost/process/environment.hpp b/include/boost/process/environment.hpp index 9c9727fb..8f0f18f8 100644 --- a/include/boost/process/environment.hpp +++ b/include/boost/process/environment.hpp @@ -1,9 +1 @@ -// Copyright (c) 2024 Klemens D. Morgenstern -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - - -#include -BOOST_HEADER_DEPRECATED("") -#include +#include diff --git a/include/boost/process/error.hpp b/include/boost/process/error.hpp index 34794745..1cd3eb9b 100644 --- a/include/boost/process/error.hpp +++ b/include/boost/process/error.hpp @@ -1,9 +1 @@ -// Copyright (c) 2024 Klemens D. Morgenstern -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - - -#include -BOOST_HEADER_DEPRECATED("") -#include +#include diff --git a/include/boost/process/exception.hpp b/include/boost/process/exception.hpp deleted file mode 100644 index a9416db4..00000000 --- a/include/boost/process/exception.hpp +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) 2024 Klemens D. Morgenstern -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - - -#include -BOOST_HEADER_DEPRECATED("") -#include diff --git a/include/boost/process/exe.hpp b/include/boost/process/exe.hpp deleted file mode 100644 index 61383c95..00000000 --- a/include/boost/process/exe.hpp +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) 2024 Klemens D. Morgenstern -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - - -#include -BOOST_HEADER_DEPRECATED("") -#include diff --git a/include/boost/process/execute.hpp b/include/boost/process/execute.hpp new file mode 100644 index 00000000..99b92810 --- /dev/null +++ b/include/boost/process/execute.hpp @@ -0,0 +1 @@ +#include diff --git a/include/boost/process/exit_code.hpp b/include/boost/process/exit_code.hpp new file mode 100644 index 00000000..a65f3b8f --- /dev/null +++ b/include/boost/process/exit_code.hpp @@ -0,0 +1 @@ +#include diff --git a/include/boost/process/ext.hpp b/include/boost/process/ext.hpp new file mode 100644 index 00000000..338da1fd --- /dev/null +++ b/include/boost/process/ext.hpp @@ -0,0 +1 @@ +#include diff --git a/include/boost/process/ext/cmd.hpp b/include/boost/process/ext/cmd.hpp new file mode 100644 index 00000000..77b638f5 --- /dev/null +++ b/include/boost/process/ext/cmd.hpp @@ -0,0 +1 @@ +#include diff --git a/include/boost/process/ext/cwd.hpp b/include/boost/process/ext/cwd.hpp new file mode 100644 index 00000000..045c6b31 --- /dev/null +++ b/include/boost/process/ext/cwd.hpp @@ -0,0 +1 @@ +#include diff --git a/include/boost/process/ext/env.hpp b/include/boost/process/ext/env.hpp new file mode 100644 index 00000000..b73cd9c2 --- /dev/null +++ b/include/boost/process/ext/env.hpp @@ -0,0 +1 @@ +#include diff --git a/include/boost/process/ext/exe.hpp b/include/boost/process/ext/exe.hpp new file mode 100644 index 00000000..a891b31c --- /dev/null +++ b/include/boost/process/ext/exe.hpp @@ -0,0 +1 @@ +#include diff --git a/include/boost/process/extend.hpp b/include/boost/process/extend.hpp deleted file mode 100644 index aaa0e865..00000000 --- a/include/boost/process/extend.hpp +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) 2024 Klemens D. Morgenstern -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - - -#include -BOOST_HEADER_DEPRECATED("") -#include diff --git a/include/boost/process/filesystem.hpp b/include/boost/process/filesystem.hpp deleted file mode 100644 index bb42d8e9..00000000 --- a/include/boost/process/filesystem.hpp +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) 2024 Klemens D. Morgenstern -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - - -#include -BOOST_HEADER_DEPRECATED("") -#include diff --git a/include/boost/process/group.hpp b/include/boost/process/group.hpp deleted file mode 100644 index f441adf9..00000000 --- a/include/boost/process/group.hpp +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) 2024 Klemens D. Morgenstern -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - - -#include -BOOST_HEADER_DEPRECATED("") -#include diff --git a/include/boost/process/handles.hpp b/include/boost/process/handles.hpp deleted file mode 100644 index 82a50210..00000000 --- a/include/boost/process/handles.hpp +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) 2024 Klemens D. Morgenstern -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - - -#include -BOOST_HEADER_DEPRECATED("") -#include diff --git a/include/boost/process/io.hpp b/include/boost/process/io.hpp deleted file mode 100644 index 66535459..00000000 --- a/include/boost/process/io.hpp +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) 2024 Klemens D. Morgenstern -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - - -#include -BOOST_HEADER_DEPRECATED("") -#include diff --git a/include/boost/process/locale.hpp b/include/boost/process/locale.hpp deleted file mode 100644 index cd741c75..00000000 --- a/include/boost/process/locale.hpp +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) 2024 Klemens D. Morgenstern -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - - -#include -BOOST_HEADER_DEPRECATED("") -#include diff --git a/include/boost/process/pid.hpp b/include/boost/process/pid.hpp new file mode 100644 index 00000000..1dfcc2b9 --- /dev/null +++ b/include/boost/process/pid.hpp @@ -0,0 +1 @@ +#include diff --git a/include/boost/process/pipe.hpp b/include/boost/process/pipe.hpp deleted file mode 100644 index 0cf85bc9..00000000 --- a/include/boost/process/pipe.hpp +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) 2024 Klemens D. Morgenstern -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - - -#include -BOOST_HEADER_DEPRECATED("") -#include diff --git a/include/boost/process/popen.hpp b/include/boost/process/popen.hpp new file mode 100644 index 00000000..b8a98343 --- /dev/null +++ b/include/boost/process/popen.hpp @@ -0,0 +1 @@ +#include diff --git a/include/boost/process/posix.hpp b/include/boost/process/posix.hpp deleted file mode 100644 index ce1d8e60..00000000 --- a/include/boost/process/posix.hpp +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) 2024 Klemens D. Morgenstern -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - - -#include -BOOST_HEADER_DEPRECATED("") -#include diff --git a/include/boost/process/posix/bind_fd.hpp b/include/boost/process/posix/bind_fd.hpp new file mode 100644 index 00000000..1aa72d48 --- /dev/null +++ b/include/boost/process/posix/bind_fd.hpp @@ -0,0 +1 @@ +#include diff --git a/include/boost/process/posix/default_launcher.hpp b/include/boost/process/posix/default_launcher.hpp new file mode 100644 index 00000000..accced3c --- /dev/null +++ b/include/boost/process/posix/default_launcher.hpp @@ -0,0 +1 @@ +#include diff --git a/include/boost/process/posix/fork_and_forget_launcher.hpp b/include/boost/process/posix/fork_and_forget_launcher.hpp new file mode 100644 index 00000000..f3da2c20 --- /dev/null +++ b/include/boost/process/posix/fork_and_forget_launcher.hpp @@ -0,0 +1 @@ +#include diff --git a/include/boost/process/posix/pdfork_launcher.hpp b/include/boost/process/posix/pdfork_launcher.hpp new file mode 100644 index 00000000..a537a72a --- /dev/null +++ b/include/boost/process/posix/pdfork_launcher.hpp @@ -0,0 +1 @@ +#include diff --git a/include/boost/process/posix/vfork_launcher.hpp b/include/boost/process/posix/vfork_launcher.hpp new file mode 100644 index 00000000..8ec37eb5 --- /dev/null +++ b/include/boost/process/posix/vfork_launcher.hpp @@ -0,0 +1 @@ +#include diff --git a/include/boost/process/process.hpp b/include/boost/process/process.hpp new file mode 100644 index 00000000..27139c8c --- /dev/null +++ b/include/boost/process/process.hpp @@ -0,0 +1 @@ +#include diff --git a/include/boost/process/process_handle.hpp b/include/boost/process/process_handle.hpp new file mode 100644 index 00000000..3184a63b --- /dev/null +++ b/include/boost/process/process_handle.hpp @@ -0,0 +1 @@ +#include diff --git a/include/boost/process/search_path.hpp b/include/boost/process/search_path.hpp deleted file mode 100644 index 4a869025..00000000 --- a/include/boost/process/search_path.hpp +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) 2024 Klemens D. Morgenstern -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - - -#include -BOOST_HEADER_DEPRECATED("") -#include diff --git a/include/boost/process/shell.hpp b/include/boost/process/shell.hpp index 218aa34f..33b31929 100644 --- a/include/boost/process/shell.hpp +++ b/include/boost/process/shell.hpp @@ -1,9 +1 @@ -// Copyright (c) 2024 Klemens D. Morgenstern -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - - -#include -BOOST_HEADER_DEPRECATED("") -#include +#include diff --git a/include/boost/process/spawn.hpp b/include/boost/process/spawn.hpp deleted file mode 100644 index 2d48987b..00000000 --- a/include/boost/process/spawn.hpp +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) 2024 Klemens D. Morgenstern -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - - -#include -BOOST_HEADER_DEPRECATED("") -#include diff --git a/include/boost/process/start_dir.hpp b/include/boost/process/start_dir.hpp index 1fc31b43..d56dadf9 100644 --- a/include/boost/process/start_dir.hpp +++ b/include/boost/process/start_dir.hpp @@ -1,9 +1 @@ -// Copyright (c) 2024 Klemens D. Morgenstern -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - - -#include -BOOST_HEADER_DEPRECATED("") -#include +#include diff --git a/include/boost/process/stdio.hpp b/include/boost/process/stdio.hpp new file mode 100644 index 00000000..92d685d7 --- /dev/null +++ b/include/boost/process/stdio.hpp @@ -0,0 +1 @@ +#include diff --git a/include/boost/process/system.hpp b/include/boost/process/system.hpp deleted file mode 100644 index 3fd07379..00000000 --- a/include/boost/process/system.hpp +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) 2024 Klemens D. Morgenstern -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - - -#include -BOOST_HEADER_DEPRECATED("") -#include diff --git a/include/boost/process/v1.hpp b/include/boost/process/v1.hpp deleted file mode 100644 index 9d081cda..00000000 --- a/include/boost/process/v1.hpp +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) 2024 Klemens D. Morgenstern -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_PROCESS_V1_HPP -#define BOOST_PROCESS_V1_HPP - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#endif //BOOST_PROCESS_V1_HPP diff --git a/include/boost/process/v2.hpp b/include/boost/process/v2.hpp deleted file mode 100644 index c3f54bd9..00000000 --- a/include/boost/process/v2.hpp +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (c) 2022 Klemens D. Morgenstern -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_PROCESS_V2_HPP -#define BOOST_PROCESS_V2_HPP - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#endif //BOOST_PROCESS_V2_HPP diff --git a/include/boost/process/windows.hpp b/include/boost/process/windows.hpp deleted file mode 100644 index 8bc2893b..00000000 --- a/include/boost/process/windows.hpp +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) 2024 Klemens D. Morgenstern -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - - -#include -BOOST_HEADER_DEPRECATED("") -#include diff --git a/include/boost/process/windows/as_user_launcher.hpp b/include/boost/process/windows/as_user_launcher.hpp new file mode 100644 index 00000000..1886ebf1 --- /dev/null +++ b/include/boost/process/windows/as_user_launcher.hpp @@ -0,0 +1 @@ +#include diff --git a/include/boost/process/windows/creation_flags.hpp b/include/boost/process/windows/creation_flags.hpp new file mode 100644 index 00000000..1bc946c7 --- /dev/null +++ b/include/boost/process/windows/creation_flags.hpp @@ -0,0 +1 @@ +#include diff --git a/include/boost/process/windows/default_launcher.hpp b/include/boost/process/windows/default_launcher.hpp new file mode 100644 index 00000000..1ced2268 --- /dev/null +++ b/include/boost/process/windows/default_launcher.hpp @@ -0,0 +1 @@ +#include diff --git a/include/boost/process/windows/show_window.hpp b/include/boost/process/windows/show_window.hpp new file mode 100644 index 00000000..1c75b79b --- /dev/null +++ b/include/boost/process/windows/show_window.hpp @@ -0,0 +1,53 @@ +// +// boost/process/v2/windows/default_launcher.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2022 Klemens D. Morgenstern (klemens dot morgenstern at gmx dot net) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// + +#ifndef BOOST_PROCESS_V2_WINDOWS_SHOW_WINDOW_HPP +#define BOOST_PROCESS_V2_WINDOWS_SHOW_WINDOW_HPP + +#include + +BOOST_PROCESS_V2_BEGIN_NAMESPACE +namespace windows +{ + +/// A templated initializer to add wShowWindow flags. +template +struct process_show_window +{ + constexpr process_show_window() {} + + error_code on_setup(windows::default_launcher & launcher, + const filesystem::path &, + const std::wstring &) const + { + launcher.startup_info.StartupInfo.dwFlags |= STARTF_USESHOWWINDOW; + launcher.startup_info.StartupInfo.wShowWindow |= Flags; + + return error_code {}; + }; +}; + +///Hides the window and activates another window. +constexpr static process_show_window show_window_hide; +///Activates the window and displays it as a maximized window. +constexpr static process_show_window show_window_maximized; +///Activates the window and displays it as a minimized window. +constexpr static process_show_window show_window_minimized; +///Displays the window as a minimized window. This value is similar to `minimized`, except the window is not activated. +constexpr static process_show_window show_window_minimized_not_active; +///Displays a window in its most recent size and position. This value is similar to show_normal`, except that the window is not activated. +constexpr static process_show_window show_window_not_active; +///Activates and displays a window. If the window is minimized or maximized, the system restores it to its original size and position. An application should specify this flag when displaying the window for the first time. +constexpr static process_show_window show_window_normal; + +} +BOOST_PROCESS_V2_END_NAMESPACE + +#endif // BOOST_PROCESS_V2_WINDOWS_SHOW_WINDOW_HPP \ No newline at end of file diff --git a/include/boost/process/windows/with_logon_launcher.hpp b/include/boost/process/windows/with_logon_launcher.hpp new file mode 100644 index 00000000..a71540ca --- /dev/null +++ b/include/boost/process/windows/with_logon_launcher.hpp @@ -0,0 +1,140 @@ +// +// boost/process/v2/windows/default_launcher.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2022 Klemens D. Morgenstern (klemens dot morgenstern at gmx dot net) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// + +#ifndef BOOST_PROCESS_V2_WINDOWS_WITH_LOGON_LAUNCHER_HPP +#define BOOST_PROCESS_V2_WINDOWS_WITH_LOGON_LAUNCHER_HPP + +#include + +BOOST_PROCESS_V2_BEGIN_NAMESPACE +namespace windows +{ + +/// A windows launcher using CreateProcessWithLogon instead of CreateProcess +struct with_logon_launcher : default_launcher +{ + std::wstring username, password, domain; + DWORD logon_flags{0u}; + + with_logon_launcher(std::wstring username = L"", + std::wstring password = L"", + std::wstring domain = L"", + DWORD logon_flags = 0u) : + username(std::move(username)), + password(std::move(password)), + domain(std::move(domain)), + logon_flags(logon_flags) + { + } + + + template + auto operator()(ExecutionContext & context, + error_code & ec, + const typename std::enable_if::value, + filesystem::path >::type & executable, + Args && args, + Inits && ... inits ) -> basic_process + { + return (*this)(context.get_executor(), ec, executable, std::forward(args), std::forward(inits)...); + } + + + template + auto operator()(ExecutionContext & context, + const typename std::enable_if::value, + filesystem::path >::type & executable, + Args && args, + Inits && ... inits ) -> basic_process + { + return (*this)(context.get_executor(), executable, std::forward(args), std::forward(inits)...); + } + + template + auto operator()(Executor exec, + const typename std::enable_if< + net::execution::is_executor::value || + net::is_executor::value, + filesystem::path >::type & executable, + Args && args, + Inits && ... inits ) -> basic_process + { + error_code ec; + auto proc = (*this)(std::move(exec), ec, executable, std::forward(args), std::forward(inits)...); + + if (ec) + v2::detail::throw_error(ec, "with_logon_launcher"); + + return proc; + } + + template + auto operator()(Executor exec, + error_code & ec, + const typename std::enable_if< + net::execution::is_executor::value || + net::is_executor::value, + filesystem::path >::type & executable, + Args && args, + Inits && ... inits ) -> basic_process + { + auto command_line = this->build_command_line(executable, args); + + ec = detail::on_setup(*this, executable, command_line, inits...); + if (ec) + { + detail::on_error(*this, executable, command_line, ec, inits...); + return basic_process(exec); + } + auto ok = ::CreateProcessWithLogonW( + username.c_str(), + domain.empty() ? nullptr : domain.c_str(), + password.c_str(), + logon_flags, + executable.empty() ? nullptr : executable.c_str(), + command_line.empty() ? nullptr : &command_line.front(), + creation_flags, + environment, + current_directory.empty() ? nullptr : current_directory.c_str(), + &startup_info.StartupInfo, + &process_information); + + + if (ok == 0) + { + BOOST_PROCESS_V2_ASSIGN_LAST_ERROR(ec); + detail::on_error(*this, executable, command_line, ec, inits...); + + if (process_information.hProcess != INVALID_HANDLE_VALUE) + ::CloseHandle(process_information.hProcess); + if (process_information.hThread != INVALID_HANDLE_VALUE) + ::CloseHandle(process_information.hThread); + + return basic_process(exec); + } else + { + detail::on_success(*this, executable, command_line, inits...); + + if (process_information.hThread != INVALID_HANDLE_VALUE) + ::CloseHandle(process_information.hThread); + + return basic_process(exec, + this->process_information.dwProcessId, + this->process_information.hProcess); + } + } +}; + +} +BOOST_PROCESS_V2_END_NAMESPACE + +#endif // BOOST_PROCESS_V2_WINDOWS_WITH_LOGON_LAUNCHER_HPP \ No newline at end of file diff --git a/include/boost/process/windows/with_token_launcher.hpp b/include/boost/process/windows/with_token_launcher.hpp new file mode 100644 index 00000000..48efab69 --- /dev/null +++ b/include/boost/process/windows/with_token_launcher.hpp @@ -0,0 +1,135 @@ +// +// boost/process/v2/windows/default_launcher.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2022 Klemens D. Morgenstern (klemens dot morgenstern at gmx dot net) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// + +#ifndef BOOST_PROCESS_V2_WINDOWS_WITH_TOKEN_LAUNCHER_HPP +#define BOOST_PROCESS_V2_WINDOWS_WITH_TOKEN_LAUNCHER_HPP + +#include + +BOOST_PROCESS_V2_BEGIN_NAMESPACE +namespace windows +{ + +/// A windows launcher using CreateProcessWithToken instead of CreateProcess +struct with_token_launcher : default_launcher +{ + HANDLE token; + DWORD logon_flags; + with_token_launcher(HANDLE token = INVALID_HANDLE_VALUE, + DWORD logon_flags = 0u) : token(token), logon_flags(logon_flags) {} + + + template + auto operator()(ExecutionContext & context, + const typename std::enable_if::value, + filesystem::path >::type & executable, + Args && args, + Inits && ... inits ) -> basic_process + { + error_code ec; + auto proc = (*this)(context, ec, executable, std::forward(args), std::forward(inits)...); + + if (ec) + v2::detail::throw_error(ec, "with_token_launcher"); + + return proc; + } + + + template + auto operator()(ExecutionContext & context, + error_code & ec, + const typename std::enable_if::value, + filesystem::path >::type & executable, + Args && args, + Inits && ... inits ) -> basic_process + { + return (*this)(context.get_executor(), ec, executable, std::forward(args), std::forward(inits)...); + } + + template + auto operator()(Executor exec, + const typename std::enable_if< + net::execution::is_executor::value || + net::is_executor::value, + filesystem::path >::type & executable, + Args && args, + Inits && ... inits ) -> basic_process + { + error_code ec; + auto proc = (*this)(std::move(exec), ec, executable, std::forward(args), std::forward(inits)...); + + if (ec) + detail::throw_error(ec, "with_token_launcher"); + + return proc; + } + + template + auto operator()(Executor exec, + error_code & ec, + const typename std::enable_if< + net::execution::is_executor::value || + net::is_executor::value, + filesystem::path >::type & executable, + Args && args, + Inits && ... inits ) -> basic_process + { + auto command_line = this->build_command_line(executable, args); + + ec = detail::on_setup(*this, executable, command_line, inits...); + if (ec) + { + detail::on_error(*this, executable, command_line, ec, inits...); + return basic_process(exec); + } + auto ok = ::CreateProcessWithTokenW( + token, + logon_flags, + executable.empty() ? nullptr : executable.c_str(), + command_line.empty() ? nullptr : &command_line.front(), + creation_flags, + environment, + current_directory.empty() ? nullptr : current_directory.c_str(), + &startup_info.StartupInfo, + &process_information); + + + if (ok == 0) + { + BOOST_PROCESS_V2_ASSIGN_LAST_ERROR(ec); + detail::on_error(*this, executable, command_line, ec, inits...); + + if (process_information.hProcess != INVALID_HANDLE_VALUE) + ::CloseHandle(process_information.hProcess); + if (process_information.hThread != INVALID_HANDLE_VALUE) + ::CloseHandle(process_information.hThread); + + return basic_process(exec); + } else + { + detail::on_success(*this, executable, command_line, inits...); + + if (process_information.hThread != INVALID_HANDLE_VALUE) + ::CloseHandle(process_information.hThread); + + return basic_process(exec, + this->process_information.dwProcessId, + this->process_information.hProcess); + } + } +}; + +} +BOOST_PROCESS_V2_END_NAMESPACE + +#endif // BOOST_PROCESS_V2_WINDOWS_WITH_TOKEN_LAUNCHER_HPP \ No newline at end of file diff --git a/test/Jamfile.jam b/test/Jamfile.jam index 55e04504..cd1b744b 100644 --- a/test/Jamfile.jam +++ b/test/Jamfile.jam @@ -3,5 +3,5 @@ # Distributed under the Boost Software License, Version 1.0. (See accompanying # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -alias v1-tests : v1//bare v1//with-valgrind v1//without-valgrind ; +# alias v1-tests : v1//bare v1//with-valgrind v1//without-valgrind ; alias v2-tests : v2//standalone v2//with_target ;