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