Source code of Windows XP (NT5)
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.

272 lines
8.5 KiB

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