From ef24f3d16aa13d4a0d42ce63c81a9535acead7da Mon Sep 17 00:00:00 2001 From: klemens-morgenstern Date: Sun, 11 Oct 2015 17:41:03 +0200 Subject: [PATCH] continued working on the replacement of the winapi --- boost/detail/winapi/environment.hpp | 98 ++++++++++++++++ boost/detail/winapi/handle_info.hpp | 2 +- boost/detail/winapi/namepd_pipe_api.hpp | 89 ++++++++++++++ boost/detail/winapi/process_api.hpp | 30 ++++- boost/detail/winapi/process_info.hpp | 109 ++++++++++++++++++ boost/detail/winapi/show_windows.hpp | 3 +- boost/detail/winapi/startf.hpp | 3 +- boost/process/windows/child.hpp | 25 ++-- boost/process/windows/create_pipe.hpp | 4 +- boost/process/windows/executor.hpp | 39 ++++--- .../windows/initializers/close_stdout.hpp | 7 +- .../process/windows/initializers/set_env.hpp | 4 +- .../windows/initializers/show_window.hpp | 5 +- boost/process/windows/pipe.hpp | 6 +- 14 files changed, 372 insertions(+), 52 deletions(-) create mode 100644 boost/detail/winapi/environment.hpp create mode 100644 boost/detail/winapi/namepd_pipe_api.hpp create mode 100644 boost/detail/winapi/process_info.hpp diff --git a/boost/detail/winapi/environment.hpp b/boost/detail/winapi/environment.hpp new file mode 100644 index 00000000..012a7f1a --- /dev/null +++ b/boost/detail/winapi/environment.hpp @@ -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 + + +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_ */ diff --git a/boost/detail/winapi/handle_info.hpp b/boost/detail/winapi/handle_info.hpp index 7ab8a2ba..03948b79 100644 --- a/boost/detail/winapi/handle_info.hpp +++ b/boost/detail/winapi/handle_info.hpp @@ -2,7 +2,7 @@ * handleapi.hpp * * Created on: 11.10.2015 - * Author: Klemens + * Author: Klemens Morgenstern */ #ifndef BOOST_DETAIL_HANDLEAPI_HPP_ diff --git a/boost/detail/winapi/namepd_pipe_api.hpp b/boost/detail/winapi/namepd_pipe_api.hpp new file mode 100644 index 00000000..a1b75d2d --- /dev/null +++ b/boost/detail/winapi/namepd_pipe_api.hpp @@ -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 +#include +#include +#include + +//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_ */ diff --git a/boost/detail/winapi/process_api.hpp b/boost/detail/winapi/process_api.hpp index 1c0637b5..d9985e8b 100644 --- a/boost/detail/winapi/process_api.hpp +++ b/boost/detail/winapi/process_api.hpp @@ -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 #include +#include +#include //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 } diff --git a/boost/detail/winapi/process_info.hpp b/boost/detail/winapi/process_info.hpp new file mode 100644 index 00000000..76a46c27 --- /dev/null +++ b/boost/detail/winapi/process_info.hpp @@ -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 +#include +#include + +//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_ */ diff --git a/boost/detail/winapi/show_windows.hpp b/boost/detail/winapi/show_windows.hpp index e5e471eb..559253ba 100644 --- a/boost/detail/winapi/show_windows.hpp +++ b/boost/detail/winapi/show_windows.hpp @@ -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 +#include namespace boost diff --git a/boost/detail/winapi/startf.hpp b/boost/detail/winapi/startf.hpp index 6fe1d6b5..b7a3612d 100644 --- a/boost/detail/winapi/startf.hpp +++ b/boost/detail/winapi/startf.hpp @@ -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 +#include namespace boost diff --git a/boost/process/windows/child.hpp b/boost/process/windows/child.hpp index 083cd29d..54c13f8a 100644 --- a/boost/process/windows/child.hpp +++ b/boost/process/windows/child.hpp @@ -11,40 +11,41 @@ #define BOOST_PROCESS_WINDOWS_CHILD_HPP #include -#include +#include +#include > 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); diff --git a/boost/process/windows/create_pipe.hpp b/boost/process/windows/create_pipe.hpp index fe1e4975..8e02adc0 100644 --- a/boost/process/windows/create_pipe.hpp +++ b/boost/process/windows/create_pipe.hpp @@ -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(); diff --git a/boost/process/windows/executor.hpp b/boost/process/windows/executor.hpp index 1560f307..3e734450 100644 --- a/boost/process/windows/executor.hpp +++ b/boost/process/windows/executor.hpp @@ -12,7 +12,8 @@ #include #include -#include +#include +#include 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; }; }}} diff --git a/boost/process/windows/initializers/close_stdout.hpp b/boost/process/windows/initializers/close_stdout.hpp index b58a6000..78474139 100644 --- a/boost/process/windows/initializers/close_stdout.hpp +++ b/boost/process/windows/initializers/close_stdout.hpp @@ -11,7 +11,8 @@ #define BOOST_PROCESS_WINDOWS_INITIALIZERS_CLOSE_STDOUT_HPP #include -#include +#include +#include namespace boost { namespace process { namespace windows { namespace initializers { @@ -21,8 +22,8 @@ public: template 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; } }; diff --git a/boost/process/windows/initializers/set_env.hpp b/boost/process/windows/initializers/set_env.hpp index 6dfdfc58..f3a5e461 100644 --- a/boost/process/windows/initializers/set_env.hpp +++ b/boost/process/windows/initializers/set_env.hpp @@ -10,7 +10,7 @@ #ifndef BOOST_PROCESS_WINDOWS_INITIALIZERS_SET_ENV_HPP #define BOOST_PROCESS_WINDOWS_INITIALIZERS_SET_ENV_HPP -#include +#include #include #include #include @@ -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: diff --git a/boost/process/windows/initializers/show_window.hpp b/boost/process/windows/initializers/show_window.hpp index 30461792..ff802f9a 100644 --- a/boost/process/windows/initializers/show_window.hpp +++ b/boost/process/windows/initializers/show_window.hpp @@ -11,7 +11,8 @@ #define BOOST_PROCESS_WINDOWS_INITIALIZERS_SHOW_WINDOW_HPP #include -#include +#include + namespace boost { namespace process { namespace windows { namespace initializers { @@ -23,7 +24,7 @@ public: template 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_; } diff --git a/boost/process/windows/pipe.hpp b/boost/process/windows/pipe.hpp index fd912afc..1dd85667 100644 --- a/boost/process/windows/pipe.hpp +++ b/boost/process/windows/pipe.hpp @@ -10,14 +10,14 @@ #ifndef BOOST_PROCESS_WINDOWS_PIPE_HPP #define BOOST_PROCESS_WINDOWS_PIPE_HPP -#include +#include 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) {} };