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.

306 lines
8.9 KiB

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