ReactOS 0.4.16-dev-1113-g99ecbf5
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#ifndef _INC_PROCESS // include guard for 3rd party interop
11#define _INC_PROCESS
12
13#include <corecrt.h>
14#include <corecrt_startup.h>
15#include <corecrt_wprocess.h>
16
17#pragma warning(push)
18#pragma warning(disable: _UCRT_DISABLED_WARNINGS)
20
22
23
24
25// Flag values for the _spawn family of functions
26#define _P_WAIT 0
27#define _P_NOWAIT 1
28#define _OLD_P_OVERLAY 2
29#define _P_NOWAITO 3
30#define _P_DETACH 4
31#define _P_OVERLAY 2
32
33// Action codes for _cwait(). The action code argument to _cwait() is ignored on
34// Win32. The parameter only exists so that we do not break existing code.
35#define _WAIT_CHILD 0
36#define _WAIT_GRANDCHILD 1
37
38
39
40#if _CRT_FUNCTIONS_REQUIRED
41
42 _ACRTIMP __declspec(noreturn) void __cdecl exit(_In_ int _Code);
43 _ACRTIMP __declspec(noreturn) void __cdecl _exit(_In_ int _Code);
44 _ACRTIMP __declspec(noreturn) void __cdecl _Exit(_In_ int _Code);
45 _ACRTIMP __declspec(noreturn) void __cdecl quick_exit(_In_ int _Code);
46 _ACRTIMP __declspec(noreturn) void __cdecl abort(void);
47
48 _DCRTIMP int __cdecl system(_In_opt_z_ char const* _Command);
49
50 _ACRTIMP void __cdecl _cexit(void);
51 _ACRTIMP void __cdecl _c_exit(void);
52
53 typedef void (__stdcall *_tls_callback_type)(void *, unsigned long, void *);
54 _ACRTIMP void __cdecl _register_thread_local_exe_atexit_callback(_In_ _tls_callback_type _Callback);
55
56#endif // _CRT_FUNCTIONS_REQUIRED
57
58// Declare DLL notification (initialization/termination) routines. The preferred
59// method is for the CRT client to define DllMain(), which will automatically be
60// called by the DLL entry point defined by the CRT. If the CRT client wants to
61// define the DLL entry point, the client entry point must call _CRT_INIT on all
62// types of notifications, as the very first thing on attach notifications and as
63// the very last thing on detach notifications.
64#ifdef _DECL_DLLMAIN
65
67 _In_ void* _DllHandle,
68 _In_ unsigned long _Reason,
70 );
71
72 int __stdcall _CRT_INIT(
73 _In_ void* _DllHandle,
74 _In_ unsigned long _Reason,
76 );
77
78 extern int (__stdcall* const _pRawDllMain)(void*, unsigned long, void*);
79
80#endif
81
82
83
84typedef void (__cdecl* _beginthread_proc_type )(void*);
86
88 _In_ _beginthread_proc_type _StartAddress,
89 _In_ unsigned _StackSize,
90 _In_opt_ void* _ArgList
91 );
92
93_ACRTIMP void __cdecl _endthread(void);
94
95_Success_(return != 0)
97 _In_opt_ void* _Security,
98 _In_ unsigned _StackSize,
101 _In_ unsigned _InitFlag,
103 );
104
106 _In_ unsigned _ReturnCode
107 );
108
109
110
111#ifdef _CRT_USE_WINAPI_FAMILY_DESKTOP_APP
112
113 _ACRTIMP int __cdecl _getpid(void);
114
116 _Out_opt_ int* _TermStat,
117 _In_ intptr_t _ProcHandle,
118 _In_ int _Action
119 );
120
122 _In_z_ char const* _FileName,
123 _In_z_ char const* _Arguments,
124 ...);
125
127 _In_z_ char const* _FileName,
128 _In_z_ char const* _Arguments,
129 ...);
130
132 _In_z_ char const* _FileName,
133 _In_z_ char const* _Arguments,
134 ...);
135
137 _In_z_ char const* _FileName,
138 _In_z_ char const* _Arguments,
139 ...);
140
142 _In_z_ char const* _FileName,
143 _In_z_ char const* const* _Arguments
144 );
145
147 _In_z_ char const* _FileName,
148 _In_z_ char const* const* _Arguments,
149 _In_opt_z_ char const* const* _Environment
150 );
151
153 _In_z_ char const* _FileName,
154 _In_z_ char const* const* _Arguments
155 );
156
158 _In_z_ char const* _FileName,
159 _In_z_ char const* const* _Arguments,
160 _In_opt_z_ char const* const* _Environment
161 );
162
164 _In_ int _Mode,
165 _In_z_ char const* _FileName,
166 _In_z_ char const* _Arguments,
167 ...);
168
170 _In_ int _Mode,
171 _In_z_ char const* _FileName,
172 _In_z_ char const* _Arguments,
173 ...);
174
176 _In_ int _Mode,
177 _In_z_ char const* _FileName,
178 _In_z_ char const* _Arguments,
179 ...);
180
182 _In_ int _Mode,
183 _In_z_ char const* _FileName,
184 _In_z_ char const* _Arguments,
185 ...);
186
188 _In_ int _Mode,
189 _In_z_ char const* _FileName,
190 _In_z_ char const* const* _Arguments
191 );
192
194 _In_ int _Mode,
195 _In_z_ char const* _FileName,
196 _In_z_ char const* const* _Arguments,
197 _In_opt_z_ char const* const* _Environment
198 );
199
201 _In_ int _Mode,
202 _In_z_ char const* _FileName,
203 _In_z_ char const* const* _Arguments
204 );
205
207 _In_ int _Mode,
208 _In_z_ char const* _FileName,
209 _In_z_ char const* const* _Arguments,
210 _In_opt_z_ char const* const* _Environment
211 );
212
215 _In_z_ char* _FileName
216 );
217
220 _In_ intptr_t _Handle
221 );
222
223 typedef int (__cdecl* _GetDllProcAddrProcType)(void);
224
226 _DCRTIMP _GetDllProcAddrProcType __cdecl _getdllprocaddr(
227 _In_ intptr_t _Handle,
228 _In_opt_z_ char* _ProcedureName,
229 _In_ intptr_t _Ordinal
230 );
231
232#endif // _CRT_USE_WINAPI_FAMILY_DESKTOP_APP
233
234
235
236#if defined(_CRT_INTERNAL_NONSTDC_NAMES) && _CRT_INTERNAL_NONSTDC_NAMES
237
238 #define P_WAIT _P_WAIT
239 #define P_NOWAIT _P_NOWAIT
240 #define P_OVERLAY _P_OVERLAY
241 #define OLD_P_OVERLAY _OLD_P_OVERLAY
242 #define P_NOWAITO _P_NOWAITO
243 #define P_DETACH _P_DETACH
244 #define WAIT_CHILD _WAIT_CHILD
245 #define WAIT_GRANDCHILD _WAIT_GRANDCHILD
246
247 #ifdef _CRT_USE_WINAPI_FAMILY_DESKTOP_APP
248
251 _Out_opt_ int* _TermStat,
252 _In_ intptr_t _ProcHandle,
253 _In_ int _Action
254 );
255
258 _In_z_ char const* _FileName,
259 _In_z_ char const* _Arguments,
260 ...);
261
264 _In_z_ char const* _FileName,
265 _In_z_ char const* _Arguments,
266 ...);
267
270 _In_z_ char const* _FileName,
271 _In_z_ char const* _Arguments,
272 ...);
273
276 _In_z_ char const* _FileName,
277 _In_z_ char const* _Arguments,
278 ...);
279
282 _In_z_ char const* _FileName,
283 _In_z_ char const* const* _Arguments
284 );
285
288 _In_z_ char const* _FileName,
289 _In_z_ char const* const* _Arguments,
290 _In_opt_z_ char const* const* _Environment
291 );
292
295 _In_z_ char const* _FileName,
296 _In_z_ char const* const* _Arguments
297 );
298
301 _In_z_ char const* _FileName,
302 _In_z_ char const* const* _Arguments,
303 _In_opt_z_ char const* const* _Environment
304 );
305
308 _In_ int _Mode,
309 _In_z_ char const* _FileName,
310 _In_z_ char const* _Arguments,
311 ...);
312
315 _In_ int _Mode,
316 _In_z_ char const* _FileName,
317 _In_z_ char const* _Arguments,
318 ...);
319
322 _In_ int _Mode,
323 _In_z_ char const* _FileName,
324 _In_z_ char const* _Arguments,
325 ...);
326
329 _In_ int _Mode,
330 _In_z_ char const* _FileName,
331 _In_z_ char const* _Arguments,
332 ...);
333
336 _In_ int _Mode,
337 _In_z_ char const* _FileName,
338 _In_z_ char const* const* _Arguments);
339
342 _In_ int _Mode,
343 _In_z_ char const* _FileName,
344 _In_z_ char const* const* _Arguments,
345 _In_opt_z_ char const* const* _Environment
346 );
347
350 _In_ int _Mode,
351 _In_z_ char const* _FileName,
352 _In_z_ char const* const* _Arguments
353 );
354
357 _In_ int _Mode,
358 _In_z_ char const* _FileName,
359 _In_z_ char const* const* _Arguments,
360 _In_opt_z_ char const* const* _Environment
361 );
362
364 _ACRTIMP int __cdecl getpid(void);
365
366 #endif // _CRT_USE_WINAPI_FAMILY_DESKTOP_APP
367
368#endif // _CRT_INTERNAL_NONSTDC_NAMES
369
370
371
374#pragma warning(pop) // _UCRT_DISABLED_WARNINGS
375#endif // _INC_PROCESS
void _exit(int exitcode)
Definition: _exit.c:25
#define __cdecl
Definition: accygwin.h:79
#define GetProcAddress(x, y)
Definition: compat.h:753
#define FreeLibrary(x)
Definition: compat.h:748
_In_z_ _Printf_format_string_ char const *const va_list _ArgList
Definition: printf.c:23
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
void __cdecl _register_thread_local_exe_atexit_callback(_In_ _tls_callback_type const _Callback)
Definition: exit.cpp:162
void __cdecl quick_exit(int const return_code)
Definition: exit.cpp:304
void __declspec(noinline) __cdecl _free_base(void *const block)
Definition: free_base.cpp:98
#define abort()
Definition: i386-dis.c:34
BOOL WINAPI DllMain(IN HINSTANCE hinstDLL, IN DWORD dwReason, IN LPVOID lpvReserved)
Definition: kbsdll.c:95
unsigned int uintptr_t
Definition: intrin.h:47
static unsigned(__cdecl *hash_bstr)(bstr_t s)
#define _Out_opt_
Definition: no_sal2.h:214
#define _Success_(c)
Definition: no_sal2.h:84
#define _In_z_
Definition: no_sal2.h:164
#define _In_opt_z_
Definition: no_sal2.h:218
#define _In_
Definition: no_sal2.h:158
#define _In_opt_
Definition: no_sal2.h:212
#define long
Definition: qsort.c:33
_CRTIMP intptr_t __cdecl _execlpe(_In_z_ const char *_Filename, _In_z_ const char *_ArgList,...)
_CRTIMP intptr_t __cdecl _spawnlpe(_In_ int _Mode, _In_z_ const char *_Filename, _In_z_ const char *_ArgList,...)
_CRTIMP void __cdecl _endthreadex(_In_ unsigned _Retval)
_CRTIMP intptr_t __cdecl _spawnlp(_In_ int _Mode, _In_z_ const char *_Filename, _In_z_ const char *_ArgList,...)
_CRTIMP uintptr_t __cdecl _beginthreadex(_In_opt_ void *_Security, _In_ unsigned _StackSize, _In_ unsigned(__stdcall *_StartAddress)(void *), _In_opt_ void *_ArgList, _In_ unsigned _InitFlag, _Out_opt_ unsigned *_ThrdAddr)
_CRTIMP intptr_t __cdecl _execvpe(_In_z_ const char *_Filename, _In_z_ const char *const *_ArgList, _In_opt_z_ const char *const *_Env)
_CRTIMP int __cdecl getpid(void)
_CRTIMP intptr_t __cdecl _spawnle(_In_ int _Mode, _In_z_ const char *_Filename, _In_z_ const char *_ArgList,...)
_CRTIMP intptr_t __cdecl _spawnl(_In_ int _Mode, _In_z_ const char *_Filename, _In_z_ const char *_ArgList,...)
int __cdecl _unloaddll(_In_ intptr_t _Handle)
_CRTIMP intptr_t __cdecl spawnlpe(_In_ int, _In_z_ const char *_Filename, _In_z_ const char *_ArgList,...)
_CRTIMP intptr_t __cdecl _execle(_In_z_ const char *_Filename, _In_z_ const char *_ArgList,...)
_CRTIMP intptr_t __cdecl _execlp(_In_z_ const char *_Filename, _In_z_ const char *_ArgList,...)
_CRTIMP intptr_t __cdecl _execve(_In_z_ const char *_Filename, _In_z_ const char *const *_ArgList, _In_opt_z_ const char *const *_Env)
_CRTIMP intptr_t __cdecl execle(_In_z_ const char *_Filename, _In_z_ const char *_ArgList,...)
_CRTIMP intptr_t __cdecl execlpe(_In_z_ const char *_Filename, _In_z_ const char *_ArgList,...)
__analysis_noreturn _CRTIMP void __cdecl _cexit(void)
Definition: _exit.c:7
_CRTIMP int __cdecl _getpid(void)
Definition: procid.c:7
_CRTIMP intptr_t __cdecl execv(_In_z_ const char *_Filename, _In_z_ char *const _ArgList[])
_CRTIMP intptr_t __cdecl execve(_In_z_ const char *_Filename, _In_z_ char *const _ArgList[], _In_opt_z_ char *const _Env[])
_CRTIMP intptr_t __cdecl execl(_In_z_ const char *_Filename, _In_z_ const char *_ArgList,...)
_CRTIMP uintptr_t __cdecl _beginthread(_In_ void(__cdecl *_StartAddress)(void *), _In_ unsigned _StackSize, _In_opt_ void *_ArgList)
_CRTIMP intptr_t __cdecl spawnv(_In_ int, _In_z_ const char *_Filename, _In_z_ char *const _ArgList[])
_CRTIMP intptr_t __cdecl _execl(_In_z_ const char *_Filename, _In_z_ const char *_ArgList,...)
_CRTIMP intptr_t __cdecl spawnvpe(_In_ int, _In_z_ const char *_Filename, _In_z_ char *const _ArgList[], _In_opt_z_ char *const _Env[])
__analysis_noreturn _CRTIMP void __cdecl _c_exit(void)
Definition: _exit.c:17
_CRTIMP intptr_t __cdecl _cwait(_Out_opt_ int *_TermStat, _In_ intptr_t _ProcHandle, _In_ int _Action)
_CRTIMP intptr_t __cdecl _spawnv(_In_ int _Mode, _In_z_ const char *_Filename, _In_z_ const char *const *_ArgList)
__CRT_INLINE void __cdecl _Exit(int status)
Definition: process.h:60
_CRTIMP intptr_t __cdecl execlp(_In_z_ const char *_Filename, _In_z_ const char *_ArgList,...)
_CRTIMP intptr_t __cdecl cwait(_Out_opt_ int *_TermStat, _In_ intptr_t _ProcHandle, _In_ int _Action)
_CRTIMP intptr_t __cdecl execvp(_In_z_ const char *_Filename, _In_z_ char *const _ArgList[])
_CRTIMP intptr_t __cdecl _spawnvp(_In_ int _Mode, _In_z_ const char *_Filename, _In_z_ const char *const *_ArgList)
_CRTIMP intptr_t __cdecl spawnvp(_In_ int, _In_z_ const char *_Filename, _In_z_ char *const _ArgList[])
_CRTIMP intptr_t __cdecl spawnlp(_In_ int, _In_z_ const char *_Filename, _In_z_ const char *_ArgList,...)
_CRTIMP intptr_t __cdecl execvpe(_In_z_ const char *_Filename, _In_z_ char *const _ArgList[], _In_opt_z_ char *const _Env[])
int __cdecl system(_In_opt_z_ const char *_Command)
_CRTIMP intptr_t __cdecl spawnl(_In_ int, _In_z_ const char *_Filename, _In_z_ const char *_ArgList,...)
_CRTIMP intptr_t __cdecl _spawnve(_In_ int _Mode, _In_z_ const char *_Filename, _In_z_ const char *const *_ArgList, _In_opt_z_ const char *const *_Env)
intptr_t __cdecl _loaddll(_In_z_ char *_Filename)
_CRTIMP intptr_t __cdecl _spawnvpe(_In_ int _Mode, _In_z_ const char *_Filename, _In_z_ const char *const *_ArgList, _In_opt_z_ const char *const *_Env)
_CRTIMP void __cdecl _endthread(void)
Definition: thread.c:95
_CRTIMP intptr_t __cdecl spawnle(_In_ int, _In_z_ const char *_Filename, _In_z_ const char *_ArgList,...)
_CRTIMP intptr_t __cdecl _execvp(_In_z_ const char *_Filename, _In_z_ const char *const *_ArgList)
_CRTIMP intptr_t __cdecl spawnve(_In_ int, _In_z_ const char *_Filename, _In_z_ char *const _ArgList[], _In_opt_z_ char *const _Env[])
_CRTIMP intptr_t __cdecl _execv(_In_z_ const char *_Filename, _In_z_ const char *const *_ArgList)
unsigned(__stdcall * _beginthreadex_proc_type)(void *)
Definition: process.h:85
_In_ unsigned _In_ _beginthreadex_proc_type _StartAddress
Definition: process.h:99
_In_ unsigned _StackSize
Definition: process.h:98
_In_ unsigned _In_ _beginthreadex_proc_type _In_opt_ void _In_ unsigned _Out_opt_ unsigned * _ThrdAddr
Definition: process.h:103
_In_ unsigned _In_ _beginthreadex_proc_type _In_opt_ void _In_ unsigned _InitFlag
Definition: process.h:101
#define exit(n)
Definition: config.h:202
FARPROC _getdllprocaddr(intptr_t hModule, char *lpProcName, intptr_t iOrdinal)
Definition: dll.c:32
#define __stdcall
Definition: typedefs.h:25
#define _CRT_OBSOLETE(_NewItem)
Definition: corecrt.h:549
#define _DCRTIMP
Definition: corecrt.h:154
#define _CRT_NONSTDC_DEPRECATE(_NewName)
Definition: corecrt.h:439
#define _ACRTIMP
Definition: corecrt.h:138
#define _UCRT_DISABLE_CLANG_WARNINGS
Definition: corecrt.h:109
#define _UCRT_RESTORE_CLANG_WARNINGS
Definition: corecrt.h:117
_In_opt_z_ wchar_t const _In_opt_z_ wchar_t const _In_ unsigned int _In_ uintptr_t _Reserved
Definition: corecrt.h:391
int intptr_t
Definition: vcruntime.h:134
#define _CRT_END_C_HEADER
Definition: vcruntime.h:42
#define _CRT_BEGIN_C_HEADER
Definition: vcruntime.h:40
#define LoadLibrary
Definition: winbase.h:3893