home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / include / process.h < prev    next >
C/C++ Source or Header  |  1998-06-16  |  9KB  |  273 lines

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