process.hpp 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478
  1. /*
  2. * Copyright 2016 Klemens D. Morgenstern
  3. * Copyright 2016, 2017 Andrey Semashev
  4. *
  5. * Distributed under the Boost Software License, Version 1.0.
  6. * See http://www.boost.org/LICENSE_1_0.txt
  7. */
  8. #ifndef BOOST_WINAPI_PROCESS_HPP_INCLUDED_
  9. #define BOOST_WINAPI_PROCESS_HPP_INCLUDED_
  10. #include <boost/winapi/config.hpp>
  11. #include <boost/winapi/basic_types.hpp>
  12. #include <boost/winapi/access_rights.hpp>
  13. #include <boost/winapi/get_current_process.hpp>
  14. #include <boost/winapi/get_current_process_id.hpp>
  15. #ifdef BOOST_HAS_PRAGMA_ONCE
  16. #pragma once
  17. #endif
  18. #if !defined( BOOST_USE_WINDOWS_H )
  19. extern "C" {
  20. #if BOOST_WINAPI_PARTITION_APP_SYSTEM
  21. struct _PROCESS_INFORMATION;
  22. #if !defined( BOOST_NO_ANSI_APIS )
  23. struct _STARTUPINFOA;
  24. #endif
  25. struct _STARTUPINFOW;
  26. #endif // BOOST_WINAPI_PARTITION_APP_SYSTEM
  27. #if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6
  28. #if BOOST_WINAPI_PARTITION_DESKTOP_SYSTEM
  29. struct _PROC_THREAD_ATTRIBUTE_LIST;
  30. #endif // BOOST_WINAPI_PARTITION_DESKTOP_SYSTEM
  31. #if BOOST_WINAPI_PARTITION_DESKTOP
  32. #if !defined( BOOST_NO_ANSI_APIS )
  33. struct _STARTUPINFOEXA;
  34. #endif
  35. struct _STARTUPINFOEXW;
  36. #endif // BOOST_WINAPI_PARTITION_DESKTOP
  37. #endif // BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6
  38. #if BOOST_WINAPI_PARTITION_DESKTOP_SYSTEM
  39. BOOST_SYMBOL_IMPORT BOOST_NORETURN boost::winapi::VOID_ BOOST_WINAPI_WINAPI_CC
  40. ExitProcess(boost::winapi::UINT_ uExitCode);
  41. BOOST_SYMBOL_IMPORT boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC GetExitCodeProcess(
  42. boost::winapi::HANDLE_ hProcess,
  43. boost::winapi::LPDWORD_ lpExitCode);
  44. #if !defined( BOOST_NO_ANSI_APIS )
  45. BOOST_SYMBOL_IMPORT boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC CreateProcessA(
  46. boost::winapi::LPCSTR_ lpApplicationName,
  47. boost::winapi::LPSTR_ lpCommandLine,
  48. ::_SECURITY_ATTRIBUTES* lpProcessAttributes,
  49. ::_SECURITY_ATTRIBUTES* lpThreadAttributes,
  50. boost::winapi::INT_ bInheritHandles,
  51. boost::winapi::DWORD_ dwCreationFlags,
  52. boost::winapi::LPVOID_ lpEnvironment,
  53. boost::winapi::LPCSTR_ lpCurrentDirectory,
  54. ::_STARTUPINFOA* lpStartupInfo,
  55. ::_PROCESS_INFORMATION* lpProcessInformation);
  56. #endif
  57. BOOST_SYMBOL_IMPORT boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC CreateProcessW(
  58. boost::winapi::LPCWSTR_ lpApplicationName,
  59. boost::winapi::LPWSTR_ lpCommandLine,
  60. ::_SECURITY_ATTRIBUTES* lpProcessAttributes,
  61. ::_SECURITY_ATTRIBUTES* lpThreadAttributes,
  62. boost::winapi::INT_ bInheritHandles,
  63. boost::winapi::DWORD_ dwCreationFlags,
  64. boost::winapi::LPVOID_ lpEnvironment,
  65. boost::winapi::LPCWSTR_ lpCurrentDirectory,
  66. ::_STARTUPINFOW* lpStartupInfo,
  67. ::_PROCESS_INFORMATION* lpProcessInformation);
  68. #endif // BOOST_WINAPI_PARTITION_DESKTOP_SYSTEM
  69. #if BOOST_WINAPI_PARTITION_APP_SYSTEM
  70. BOOST_SYMBOL_IMPORT boost::winapi::HANDLE_ BOOST_WINAPI_WINAPI_CC OpenProcess(
  71. boost::winapi::DWORD_ dwDesiredAccess,
  72. boost::winapi::BOOL_ bInheritHandle,
  73. boost::winapi::DWORD_ dwProcessId);
  74. BOOST_SYMBOL_IMPORT boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC TerminateProcess(
  75. boost::winapi::HANDLE_ hProcess,
  76. boost::winapi::UINT_ uExitCode);
  77. #endif // BOOST_WINAPI_PARTITION_APP_SYSTEM
  78. } // extern "C"
  79. #endif // defined BOOST_WINDOWS_H
  80. namespace boost {
  81. namespace winapi {
  82. #if defined( BOOST_USE_WINDOWS_H )
  83. #if BOOST_WINAPI_PARTITION_APP_SYSTEM
  84. BOOST_CONSTEXPR_OR_CONST DWORD_ DEBUG_PROCESS_ = DEBUG_PROCESS;
  85. BOOST_CONSTEXPR_OR_CONST DWORD_ DEBUG_ONLY_THIS_PROCESS_ = DEBUG_ONLY_THIS_PROCESS;
  86. BOOST_CONSTEXPR_OR_CONST DWORD_ CREATE_SUSPENDED_ = CREATE_SUSPENDED;
  87. BOOST_CONSTEXPR_OR_CONST DWORD_ DETACHED_PROCESS_ = DETACHED_PROCESS;
  88. BOOST_CONSTEXPR_OR_CONST DWORD_ CREATE_NEW_CONSOLE_ = CREATE_NEW_CONSOLE;
  89. BOOST_CONSTEXPR_OR_CONST DWORD_ CREATE_NEW_PROCESS_GROUP_ = CREATE_NEW_PROCESS_GROUP;
  90. BOOST_CONSTEXPR_OR_CONST DWORD_ CREATE_UNICODE_ENVIRONMENT_ = CREATE_UNICODE_ENVIRONMENT;
  91. BOOST_CONSTEXPR_OR_CONST DWORD_ CREATE_SEPARATE_WOW_VDM_ = CREATE_SEPARATE_WOW_VDM;
  92. BOOST_CONSTEXPR_OR_CONST DWORD_ CREATE_SHARED_WOW_VDM_ = CREATE_SHARED_WOW_VDM;
  93. BOOST_CONSTEXPR_OR_CONST DWORD_ CREATE_FORCEDOS_ = CREATE_FORCEDOS;
  94. BOOST_CONSTEXPR_OR_CONST DWORD_ CREATE_BREAKAWAY_FROM_JOB_ = CREATE_BREAKAWAY_FROM_JOB;
  95. BOOST_CONSTEXPR_OR_CONST DWORD_ CREATE_DEFAULT_ERROR_MODE_ = CREATE_DEFAULT_ERROR_MODE;
  96. BOOST_CONSTEXPR_OR_CONST DWORD_ CREATE_NO_WINDOW_ = CREATE_NO_WINDOW;
  97. // Undocumented
  98. BOOST_CONSTEXPR_OR_CONST DWORD_ PROFILE_USER_ = PROFILE_USER;
  99. BOOST_CONSTEXPR_OR_CONST DWORD_ PROFILE_KERNEL_ = PROFILE_KERNEL;
  100. BOOST_CONSTEXPR_OR_CONST DWORD_ PROFILE_SERVER_ = PROFILE_SERVER;
  101. #if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6
  102. BOOST_CONSTEXPR_OR_CONST DWORD_ CREATE_PROTECTED_PROCESS_ = CREATE_PROTECTED_PROCESS;
  103. BOOST_CONSTEXPR_OR_CONST DWORD_ EXTENDED_STARTUPINFO_PRESENT_ = EXTENDED_STARTUPINFO_PRESENT;
  104. #endif
  105. #if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN7
  106. BOOST_CONSTEXPR_OR_CONST DWORD_ INHERIT_PARENT_AFFINITY_ = INHERIT_PARENT_AFFINITY;
  107. #endif
  108. // Only documented for Windows CE
  109. #if defined(UNDER_CE)
  110. BOOST_CONSTEXPR_OR_CONST DWORD_ INHERIT_CALLER_PRIORITY_ = INHERIT_CALLER_PRIORITY;
  111. #endif
  112. #endif // BOOST_WINAPI_PARTITION_APP_SYSTEM
  113. #if BOOST_WINAPI_PARTITION_DESKTOP
  114. BOOST_CONSTEXPR_OR_CONST DWORD_ STARTF_USESHOWWINDOW_ = STARTF_USESHOWWINDOW;
  115. BOOST_CONSTEXPR_OR_CONST DWORD_ STARTF_USESIZE_ = STARTF_USESIZE;
  116. BOOST_CONSTEXPR_OR_CONST DWORD_ STARTF_USEPOSITION_ = STARTF_USEPOSITION;
  117. BOOST_CONSTEXPR_OR_CONST DWORD_ STARTF_USECOUNTCHARS_ = STARTF_USECOUNTCHARS;
  118. BOOST_CONSTEXPR_OR_CONST DWORD_ STARTF_USEFILLATTRIBUTE_ = STARTF_USEFILLATTRIBUTE;
  119. BOOST_CONSTEXPR_OR_CONST DWORD_ STARTF_RUNFULLSCREEN_ = STARTF_RUNFULLSCREEN;
  120. BOOST_CONSTEXPR_OR_CONST DWORD_ STARTF_FORCEONFEEDBACK_ = STARTF_FORCEONFEEDBACK;
  121. BOOST_CONSTEXPR_OR_CONST DWORD_ STARTF_FORCEOFFFEEDBACK_ = STARTF_FORCEOFFFEEDBACK;
  122. BOOST_CONSTEXPR_OR_CONST DWORD_ STARTF_USESTDHANDLES_ = STARTF_USESTDHANDLES;
  123. BOOST_CONSTEXPR_OR_CONST DWORD_ STARTF_USEHOTKEY_ = STARTF_USEHOTKEY;
  124. #if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN7
  125. BOOST_CONSTEXPR_OR_CONST DWORD_ STARTF_TITLEISLINKNAME_ = STARTF_TITLEISLINKNAME;
  126. BOOST_CONSTEXPR_OR_CONST DWORD_ STARTF_TITLEISAPPID_ = STARTF_TITLEISAPPID;
  127. BOOST_CONSTEXPR_OR_CONST DWORD_ STARTF_PREVENTPINNING_ = STARTF_PREVENTPINNING;
  128. #endif
  129. #endif // BOOST_WINAPI_PARTITION_DESKTOP
  130. BOOST_CONSTEXPR_OR_CONST DWORD_ PROCESS_TERMINATE_ = PROCESS_TERMINATE;
  131. BOOST_CONSTEXPR_OR_CONST DWORD_ PROCESS_CREATE_THREAD_ = PROCESS_CREATE_THREAD;
  132. BOOST_CONSTEXPR_OR_CONST DWORD_ PROCESS_SET_SESSIONID_ = PROCESS_SET_SESSIONID;
  133. BOOST_CONSTEXPR_OR_CONST DWORD_ PROCESS_VM_OPERATION_ = PROCESS_VM_OPERATION;
  134. BOOST_CONSTEXPR_OR_CONST DWORD_ PROCESS_VM_READ_ = PROCESS_VM_READ;
  135. BOOST_CONSTEXPR_OR_CONST DWORD_ PROCESS_VM_WRITE_ = PROCESS_VM_WRITE;
  136. BOOST_CONSTEXPR_OR_CONST DWORD_ PROCESS_DUP_HANDLE_ = PROCESS_DUP_HANDLE;
  137. BOOST_CONSTEXPR_OR_CONST DWORD_ PROCESS_CREATE_PROCESS_ = PROCESS_CREATE_PROCESS;
  138. BOOST_CONSTEXPR_OR_CONST DWORD_ PROCESS_SET_QUOTA_ = PROCESS_SET_QUOTA;
  139. BOOST_CONSTEXPR_OR_CONST DWORD_ PROCESS_SET_INFORMATION_ = PROCESS_SET_INFORMATION;
  140. BOOST_CONSTEXPR_OR_CONST DWORD_ PROCESS_QUERY_INFORMATION_ = PROCESS_QUERY_INFORMATION;
  141. BOOST_CONSTEXPR_OR_CONST DWORD_ PROCESS_SUSPEND_RESUME_ = PROCESS_SUSPEND_RESUME;
  142. BOOST_CONSTEXPR_OR_CONST DWORD_ PROCESS_ALL_ACCESS_ = PROCESS_ALL_ACCESS;
  143. #else // defined( BOOST_USE_WINDOWS_H )
  144. #if BOOST_WINAPI_PARTITION_APP_SYSTEM
  145. BOOST_CONSTEXPR_OR_CONST DWORD_ DEBUG_PROCESS_ = 0x1;
  146. BOOST_CONSTEXPR_OR_CONST DWORD_ DEBUG_ONLY_THIS_PROCESS_ = 0x2;
  147. BOOST_CONSTEXPR_OR_CONST DWORD_ CREATE_SUSPENDED_ = 0x4;
  148. BOOST_CONSTEXPR_OR_CONST DWORD_ DETACHED_PROCESS_ = 0x8;
  149. BOOST_CONSTEXPR_OR_CONST DWORD_ CREATE_NEW_CONSOLE_ = 0x10;
  150. BOOST_CONSTEXPR_OR_CONST DWORD_ CREATE_NEW_PROCESS_GROUP_ = 0x200;
  151. BOOST_CONSTEXPR_OR_CONST DWORD_ CREATE_UNICODE_ENVIRONMENT_ = 0x400;
  152. BOOST_CONSTEXPR_OR_CONST DWORD_ CREATE_SEPARATE_WOW_VDM_ = 0x800;
  153. BOOST_CONSTEXPR_OR_CONST DWORD_ CREATE_SHARED_WOW_VDM_ = 0x1000;
  154. BOOST_CONSTEXPR_OR_CONST DWORD_ CREATE_FORCEDOS_ = 0x2000;
  155. BOOST_CONSTEXPR_OR_CONST DWORD_ CREATE_BREAKAWAY_FROM_JOB_ = 0x1000000;
  156. BOOST_CONSTEXPR_OR_CONST DWORD_ CREATE_DEFAULT_ERROR_MODE_ = 0x4000000;
  157. BOOST_CONSTEXPR_OR_CONST DWORD_ CREATE_NO_WINDOW_ = 0x8000000;
  158. // Undocumented
  159. BOOST_CONSTEXPR_OR_CONST DWORD_ PROFILE_USER_ = 0x10000000;
  160. BOOST_CONSTEXPR_OR_CONST DWORD_ PROFILE_KERNEL_ = 0x20000000;
  161. BOOST_CONSTEXPR_OR_CONST DWORD_ PROFILE_SERVER_ = 0x40000000;
  162. #if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6
  163. BOOST_CONSTEXPR_OR_CONST DWORD_ CREATE_PROTECTED_PROCESS_ = 0x40000;
  164. BOOST_CONSTEXPR_OR_CONST DWORD_ EXTENDED_STARTUPINFO_PRESENT_ = 0x80000;
  165. #endif
  166. #if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN7
  167. BOOST_CONSTEXPR_OR_CONST DWORD_ INHERIT_PARENT_AFFINITY_ = 0x10000;
  168. #endif
  169. // Only documented for Windows CE
  170. #if defined(UNDER_CE)
  171. BOOST_CONSTEXPR_OR_CONST DWORD_ INHERIT_CALLER_PRIORITY_ = 0x20000;
  172. #endif
  173. #endif // BOOST_WINAPI_PARTITION_APP_SYSTEM
  174. #if BOOST_WINAPI_PARTITION_DESKTOP
  175. BOOST_CONSTEXPR_OR_CONST DWORD_ STARTF_USESHOWWINDOW_ = 0x00000001;
  176. BOOST_CONSTEXPR_OR_CONST DWORD_ STARTF_USESIZE_ = 0x00000002;
  177. BOOST_CONSTEXPR_OR_CONST DWORD_ STARTF_USEPOSITION_ = 0x00000004;
  178. BOOST_CONSTEXPR_OR_CONST DWORD_ STARTF_USECOUNTCHARS_ = 0x00000008;
  179. BOOST_CONSTEXPR_OR_CONST DWORD_ STARTF_USEFILLATTRIBUTE_ = 0x00000010;
  180. BOOST_CONSTEXPR_OR_CONST DWORD_ STARTF_RUNFULLSCREEN_ = 0x00000020;
  181. BOOST_CONSTEXPR_OR_CONST DWORD_ STARTF_FORCEONFEEDBACK_ = 0x00000040;
  182. BOOST_CONSTEXPR_OR_CONST DWORD_ STARTF_FORCEOFFFEEDBACK_ = 0x00000080;
  183. BOOST_CONSTEXPR_OR_CONST DWORD_ STARTF_USESTDHANDLES_ = 0x00000100;
  184. BOOST_CONSTEXPR_OR_CONST DWORD_ STARTF_USEHOTKEY_ = 0x00000200;
  185. #if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN7
  186. BOOST_CONSTEXPR_OR_CONST DWORD_ STARTF_TITLEISLINKNAME_ = 0x00000800;
  187. BOOST_CONSTEXPR_OR_CONST DWORD_ STARTF_TITLEISAPPID_ = 0x00001000;
  188. BOOST_CONSTEXPR_OR_CONST DWORD_ STARTF_PREVENTPINNING_ = 0x00002000;
  189. #endif
  190. #endif // BOOST_WINAPI_PARTITION_DESKTOP
  191. BOOST_CONSTEXPR_OR_CONST DWORD_ PROCESS_TERMINATE_ = 0x0001;
  192. BOOST_CONSTEXPR_OR_CONST DWORD_ PROCESS_CREATE_THREAD_ = 0x0002;
  193. BOOST_CONSTEXPR_OR_CONST DWORD_ PROCESS_SET_SESSIONID_ = 0x0004;
  194. BOOST_CONSTEXPR_OR_CONST DWORD_ PROCESS_VM_OPERATION_ = 0x0008;
  195. BOOST_CONSTEXPR_OR_CONST DWORD_ PROCESS_VM_READ_ = 0x0010;
  196. BOOST_CONSTEXPR_OR_CONST DWORD_ PROCESS_VM_WRITE_ = 0x0020;
  197. BOOST_CONSTEXPR_OR_CONST DWORD_ PROCESS_DUP_HANDLE_ = 0x0040;
  198. BOOST_CONSTEXPR_OR_CONST DWORD_ PROCESS_CREATE_PROCESS_ = 0x0080;
  199. BOOST_CONSTEXPR_OR_CONST DWORD_ PROCESS_SET_QUOTA_ = 0x0100;
  200. BOOST_CONSTEXPR_OR_CONST DWORD_ PROCESS_SET_INFORMATION_ = 0x0200;
  201. BOOST_CONSTEXPR_OR_CONST DWORD_ PROCESS_QUERY_INFORMATION_ = 0x0400;
  202. BOOST_CONSTEXPR_OR_CONST DWORD_ PROCESS_SUSPEND_RESUME_ = 0x0800;
  203. BOOST_CONSTEXPR_OR_CONST DWORD_ PROCESS_ALL_ACCESS_ = (STANDARD_RIGHTS_REQUIRED_ | SYNCHRONIZE_ |
  204. #if BOOST_USE_NTDDI_VERSION >= BOOST_WINAPI_NTDDI_WIN6
  205. 0xFFFF
  206. #else
  207. 0x0FFF
  208. #endif
  209. );
  210. #endif // defined( BOOST_USE_WINDOWS_H )
  211. #if BOOST_WINAPI_PARTITION_APP_SYSTEM
  212. #if defined( BOOST_USE_WINDOWS_H ) && !defined( BOOST_WINAPI_IS_MINGW )
  213. BOOST_CONSTEXPR_OR_CONST DWORD_ CREATE_PRESERVE_CODE_AUTHZ_LEVEL_ = CREATE_PRESERVE_CODE_AUTHZ_LEVEL;
  214. // Undocumented
  215. BOOST_CONSTEXPR_OR_CONST DWORD_ CREATE_IGNORE_SYSTEM_DEFAULT_ = CREATE_IGNORE_SYSTEM_DEFAULT;
  216. #else // defined( BOOST_USE_WINDOWS_H ) && !defined( BOOST_WINAPI_IS_MINGW )
  217. BOOST_CONSTEXPR_OR_CONST DWORD_ CREATE_PRESERVE_CODE_AUTHZ_LEVEL_ = 0x2000000;
  218. // Undocumented
  219. BOOST_CONSTEXPR_OR_CONST DWORD_ CREATE_IGNORE_SYSTEM_DEFAULT_ = 0x80000000;
  220. #endif // defined( BOOST_USE_WINDOWS_H ) && !defined( BOOST_WINAPI_IS_MINGW )
  221. #endif // BOOST_WINAPI_PARTITION_APP_SYSTEM
  222. #if BOOST_WINAPI_PARTITION_APP_SYSTEM
  223. typedef struct BOOST_MAY_ALIAS _PROCESS_INFORMATION {
  224. HANDLE_ hProcess;
  225. HANDLE_ hThread;
  226. DWORD_ dwProcessId;
  227. DWORD_ dwThreadId;
  228. } PROCESS_INFORMATION_, *PPROCESS_INFORMATION_, *LPPROCESS_INFORMATION_;
  229. #if !defined(BOOST_NO_ANSI_APIS)
  230. typedef struct BOOST_MAY_ALIAS _STARTUPINFOA {
  231. DWORD_ cb;
  232. LPSTR_ lpReserved;
  233. LPSTR_ lpDesktop;
  234. LPSTR_ lpTitle;
  235. DWORD_ dwX;
  236. DWORD_ dwY;
  237. DWORD_ dwXSize;
  238. DWORD_ dwYSize;
  239. DWORD_ dwXCountChars;
  240. DWORD_ dwYCountChars;
  241. DWORD_ dwFillAttribute;
  242. DWORD_ dwFlags;
  243. WORD_ wShowWindow;
  244. WORD_ cbReserved2;
  245. LPBYTE_ lpReserved2;
  246. HANDLE_ hStdInput;
  247. HANDLE_ hStdOutput;
  248. HANDLE_ hStdError;
  249. } STARTUPINFOA_, *LPSTARTUPINFOA_;
  250. #endif // !defined(BOOST_NO_ANSI_APIS)
  251. typedef struct BOOST_MAY_ALIAS _STARTUPINFOW {
  252. DWORD_ cb;
  253. LPWSTR_ lpReserved;
  254. LPWSTR_ lpDesktop;
  255. LPWSTR_ lpTitle;
  256. DWORD_ dwX;
  257. DWORD_ dwY;
  258. DWORD_ dwXSize;
  259. DWORD_ dwYSize;
  260. DWORD_ dwXCountChars;
  261. DWORD_ dwYCountChars;
  262. DWORD_ dwFillAttribute;
  263. DWORD_ dwFlags;
  264. WORD_ wShowWindow;
  265. WORD_ cbReserved2;
  266. LPBYTE_ lpReserved2;
  267. HANDLE_ hStdInput;
  268. HANDLE_ hStdOutput;
  269. HANDLE_ hStdError;
  270. } STARTUPINFOW_, *LPSTARTUPINFOW_;
  271. #endif // BOOST_WINAPI_PARTITION_APP_SYSTEM
  272. #if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6
  273. #if BOOST_WINAPI_PARTITION_DESKTOP_SYSTEM
  274. typedef struct _PROC_THREAD_ATTRIBUTE_LIST PROC_THREAD_ATTRIBUTE_LIST_, *PPROC_THREAD_ATTRIBUTE_LIST_;
  275. #endif // BOOST_WINAPI_PARTITION_DESKTOP_SYSTEM
  276. #if BOOST_WINAPI_PARTITION_DESKTOP
  277. #if !defined(BOOST_NO_ANSI_APIS)
  278. typedef struct BOOST_MAY_ALIAS _STARTUPINFOEXA {
  279. STARTUPINFOA_ StartupInfo;
  280. PPROC_THREAD_ATTRIBUTE_LIST_ lpAttributeList;
  281. } STARTUPINFOEXA_, *LPSTARTUPINFOEXA_;
  282. #endif // !defined(BOOST_NO_ANSI_APIS)
  283. typedef struct BOOST_MAY_ALIAS _STARTUPINFOEXW {
  284. STARTUPINFOW_ StartupInfo;
  285. PPROC_THREAD_ATTRIBUTE_LIST_ lpAttributeList;
  286. } STARTUPINFOEXW_, *LPSTARTUPINFOEXW_;
  287. #endif // BOOST_WINAPI_PARTITION_DESKTOP
  288. #endif // BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6
  289. #if BOOST_WINAPI_PARTITION_APP_SYSTEM
  290. using ::TerminateProcess;
  291. using ::OpenProcess;
  292. #endif // BOOST_WINAPI_PARTITION_APP_SYSTEM
  293. #if BOOST_WINAPI_PARTITION_DESKTOP_SYSTEM
  294. using ::GetExitCodeProcess;
  295. using ::ExitProcess;
  296. #if !defined( BOOST_NO_ANSI_APIS )
  297. BOOST_FORCEINLINE BOOL_ CreateProcessA(
  298. LPCSTR_ lpApplicationName,
  299. LPSTR_ lpCommandLine,
  300. LPSECURITY_ATTRIBUTES_ lpProcessAttributes,
  301. LPSECURITY_ATTRIBUTES_ lpThreadAttributes,
  302. INT_ bInheritHandles,
  303. DWORD_ dwCreationFlags,
  304. LPVOID_ lpEnvironment,
  305. LPCSTR_ lpCurrentDirectory,
  306. LPSTARTUPINFOA_ lpStartupInfo,
  307. LPPROCESS_INFORMATION_ lpProcessInformation)
  308. {
  309. return ::CreateProcessA(
  310. lpApplicationName,
  311. lpCommandLine,
  312. reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(lpProcessAttributes),
  313. reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(lpThreadAttributes),
  314. bInheritHandles,
  315. dwCreationFlags,
  316. lpEnvironment,
  317. lpCurrentDirectory,
  318. reinterpret_cast< ::_STARTUPINFOA* >(lpStartupInfo),
  319. reinterpret_cast< ::_PROCESS_INFORMATION* >(lpProcessInformation));
  320. }
  321. BOOST_FORCEINLINE BOOL_ create_process(
  322. LPCSTR_ lpApplicationName,
  323. LPSTR_ lpCommandLine,
  324. LPSECURITY_ATTRIBUTES_ lpProcessAttributes,
  325. LPSECURITY_ATTRIBUTES_ lpThreadAttributes,
  326. INT_ bInheritHandles,
  327. DWORD_ dwCreationFlags,
  328. LPVOID_ lpEnvironment,
  329. LPCSTR_ lpCurrentDirectory,
  330. LPSTARTUPINFOA_ lpStartupInfo,
  331. LPPROCESS_INFORMATION_ lpProcessInformation)
  332. {
  333. return ::CreateProcessA(
  334. lpApplicationName,
  335. lpCommandLine,
  336. reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(lpProcessAttributes),
  337. reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(lpThreadAttributes),
  338. bInheritHandles,
  339. dwCreationFlags,
  340. lpEnvironment,
  341. lpCurrentDirectory,
  342. reinterpret_cast< ::_STARTUPINFOA* >(lpStartupInfo),
  343. reinterpret_cast< ::_PROCESS_INFORMATION* >(lpProcessInformation));
  344. }
  345. #endif
  346. BOOST_FORCEINLINE BOOL_ CreateProcessW(
  347. LPCWSTR_ lpApplicationName,
  348. LPWSTR_ lpCommandLine,
  349. LPSECURITY_ATTRIBUTES_ lpProcessAttributes,
  350. LPSECURITY_ATTRIBUTES_ lpThreadAttributes,
  351. INT_ bInheritHandles,
  352. DWORD_ dwCreationFlags,
  353. LPVOID_ lpEnvironment,
  354. LPCWSTR_ lpCurrentDirectory,
  355. LPSTARTUPINFOW_ lpStartupInfo,
  356. LPPROCESS_INFORMATION_ lpProcessInformation)
  357. {
  358. return ::CreateProcessW(
  359. lpApplicationName,
  360. lpCommandLine,
  361. reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(lpProcessAttributes),
  362. reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(lpThreadAttributes),
  363. bInheritHandles,
  364. dwCreationFlags,
  365. lpEnvironment,
  366. lpCurrentDirectory,
  367. reinterpret_cast< ::_STARTUPINFOW* >(lpStartupInfo),
  368. reinterpret_cast< ::_PROCESS_INFORMATION* >(lpProcessInformation));
  369. }
  370. BOOST_FORCEINLINE BOOL_ create_process(
  371. LPCWSTR_ lpApplicationName,
  372. LPWSTR_ lpCommandLine,
  373. LPSECURITY_ATTRIBUTES_ lpProcessAttributes,
  374. LPSECURITY_ATTRIBUTES_ lpThreadAttributes,
  375. INT_ bInheritHandles,
  376. DWORD_ dwCreationFlags,
  377. LPVOID_ lpEnvironment,
  378. LPCWSTR_ lpCurrentDirectory,
  379. LPSTARTUPINFOW_ lpStartupInfo,
  380. LPPROCESS_INFORMATION_ lpProcessInformation)
  381. {
  382. return ::CreateProcessW(
  383. lpApplicationName,
  384. lpCommandLine,
  385. reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(lpProcessAttributes),
  386. reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(lpThreadAttributes),
  387. bInheritHandles,
  388. dwCreationFlags,
  389. lpEnvironment,
  390. lpCurrentDirectory,
  391. reinterpret_cast< ::_STARTUPINFOW* >(lpStartupInfo),
  392. reinterpret_cast< ::_PROCESS_INFORMATION* >(lpProcessInformation));
  393. }
  394. #endif // BOOST_WINAPI_PARTITION_DESKTOP_SYSTEM
  395. }
  396. }
  397. #endif // BOOST_WINAPI_PROCESS_HPP_INCLUDED_