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.

263 lines
8.3 KiB

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