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
9 #ifndef BOOST_WINAPI_PROCESS_HPP_INCLUDED_
10 #define BOOST_WINAPI_PROCESS_HPP_INCLUDED_
11
12 #include <boost/winapi/config.hpp>
13 #include <boost/winapi/basic_types.hpp>
14 #include <boost/winapi/access_rights.hpp>
15 #include <boost/winapi/get_current_process.hpp>
16 #include <boost/winapi/get_current_process_id.hpp>
17 #include <boost/winapi/detail/header.hpp>
18
19 #ifdef BOOST_HAS_PRAGMA_ONCE
20 #pragma once
21 #endif
22
23 #if !defined( BOOST_USE_WINDOWS_H )
24 extern "C" {
25
26 #if BOOST_WINAPI_PARTITION_APP_SYSTEM
27 struct _PROCESS_INFORMATION;
28 #if !defined( BOOST_NO_ANSI_APIS )
29 struct _STARTUPINFOA;
30 #endif
31 struct _STARTUPINFOW;
32 #endif // BOOST_WINAPI_PARTITION_APP_SYSTEM
33
34 #if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6
35
36 #if BOOST_WINAPI_PARTITION_DESKTOP_SYSTEM
37 struct _PROC_THREAD_ATTRIBUTE_LIST;
38 #endif // BOOST_WINAPI_PARTITION_DESKTOP_SYSTEM
39
40 #if BOOST_WINAPI_PARTITION_DESKTOP
41 #if !defined( BOOST_NO_ANSI_APIS )
42 struct _STARTUPINFOEXA;
43 #endif
44 struct _STARTUPINFOEXW;
45 #endif // BOOST_WINAPI_PARTITION_DESKTOP
46
47 #endif // BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6
48
49 #if BOOST_WINAPI_PARTITION_DESKTOP_SYSTEM
50
51 #if !defined(_WIN32_WCE)
52 // On Windows CE ExitProcess is a macro to call TerminateProcess
53 BOOST_WINAPI_IMPORT BOOST_NORETURN boost::winapi::VOID_ BOOST_WINAPI_WINAPI_CC
54 ExitProcess(boost::winapi::UINT_ uExitCode);
55 #endif
56
57 BOOST_WINAPI_IMPORT_EXCEPT_WM boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC GetExitCodeProcess(
58 boost::winapi::HANDLE_ hProcess,
59 boost::winapi::LPDWORD_ lpExitCode);
60
61 #if !defined( BOOST_NO_ANSI_APIS )
62 BOOST_WINAPI_IMPORT boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC CreateProcessA(
63 boost::winapi::LPCSTR_ lpApplicationName,
64 boost::winapi::LPSTR_ lpCommandLine,
65 ::_SECURITY_ATTRIBUTES* lpProcessAttributes,
66 ::_SECURITY_ATTRIBUTES* lpThreadAttributes,
67 boost::winapi::INT_ bInheritHandles,
68 boost::winapi::DWORD_ dwCreationFlags,
69 boost::winapi::LPVOID_ lpEnvironment,
70 boost::winapi::LPCSTR_ lpCurrentDirectory,
71 ::_STARTUPINFOA* lpStartupInfo,
72 ::_PROCESS_INFORMATION* lpProcessInformation);
73 #endif
74
75 #if defined(_WIN32_WCE)
76 BOOST_WINAPI_IMPORT_EXCEPT_WM boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC CreateProcessW(
77 boost::winapi::LPCWSTR_ lpApplicationName,
78 boost::winapi::LPCWSTR_ lpCommandLine,
79 ::_SECURITY_ATTRIBUTES* lpProcessAttributes,
80 ::_SECURITY_ATTRIBUTES* lpThreadAttributes,
81 boost::winapi::INT_ bInheritHandles,
82 boost::winapi::DWORD_ dwCreationFlags,
83 boost::winapi::LPVOID_ lpEnvironment,
84 boost::winapi::LPWSTR_ lpCurrentDirectory,
85 ::_STARTUPINFOW* lpStartupInfo,
86 ::_PROCESS_INFORMATION* lpProcessInformation);
87 #else
88 BOOST_WINAPI_IMPORT boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC CreateProcessW(
89 boost::winapi::LPCWSTR_ lpApplicationName,
90 boost::winapi::LPWSTR_ lpCommandLine,
91 ::_SECURITY_ATTRIBUTES* lpProcessAttributes,
92 ::_SECURITY_ATTRIBUTES* lpThreadAttributes,
93 boost::winapi::INT_ bInheritHandles,
94 boost::winapi::DWORD_ dwCreationFlags,
95 boost::winapi::LPVOID_ lpEnvironment,
96 boost::winapi::LPCWSTR_ lpCurrentDirectory,
97 ::_STARTUPINFOW* lpStartupInfo,
98 ::_PROCESS_INFORMATION* lpProcessInformation);
99 #endif
100
101
102 #endif // BOOST_WINAPI_PARTITION_DESKTOP_SYSTEM
103
104 #if BOOST_WINAPI_PARTITION_APP_SYSTEM
105
106 BOOST_WINAPI_IMPORT_EXCEPT_WM boost::winapi::HANDLE_ BOOST_WINAPI_WINAPI_CC OpenProcess(
107 boost::winapi::DWORD_ dwDesiredAccess,
108 boost::winapi::BOOL_ bInheritHandle,
109 boost::winapi::DWORD_ dwProcessId);
110
111 #if defined(_WIN32_WCE)
112 BOOST_WINAPI_IMPORT_EXCEPT_WM boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC TerminateProcess(
113 boost::winapi::HANDLE_ hProcess,
114 boost::winapi::DWORD_ uExitCode);
115 #else
116 BOOST_WINAPI_IMPORT_EXCEPT_WM boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC TerminateProcess(
117 boost::winapi::HANDLE_ hProcess,
118 boost::winapi::UINT_ uExitCode);
119 #endif
120
121 #endif // BOOST_WINAPI_PARTITION_APP_SYSTEM
122
123 } // extern "C"
124 #endif // defined BOOST_WINDOWS_H
125
126 namespace boost {
127 namespace winapi {
128
129 #if defined( BOOST_USE_WINDOWS_H )
130
131 #if BOOST_WINAPI_PARTITION_APP_SYSTEM
132
133 BOOST_CONSTEXPR_OR_CONST DWORD_ DEBUG_PROCESS_ = DEBUG_PROCESS;
134 BOOST_CONSTEXPR_OR_CONST DWORD_ DEBUG_ONLY_THIS_PROCESS_ = DEBUG_ONLY_THIS_PROCESS;
135 BOOST_CONSTEXPR_OR_CONST DWORD_ CREATE_SUSPENDED_ = CREATE_SUSPENDED;
136 BOOST_CONSTEXPR_OR_CONST DWORD_ DETACHED_PROCESS_ = DETACHED_PROCESS;
137 BOOST_CONSTEXPR_OR_CONST DWORD_ CREATE_NEW_CONSOLE_ = CREATE_NEW_CONSOLE;
138 BOOST_CONSTEXPR_OR_CONST DWORD_ CREATE_NEW_PROCESS_GROUP_ = CREATE_NEW_PROCESS_GROUP;
139 BOOST_CONSTEXPR_OR_CONST DWORD_ CREATE_UNICODE_ENVIRONMENT_ = CREATE_UNICODE_ENVIRONMENT;
140 BOOST_CONSTEXPR_OR_CONST DWORD_ CREATE_SEPARATE_WOW_VDM_ = CREATE_SEPARATE_WOW_VDM;
141 BOOST_CONSTEXPR_OR_CONST DWORD_ CREATE_SHARED_WOW_VDM_ = CREATE_SHARED_WOW_VDM;
142 BOOST_CONSTEXPR_OR_CONST DWORD_ CREATE_FORCEDOS_ = CREATE_FORCEDOS;
143 BOOST_CONSTEXPR_OR_CONST DWORD_ CREATE_BREAKAWAY_FROM_JOB_ = CREATE_BREAKAWAY_FROM_JOB;
144 BOOST_CONSTEXPR_OR_CONST DWORD_ CREATE_DEFAULT_ERROR_MODE_ = CREATE_DEFAULT_ERROR_MODE;
145 BOOST_CONSTEXPR_OR_CONST DWORD_ CREATE_NO_WINDOW_ = CREATE_NO_WINDOW;
146
147 // Undocumented
148 BOOST_CONSTEXPR_OR_CONST DWORD_ PROFILE_USER_ = PROFILE_USER;
149 BOOST_CONSTEXPR_OR_CONST DWORD_ PROFILE_KERNEL_ = PROFILE_KERNEL;
150 BOOST_CONSTEXPR_OR_CONST DWORD_ PROFILE_SERVER_ = PROFILE_SERVER;
151
152 #if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6
153 BOOST_CONSTEXPR_OR_CONST DWORD_ CREATE_PROTECTED_PROCESS_ = CREATE_PROTECTED_PROCESS;
154 BOOST_CONSTEXPR_OR_CONST DWORD_ EXTENDED_STARTUPINFO_PRESENT_ = EXTENDED_STARTUPINFO_PRESENT;
155 #endif
156
157 #if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN7
158 BOOST_CONSTEXPR_OR_CONST DWORD_ INHERIT_PARENT_AFFINITY_ = INHERIT_PARENT_AFFINITY;
159 #endif
160
161 // Only documented for Windows CE
162 #if defined(UNDER_CE)
163 BOOST_CONSTEXPR_OR_CONST DWORD_ INHERIT_CALLER_PRIORITY_ = INHERIT_CALLER_PRIORITY;
164 #endif
165
166 #endif // BOOST_WINAPI_PARTITION_APP_SYSTEM
167
168 #if BOOST_WINAPI_PARTITION_DESKTOP
169
170 BOOST_CONSTEXPR_OR_CONST DWORD_ STARTF_USESHOWWINDOW_ = STARTF_USESHOWWINDOW;
171 BOOST_CONSTEXPR_OR_CONST DWORD_ STARTF_USESIZE_ = STARTF_USESIZE;
172 BOOST_CONSTEXPR_OR_CONST DWORD_ STARTF_USEPOSITION_ = STARTF_USEPOSITION;
173 BOOST_CONSTEXPR_OR_CONST DWORD_ STARTF_USECOUNTCHARS_ = STARTF_USECOUNTCHARS;
174 BOOST_CONSTEXPR_OR_CONST DWORD_ STARTF_USEFILLATTRIBUTE_ = STARTF_USEFILLATTRIBUTE;
175 BOOST_CONSTEXPR_OR_CONST DWORD_ STARTF_RUNFULLSCREEN_ = STARTF_RUNFULLSCREEN;
176 BOOST_CONSTEXPR_OR_CONST DWORD_ STARTF_FORCEONFEEDBACK_ = STARTF_FORCEONFEEDBACK;
177 BOOST_CONSTEXPR_OR_CONST DWORD_ STARTF_FORCEOFFFEEDBACK_ = STARTF_FORCEOFFFEEDBACK;
178 BOOST_CONSTEXPR_OR_CONST DWORD_ STARTF_USESTDHANDLES_ = STARTF_USESTDHANDLES;
179 BOOST_CONSTEXPR_OR_CONST DWORD_ STARTF_USEHOTKEY_ = STARTF_USEHOTKEY;
180
181 #if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN7
182 BOOST_CONSTEXPR_OR_CONST DWORD_ STARTF_TITLEISLINKNAME_ = STARTF_TITLEISLINKNAME;
183 BOOST_CONSTEXPR_OR_CONST DWORD_ STARTF_TITLEISAPPID_ = STARTF_TITLEISAPPID;
184 BOOST_CONSTEXPR_OR_CONST DWORD_ STARTF_PREVENTPINNING_ = STARTF_PREVENTPINNING;
185 #endif
186
187 #endif // BOOST_WINAPI_PARTITION_DESKTOP
188
189 BOOST_CONSTEXPR_OR_CONST DWORD_ PROCESS_TERMINATE_ = PROCESS_TERMINATE;
190 BOOST_CONSTEXPR_OR_CONST DWORD_ PROCESS_CREATE_THREAD_ = PROCESS_CREATE_THREAD;
191 BOOST_CONSTEXPR_OR_CONST DWORD_ PROCESS_SET_SESSIONID_ = PROCESS_SET_SESSIONID;
192 BOOST_CONSTEXPR_OR_CONST DWORD_ PROCESS_VM_OPERATION_ = PROCESS_VM_OPERATION;
193 BOOST_CONSTEXPR_OR_CONST DWORD_ PROCESS_VM_READ_ = PROCESS_VM_READ;
194 BOOST_CONSTEXPR_OR_CONST DWORD_ PROCESS_VM_WRITE_ = PROCESS_VM_WRITE;
195 BOOST_CONSTEXPR_OR_CONST DWORD_ PROCESS_DUP_HANDLE_ = PROCESS_DUP_HANDLE;
196 BOOST_CONSTEXPR_OR_CONST DWORD_ PROCESS_CREATE_PROCESS_ = PROCESS_CREATE_PROCESS;
197 BOOST_CONSTEXPR_OR_CONST DWORD_ PROCESS_SET_QUOTA_ = PROCESS_SET_QUOTA;
198 BOOST_CONSTEXPR_OR_CONST DWORD_ PROCESS_SET_INFORMATION_ = PROCESS_SET_INFORMATION;
199 BOOST_CONSTEXPR_OR_CONST DWORD_ PROCESS_QUERY_INFORMATION_ = PROCESS_QUERY_INFORMATION;
200 BOOST_CONSTEXPR_OR_CONST DWORD_ PROCESS_SUSPEND_RESUME_ = PROCESS_SUSPEND_RESUME;
201 BOOST_CONSTEXPR_OR_CONST DWORD_ PROCESS_ALL_ACCESS_ = PROCESS_ALL_ACCESS;
202
203 #else // defined( BOOST_USE_WINDOWS_H )
204
205 #if BOOST_WINAPI_PARTITION_APP_SYSTEM
206
207 BOOST_CONSTEXPR_OR_CONST DWORD_ DEBUG_PROCESS_ = 0x1;
208 BOOST_CONSTEXPR_OR_CONST DWORD_ DEBUG_ONLY_THIS_PROCESS_ = 0x2;
209 BOOST_CONSTEXPR_OR_CONST DWORD_ CREATE_SUSPENDED_ = 0x4;
210 BOOST_CONSTEXPR_OR_CONST DWORD_ DETACHED_PROCESS_ = 0x8;
211 BOOST_CONSTEXPR_OR_CONST DWORD_ CREATE_NEW_CONSOLE_ = 0x10;
212 BOOST_CONSTEXPR_OR_CONST DWORD_ CREATE_NEW_PROCESS_GROUP_ = 0x200;
213 BOOST_CONSTEXPR_OR_CONST DWORD_ CREATE_UNICODE_ENVIRONMENT_ = 0x400;
214 BOOST_CONSTEXPR_OR_CONST DWORD_ CREATE_SEPARATE_WOW_VDM_ = 0x800;
215 BOOST_CONSTEXPR_OR_CONST DWORD_ CREATE_SHARED_WOW_VDM_ = 0x1000;
216 BOOST_CONSTEXPR_OR_CONST DWORD_ CREATE_FORCEDOS_ = 0x2000;
217 BOOST_CONSTEXPR_OR_CONST DWORD_ CREATE_BREAKAWAY_FROM_JOB_ = 0x1000000;
218 BOOST_CONSTEXPR_OR_CONST DWORD_ CREATE_DEFAULT_ERROR_MODE_ = 0x4000000;
219 BOOST_CONSTEXPR_OR_CONST DWORD_ CREATE_NO_WINDOW_ = 0x8000000;
220
221 // Undocumented
222 BOOST_CONSTEXPR_OR_CONST DWORD_ PROFILE_USER_ = 0x10000000;
223 BOOST_CONSTEXPR_OR_CONST DWORD_ PROFILE_KERNEL_ = 0x20000000;
224 BOOST_CONSTEXPR_OR_CONST DWORD_ PROFILE_SERVER_ = 0x40000000;
225
226 #if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6
227 BOOST_CONSTEXPR_OR_CONST DWORD_ CREATE_PROTECTED_PROCESS_ = 0x40000;
228 BOOST_CONSTEXPR_OR_CONST DWORD_ EXTENDED_STARTUPINFO_PRESENT_ = 0x80000;
229 #endif
230
231 #if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN7
232 BOOST_CONSTEXPR_OR_CONST DWORD_ INHERIT_PARENT_AFFINITY_ = 0x10000;
233 #endif
234
235 // Only documented for Windows CE
236 #if defined(UNDER_CE)
237 BOOST_CONSTEXPR_OR_CONST DWORD_ INHERIT_CALLER_PRIORITY_ = 0x20000;
238 #endif
239
240 #endif // BOOST_WINAPI_PARTITION_APP_SYSTEM
241
242 #if BOOST_WINAPI_PARTITION_DESKTOP
243
244 BOOST_CONSTEXPR_OR_CONST DWORD_ STARTF_USESHOWWINDOW_ = 0x00000001;
245 BOOST_CONSTEXPR_OR_CONST DWORD_ STARTF_USESIZE_ = 0x00000002;
246 BOOST_CONSTEXPR_OR_CONST DWORD_ STARTF_USEPOSITION_ = 0x00000004;
247 BOOST_CONSTEXPR_OR_CONST DWORD_ STARTF_USECOUNTCHARS_ = 0x00000008;
248 BOOST_CONSTEXPR_OR_CONST DWORD_ STARTF_USEFILLATTRIBUTE_ = 0x00000010;
249 BOOST_CONSTEXPR_OR_CONST DWORD_ STARTF_RUNFULLSCREEN_ = 0x00000020;
250 BOOST_CONSTEXPR_OR_CONST DWORD_ STARTF_FORCEONFEEDBACK_ = 0x00000040;
251 BOOST_CONSTEXPR_OR_CONST DWORD_ STARTF_FORCEOFFFEEDBACK_ = 0x00000080;
252 BOOST_CONSTEXPR_OR_CONST DWORD_ STARTF_USESTDHANDLES_ = 0x00000100;
253 BOOST_CONSTEXPR_OR_CONST DWORD_ STARTF_USEHOTKEY_ = 0x00000200;
254
255 #if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN7
256 BOOST_CONSTEXPR_OR_CONST DWORD_ STARTF_TITLEISLINKNAME_ = 0x00000800;
257 BOOST_CONSTEXPR_OR_CONST DWORD_ STARTF_TITLEISAPPID_ = 0x00001000;
258 BOOST_CONSTEXPR_OR_CONST DWORD_ STARTF_PREVENTPINNING_ = 0x00002000;
259 #endif
260
261 #endif // BOOST_WINAPI_PARTITION_DESKTOP
262
263 BOOST_CONSTEXPR_OR_CONST DWORD_ PROCESS_TERMINATE_ = 0x0001;
264 BOOST_CONSTEXPR_OR_CONST DWORD_ PROCESS_CREATE_THREAD_ = 0x0002;
265 BOOST_CONSTEXPR_OR_CONST DWORD_ PROCESS_SET_SESSIONID_ = 0x0004;
266 BOOST_CONSTEXPR_OR_CONST DWORD_ PROCESS_VM_OPERATION_ = 0x0008;
267 BOOST_CONSTEXPR_OR_CONST DWORD_ PROCESS_VM_READ_ = 0x0010;
268 BOOST_CONSTEXPR_OR_CONST DWORD_ PROCESS_VM_WRITE_ = 0x0020;
269 BOOST_CONSTEXPR_OR_CONST DWORD_ PROCESS_DUP_HANDLE_ = 0x0040;
270 BOOST_CONSTEXPR_OR_CONST DWORD_ PROCESS_CREATE_PROCESS_ = 0x0080;
271 BOOST_CONSTEXPR_OR_CONST DWORD_ PROCESS_SET_QUOTA_ = 0x0100;
272 BOOST_CONSTEXPR_OR_CONST DWORD_ PROCESS_SET_INFORMATION_ = 0x0200;
273 BOOST_CONSTEXPR_OR_CONST DWORD_ PROCESS_QUERY_INFORMATION_ = 0x0400;
274 BOOST_CONSTEXPR_OR_CONST DWORD_ PROCESS_SUSPEND_RESUME_ = 0x0800;
275 BOOST_CONSTEXPR_OR_CONST DWORD_ PROCESS_ALL_ACCESS_ = (STANDARD_RIGHTS_REQUIRED_ | SYNCHRONIZE_ |
276 #if BOOST_USE_NTDDI_VERSION >= BOOST_WINAPI_NTDDI_WIN6
277 0xFFFF
278 #else
279 0x0FFF
280 #endif
281 );
282
283 #endif // defined( BOOST_USE_WINDOWS_H )
284
285 #if BOOST_WINAPI_PARTITION_APP_SYSTEM
286
287 #if defined( BOOST_USE_WINDOWS_H ) && !defined( BOOST_WINAPI_IS_MINGW )
288
289 BOOST_CONSTEXPR_OR_CONST DWORD_ CREATE_PRESERVE_CODE_AUTHZ_LEVEL_ = CREATE_PRESERVE_CODE_AUTHZ_LEVEL;
290
291 // Undocumented
292 BOOST_CONSTEXPR_OR_CONST DWORD_ CREATE_IGNORE_SYSTEM_DEFAULT_ = CREATE_IGNORE_SYSTEM_DEFAULT;
293
294 #else // defined( BOOST_USE_WINDOWS_H ) && !defined( BOOST_WINAPI_IS_MINGW )
295
296 BOOST_CONSTEXPR_OR_CONST DWORD_ CREATE_PRESERVE_CODE_AUTHZ_LEVEL_ = 0x2000000;
297
298 // Undocumented
299 BOOST_CONSTEXPR_OR_CONST DWORD_ CREATE_IGNORE_SYSTEM_DEFAULT_ = 0x80000000;
300
301 #endif // defined( BOOST_USE_WINDOWS_H ) && !defined( BOOST_WINAPI_IS_MINGW )
302
303 #endif // BOOST_WINAPI_PARTITION_APP_SYSTEM
304
305 #if BOOST_WINAPI_PARTITION_APP_SYSTEM
306
307 typedef struct BOOST_MAY_ALIAS _PROCESS_INFORMATION {
308 HANDLE_ hProcess;
309 HANDLE_ hThread;
310 DWORD_ dwProcessId;
311 DWORD_ dwThreadId;
312 } PROCESS_INFORMATION_, *PPROCESS_INFORMATION_, *LPPROCESS_INFORMATION_;
313
314 #if !defined(BOOST_NO_ANSI_APIS)
315 typedef struct BOOST_MAY_ALIAS _STARTUPINFOA {
316 DWORD_ cb;
317 LPSTR_ lpReserved;
318 LPSTR_ lpDesktop;
319 LPSTR_ lpTitle;
320 DWORD_ dwX;
321 DWORD_ dwY;
322 DWORD_ dwXSize;
323 DWORD_ dwYSize;
324 DWORD_ dwXCountChars;
325 DWORD_ dwYCountChars;
326 DWORD_ dwFillAttribute;
327 DWORD_ dwFlags;
328 WORD_ wShowWindow;
329 WORD_ cbReserved2;
330 LPBYTE_ lpReserved2;
331 HANDLE_ hStdInput;
332 HANDLE_ hStdOutput;
333 HANDLE_ hStdError;
334 } STARTUPINFOA_, *LPSTARTUPINFOA_;
335 #endif // !defined(BOOST_NO_ANSI_APIS)
336
337 typedef struct BOOST_MAY_ALIAS _STARTUPINFOW {
338 DWORD_ cb;
339 LPWSTR_ lpReserved;
340 LPWSTR_ lpDesktop;
341 LPWSTR_ lpTitle;
342 DWORD_ dwX;
343 DWORD_ dwY;
344 DWORD_ dwXSize;
345 DWORD_ dwYSize;
346 DWORD_ dwXCountChars;
347 DWORD_ dwYCountChars;
348 DWORD_ dwFillAttribute;
349 DWORD_ dwFlags;
350 WORD_ wShowWindow;
351 WORD_ cbReserved2;
352 LPBYTE_ lpReserved2;
353 HANDLE_ hStdInput;
354 HANDLE_ hStdOutput;
355 HANDLE_ hStdError;
356 } STARTUPINFOW_, *LPSTARTUPINFOW_;
357
358 #endif // BOOST_WINAPI_PARTITION_APP_SYSTEM
359
360 #if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6
361
362 #if BOOST_WINAPI_PARTITION_DESKTOP_SYSTEM
363 typedef struct _PROC_THREAD_ATTRIBUTE_LIST PROC_THREAD_ATTRIBUTE_LIST_, *PPROC_THREAD_ATTRIBUTE_LIST_;
364 #endif // BOOST_WINAPI_PARTITION_DESKTOP_SYSTEM
365
366 #if BOOST_WINAPI_PARTITION_DESKTOP
367
368 #if !defined(BOOST_NO_ANSI_APIS)
369 typedef struct BOOST_MAY_ALIAS _STARTUPINFOEXA {
370 STARTUPINFOA_ StartupInfo;
371 PPROC_THREAD_ATTRIBUTE_LIST_ lpAttributeList;
372 } STARTUPINFOEXA_, *LPSTARTUPINFOEXA_;
373 #endif // !defined(BOOST_NO_ANSI_APIS)
374
375 typedef struct BOOST_MAY_ALIAS _STARTUPINFOEXW {
376 STARTUPINFOW_ StartupInfo;
377 PPROC_THREAD_ATTRIBUTE_LIST_ lpAttributeList;
378 } STARTUPINFOEXW_, *LPSTARTUPINFOEXW_;
379
380 #endif // BOOST_WINAPI_PARTITION_DESKTOP
381
382 #endif // BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6
383
384 #if BOOST_WINAPI_PARTITION_APP_SYSTEM
385
386 using ::TerminateProcess;
387 using ::OpenProcess;
388
389 #endif // BOOST_WINAPI_PARTITION_APP_SYSTEM
390
391 #if BOOST_WINAPI_PARTITION_DESKTOP_SYSTEM
392
393 using ::GetExitCodeProcess;
394 #if !defined(_WIN32_WCE)
395 using ::ExitProcess;
396 #endif
397
exit_process(boost::winapi::UINT_ uExitCode)398 BOOST_FORCEINLINE BOOST_NORETURN boost::winapi::VOID_ exit_process(
399 boost::winapi::UINT_ uExitCode)
400 {
401 #if !defined(_WIN32_WCE)
402 ExitProcess(uExitCode);
403 #else
404 // ExitProcess macro in Windows CE and Windows Mobile SDKs actually does this
405 TerminateProcess(GetCurrentProcess(), (uExitCode));
406 #endif
407 }
408
409 #if !defined( BOOST_NO_ANSI_APIS )
CreateProcessA(LPCSTR_ lpApplicationName,LPSTR_ lpCommandLine,LPSECURITY_ATTRIBUTES_ lpProcessAttributes,LPSECURITY_ATTRIBUTES_ lpThreadAttributes,INT_ bInheritHandles,DWORD_ dwCreationFlags,LPVOID_ lpEnvironment,LPCSTR_ lpCurrentDirectory,LPSTARTUPINFOA_ lpStartupInfo,LPPROCESS_INFORMATION_ lpProcessInformation)410 BOOST_FORCEINLINE BOOL_ CreateProcessA(
411 LPCSTR_ lpApplicationName,
412 LPSTR_ lpCommandLine,
413 LPSECURITY_ATTRIBUTES_ lpProcessAttributes,
414 LPSECURITY_ATTRIBUTES_ lpThreadAttributes,
415 INT_ bInheritHandles,
416 DWORD_ dwCreationFlags,
417 LPVOID_ lpEnvironment,
418 LPCSTR_ lpCurrentDirectory,
419 LPSTARTUPINFOA_ lpStartupInfo,
420 LPPROCESS_INFORMATION_ lpProcessInformation)
421 {
422 return ::CreateProcessA(
423 lpApplicationName,
424 lpCommandLine,
425 reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(lpProcessAttributes),
426 reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(lpThreadAttributes),
427 bInheritHandles,
428 dwCreationFlags,
429 lpEnvironment,
430 lpCurrentDirectory,
431 reinterpret_cast< ::_STARTUPINFOA* >(lpStartupInfo),
432 reinterpret_cast< ::_PROCESS_INFORMATION* >(lpProcessInformation));
433 }
434
create_process(LPCSTR_ lpApplicationName,LPSTR_ lpCommandLine,LPSECURITY_ATTRIBUTES_ lpProcessAttributes,LPSECURITY_ATTRIBUTES_ lpThreadAttributes,INT_ bInheritHandles,DWORD_ dwCreationFlags,LPVOID_ lpEnvironment,LPCSTR_ lpCurrentDirectory,LPSTARTUPINFOA_ lpStartupInfo,LPPROCESS_INFORMATION_ lpProcessInformation)435 BOOST_FORCEINLINE BOOL_ create_process(
436 LPCSTR_ lpApplicationName,
437 LPSTR_ lpCommandLine,
438 LPSECURITY_ATTRIBUTES_ lpProcessAttributes,
439 LPSECURITY_ATTRIBUTES_ lpThreadAttributes,
440 INT_ bInheritHandles,
441 DWORD_ dwCreationFlags,
442 LPVOID_ lpEnvironment,
443 LPCSTR_ lpCurrentDirectory,
444 LPSTARTUPINFOA_ lpStartupInfo,
445 LPPROCESS_INFORMATION_ lpProcessInformation)
446 {
447 return ::CreateProcessA(
448 lpApplicationName,
449 lpCommandLine,
450 reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(lpProcessAttributes),
451 reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(lpThreadAttributes),
452 bInheritHandles,
453 dwCreationFlags,
454 lpEnvironment,
455 lpCurrentDirectory,
456 reinterpret_cast< ::_STARTUPINFOA* >(lpStartupInfo),
457 reinterpret_cast< ::_PROCESS_INFORMATION* >(lpProcessInformation));
458 }
459 #endif
460
CreateProcessW(LPCWSTR_ lpApplicationName,LPWSTR_ lpCommandLine,LPSECURITY_ATTRIBUTES_ lpProcessAttributes,LPSECURITY_ATTRIBUTES_ lpThreadAttributes,INT_ bInheritHandles,DWORD_ dwCreationFlags,LPVOID_ lpEnvironment,LPCWSTR_ lpCurrentDirectory,LPSTARTUPINFOW_ lpStartupInfo,LPPROCESS_INFORMATION_ lpProcessInformation)461 BOOST_FORCEINLINE BOOL_ CreateProcessW(
462 LPCWSTR_ lpApplicationName,
463 LPWSTR_ lpCommandLine,
464 LPSECURITY_ATTRIBUTES_ lpProcessAttributes,
465 LPSECURITY_ATTRIBUTES_ lpThreadAttributes,
466 INT_ bInheritHandles,
467 DWORD_ dwCreationFlags,
468 LPVOID_ lpEnvironment,
469 LPCWSTR_ lpCurrentDirectory,
470 LPSTARTUPINFOW_ lpStartupInfo,
471 LPPROCESS_INFORMATION_ lpProcessInformation)
472 {
473 return ::CreateProcessW(
474 lpApplicationName,
475 lpCommandLine,
476 reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(lpProcessAttributes),
477 reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(lpThreadAttributes),
478 bInheritHandles,
479 dwCreationFlags,
480 lpEnvironment,
481 #if defined(_WIN32_WCE)
482 const_cast<LPWSTR_>(lpCurrentDirectory),
483 #else
484 lpCurrentDirectory,
485 #endif
486 reinterpret_cast< ::_STARTUPINFOW* >(lpStartupInfo),
487 reinterpret_cast< ::_PROCESS_INFORMATION* >(lpProcessInformation));
488 }
489
create_process(LPCWSTR_ lpApplicationName,LPWSTR_ lpCommandLine,LPSECURITY_ATTRIBUTES_ lpProcessAttributes,LPSECURITY_ATTRIBUTES_ lpThreadAttributes,INT_ bInheritHandles,DWORD_ dwCreationFlags,LPVOID_ lpEnvironment,LPCWSTR_ lpCurrentDirectory,LPSTARTUPINFOW_ lpStartupInfo,LPPROCESS_INFORMATION_ lpProcessInformation)490 BOOST_FORCEINLINE BOOL_ create_process(
491 LPCWSTR_ lpApplicationName,
492 LPWSTR_ lpCommandLine,
493 LPSECURITY_ATTRIBUTES_ lpProcessAttributes,
494 LPSECURITY_ATTRIBUTES_ lpThreadAttributes,
495 INT_ bInheritHandles,
496 DWORD_ dwCreationFlags,
497 LPVOID_ lpEnvironment,
498 LPCWSTR_ lpCurrentDirectory,
499 LPSTARTUPINFOW_ lpStartupInfo,
500 LPPROCESS_INFORMATION_ lpProcessInformation)
501 {
502 return ::CreateProcessW(
503 lpApplicationName,
504 lpCommandLine,
505 reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(lpProcessAttributes),
506 reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(lpThreadAttributes),
507 bInheritHandles,
508 dwCreationFlags,
509 lpEnvironment,
510 #if defined(_WIN32_WCE)
511 const_cast<LPWSTR_>(lpCurrentDirectory),
512 #else
513 lpCurrentDirectory,
514 #endif
515 reinterpret_cast< ::_STARTUPINFOW* >(lpStartupInfo),
516 reinterpret_cast< ::_PROCESS_INFORMATION* >(lpProcessInformation));
517 }
518
519 #endif // BOOST_WINAPI_PARTITION_DESKTOP_SYSTEM
520
521 }
522 }
523
524 #include <boost/winapi/detail/footer.hpp>
525
526 #endif // BOOST_WINAPI_PROCESS_HPP_INCLUDED_
527