2
0
mirror of https://github.com/boostorg/process.git synced 2026-01-19 04:22:15 +00:00

continued working on the replacement of the winapi

This commit is contained in:
klemens-morgenstern
2015-10-11 17:41:03 +02:00
parent 6942020ccc
commit ef24f3d16a
14 changed files with 372 additions and 52 deletions

View File

@@ -0,0 +1,98 @@
/*
* environment.hpp
*
* Created on: 11.10.2015
* Author: Klemens Morgenstern
*/
#ifndef BOOST_DETAIL_WINAPI_ENVIRONMENT_HPP_
#define BOOST_DETAIL_WINAPI_ENVIRONMENT_HPP_
#include <boost/detail/winapi/basic_types.hpp>
namespace boost
{
namespace detail
{
namespace winapi
{
extern "C" {
#if defined( BOOST_USE_WINDOWS_H )
const DWORD_ debug_process = DEBUG_PROCESS ;
const DWORD_ debug_only_this_process = DEBUG_ONLY_THIS_PROCESS ;
const DWORD_ create_suspended = CREATE_SUSPENDED ;
const DWORD_ detached_process = DETACHED_PROCESS ;
const DWORD_ create_new_console = CREATE_NEW_CONSOLE ;
const DWORD_ normal_priority_class = NORMAL_PRIORITY_CLASS ;
const DWORD_ idle_priority_class = IDLE_PRIORITY_CLASS ;
const DWORD_ high_priority_class = HIGH_PRIORITY_CLASS ;
const DWORD_ realtime_priority_class = REALTIME_PRIORITY_CLASS ;
const DWORD_ create_new_process_group = CREATE_NEW_PROCESS_GROUP ;
const DWORD_ create_unicode_environment = CREATE_UNICODE_ENVIRONMENT ;
const DWORD_ create_separate_wow_vdm = CREATE_SEPARATE_WOW_VDM ;
const DWORD_ create_shared_wow_vdm = CREATE_SHARED_WOW_VDM ;
const DWORD_ create_forcedos = CREATE_FORCEDOS ;
const DWORD_ below_normal_priority_class = BELOW_NORMAL_PRIORITY_CLASS ;
const DWORD_ above_normal_priority_class = ABOVE_NORMAL_PRIORITY_CLASS ;
const DWORD_ inherit_parent_affinity = INHERIT_PARENT_AFFINITY ;
const DWORD_ inherit_caller_priority = INHERIT_CALLER_PRIORITY ;
const DWORD_ create_protected_process = CREATE_PROTECTED_PROCESS ;
const DWORD_ extended_startupinfo_present = EXTENDED_STARTUPINFO_PRESENT ;
const DWORD_ process_mode_background_begin = PROCESS_MODE_BACKGROUND_BEGIN ;
const DWORD_ process_mode_background_end = PROCESS_MODE_BACKGROUND_END ;
const DWORD_ create_breakaway_from_job = CREATE_BREAKAWAY_FROM_JOB ;
const DWORD_ create_preserve_code_authz_level = CREATE_PRESERVE_CODE_AUTHZ_LEVEL;
const DWORD_ create_default_error_mode = CREATE_DEFAULT_ERROR_MODE ;
const DWORD_ create_no_window = CREATE_NO_WINDOW ;
const DWORD_ profile_user = PROFILE_USER ;
const DWORD_ profile_kernel = PROFILE_KERNEL ;
const DWORD_ profile_server = PROFILE_SERVER ;
const DWORD_ create_ignore_system_default = CREATE_IGNORE_SYSTEM_DEFAULT ;
#else
const DWORD_ debug_process = 0x1 ;
const DWORD_ debug_only_this_process = 0x2 ;
const DWORD_ create_suspended = 0x4 ;
const DWORD_ detached_process = 0x8 ;
const DWORD_ create_new_console = 0x10 ;
const DWORD_ normal_priority_class = 0x20 ;
const DWORD_ idle_priority_class = 0x40 ;
const DWORD_ high_priority_class = 0x80 ;
const DWORD_ realtime_priority_class = 0x100 ;
const DWORD_ create_new_process_group = 0x200 ;
const DWORD_ create_unicode_environment = 0x400 ;
const DWORD_ create_separate_wow_vdm = 0x800 ;
const DWORD_ create_shared_wow_vdm = 0x1000 ;
const DWORD_ create_forcedos = 0x2000 ;
const DWORD_ below_normal_priority_class = 0x4000 ;
const DWORD_ above_normal_priority_class = 0x8000 ;
const DWORD_ inherit_parent_affinity = 0x10000 ;
const DWORD_ inherit_caller_priority = 0x20000 ;
const DWORD_ create_protected_process = 0x40000 ;
const DWORD_ extended_startupinfo_present = 0x80000 ;
const DWORD_ process_mode_background_begin = 0x100000 ;
const DWORD_ process_mode_background_end = 0x200000 ;
const DWORD_ create_breakaway_from_job = 0x1000000 ;
const DWORD_ create_preserve_code_authz_level = 0x2000000 ;
const DWORD_ create_default_error_mode = 0x4000000 ;
const DWORD_ create_no_window = 0x8000000 ;
const DWORD_ profile_user = 0x10000000 ;
const DWORD_ profile_kernel = 0x20000000 ;
const DWORD_ profile_server = 0x40000000 ;
const DWORD_ create_ignore_system_default = 0x80000000 ;
}
#endif
}
}
}
#endif /* BOOST_DETAIL_WINAPI_ENVIRONMENT_HPP_ */

View File

@@ -2,7 +2,7 @@
* handleapi.hpp
*
* Created on: 11.10.2015
* Author: Klemens
* Author: Klemens Morgenstern
*/
#ifndef BOOST_DETAIL_HANDLEAPI_HPP_

View File

@@ -0,0 +1,89 @@
/*
* namepd_pipe_api.hpp
*
* Created on: 11.10.2015
* Author: Klemens Morgenstern
*/
#ifndef BOOST_DETAIL_WINAPI_NAMEPD_PIPE_API_HPP_
#define BOOST_DETAIL_WINAPI_NAMEPD_PIPE_API_HPP_
#include <boost/detail/winapi/basic_types.hpp>
#include <boost/detail/winapi/config.hpp>
#include <boost/detail/winapi/security.hpp>
#include <boost/detail/winapi/file_management.hpp>
//HANDLE_FLAG_INHERIT HANDLE_FLAG_INHERIT
namespace boost
{
namespace detail
{
namespace winapi
{
extern "C" {
#if defined( BOOST_USE_WINDOWS_H )
using ::ImpersonateNamedPipeClient;
using ::CreatePipe;
using ::ConnectNamedPipe;
using ::DisconnectNamedPipe;
using ::SetNamedPipeHandleState;
using ::PeekNamedPipe;
using ::TransactNamedPipe;
using ::CreateNamedPipeW;
using ::WaitNamedPipeW;
#if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6
using ::GetNamedPipeClientComputerNameW;
#endif
#else
typedef ::boost::detail::winapi::LPOVERLAPPED LPOVERLAPPED_;
__declspec(import) int WINAPI ImpersonateNamedPipeClient (HANDLE_ hNamedPipe);
__declspec(import) int WINAPI CreatePipe (HANDLE_* hReadPipe, HANDLE_* hWritePipe, LPSECURITY_ATTRIBUTES_ lpPipeAttributes, DWORD_ nSize);
__declspec(import) int WINAPI ConnectNamedPipe (HANDLE_ hNamedPipe, LPOVERLAPPED_ lpOverlapped);
__declspec(import) int WINAPI DisconnectNamedPipe (HANDLE_ hNamedPipe);
__declspec(import) int WINAPI SetNamedPipeHandleState (HANDLE_ hNamedPipe, DWORD_* lpMode, DWORD_* lpMaxCollectionCount, DWORD_* lpCollectDataTimeout);
__declspec(import) int WINAPI PeekNamedPipe (HANDLE_ hNamedPipe, LPVOID_ lpBuffer, DWORD_ nBufferSize, DWORD_* lpBytesRead, DWORD_* lpTotalBytesAvail, DWORD_* lpBytesLeftThisMessage);
__declspec(import) int WINAPI TransactNamedPipe (HANDLE_ hNamedPipe, LPVOID_ lpInBuffer, DWORD_ nInBufferSize, LPVOID_ lpOutBuffer, DWORD_ nOutBufferSize, DWORD_* lpBytesRead, LPOVERLAPPED_ lpOverlapped);
__declspec(import) HANDLE_ WINAPI CreateNamedPipeW (LPCWSTR_ lpName, DWORD_ dwOpenMode, DWORD_ dwPipeMode, DWORD_ nMaxInstances, DWORD_ nOutBufferSize, DWORD_ nInBufferSize, DWORD_ nDefaultTimeOut, LPSECURITY_ATTRIBUTES_ lpSecurityAttributes);
__declspec(import) int WINAPI WaitNamedPipeW (LPCWSTR_ lpNamedPipeName, DWORD_ nTimeOut);
#if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6
WINBASEAPI int WINAPI GetNamedPipeClientComputerNameW (HANDLE_ Pipe, LPWSTR ClientComputerName, ULONG ClientComputerNameLength);
#endif
#if defined(UNICODE)
inline HANDLE_ CreateNamedPipe(LPCWSTR_ lpName, DWORD_ dwOpenMode, DWORD_ dwPipeMode, DWORD_ nMaxInstances, DWORD_ nOutBufferSize, DWORD_ nInBufferSize, DWORD_ nDefaultTimeOut, LPSECURITY_ATTRIBUTES_ lpSecurityAttributes)
{
return CreateNamedPipeW(lpName, dwOpenMode, dwPipeMode, nMaxInstances, nOutBufferSize, nInBufferSize, nDefaultTimeOut, lpSecurityAttributes);
}
inline int WaitNamedPipe(LPCWSTR_ lpNamedPipeName, DWORD_ nTimeOut)
{
return WaitNamedPipeW(lpNamedPipeName, nTimeOut);
}
#if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6
inline int GetNamedPipeClientComputerName(HANDLE_ Pipe, LPWSTR ClientComputerName, ULONG ClientComputerNameLength)
{
return GetNamedPipeClientComputerNameW(Pipe, ClientComputerName, ClientComputerNameLength);
}
#endif
#endif
#endif
}
#endif
}
}
}
#endif /* BOOST_DETAIL_WINAPI_NAMEPD_PIPE_API_HPP_ */

View File

@@ -2,14 +2,16 @@
* HANDLE_api.hpp
*
* Created on: 11.10.2015
* Author: Klemens
* Author: Klemens Morgenstern
*/
#ifndef BOOST_DETAIL_HANDLE_API_HPP_
#define BOOST_DETAIL_HANDLE_API_HPP_
#ifndef BOOST_DETAIL_PROCESS_API_HPP_
#define BOOST_DETAIL_PROCESS_API_HPP_
#include <boost/detail/winapi/basic_types.hpp>
#include <boost/detail/winapi/config.hpp>
#include <boost/detail/winapi/security.hpp>
#include <boost/detail/winapi/process_info.hpp>
//HANDLE_FLAG_INHERIT HANDLE_FLAG_INHERIT
@@ -26,16 +28,32 @@ extern "C" {
using ::GetExitCodeProcess;
using ::ExitProcess;
using ::TerminateProcess;
using ::CreateProcessA;
using ::CreateProcessW;
#else
__declspec(dllimport) __declspec (noreturn) void WINAPI ExitProcess (UINT_ uExitCode);
__declspec(dllimport) int WINAPI TerminateProcess (HANDLE_ hProcess, UINT_ uExitCode);
__declspec(dllimport) int WINAPI GetExitCodeProcess (HANDLE_ hProcess, LPDWORD_ lpExitCode);
__declspec(dllimport) __declspec (noreturn) void WINAPI ExitProcess (unsigned int uExitCode);
__declspec(dllimport) int WINAPI TerminateProcess (HANDLE_ hProcess, unsigned int uExitCode);
__declspec(dllimport) int WINAPI GetExitCodeProcess (HANDLE_ hProcess, DWORD_* lpExitCode);
__declspec(dllimport) int WINAPI CreateProcessA (LPCSTR_ lpApplicationName, LPSTR_ lpCommandLine, LPSECURITY_ATTRIBUTES_ lpProcessAttributes, LPSECURITY_ATTRIBUTES_ lpThreadAttributes, int bInheritHandles, DWORD_ dwCreationFlags, LPVOID_ lpEnvironment, LPCSTR_ lpCurrentDirectory, STARTUPINFOA_* lpStartupInfo, PROCESS_INFORMATION_* lpProcessInformation);
__declspec(dllimport) int WINAPI CreateProcessW (LPCWSTR_ lpApplicationName, LPWSTR_ lpCommandLine, LPSECURITY_ATTRIBUTES_ lpProcessAttributes, LPSECURITY_ATTRIBUTES_ lpThreadAttributes, int bInheritHandles, DWORD_ dwCreationFlags, LPVOID_ lpEnvironment, LPCWSTR_ lpCurrentDirectory, STARTUPINFOW_* lpStartupInfo, PROCESS_INFORMATION_* lpProcessInformation);
}
#endif
#if defined(UNICODE) || defined(_UNICODE)
inline int CreateProcess (LPCWSTR_ lpApplicationName, LPWSTR_ lpCommandLine, LPSECURITY_ATTRIBUTES_ lpProcessAttributes, LPSECURITY_ATTRIBUTES_ lpThreadAttributes, int bInheritHandles, DWORD_ dwCreationFlags, LPVOID_ lpEnvironment, LPCWSTR_ lpCurrentDirectory, STARTUPINFOW_* lpStartupInfo, PROCESS_INFORMATION_* lpProcessInformation)
{
return CreateProcessW (lpApplicationName, lpCommandLine, lpProcessAttributes, lpThreadAttributes, bInheritHandles, dwCreationFlags, lpEnvironment, lpCurrentDirectory, lpStartupInfo, lpProcessInformation);
}
#else
inline int CreateProcess (LPCSTR_ lpApplicationName, LPSTR_ lpCommandLine, LPSECURITY_ATTRIBUTES_ lpProcessAttributes, LPSECURITY_ATTRIBUTES_ lpThreadAttributes, int bInheritHandles, DWORD_ dwCreationFlags, LPVOID_ lpEnvironment, LPCSTR_ lpCurrentDirectory, STARTUPINFOA_* lpStartupInfo, PROCESS_INFORMATION_* lpProcessInformation)
{
return CreateProcessA (lpApplicationName, lpCommandLine, lpProcessAttributes, lpThreadAttributes, bInheritHandles, dwCreationFlags, lpEnvironment, lpCurrentDirectory, lpStartupInfo, lpProcessInformation);
}
#endif
}

View File

@@ -0,0 +1,109 @@
/*
* process_info.hpp
*
* Created on: 11.10.2015
* Author: Klemens
*/
#ifndef BOOST_DETAIL_WINAPI_PROCESS_INFO_HPP_
#define BOOST_DETAIL_WINAPI_PROCESS_INFO_HPP_
#include <boost/detail/winapi/basic_types.hpp>
#include <boost/detail/winapi/config.hpp>
#include <boost/detail/winapi/handles.hpp>
//HANDLE_FLAG_INHERIT HANDLE_FLAG_INHERIT
namespace boost
{
namespace detail
{
namespace winapi
{
extern "C" {
#if defined( BOOST_USE_WINDOWS_H )
typedef ::PROCESS_INFORMATION PROCESS_INFORMATION_;
typedef ::STARTUPINFOA STARTUPINFOA_;
typedef ::STARTUPINFOW STARTUPINFOW_;
#else
struct PROCESS_INFORMATION_
{
HANDLE_ hProcess;
HANDLE_ hThread;
DWORD_ dwProcessId;
DWORD_ dwThreadId;
};
typedef struct STARTUPINFOA_ {
DWORD_ cb;
LPSTR_ lpReserved;
LPSTR_ lpDesktop;
LPSTR_ lpTitle;
DWORD_ dwX;
DWORD_ dwY;
DWORD_ dwXSize;
DWORD_ dwYSize;
DWORD_ dwXCountChars;
DWORD_ dwYCountChars;
DWORD_ dwFillAttribute;
DWORD_ dwFlags;
WORD_ wShowWindow;
WORD_ cbReserved2;
BYTE_ *lpReserved2;
HANDLE_ hStdInput;
HANDLE_ hStdOutput;
HANDLE_ hStdError;
} ;
struct STARTUPINFOW_ {
DWORD cb;
LPWSTR lpReserved;
LPWSTR lpDesktop;
LPWSTR lpTitle;
DWORD_ dwX;
DWORD_ dwY;
DWORD_ dwXSize;
DWORD_ dwYSize;
DWORD_ dwXCountChars;
DWORD_ dwYCountChars;
DWORD_ dwFillAttribute;
DWORD_ dwFlags;
WORD_ wShowWindow;
WORD_ cbReserved2;
BYTE_ *lpReserved2;
HANDLE_ hStdInput;
HANDLE_ hStdOutput;
HANDLE_ hStdError;
} ;
#endif
#if defined(UNICODE) || defined(_UNICODE)
typedef STARTUPINFOW_ STARTUPINFO_;
#else
typedef STARTUPINFOA_ STARTUPINFO_;
#endif
#if defined( BOOST_USE_WINDOWS_H )
typedef ::STARTUPINFOEX STARTUPINFOEX_;
#else
struct PROC_THREAD_ATTRIBUTE_LIST_ {};
struct STARTUPINFOEX_ {
STARTUPINFO_ StartupInfo;
PROC_THREAD_ATTRIBUTE_LIST_* lpAttributeList;
};
#endif
}
}}}
#endif /* BOOST_DETAIL_WINAPI_PROCESS_INFO_HPP_ */

View File

@@ -2,7 +2,7 @@
* show_windows.hpp
*
* Created on: 11.10.2015
* Author: Klemens
* Author: Klemens Morgenstern
*/
#ifndef BOOST_DETAIL_WINAPI_SHOW_WINDOWS_HPP_
@@ -11,6 +11,7 @@
#include <boost/detail/winapi/basic_types.hpp>
#include <boost/detail/winapi/config.hpp>
namespace boost

View File

@@ -2,13 +2,14 @@
* startf.hpp
*
* Created on: 11.10.2015
* Author: Klemens
* Author: Klemens Morgenstern
*/
#ifndef BOOST_DETAIL_WINAPI_STARTF_HPP_
#define BOOST_DETAIL_WINAPI_STARTF_HPP_
#include <boost/detail/winapi/basic_types.hpp>
#include <boost/detail/winapi/config.hpp>
namespace boost

View File

@@ -11,40 +11,41 @@
#define BOOST_PROCESS_WINDOWS_CHILD_HPP
#include <boost/move/move.hpp>
#include <Windows.h>
#include <boost/detail/winapi/handles.hpp>
#include <boost/detail/winapi/process_info.hpp>>
namespace boost { namespace process { namespace windows {
class child
{
public:
PROCESS_INFORMATION proc_info;
::boost::detail::winapi::PROCESS_INFORMATION_ proc_info;
explicit child(const PROCESS_INFORMATION &pi) : proc_info(pi) {}
explicit child(const ::boost::detail::winapi::PROCESS_INFORMATION_ &pi) : proc_info(pi) {}
~child()
{
::CloseHandle(proc_info.hProcess);
::CloseHandle(proc_info.hThread);
::boots::detail::winapi::CloseHandle(proc_info.hProcess);
::boots::detail::winapi::CloseHandle(proc_info.hThread);
}
child(BOOST_RV_REF(child) c) : proc_info(c.proc_info)
{
c.proc_info.hProcess = INVALID_HANDLE_VALUE;
c.proc_info.hThread = INVALID_HANDLE_VALUE;
c.proc_info.hProcess = ::boost::detail::winapi::invalid_handle_value;
c.proc_info.hThread = ::boost::detail::winapi::invalid_handle_value;
}
child &operator=(BOOST_RV_REF(child) c)
{
::CloseHandle(proc_info.hProcess);
::CloseHandle(proc_info.hThread);
::boots::detail::winapi::CloseHandle(proc_info.hProcess);
::boots::detail::winapi::CloseHandle(proc_info.hThread);
proc_info = c.proc_info;
c.proc_info.hProcess = INVALID_HANDLE_VALUE;
c.proc_info.hThread = INVALID_HANDLE_VALUE;
c.proc_info.hProcess = ::boost::detail::winapi::invalid_handle_value;
c.proc_info.hThread = ::boost::detail::winapi::invalid_handle_value;
return *this;
}
HANDLE process_handle() const { return proc_info.hProcess; }
HANDLE_ process_handle() const { return proc_info.hProcess; }
private:
BOOST_MOVABLE_BUT_NOT_COPYABLE(child);

View File

@@ -20,7 +20,7 @@ namespace boost { namespace process { namespace windows {
inline pipe create_pipe()
{
HANDLE handles[2];
if (!::CreatePipe(&handles[0], &handles[1], NULL, 0))
if (!::boost::detail::winapi::CreatePipe(&handles[0], &handles[1], nullptr, 0))
BOOST_PROCESS_THROW_LAST_SYSTEM_ERROR("CreatePipe() failed");
return make_pipe(handles[0], handles[1]);
}
@@ -28,7 +28,7 @@ inline pipe create_pipe()
inline pipe create_pipe(boost::system::error_code &ec)
{
HANDLE handles[2];
if (!::CreatePipe(&handles[0], &handles[1], NULL, 0))
if (!::boost::detail::winapi::CreatePipe(&handles[0], &handles[1], nullptr, 0))
BOOST_PROCESS_RETURN_LAST_SYSTEM_ERROR(ec);
else
ec.clear();

View File

@@ -12,7 +12,8 @@
#include <boost/process/windows/child.hpp>
#include <boost/fusion/algorithm/iteration/for_each.hpp>
#include <Windows.h>
#include <boost/detail/winapi/handles.hpp>
#include <boost/detail/winapi/process_api.hpp>
namespace boost { namespace process { namespace windows {
@@ -34,12 +35,12 @@ struct executor
ZeroMemory(&startup_info_ex, sizeof(STARTUPINFOEX));
startup_info.cb = sizeof(STARTUPINFOEX);
#else
ZeroMemory(&startup_info, sizeof(STARTUPINFO));
startup_info.cb = sizeof(STARTUPINFO);
ZeroMemory(&startup_info, sizeof(::boost::detail::winapi::STARTUPINFO_));
startup_info.cb = sizeof(::boost::detail::winapi::STARTUPINFO_);
#endif
startup_info.hStdInput = INVALID_HANDLE_VALUE;
startup_info.hStdOutput = INVALID_HANDLE_VALUE;
startup_info.hStdError = INVALID_HANDLE_VALUE;
startup_info.hStdInput = ::boost::detail::winapi::invalid_handle_value;
startup_info.hStdOutput = ::boost::detail::winapi::invalid_handle_value;
startup_info.hStdError = ::boost::detail::winapi::invalid_handle_value;
}
struct call_on_CreateProcess_setup
@@ -86,7 +87,7 @@ struct executor
{
boost::fusion::for_each(seq, call_on_CreateProcess_setup(*this));
if (!::CreateProcess(
if (!::boost::detail::winapi::CreateProcess(
exe,
cmd_line,
proc_attrs,
@@ -108,21 +109,21 @@ struct executor
return child(proc_info);
}
LPCTSTR exe;
LPTSTR cmd_line;
LPSECURITY_ATTRIBUTES proc_attrs;
LPSECURITY_ATTRIBUTES thread_attrs;
BOOL inherit_handles;
DWORD creation_flags;
LPVOID env;
LPCTSTR work_dir;
::boost::detail::winapi::LPCSTR_ exe;
::boost::detail::winapi::LPSTR_ cmd_line;
::boost::detail::winapi::LPSECURITY_ATTRIBUTES_ proc_attrs;
::boost::detail::winapi::LPSECURITY_ATTRIBUTES_ thread_attrs;
::boost::detail::winapi::BOOL_ inherit_handles;
::boost::detail::winapi::DWORD_ creation_flags;
::boost::detail::winapi::LPVOID_ env;
::boost::detail::winapi::LPCSTR_ work_dir;
#if (_WIN32_WINNT >= 0x0600)
STARTUPINFOEX startup_info_ex;
STARTUPINFO &startup_info;
::boost::detail::winapi::STARTUPINFOEX_ startup_info_ex;
::boost::detail::winapi::STARTUPINFO_ &startup_info;
#else
STARTUPINFO startup_info;
::boost::detail::winapi::STARTUPINFO_ startup_info;
#endif
PROCESS_INFORMATION proc_info;
::boost::detail::winapi::PROCESS_INFORMATION_ proc_info;
};
}}}

View File

@@ -11,7 +11,8 @@
#define BOOST_PROCESS_WINDOWS_INITIALIZERS_CLOSE_STDOUT_HPP
#include <boost/process/windows/initializers/initializer_base.hpp>
#include <Windows.h>
#include <boost/detail/winapi/startf.hpp>
#include <boost/detail/winapi/handles.hpp>
namespace boost { namespace process { namespace windows { namespace initializers {
@@ -21,8 +22,8 @@ public:
template <class WindowsExecutor>
void on_CreateProcess_setup(WindowsExecutor &e) const
{
e.startup_info.hStdOutput = INVALID_HANDLE_VALUE;
e.startup_info.dwFlags |= STARTF_USESTDHANDLES;
e.startup_info.hStdOutput = boost::detail::winapi::invalid_handle_value;
e.startup_info.dwFlags |= boost::detail::winapi::startf_usestdhandles;
}
};

View File

@@ -10,7 +10,7 @@
#ifndef BOOST_PROCESS_WINDOWS_INITIALIZERS_SET_ENV_HPP
#define BOOST_PROCESS_WINDOWS_INITIALIZERS_SET_ENV_HPP
#include <Windows.h>
#include <boost/detail/winapi/environment.hpp>
#include <boost/process/windows/initializers/initializer_base.hpp>
#include <boost/range/numeric.hpp>
#include <boost/range/algorithm/copy.hpp>
@@ -61,7 +61,7 @@ public:
{
e.env = env_.get();
if (Unicode)
e.creation_flags |= CREATE_UNICODE_ENVIRONMENT;
e.creation_flags |= ::boost::detail::winapi::create_unicode_environment;
}
private:

View File

@@ -11,7 +11,8 @@
#define BOOST_PROCESS_WINDOWS_INITIALIZERS_SHOW_WINDOW_HPP
#include <boost/process/windows/initializers/initializer_base.hpp>
#include <Windows.h>
#include <boost/detail/winapi/startf.hpp>
namespace boost { namespace process { namespace windows { namespace initializers {
@@ -23,7 +24,7 @@ public:
template <class WindowsExecutor>
void on_CreateProcess_setup(WindowsExecutor &e) const
{
e.startup_info.dwFlags |= STARTF_USESHOWWINDOW;
e.startup_info.dwFlags |= ::boost::detail::winapi::startf_useshowwindow;
e.startup_info.wShowWindow |= flags_;
}

View File

@@ -10,14 +10,14 @@
#ifndef BOOST_PROCESS_WINDOWS_PIPE_HPP
#define BOOST_PROCESS_WINDOWS_PIPE_HPP
#include <Windows.h>
#include <boost/detail/winapi/basic_types.hpp>
namespace boost { namespace process { namespace windows {
struct pipe
{
HANDLE source;
HANDLE sink;
boost::detail::winapi::HANDLE_ source;
boost::detail::winapi::HANDLE_ sink;
pipe(HANDLE source, HANDLE sink) : source(source), sink(sink) {}
};