ReactOS 0.4.16-dev-2104-gb84fa49
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 *);
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
#define GetProcAddress(x, y)
Definition: compat.h:753
#define FreeLibrary(x)
Definition: compat.h:748
void CDECL _register_thread_local_exe_atexit_callback(_tls_callback_type callback)
Definition: exit.c:460
void(__stdcall * _tls_callback_type)(void *, ULONG, void *)
Definition: exit.c:39
int intptr_t
Definition: corecrt.h:176
#define __cdecl
Definition: corecrt.h:121
#define _ACRTIMP
Definition: corecrt.h:153
unsigned int uintptr_t
Definition: corecrt.h:185
#define __stdcall
Definition: corecrt.h:120
_ACRTIMP DECLSPEC_NORETURN void __cdecl abort(void)
Aborts the program.
Definition: exit.c:252
_ACRTIMP DECLSPEC_NORETURN void __cdecl _exit(int)
Definition: exit.c:187
_ACRTIMP int __cdecl system(const char *)
Definition: process.c:1297
#define spawnl
Definition: process.h:101
_ACRTIMP intptr_t __cdecl _execvp(const char *, const char *const *)
Definition: process.c:679
#define spawnlpe
Definition: process.h:104
_ACRTIMP intptr_t __cdecl _spawnl(int, const char *, const char *,...)
Definition: process.c:711
_ACRTIMP intptr_t __cdecl _spawnvpe(int, const char *, const char *const *, const char *const *)
Definition: process.c:967
static intptr_t spawnve(int flags, const char *name, const char *const *argv, const char *const *envv)
Definition: process.h:79
#define execle
Definition: process.h:98
#define spawnlp
Definition: process.h:103
_ACRTIMP int __cdecl _getpid(void)
Definition: process.c:1360
#define execv
Definition: process.h:82
_ACRTIMP intptr_t __cdecl _execv(const char *, const char *const *)
Definition: process.c:616
#define execlp
Definition: process.h:99
_ACRTIMP uintptr_t __cdecl _beginthreadex(void *, unsigned int, _beginthreadex_start_routine_t, void *, unsigned int, unsigned int *)
Definition: thread.c:207
#define execvpe
Definition: process.h:85
_ACRTIMP void __cdecl _cexit(void)
Definition: exit.c:336
_ACRTIMP DECLSPEC_NORETURN void __cdecl _endthreadex(unsigned int)
Definition: thread.c:93
_ACRTIMP intptr_t __cdecl _execle(const char *, const char *,...)
Definition: process.c:468
static intptr_t spawnvpe(int flags, const char *name, const char *const *argv, const char *const *envv)
Definition: process.h:81
static intptr_t spawnvp(int flags, const char *name, const char *const *argv)
Definition: process.h:80
_ACRTIMP intptr_t __cdecl _cwait(int *, intptr_t, int)
Definition: process.c:362
_ACRTIMP intptr_t __cdecl _execlp(const char *, const char *,...)
Definition: process.c:522
_ACRTIMP intptr_t __cdecl _execvpe(const char *, const char *const *, const char *const *)
Definition: process.c:658
#define execlpe
Definition: process.h:100
#define execl
Definition: process.h:97
#define execvp
Definition: process.h:84
_ACRTIMP intptr_t __cdecl _spawnlpe(int, const char *, const char *,...)
Definition: process.c:867
static int getpid(void)
Definition: process.h:77
_ACRTIMP uintptr_t __cdecl _beginthread(_beginthread_start_routine_t, unsigned int, void *)
Definition: thread.c:134
static intptr_t spawnv(int flags, const char *name, const char *const *argv)
Definition: process.h:78
static intptr_t cwait(int *status, intptr_t pid, int action)
Definition: process.h:76
_ACRTIMP intptr_t __cdecl _execve(const char *, const char *const *, const char *const *)
Definition: process.c:637
_ACRTIMP intptr_t __cdecl _spawnvp(int, const char *, const char *const *)
Definition: process.c:1013
_ACRTIMP intptr_t __cdecl _spawnv(int, const char *, const char *const *)
Definition: process.c:946
_ACRTIMP intptr_t __cdecl _spawnlp(int, const char *, const char *,...)
Definition: process.c:816
_ACRTIMP void __cdecl _c_exit(void)
Definition: exit.c:327
#define execve
Definition: process.h:83
_ACRTIMP intptr_t __cdecl _execlpe(const char *, const char *,...)
Definition: process.c:573
_ACRTIMP intptr_t __cdecl _spawnle(int, const char *, const char *,...)
Definition: process.c:762
_ACRTIMP DECLSPEC_NORETURN void __cdecl _endthread(void)
Definition: thread.c:73
_ACRTIMP intptr_t __cdecl _execl(const char *, const char *,...)
Definition: process.c:417
_ACRTIMP intptr_t __cdecl _spawnve(int, const char *, const char *const *, const char *const *)
Definition: process.c:900
_ACRTIMP DECLSPEC_NORETURN void __cdecl quick_exit(int)
Definition: exit.cpp:304
#define spawnle
Definition: process.h:102
void *CDECL _getdllprocaddr(intptr_t dll, const char *name, int ordinal)
Definition: process.c:1346
_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 __declspec(noinline) __cdecl _free_base(void *const block)
Definition: free_base.cpp:98
BOOL WINAPI DllMain(IN HINSTANCE hinstDLL, IN DWORD dwReason, IN LPVOID lpvReserved)
Definition: indicdll.c:224
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
int __cdecl _unloaddll(_In_ intptr_t _Handle)
__CRT_INLINE void __cdecl _Exit(int status)
Definition: process.h:60
intptr_t __cdecl _loaddll(_In_z_ char *_Filename)
#define _CRT_OBSOLETE(_NewItem)
Definition: corecrt.h:549
#define _DCRTIMP
Definition: corecrt.h:154
#define _CRT_NONSTDC_DEPRECATE(_NewName)
Definition: corecrt.h:439
#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
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
#define _CRT_END_C_HEADER
Definition: vcruntime.h:42
#define _CRT_BEGIN_C_HEADER
Definition: vcruntime.h:40
#define LoadLibrary
Definition: winbase.h:3611