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.

302 lines
7.4 KiB

  1. /***
  2. *io.h - declarations for low-level file handling and I/O functions
  3. *
  4. * Copyright (c) 1985-1995, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. * This file contains the function declarations for the low-level
  8. * file handling and I/O functions.
  9. *
  10. * [Public]
  11. *
  12. ****/
  13. #ifndef _INC_IO
  14. #define _INC_IO
  15. #if !defined(_WIN32) && !defined(_MAC)
  16. #error ERROR: Only Mac or Win32 targets supported!
  17. #endif
  18. #ifdef _MSC_VER
  19. /*
  20. * Currently, all MS C compilers for Win32 platforms default to 8 byte
  21. * alignment.
  22. */
  23. #pragma pack(push,8)
  24. #endif /* _MSC_VER */
  25. #ifndef _POSIX_
  26. #ifdef __cplusplus
  27. extern "C" {
  28. #endif
  29. /* Define _CRTAPI1 (for compatibility with the NT SDK) */
  30. #ifndef _CRTAPI1
  31. #if _MSC_VER >= 800 && _M_IX86 >= 300
  32. #define _CRTAPI1 __cdecl
  33. #else
  34. #define _CRTAPI1
  35. #endif
  36. #endif
  37. /* Define _CRTAPI2 (for compatibility with the NT SDK) */
  38. #ifndef _CRTAPI2
  39. #if _MSC_VER >= 800 && _M_IX86 >= 300
  40. #define _CRTAPI2 __cdecl
  41. #else
  42. #define _CRTAPI2
  43. #endif
  44. #endif
  45. /* Define _CRTIMP */
  46. #ifndef _CRTIMP
  47. #ifdef _NTSDK
  48. /* definition compatible with NT SDK */
  49. #define _CRTIMP
  50. #else /* ndef _NTSDK */
  51. /* current definition */
  52. #ifdef _DLL
  53. #define _CRTIMP __declspec(dllimport)
  54. #else /* ndef _DLL */
  55. #define _CRTIMP
  56. #endif /* _DLL */
  57. #endif /* _NTSDK */
  58. #endif /* _CRTIMP */
  59. /* Define __cdecl for non-Microsoft compilers */
  60. #if ( !defined(_MSC_VER) && !defined(__cdecl) )
  61. #define __cdecl
  62. #endif
  63. #ifndef _MAC
  64. #ifndef _WCHAR_T_DEFINED
  65. typedef unsigned short wchar_t;
  66. #define _WCHAR_T_DEFINED
  67. #endif
  68. #endif /* ndef _MAC */
  69. #ifndef _TIME_T_DEFINED
  70. typedef long time_t; /* time value */
  71. #define _TIME_T_DEFINED /* avoid multiple def's of time_t */
  72. #endif
  73. #ifndef _FSIZE_T_DEFINED
  74. typedef unsigned long _fsize_t; /* Could be 64 bits for Win32 */
  75. #define _FSIZE_T_DEFINED
  76. #endif
  77. #ifndef _MAC
  78. #ifndef _FINDDATA_T_DEFINED
  79. struct _finddata_t {
  80. unsigned attrib;
  81. time_t time_create; /* -1 for FAT file systems */
  82. time_t time_access; /* -1 for FAT file systems */
  83. time_t time_write;
  84. _fsize_t size;
  85. char name[260];
  86. };
  87. #if _INTEGRAL_MAX_BITS >= 64
  88. struct _finddatai64_t {
  89. unsigned attrib;
  90. time_t time_create; /* -1 for FAT file systems */
  91. time_t time_access; /* -1 for FAT file systems */
  92. time_t time_write;
  93. __int64 size;
  94. char name[260];
  95. };
  96. #endif
  97. #define _FINDDATA_T_DEFINED
  98. #endif
  99. #ifndef _WFINDDATA_T_DEFINED
  100. struct _wfinddata_t {
  101. unsigned attrib;
  102. time_t time_create; /* -1 for FAT file systems */
  103. time_t time_access; /* -1 for FAT file systems */
  104. time_t time_write;
  105. _fsize_t size;
  106. wchar_t name[260];
  107. };
  108. #if _INTEGRAL_MAX_BITS >= 64
  109. struct _wfinddatai64_t {
  110. unsigned attrib;
  111. time_t time_create; /* -1 for FAT file systems */
  112. time_t time_access; /* -1 for FAT file systems */
  113. time_t time_write;
  114. __int64 size;
  115. wchar_t name[260];
  116. };
  117. #endif
  118. #define _WFINDDATA_T_DEFINED
  119. #endif
  120. /* File attribute constants for _findfirst() */
  121. #define _A_NORMAL 0x00 /* Normal file - No read/write restrictions */
  122. #define _A_RDONLY 0x01 /* Read only file */
  123. #define _A_HIDDEN 0x02 /* Hidden file */
  124. #define _A_SYSTEM 0x04 /* System file */
  125. #define _A_SUBDIR 0x10 /* Subdirectory */
  126. #define _A_ARCH 0x20 /* Archive file */
  127. #endif /* ndef _MAC */
  128. /* function prototypes */
  129. _CRTIMP int __cdecl _access(const char *, int);
  130. _CRTIMP int __cdecl _chmod(const char *, int);
  131. _CRTIMP int __cdecl _chsize(int, long);
  132. _CRTIMP int __cdecl _close(int);
  133. _CRTIMP int __cdecl _commit(int);
  134. _CRTIMP int __cdecl _creat(const char *, int);
  135. _CRTIMP int __cdecl _dup(int);
  136. _CRTIMP int __cdecl _dup2(int, int);
  137. _CRTIMP int __cdecl _eof(int);
  138. _CRTIMP long __cdecl _filelength(int);
  139. #ifndef _MAC
  140. _CRTIMP long __cdecl _findfirst(char *, struct _finddata_t *);
  141. _CRTIMP int __cdecl _findnext(long, struct _finddata_t *);
  142. _CRTIMP int __cdecl _findclose(long);
  143. #endif /* ndef _MAC */
  144. _CRTIMP int __cdecl _isatty(int);
  145. _CRTIMP int __cdecl _locking(int, int, long);
  146. _CRTIMP long __cdecl _lseek(int, long, int);
  147. _CRTIMP char * __cdecl _mktemp(char *);
  148. _CRTIMP int __cdecl _open(const char *, int, ...);
  149. #ifndef _MAC
  150. _CRTIMP int __cdecl _pipe(int *, unsigned int, int);
  151. #endif /* ndef _MAC */
  152. _CRTIMP int __cdecl _read(int, void *, unsigned int);
  153. _CRTIMP int __cdecl remove(const char *);
  154. _CRTIMP int __cdecl rename(const char *, const char *);
  155. _CRTIMP int __cdecl _setmode(int, int);
  156. _CRTIMP int __cdecl _sopen(const char *, int, int, ...);
  157. _CRTIMP long __cdecl _tell(int);
  158. _CRTIMP int __cdecl _umask(int);
  159. _CRTIMP int __cdecl _unlink(const char *);
  160. _CRTIMP int __cdecl _write(int, const void *, unsigned int);
  161. #if _INTEGRAL_MAX_BITS >= 64
  162. _CRTIMP __int64 __cdecl _filelengthi64(int);
  163. _CRTIMP long __cdecl _findfirsti64(char *, struct _finddatai64_t *);
  164. _CRTIMP int __cdecl _findnexti64(long, struct _finddatai64_t *);
  165. _CRTIMP __int64 __cdecl _lseeki64(int, __int64, int);
  166. _CRTIMP __int64 __cdecl _telli64(int);
  167. #endif
  168. #ifndef _MAC
  169. #ifndef _WIO_DEFINED
  170. /* wide function prototypes, also declared in wchar.h */
  171. _CRTIMP int __cdecl _waccess(const wchar_t *, int);
  172. _CRTIMP int __cdecl _wchmod(const wchar_t *, int);
  173. _CRTIMP int __cdecl _wcreat(const wchar_t *, int);
  174. _CRTIMP long __cdecl _wfindfirst(wchar_t *, struct _wfinddata_t *);
  175. _CRTIMP int __cdecl _wfindnext(long, struct _wfinddata_t *);
  176. _CRTIMP int __cdecl _wunlink(const wchar_t *);
  177. _CRTIMP int __cdecl _wrename(const wchar_t *, const wchar_t *);
  178. _CRTIMP int __cdecl _wopen(const wchar_t *, int, ...);
  179. _CRTIMP int __cdecl _wsopen(const wchar_t *, int, int, ...);
  180. _CRTIMP wchar_t * __cdecl _wmktemp(wchar_t *);
  181. #if _INTEGRAL_MAX_BITS >= 64
  182. _CRTIMP long __cdecl _wfindfirsti64(wchar_t *, struct _wfinddatai64_t *);
  183. _CRTIMP int __cdecl _wfindnexti64(long, struct _wfinddatai64_t *);
  184. #endif
  185. #define _WIO_DEFINED
  186. #endif
  187. #endif /* ndef _MAC */
  188. _CRTIMP long __cdecl _get_osfhandle(int);
  189. _CRTIMP int __cdecl _open_osfhandle(long, int);
  190. #if !__STDC__
  191. /* Non-ANSI names for compatibility */
  192. #ifdef _NTSDK
  193. #ifndef __cplusplus
  194. #define access _access
  195. #define chmod _chmod
  196. #define chsize _chsize
  197. #define close _close
  198. #define creat _creat
  199. #define dup _dup
  200. #define dup2 _dup2
  201. #define eof _eof
  202. #define filelength _filelength
  203. #define isatty _isatty
  204. #define locking _locking
  205. #define lseek _lseek
  206. #define mktemp _mktemp
  207. #define open _open
  208. #define read _read
  209. #define setmode _setmode
  210. #define sopen _sopen
  211. #define tell _tell
  212. #define umask _umask
  213. #define unlink _unlink
  214. #define write _write
  215. #endif /* __cplusplus */
  216. #else /* ndef _NTSDK */
  217. _CRTIMP int __cdecl access(const char *, int);
  218. _CRTIMP int __cdecl chmod(const char *, int);
  219. _CRTIMP int __cdecl chsize(int, long);
  220. _CRTIMP int __cdecl close(int);
  221. _CRTIMP int __cdecl creat(const char *, int);
  222. _CRTIMP int __cdecl dup(int);
  223. _CRTIMP int __cdecl dup2(int, int);
  224. _CRTIMP int __cdecl eof(int);
  225. _CRTIMP long __cdecl filelength(int);
  226. _CRTIMP int __cdecl isatty(int);
  227. _CRTIMP int __cdecl locking(int, int, long);
  228. _CRTIMP long __cdecl lseek(int, long, int);
  229. _CRTIMP char * __cdecl mktemp(char *);
  230. _CRTIMP int __cdecl open(const char *, int, ...);
  231. _CRTIMP int __cdecl read(int, void *, unsigned int);
  232. _CRTIMP int __cdecl setmode(int, int);
  233. _CRTIMP int __cdecl sopen(const char *, int, int, ...);
  234. _CRTIMP long __cdecl tell(int);
  235. _CRTIMP int __cdecl umask(int);
  236. _CRTIMP int __cdecl unlink(const char *);
  237. _CRTIMP int __cdecl write(int, const void *, unsigned int);
  238. #endif /* _NTSDK */
  239. #endif /* __STDC__ */
  240. #ifdef __cplusplus
  241. }
  242. #endif
  243. #endif /* _POSIX_ */
  244. #ifdef _MSC_VER
  245. #pragma pack(pop)
  246. #endif /* _MSC_VER */
  247. #endif /* _INC_IO */