STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
process.h
Go to the documentation of this file.
1 //
2 // process.h
3 //
4 // Copyright (c) Microsoft Corporation. All rights reserved.
5 //
6 // This file declares the process control functionality (e.g., the exec and
7 // spawn families of functions).
8 //
9 #pragma once
10 #define _INC_PROCESS
11 
12 #include <corecrt.h>
13 #include <corecrt_startup.h>
14 #include <corecrt_wprocess.h>
15 
17 
18 
19 
20 // Flag values for the _spawn family of functions
21 #define _P_WAIT 0
22 #define _P_NOWAIT 1
23 #define _OLD_P_OVERLAY 2
24 #define _P_NOWAITO 3
25 #define _P_DETACH 4
26 #define _P_OVERLAY 2
27 
28 // Action codes for _cwait(). The action code argument to _cwait() is ignored on
29 // Win32. The parameter only exists so that we do not break existing code.
30 #define _WAIT_CHILD 0
31 #define _WAIT_GRANDCHILD 1
32 
33 
34 
35 #if _CRT_FUNCTIONS_REQUIRED
36 
37  _ACRTIMP __declspec(noreturn) void __cdecl exit(_In_ int _Code);
38  _ACRTIMP __declspec(noreturn) void __cdecl _exit(_In_ int _Code);
39  _ACRTIMP __declspec(noreturn) void __cdecl _Exit(_In_ int _Code);
40  _ACRTIMP __declspec(noreturn) void __cdecl quick_exit(_In_ int _Code);
41  _ACRTIMP __declspec(noreturn) void __cdecl abort(void);
42 
43  _DCRTIMP int __cdecl system(_In_opt_z_ char const* _Command);
44 
45  _ACRTIMP void __cdecl _cexit(void);
46  _ACRTIMP void __cdecl _c_exit(void);
47 
48  typedef void (__stdcall *_tls_callback_type)(void *, unsigned long, void *);
50 
51 #endif // _CRT_FUNCTIONS_REQUIRED
52 
53 // Declare DLL notification (initialization/termination) routines. The preferred
54 // method is for the CRT client to define DllMain(), which will automatically be
55 // called by the DLL entry point defined by the CRT. If the CRT client wants to
56 // define the DLL entry point, the client entry point must call _CRT_INIT on all
57 // types of notifications, as the very first thing on attach notifications and as
58 // the very last thing on detach notifications.
59 #ifdef _DECL_DLLMAIN
60 
61  int __stdcall DllMain(
62  _In_ void* _DllHandle,
63  _In_ unsigned long _Reason,
64  _In_opt_ void* _Reserved
65  );
66 
67  int __stdcall _CRT_INIT(
68  _In_ void* _DllHandle,
69  _In_ unsigned long _Reason,
70  _In_opt_ void* _Reserved
71  );
72 
73  extern int (__stdcall* const _pRawDllMain)(void*, unsigned long, void*);
74 
75 #endif
76 
77 
78 
79 typedef void (__cdecl* _beginthread_proc_type )(void*);
80 typedef unsigned (__stdcall* _beginthreadex_proc_type)(void*);
81 
83  _In_ _beginthread_proc_type _StartAddress,
84  _In_ unsigned _StackSize,
85  _In_opt_ void* _ArgList
86  );
87 
88 _ACRTIMP void __cdecl _endthread(void);
89 
90 _Success_(return != 0)
91 _ACRTIMP uintptr_t __cdecl _beginthreadex(
92  _In_opt_ void* _Security,
93  _In_ unsigned _StackSize,
95  _In_opt_ void* _ArgList,
96  _In_ unsigned _InitFlag,
97  _Out_opt_ unsigned* _ThrdAddr
98  );
99 
100 _ACRTIMP void __cdecl _endthreadex(
101  _In_ unsigned _ReturnCode
102  );
103 
104 
105 
106 #ifdef _CRT_USE_WINAPI_FAMILY_DESKTOP_APP
107 
108  _ACRTIMP int __cdecl _getpid(void);
109 
110  _DCRTIMP intptr_t __cdecl _cwait(
111  _Out_opt_ int* _TermStat,
112  _In_ intptr_t _ProcHandle,
113  _In_ int _Action
114  );
115 
116  _DCRTIMP intptr_t __cdecl _execl(
117  _In_z_ char const* _FileName,
118  _In_z_ char const* _Arguments,
119  ...);
120 
121  _DCRTIMP intptr_t __cdecl _execle(
122  _In_z_ char const* _FileName,
123  _In_z_ char const* _Arguments,
124  ...);
125 
126  _DCRTIMP intptr_t __cdecl _execlp(
127  _In_z_ char const* _FileName,
128  _In_z_ char const* _Arguments,
129  ...);
130 
131  _DCRTIMP intptr_t __cdecl _execlpe(
132  _In_z_ char const* _FileName,
133  _In_z_ char const* _Arguments,
134  ...);
135 
136  _DCRTIMP intptr_t __cdecl _execv(
137  _In_z_ char const* _FileName,
138  _In_z_ char const* const* _Arguments
139  );
140 
141  _DCRTIMP intptr_t __cdecl _execve(
142  _In_z_ char const* _FileName,
143  _In_z_ char const* const* _Arguments,
144  _In_opt_z_ char const* const* _Environment
145  );
146 
147  _DCRTIMP intptr_t __cdecl _execvp(
148  _In_z_ char const* _FileName,
149  _In_z_ char const* const* _Arguments
150  );
151 
152  _DCRTIMP intptr_t __cdecl _execvpe(
153  _In_z_ char const* _FileName,
154  _In_z_ char const* const* _Arguments,
155  _In_opt_z_ char const* const* _Environment
156  );
157 
158  _DCRTIMP intptr_t __cdecl _spawnl(
159  _In_ int _Mode,
160  _In_z_ char const* _FileName,
161  _In_z_ char const* _Arguments,
162  ...);
163 
164  _DCRTIMP intptr_t __cdecl _spawnle(
165  _In_ int _Mode,
166  _In_z_ char const* _FileName,
167  _In_z_ char const* _Arguments,
168  ...);
169 
170  _DCRTIMP intptr_t __cdecl _spawnlp(
171  _In_ int _Mode,
172  _In_z_ char const* _FileName,
173  _In_z_ char const* _Arguments,
174  ...);
175 
176  _DCRTIMP intptr_t __cdecl _spawnlpe(
177  _In_ int _Mode,
178  _In_z_ char const* _FileName,
179  _In_z_ char const* _Arguments,
180  ...);
181 
182  _DCRTIMP intptr_t __cdecl _spawnv(
183  _In_ int _Mode,
184  _In_z_ char const* _FileName,
185  _In_z_ char const* const* _Arguments
186  );
187 
188  _DCRTIMP intptr_t __cdecl _spawnve(
189  _In_ int _Mode,
190  _In_z_ char const* _FileName,
191  _In_z_ char const* const* _Arguments,
192  _In_opt_z_ char const* const* _Environment
193  );
194 
195  _DCRTIMP intptr_t __cdecl _spawnvp(
196  _In_ int _Mode,
197  _In_z_ char const* _FileName,
198  _In_z_ char const* const* _Arguments
199  );
200 
201  _DCRTIMP intptr_t __cdecl _spawnvpe(
202  _In_ int _Mode,
203  _In_z_ char const* _FileName,
204  _In_z_ char const* const* _Arguments,
205  _In_opt_z_ char const* const* _Environment
206  );
207 
208  _CRT_OBSOLETE(LoadLibrary)
209  _DCRTIMP intptr_t __cdecl _loaddll(
210  _In_z_ char* _FileName
211  );
212 
213  _CRT_OBSOLETE(FreeLibrary)
214  _DCRTIMP int __cdecl _unloaddll(
215  _In_ intptr_t _Handle
216  );
217 
218  typedef int (__cdecl* _GetDllProcAddrProcType)(void);
219 
220  _CRT_OBSOLETE(GetProcAddress)
222  _In_ intptr_t _Handle,
223  _In_opt_z_ char* _ProcedureName,
224  _In_ intptr_t _Ordinal
225  );
226 
227 #endif // _CRT_USE_WINAPI_FAMILY_DESKTOP_APP
228 
229 
230 
231 #if _CRT_INTERNAL_NONSTDC_NAMES
232 
233  #define P_WAIT _P_WAIT
234  #define P_NOWAIT _P_NOWAIT
235  #define P_OVERLAY _P_OVERLAY
236  #define OLD_P_OVERLAY _OLD_P_OVERLAY
237  #define P_NOWAITO _P_NOWAITO
238  #define P_DETACH _P_DETACH
239  #define WAIT_CHILD _WAIT_CHILD
240  #define WAIT_GRANDCHILD _WAIT_GRANDCHILD
241 
242  #ifdef _CRT_USE_WINAPI_FAMILY_DESKTOP_APP
243 
245  _DCRTIMP intptr_t __cdecl cwait(
246  _Out_opt_ int* _TermStat,
247  _In_ intptr_t _ProcHandle,
248  _In_ int _Action
249  );
250 
252  _DCRTIMP intptr_t __cdecl execl(
253  _In_z_ char const* _FileName,
254  _In_z_ char const* _Arguments,
255  ...);
256 
258  _DCRTIMP intptr_t __cdecl execle(
259  _In_z_ char const* _FileName,
260  _In_z_ char const* _Arguments,
261  ...);
262 
264  _DCRTIMP intptr_t __cdecl execlp(
265  _In_z_ char const* _FileName,
266  _In_z_ char const* _Arguments,
267  ...);
268 
270  _DCRTIMP intptr_t __cdecl execlpe(
271  _In_z_ char const* _FileName,
272  _In_z_ char const* _Arguments,
273  ...);
274 
276  _DCRTIMP intptr_t __cdecl execv(
277  _In_z_ char const* _FileName,
278  _In_z_ char const* const* _Arguments
279  );
280 
282  _DCRTIMP intptr_t __cdecl execve(
283  _In_z_ char const* _FileName,
284  _In_z_ char const* const* _Arguments,
285  _In_opt_z_ char const* const* _Environment
286  );
287 
289  _DCRTIMP intptr_t __cdecl execvp(
290  _In_z_ char const* _FileName,
291  _In_z_ char const* const* _Arguments
292  );
293 
295  _DCRTIMP intptr_t __cdecl execvpe(
296  _In_z_ char const* _FileName,
297  _In_z_ char const* const* _Arguments,
298  _In_opt_z_ char const* const* _Environment
299  );
300 
302  _DCRTIMP intptr_t __cdecl spawnl(
303  _In_ int _Mode,
304  _In_z_ char const* _FileName,
305  _In_z_ char const* _Arguments,
306  ...);
307 
309  _DCRTIMP intptr_t __cdecl spawnle(
310  _In_ int _Mode,
311  _In_z_ char const* _FileName,
312  _In_z_ char const* _Arguments,
313  ...);
314 
316  _DCRTIMP intptr_t __cdecl spawnlp(
317  _In_ int _Mode,
318  _In_z_ char const* _FileName,
319  _In_z_ char const* _Arguments,
320  ...);
321 
323  _DCRTIMP intptr_t __cdecl spawnlpe(
324  _In_ int _Mode,
325  _In_z_ char const* _FileName,
326  _In_z_ char const* _Arguments,
327  ...);
328 
330  _DCRTIMP intptr_t __cdecl spawnv(
331  _In_ int _Mode,
332  _In_z_ char const* _FileName,
333  _In_z_ char const* const* _Arguments);
334 
336  _DCRTIMP intptr_t __cdecl spawnve(
337  _In_ int _Mode,
338  _In_z_ char const* _FileName,
339  _In_z_ char const* const* _Arguments,
340  _In_opt_z_ char const* const* _Environment
341  );
342 
344  _DCRTIMP intptr_t __cdecl spawnvp(
345  _In_ int _Mode,
346  _In_z_ char const* _FileName,
347  _In_z_ char const* const* _Arguments
348  );
349 
351  _DCRTIMP intptr_t __cdecl spawnvpe(
352  _In_ int _Mode,
353  _In_z_ char const* _FileName,
354  _In_z_ char const* const* _Arguments,
355  _In_opt_z_ char const* const* _Environment
356  );
357 
359  _ACRTIMP int __cdecl getpid(void);
360 
361  #endif // _CRT_USE_WINAPI_FAMILY_DESKTOP_APP
362 
363 #endif // _CRT_INTERNAL_NONSTDC_NAMES
364 
365 
366 
_DCRTIMP intptr_t __cdecl _cwait(_Out_opt_ int *_TermStat, _In_ intptr_t _ProcHandle, _In_ int _Action)
_ACRTIMP int __cdecl getpid(void)
_DCRTIMP intptr_t __cdecl execlp(_In_z_ char const *_FileName, _In_z_ char const *_Arguments,...)
_DCRTIMP intptr_t __cdecl execvp(_In_z_ char const *_FileName, _In_z_ char const *const *_Arguments)
_In_ unsigned _In_ _beginthreadex_proc_type _In_opt_ void _In_ unsigned _InitFlag
Definition: process.h:93
_DCRTIMP intptr_t __cdecl _execlp(_In_z_ char const *_FileName, _In_z_ char const *_Arguments,...)
#define _ACRTIMP
Definition: corecrt.h:27
_DCRTIMP intptr_t __cdecl _spawnve(_In_ int _Mode, _In_z_ char const *_FileName, _In_z_ char const *const *_Arguments, _In_opt_z_ char const *const *_Environment)
#define _Out_opt_
Definition: sal.h:343
_ACRTIMP __declspec(noreturn) void __cdecl exit(_In_ int _Code)
Cancels the currently executing task. This function can be called from within the body of a task to a...
Definition: ppltasks.h:132
void(__stdcall * _tls_callback_type)(void *, unsigned long, void *)
Definition: process.h:48
_In_ unsigned _StackSize
Definition: process.h:93
_DCRTIMP intptr_t __cdecl spawnve(_In_ int _Mode, _In_z_ char const *_FileName, _In_z_ char const *const *_Arguments, _In_opt_z_ char const *const *_Environment)
_In_ unsigned _In_ _beginthreadex_proc_type _In_opt_ void _In_ unsigned _Out_opt_ unsigned * _ThrdAddr
Definition: process.h:93
_DCRTIMP intptr_t __cdecl _loaddll(_In_z_ char *_FileName)
_DCRTIMP intptr_t __cdecl execve(_In_z_ char const *_FileName, _In_z_ char const *const *_Arguments, _In_opt_z_ char const *const *_Environment)
_DCRTIMP intptr_t __cdecl spawnv(_In_ int _Mode, _In_z_ char const *_FileName, _In_z_ char const *const *_Arguments)
_CRT_OBSOLETE(iswctype) _DCRTIMP int __cdecl is_wctype(_In_ wint_t _C
_DCRTIMP intptr_t __cdecl _execlpe(_In_z_ char const *_FileName, _In_z_ char const *_Arguments,...)
_In_ long
Definition: corecrt_wstdlib.h:88
_DCRTIMP _GetDllProcAddrProcType __cdecl _getdllprocaddr(_In_ intptr_t _Handle, _In_opt_z_ char *_ProcedureName, _In_ intptr_t _Ordinal)
_In_ unsigned _In_ _beginthreadex_proc_type _In_opt_ void * _ArgList
Definition: process.h:93
#define _CRT_BEGIN_C_HEADER
Definition: vcruntime.h:73
_DCRTIMP intptr_t __cdecl _spawnv(_In_ int _Mode, _In_z_ char const *_FileName, _In_z_ char const *const *_Arguments)
int(__cdecl * _GetDllProcAddrProcType)(void)
Definition: process.h:218
_DCRTIMP int __cdecl _unloaddll(_In_ intptr_t _Handle)
_DCRTIMP intptr_t __cdecl spawnlp(_In_ int _Mode, _In_z_ char const *_FileName, _In_z_ char const *_Arguments,...)
unsigned int uintptr_t
Definition: vadefs.h:30
_DCRTIMP intptr_t __cdecl execv(_In_z_ char const *_FileName, _In_z_ char const *const *_Arguments)
#define _In_opt_z_
Definition: sal.h:311
_DCRTIMP intptr_t __cdecl _execvp(_In_z_ char const *_FileName, _In_z_ char const *const *_Arguments)
#define _In_z_
Definition: sal.h:310
_DCRTIMP intptr_t __cdecl spawnlpe(_In_ int _Mode, _In_z_ char const *_FileName, _In_z_ char const *_Arguments,...)
#define _In_
Definition: sal.h:305
_DCRTIMP intptr_t __cdecl _spawnl(_In_ int _Mode, _In_z_ char const *_FileName, _In_z_ char const *_Arguments,...)
#define _In_opt_
Definition: sal.h:306
_DCRTIMP intptr_t __cdecl _execl(_In_z_ char const *_FileName, _In_z_ char const *_Arguments,...)
_DCRTIMP intptr_t __cdecl _spawnle(_In_ int _Mode, _In_z_ char const *_FileName, _In_z_ char const *_Arguments,...)
_DCRTIMP intptr_t __cdecl spawnl(_In_ int _Mode, _In_z_ char const *_FileName, _In_z_ char const *_Arguments,...)
#define _DCRTIMP
Definition: corecrt.h:43
_ACRTIMP void __cdecl _register_thread_local_exe_atexit_callback(_In_ _tls_callback_type _Callback)
_Check_return_ _In_z_ wchar_t const * _Mode
Definition: corecrt_wstdio.h:133
typedef void(__cdecl *_beginthread_proc_type)(void *)
_DCRTIMP intptr_t __cdecl _spawnvpe(_In_ int _Mode, _In_z_ char const *_FileName, _In_z_ char const *const *_Arguments, _In_opt_z_ char const *const *_Environment)
_ACRTIMP void __cdecl _cexit(void)
char int *typedef int(__CRTDECL *_CRT_REPORT_HOOKW)(int
Definition: crtdbg.h:45
_DCRTIMP intptr_t __cdecl _spawnlpe(_In_ int _Mode, _In_z_ char const *_FileName, _In_z_ char const *_Arguments,...)
_DCRTIMP intptr_t __cdecl spawnle(_In_ int _Mode, _In_z_ char const *_FileName, _In_z_ char const *_Arguments,...)
_DCRTIMP intptr_t __cdecl _execve(_In_z_ char const *_FileName, _In_z_ char const *const *_Arguments, _In_opt_z_ char const *const *_Environment)
_ACRTIMP uintptr_t __cdecl _beginthread(_In_ _beginthread_proc_type _StartAddress, _In_ unsigned _StackSize, _In_opt_ void *_ArgList)
_DCRTIMP intptr_t __cdecl cwait(_Out_opt_ int *_TermStat, _In_ intptr_t _ProcHandle, _In_ int _Action)
_DCRTIMP intptr_t __cdecl _execvpe(_In_z_ char const *_FileName, _In_z_ char const *const *_Arguments, _In_opt_z_ char const *const *_Environment)
_DCRTIMP intptr_t __cdecl spawnvp(_In_ int _Mode, _In_z_ char const *_FileName, _In_z_ char const *const *_Arguments)
_DCRTIMP intptr_t __cdecl _execle(_In_z_ char const *_FileName, _In_z_ char const *_Arguments,...)
#define _CRT_NONSTDC_DEPRECATE(_NewName)
Definition: corecrt.h:300
int intptr_t
Definition: vcruntime.h:200
_In_ unsigned _In_ _beginthreadex_proc_type _StartAddress
Definition: process.h:93
_In_opt_z_ wchar_t const _In_opt_z_ wchar_t const * _FileName
Definition: corecrt.h:253
#define _CRT_END_C_HEADER
Definition: vcruntime.h:76
_DCRTIMP intptr_t __cdecl execvpe(_In_z_ char const *_FileName, _In_z_ char const *const *_Arguments, _In_opt_z_ char const *const *_Environment)
_DCRTIMP intptr_t __cdecl _spawnvp(_In_ int _Mode, _In_z_ char const *_FileName, _In_z_ char const *const *_Arguments)
_DCRTIMP intptr_t __cdecl _spawnlp(_In_ int _Mode, _In_z_ char const *_FileName, _In_z_ char const *_Arguments,...)
_Success_(return!=0) _ACRTIMP uintptr_t __cdecl _beginthreadex(_In_opt_ void *_Security
_ACRTIMP void __cdecl _endthread(void)
_DCRTIMP intptr_t __cdecl execlpe(_In_z_ char const *_FileName, _In_z_ char const *_Arguments,...)
unsigned(__stdcall * _beginthreadex_proc_type)(void *)
Definition: process.h:80
_ACRTIMP void __cdecl _endthreadex(_In_ unsigned _ReturnCode)
_DCRTIMP intptr_t __cdecl execle(_In_z_ char const *_FileName, _In_z_ char const *_Arguments,...)
_DCRTIMP int __cdecl system(_In_opt_z_ char const *_Command)
_DCRTIMP intptr_t __cdecl spawnvpe(_In_ int _Mode, _In_z_ char const *_FileName, _In_z_ char const *const *_Arguments, _In_opt_z_ char const *const *_Environment)
_ACRTIMP int __cdecl _getpid(void)
_In_opt_z_ wchar_t const _In_opt_z_ wchar_t const _In_ unsigned int _In_ uintptr_t _Reserved
Definition: corecrt.h:253
_DCRTIMP intptr_t __cdecl execl(_In_z_ char const *_FileName, _In_z_ char const *_Arguments,...)
_DCRTIMP intptr_t __cdecl _execv(_In_z_ char const *_FileName, _In_z_ char const *const *_Arguments)
_ACRTIMP void __cdecl _c_exit(void)