Leaked source code of windows server 2003
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.

290 lines
8.2 KiB

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