Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

251 lines
8.9 KiB

  1. /***
  2. *process.h - definition and declarations for process control functions
  3. *
  4. * Copyright (c) 1985-2001, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. * This file defines the modeflag values for spawnxx calls.
  8. * Also contains the function argument declarations for all
  9. * process control related routines.
  10. *
  11. * [Public]
  12. *
  13. ****/
  14. #if _MSC_VER > 1000
  15. #pragma once
  16. #endif
  17. #ifndef _INC_PROCESS
  18. #define _INC_PROCESS
  19. #if !defined(_WIN32)
  20. #error ERROR: Only Win32 target supported!
  21. #endif
  22. #ifndef _POSIX_
  23. #ifdef __cplusplus
  24. extern "C" {
  25. #endif
  26. #if !defined(_W64)
  27. #if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300
  28. #define _W64 __w64
  29. #else
  30. #define _W64
  31. #endif
  32. #endif
  33. /* Define _CRTIMP */
  34. #ifndef _CRTIMP
  35. #ifdef _DLL
  36. #define _CRTIMP __declspec(dllimport)
  37. #else /* ndef _DLL */
  38. #define _CRTIMP
  39. #endif /* _DLL */
  40. #endif /* _CRTIMP */
  41. /* Define __cdecl for non-Microsoft compilers */
  42. #if ( !defined(_MSC_VER) && !defined(__cdecl) )
  43. #define __cdecl
  44. #endif
  45. #ifndef _INTPTR_T_DEFINED
  46. #ifdef _WIN64
  47. typedef __int64 intptr_t;
  48. #else
  49. typedef _W64 int intptr_t;
  50. #endif
  51. #define _INTPTR_T_DEFINED
  52. #endif
  53. #ifndef _UINTPTR_T_DEFINED
  54. #ifdef _WIN64
  55. typedef unsigned __int64 uintptr_t;
  56. #else
  57. typedef _W64 unsigned int uintptr_t;
  58. #endif
  59. #define _UINTPTR_T_DEFINED
  60. #endif
  61. #ifndef _WCHAR_T_DEFINED
  62. typedef unsigned short wchar_t;
  63. #define _WCHAR_T_DEFINED
  64. #endif
  65. /* modeflag values for _spawnxx routines */
  66. #define _P_WAIT 0
  67. #define _P_NOWAIT 1
  68. #define _OLD_P_OVERLAY 2
  69. #define _P_NOWAITO 3
  70. #define _P_DETACH 4
  71. #ifdef _MT
  72. #define _P_OVERLAY 2
  73. #else
  74. extern int _p_overlay;
  75. #define _P_OVERLAY _p_overlay
  76. #endif /* _MT */
  77. /* Action codes for _cwait(). The action code argument to _cwait is ignored
  78. on Win32 though it is accepted for compatibilty with old MS CRT libs */
  79. #define _WAIT_CHILD 0
  80. #define _WAIT_GRANDCHILD 1
  81. /* function prototypes */
  82. #ifdef _MT
  83. _CRTIMP uintptr_t __cdecl _beginthread (void (__cdecl *) (void *),
  84. unsigned, void *);
  85. _CRTIMP void __cdecl _endthread(void);
  86. _CRTIMP uintptr_t __cdecl _beginthreadex(void *, unsigned,
  87. unsigned (__stdcall *) (void *), void *, unsigned, unsigned *);
  88. _CRTIMP void __cdecl _endthreadex(unsigned);
  89. #endif
  90. #if _MSC_VER >= 1200
  91. _CRTIMP __declspec(noreturn) void __cdecl abort(void);
  92. _CRTIMP __declspec(noreturn) void __cdecl exit(int);
  93. _CRTIMP __declspec(noreturn) void __cdecl _exit(int);
  94. #else
  95. _CRTIMP void __cdecl abort(void);
  96. _CRTIMP void __cdecl exit(int);
  97. _CRTIMP void __cdecl _exit(int);
  98. #endif
  99. _CRTIMP void __cdecl _cexit(void);
  100. _CRTIMP void __cdecl _c_exit(void);
  101. _CRTIMP int __cdecl _getpid(void);
  102. _CRTIMP intptr_t __cdecl _cwait(int *, intptr_t, int);
  103. _CRTIMP intptr_t __cdecl _execl(const char *, const char *, ...);
  104. _CRTIMP intptr_t __cdecl _execle(const char *, const char *, ...);
  105. _CRTIMP intptr_t __cdecl _execlp(const char *, const char *, ...);
  106. _CRTIMP intptr_t __cdecl _execlpe(const char *, const char *, ...);
  107. _CRTIMP intptr_t __cdecl _execv(const char *, const char * const *);
  108. _CRTIMP intptr_t __cdecl _execve(const char *, const char * const *, const char * const *);
  109. _CRTIMP intptr_t __cdecl _execvp(const char *, const char * const *);
  110. _CRTIMP intptr_t __cdecl _execvpe(const char *, const char * const *, const char * const *);
  111. _CRTIMP intptr_t __cdecl _spawnl(int, const char *, const char *, ...);
  112. _CRTIMP intptr_t __cdecl _spawnle(int, const char *, const char *, ...);
  113. _CRTIMP intptr_t __cdecl _spawnlp(int, const char *, const char *, ...);
  114. _CRTIMP intptr_t __cdecl _spawnlpe(int, const char *, const char *, ...);
  115. _CRTIMP intptr_t __cdecl _spawnv(int, const char *, const char * const *);
  116. _CRTIMP intptr_t __cdecl _spawnve(int, const char *, const char * const *,
  117. const char * const *);
  118. _CRTIMP intptr_t __cdecl _spawnvp(int, const char *, const char * const *);
  119. _CRTIMP intptr_t __cdecl _spawnvpe(int, const char *, const char * const *,
  120. const char * const *);
  121. _CRTIMP int __cdecl system(const char *);
  122. #ifndef _WPROCESS_DEFINED
  123. /* wide function prototypes, also declared in wchar.h */
  124. _CRTIMP intptr_t __cdecl _wexecl(const wchar_t *, const wchar_t *, ...);
  125. _CRTIMP intptr_t __cdecl _wexecle(const wchar_t *, const wchar_t *, ...);
  126. _CRTIMP intptr_t __cdecl _wexeclp(const wchar_t *, const wchar_t *, ...);
  127. _CRTIMP intptr_t __cdecl _wexeclpe(const wchar_t *, const wchar_t *, ...);
  128. _CRTIMP intptr_t __cdecl _wexecv(const wchar_t *, const wchar_t * const *);
  129. _CRTIMP intptr_t __cdecl _wexecve(const wchar_t *, const wchar_t * const *, const wchar_t * const *);
  130. _CRTIMP intptr_t __cdecl _wexecvp(const wchar_t *, const wchar_t * const *);
  131. _CRTIMP intptr_t __cdecl _wexecvpe(const wchar_t *, const wchar_t * const *, const wchar_t * const *);
  132. _CRTIMP intptr_t __cdecl _wspawnl(int, const wchar_t *, const wchar_t *, ...);
  133. _CRTIMP intptr_t __cdecl _wspawnle(int, const wchar_t *, const wchar_t *, ...);
  134. _CRTIMP intptr_t __cdecl _wspawnlp(int, const wchar_t *, const wchar_t *, ...);
  135. _CRTIMP intptr_t __cdecl _wspawnlpe(int, const wchar_t *, const wchar_t *, ...);
  136. _CRTIMP intptr_t __cdecl _wspawnv(int, const wchar_t *, const wchar_t * const *);
  137. _CRTIMP intptr_t __cdecl _wspawnve(int, const wchar_t *, const wchar_t * const *,
  138. const wchar_t * const *);
  139. _CRTIMP intptr_t __cdecl _wspawnvp(int, const wchar_t *, const wchar_t * const *);
  140. _CRTIMP intptr_t __cdecl _wspawnvpe(int, const wchar_t *, const wchar_t * const *,
  141. const wchar_t * const *);
  142. _CRTIMP int __cdecl _wsystem(const wchar_t *);
  143. #define _WPROCESS_DEFINED
  144. #endif
  145. /* --------- The following functions are OBSOLETE --------- */
  146. /*
  147. * The Win32 API LoadLibrary, FreeLibrary and GetProcAddress should be used
  148. * instead.
  149. */
  150. intptr_t __cdecl _loaddll(char *);
  151. int __cdecl _unloaddll(intptr_t);
  152. int (__cdecl * __cdecl _getdllprocaddr(intptr_t, char *, intptr_t))();
  153. /* --------- The preceding functions are OBSOLETE --------- */
  154. #ifdef _DECL_DLLMAIN
  155. /*
  156. * Declare DLL notification (initialization/termination) routines
  157. * The preferred method is for the user to provide DllMain() which will
  158. * be called automatically by the DLL entry point defined by the C run-
  159. * time library code. If the user wants to define the DLL entry point
  160. * routine, the user's entry point must call _CRT_INIT on all types of
  161. * notifications, as the very first thing on attach notifications and
  162. * as the very last thing on detach notifications.
  163. */
  164. #ifdef _WINDOWS_ /* Use types from WINDOWS.H */
  165. BOOL WINAPI DllMain(HANDLE, DWORD, LPVOID);
  166. BOOL WINAPI _CRT_INIT(HANDLE, DWORD, LPVOID);
  167. BOOL WINAPI _wCRT_INIT(HANDLE, DWORD, LPVOID);
  168. extern BOOL (WINAPI *_pRawDllMain)(HANDLE, DWORD, LPVOID);
  169. #else
  170. int __stdcall DllMain(void *, unsigned, void *);
  171. int __stdcall _CRT_INIT(void *, unsigned, void *);
  172. int __stdcall _wCRT_INIT(void *, unsigned, void *);
  173. extern int (__stdcall *_pRawDllMain)(void *, unsigned, void *);
  174. #endif /* _WINDOWS_ */
  175. #endif
  176. #if !__STDC__
  177. /* Non-ANSI names for compatibility */
  178. #define P_WAIT _P_WAIT
  179. #define P_NOWAIT _P_NOWAIT
  180. #define P_OVERLAY _P_OVERLAY
  181. #define OLD_P_OVERLAY _OLD_P_OVERLAY
  182. #define P_NOWAITO _P_NOWAITO
  183. #define P_DETACH _P_DETACH
  184. #define WAIT_CHILD _WAIT_CHILD
  185. #define WAIT_GRANDCHILD _WAIT_GRANDCHILD
  186. /* current declarations */
  187. _CRTIMP intptr_t __cdecl cwait(int *, intptr_t, int);
  188. _CRTIMP intptr_t __cdecl execl(const char *, const char *, ...);
  189. _CRTIMP intptr_t __cdecl execle(const char *, const char *, ...);
  190. _CRTIMP intptr_t __cdecl execlp(const char *, const char *, ...);
  191. _CRTIMP intptr_t __cdecl execlpe(const char *, const char *, ...);
  192. _CRTIMP intptr_t __cdecl execv(const char *, const char * const *);
  193. _CRTIMP intptr_t __cdecl execve(const char *, const char * const *, const char * const *);
  194. _CRTIMP intptr_t __cdecl execvp(const char *, const char * const *);
  195. _CRTIMP intptr_t __cdecl execvpe(const char *, const char * const *, const char * const *);
  196. _CRTIMP intptr_t __cdecl spawnl(int, const char *, const char *, ...);
  197. _CRTIMP intptr_t __cdecl spawnle(int, const char *, const char *, ...);
  198. _CRTIMP intptr_t __cdecl spawnlp(int, const char *, const char *, ...);
  199. _CRTIMP intptr_t __cdecl spawnlpe(int, const char *, const char *, ...);
  200. _CRTIMP intptr_t __cdecl spawnv(int, const char *, const char * const *);
  201. _CRTIMP intptr_t __cdecl spawnve(int, const char *, const char * const *,
  202. const char * const *);
  203. _CRTIMP intptr_t __cdecl spawnvp(int, const char *, const char * const *);
  204. _CRTIMP intptr_t __cdecl spawnvpe(int, const char *, const char * const *,
  205. const char * const *);
  206. _CRTIMP int __cdecl getpid(void);
  207. #endif /* __STDC__ */
  208. #ifdef __cplusplus
  209. }
  210. #endif
  211. #endif /* _POSIX_ */
  212. #endif /* _INC_PROCESS */