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.

345 lines
9.5 KiB

  1. /***
  2. *internal.h - contains declarations of internal routines and variables
  3. *
  4. * Copyright (c) 1985-1993, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. * Declares routines and variables used internally by the C run-time.
  8. * [Internal]
  9. *
  10. *Revision History:
  11. * 05-18-87 SKS Module created
  12. * 07-15-87 JCR Added _old_pfxlen and _tempoff
  13. * 08-05-87 JCR Added _getbuf (corrected by SKS)
  14. * 11-05-87 JCR Added _buferr
  15. * 11-18-87 SKS Add __tzset(), made _isindst() near, remove _dtoxmode
  16. * 01-26-88 SKS Make __tzset, _isindst, _dtoxtime near/far for QC
  17. * 02-10-88 JCR Cleaned up white space
  18. * 06-22-88 SKS _canonic/_getcdrv are now used by all models
  19. * 06-29-88 JCR Removed static buffers _bufout and _buferr
  20. * 08-18-88 GJF Revised to also work for the 386 (small model only).
  21. * 09-22-88 GJF Added declarations for _freebuf, _stbuf and _ftbuf.
  22. * 01-31-89 JCR Removed _canonic, _getcdrv, _getcdwd (see direct.h)
  23. * 06-07-89 PHG Added _dosret for i860 (N10) version of libs
  24. * 07-05-89 PHG Changed above to _dosmaperr, added startup variables
  25. * 08-17-89 GJF Cleanup, removed stuff not needed for 386
  26. * 10-25-89 JCR Added prototype for _getpath()
  27. * 10-30-89 GJF Fixed copyright
  28. * 11-02-89 JCR Changed "DLL" to "_DLL"
  29. * 03-01-90 GJF Added #ifndef _INC_INTERNAL and #include <cruntime.h>
  30. * stuff. Also, removed some (now) useless preprocessing
  31. * directives.
  32. * 03-21-90 GJF Put _CALLTYPE1 into prototypes.
  33. * 03-26-90 GJF Added prototypes for _output() and _input(). Filled
  34. * out the prototype for _openfile
  35. * 04-05-90 GJF Added prototype for __NMSG_WRITE() (C source build
  36. * only).
  37. * 04-10-90 GJF Added prototypes for startup functions.
  38. * 05-28-90 SBM Added _flush()
  39. * 07-11-90 SBM Added _commode, removed execload()
  40. * 07-20-90 SBM Changes supporting clean -W3 compiles (added _cftoe
  41. * and _cftof prototypes)
  42. * 08-01-90 SBM Moved _cftoe() and _cftof() to new header
  43. * <fltintrn.h>, formerly named <struct.h>
  44. * 08-21-90 GJF Changed prototypes for _amsg_exit() and _NMSG_WRITE().
  45. * 11-29-90 GJF Added some defs/decls for lowio under Win32.
  46. * 12-04-90 SRW Added _osfile back for win32. Changed _osfinfo from
  47. * an array of structures to an array of 32-bit handles
  48. * (_osfhnd)
  49. * 04-06-91 GJF Changed _heapinit to _heap_init.
  50. * 08-19-91 JCR Added _exitflag
  51. * 08-20-91 JCR C++ and ANSI naming
  52. * 01-05-92 GJF Added declaration for termination done flag [_WIN32_]
  53. * 01-08-92 GJF Added prototype for _GetMainArgs.
  54. * 01-18-92 GJF Added _aexit_rtn.
  55. * 01-22-92 GJF Fixed definitions of _acmdln and _aexit_rtn for the
  56. * of crtdll.dll, crtdll.lib.
  57. * 01-29-92 GJF Added support for linked-in options equivalent to
  58. * commode.obj and setargv.obj (i.e., special declarations
  59. * for _commode and _dowildcard).
  60. * 02-14-92 GJF Replace _nfile with _nhandle for Win32. Also, added
  61. * #define-s for _NHANDLE_.
  62. * 03-17-92 GJF Removed declaration of _tmpoff for Win32.
  63. * 03-30-92 DJM POSIX support.
  64. * 04-27-92 GJF Added prototypes for _ValidDrive (in stat.c).
  65. * 05-28-92 GJF Added prototype for _mtdeletelocks() for Win32.
  66. * 06-02-92 SKS Move prototype for _pgmptr to <DOS.H>
  67. * 06-02-92 KRS Added prototype for _woutput().
  68. * 08-06-92 GJF Function calling type and variable type macros.
  69. * 08-17-92 KRS Added prototype for _winput().
  70. * 08-21-92 GJF Merged last two changes above.
  71. * 08-24-92 PBS Added _dstoffset for posix TZ
  72. * 10-24-92 SKS Add a fourth parameter to _GetMainArgs: wildcard flag
  73. * _GetMainArgs => __GetMainArgs: 2 leading _'s = internal
  74. * 10-24-92 SKS Remove two unnecessary parameters from _cenvarg()
  75. * 01-21-93 GJF Removed support for C6-386's _cdecl.
  76. * 03-30-93 GJF __gmtotime_t supercedes _dtoxtime.
  77. * 04-17-93 SKS Add _mtterm
  78. * 05-11-93 SKS _mtinit now returns success (1) or failure (0)
  79. * _C_Termination_Done needed in all models (for DLLs)
  80. * 06-02-93 CFW Add _flswbuf, _filwbuf protos.
  81. * 07-15-93 SRW Added _capture_argv function prototype
  82. * 09-22-93 CFW Test for invalid MB chars using global preset flag.
  83. *
  84. ****/
  85. #ifndef _INC_INTERNAL
  86. #ifdef __cplusplus
  87. extern "C" {
  88. #endif
  89. #include <cruntime.h>
  90. /* Define function type used in several startup sources */
  91. typedef void (__cdecl *_PVFV)(void);
  92. /*
  93. * Conditional macro definition for function calling type and variable type
  94. * qualifiers.
  95. */
  96. #ifdef _DLL
  97. #define _commode (*_commode_dll)
  98. extern int * _commode_dll;
  99. #else
  100. #ifdef CRTDLL
  101. #define _commode _commode_dll
  102. #endif
  103. extern int _commode;
  104. #endif
  105. #ifdef _WIN32_
  106. /*
  107. * Define the number of supported handles. This definition must exactly match
  108. * the one in os2dll.h.
  109. */
  110. #ifdef MTHREAD
  111. #define _NHANDLE_ 256
  112. #else
  113. #define _NHANDLE_ 64
  114. #endif
  115. extern int _nhandle; /* == _NHANDLE_, set in ioinit.c */
  116. #else /* ndef _WIN32_ */
  117. extern int _nfile;
  118. #endif /* _WIN32_ */
  119. extern char _osfile[];
  120. #ifdef _WIN32_
  121. extern long _osfhnd[];
  122. int __cdecl _alloc_osfhnd(void);
  123. int __cdecl _free_osfhnd(int);
  124. int __cdecl _set_osfhnd(int,long);
  125. #endif /* _WIN32_ */
  126. #ifdef _POSIX_
  127. extern long _dstoffset;
  128. #endif /* _POSIX_ */
  129. extern char __dnames[];
  130. extern char __mnames[];
  131. extern int _days[];
  132. extern int _lpdays[];
  133. #ifndef _TIME_T_DEFINED
  134. typedef long time_t; /* time value */
  135. #define _TIME_T_DEFINED /* avoid multiple def's of time_t */
  136. #endif
  137. extern time_t __cdecl __gmtotime_t(int, int, int, int, int, int);
  138. #ifdef _TM_DEFINED
  139. extern int __cdecl _isindst(struct tm *);
  140. #endif
  141. extern void __cdecl __tzset(void);
  142. #ifdef _POSIX_
  143. extern void __cdecl _tzset(void);
  144. #endif
  145. extern int __cdecl _ValidDrive(unsigned);
  146. /**
  147. ** This variable is in the C start-up; the length must be kept synchronized
  148. ** It is used by the *cenvarg.c modules
  149. **/
  150. extern char _acfinfo[]; /* "_C_FILE_INFO=" */
  151. #define CFI_LENGTH 12 /* "_C_FILE_INFO" is 12 bytes long */
  152. #ifndef _SIZE_T_DEFINED
  153. #ifdef _WIN64
  154. typedef unsigned __int64 size_t;
  155. #else
  156. typedef unsigned int size_t;
  157. #endif
  158. #define _SIZE_T_DEFINED
  159. #endif
  160. #ifndef _VA_LIST_DEFINED
  161. #if defined(_ALPHA_)
  162. typedef struct {
  163. char *a0; /* pointer to first homed integer argument */
  164. int offset; /* byte offset of next parameter */
  165. } va_list;
  166. #else
  167. typedef char * va_list;
  168. #endif
  169. #define _VA_LIST_DEFINED
  170. #endif
  171. /*
  172. * stdio internals
  173. */
  174. #ifdef _FILE_DEFINED
  175. extern FILE * _lastiob;
  176. FILE * __cdecl _getstream(void);
  177. #ifdef _POSIX_
  178. FILE * __cdecl _openfile(const char *, const char *, FILE *);
  179. #else
  180. FILE * __cdecl _openfile(const char *, const char *, int, FILE *);
  181. #endif
  182. void __cdecl _getbuf(FILE *);
  183. int __cdecl _filwbuf (FILE *);
  184. int __cdecl _flswbuf(int, FILE *);
  185. void __cdecl _freebuf(FILE *);
  186. int __cdecl _stbuf(FILE *);
  187. void __cdecl _ftbuf(int, FILE *);
  188. int __cdecl _output(FILE *, const char *, va_list);
  189. int __cdecl _woutput(FILE *, const wchar_t *, va_list);
  190. int __cdecl _input(FILE *, const unsigned char *, va_list);
  191. int __cdecl _winput(FILE *, const wchar_t *, va_list);
  192. int __cdecl _flush(FILE *);
  193. void __cdecl _endstdio(void);
  194. #endif
  195. extern int __invalid_mb_chars;
  196. extern int _cflush;
  197. #ifdef _CRUISER_
  198. extern unsigned int _tmpoff;
  199. #endif /* _CRUISER_ */
  200. extern unsigned int _tempoff;
  201. extern unsigned int _old_pfxlen;
  202. extern int _umaskval; /* the umask value */
  203. extern char _pipech[]; /* pipe lookahead */
  204. extern char _exitflag; /* callable termination flag */
  205. #if defined(_WIN32_)
  206. extern int _C_Termination_Done; /* termination done flag */
  207. #endif /* _WIN32_ */
  208. char * __cdecl _getpath(const char *, char *, unsigned);
  209. /* startup set values */
  210. extern char **__argv; /* argument vector */
  211. extern int __argc; /* argument count */
  212. extern char *_aenvptr; /* environment ptr */
  213. /* command line */
  214. #ifdef _DLL
  215. #define _acmdln (*_acmdln_dll)
  216. extern char **_acmdln_dll;
  217. #else
  218. #ifdef CRTDLL
  219. #define _acmdln _acmdln_dll
  220. #endif
  221. extern char *_acmdln;
  222. #endif
  223. /*
  224. * prototypes for internal startup functions
  225. */
  226. int __cdecl _cwild(void); /* wild.c */
  227. char * __cdecl _find(char *); /* stdarg.asm or stdargv.c */
  228. #ifdef MTHREAD
  229. int __cdecl _mtinit(void); /* tidtable.asm */
  230. int __cdecl _mtinitlocks(void); /* mlock.asm */
  231. void __cdecl _mtterm(void); /* tidtable.asm */
  232. void __cdecl _mtdeletelocks(void); /* mlock.asm */
  233. #endif
  234. /*
  235. * C source build only!!!!
  236. *
  237. * more prototypes for internal startup functions
  238. */
  239. void __cdecl _amsg_exit(int); /* crt0.c */
  240. void __cdecl _cinit(void); /* crt0dat.c */
  241. void __cdecl __doinits(void); /* astart.asm */
  242. void __cdecl __doterms(void); /* astart.asm */
  243. void __cdecl __dopreterms(void); /* astart.asm */
  244. void __cdecl _FF_MSGBANNER(void);
  245. void __cdecl _fptrap(void); /* crt0fp.c */
  246. void __cdecl _heap_init(void);
  247. #ifdef _WIN32_
  248. void __cdecl _ioinit(void); /* crt0.c, crtlib.c */
  249. #endif /* _WIN32_ */
  250. void __cdecl _NMSG_WRITE(int);
  251. void __cdecl _setargv(void); /* setargv.c, stdargv.c */
  252. void __cdecl __setargv(void); /* stdargv.c */
  253. void __cdecl _setenvp(void); /* stdenvp.c */
  254. #ifdef _DLL
  255. #define _aexit_rtn (*_aexit_rtn_dll)
  256. extern void (__cdecl ** _aexit_rtn_dll)(int);
  257. #else
  258. #ifdef CRTDLL
  259. #define _aexit_rtn _aexit_rtn_dll
  260. #endif
  261. extern void (__cdecl * _aexit_rtn)(int);
  262. #endif
  263. #ifdef _WIN32_
  264. #if defined(_DLL) || defined(CRTDLL)
  265. void __cdecl __GetMainArgs(int *, char ***, char ***, int);
  266. #endif
  267. #endif /* _WIN32_ */
  268. /*
  269. * C source build only!!!!
  270. *
  271. * map OS/2 errors into Xenix errno values -- for modules written in C
  272. */
  273. extern void __cdecl _dosmaperr(unsigned long);
  274. /*
  275. * internal routines used by the exec/spawn functions
  276. */
  277. extern int __cdecl _dospawn(int, const char *, char *, char *);
  278. extern int __cdecl _cenvarg(const char * const *, const char * const *,
  279. char **, char **, const char *);
  280. extern char ** __cdecl _capture_argv(
  281. va_list *,
  282. const char *,
  283. char **,
  284. size_t
  285. );
  286. #ifdef __cplusplus
  287. }
  288. #endif
  289. #define _INC_INTERNAL
  290. #endif /* _INC_INTERNAL */