2 * System I/O definitions.
4 * Derived from the mingw header written by Colin Peters.
5 * Modified for Wine use by Jon Griffiths and Francois Gouget.
6 * This file is in the public domain.
10 #ifndef __WINE_USE_MSVCRT
11 #define __WINE_USE_MSVCRT
15 # ifdef USE_MSVCRT_PREFIX
16 # define MSVCRT(x) MSVCRT_##x
22 #ifndef MSVCRT_WCHAR_T_DEFINED
23 #define MSVCRT_WCHAR_T_DEFINED
25 typedef unsigned short MSVCRT(wchar_t);
31 # define __int64 long long
35 /* The following are also defined in dos.h */
36 #define _A_NORMAL 0x00000000
37 #define _A_RDONLY 0x00000001
38 #define _A_HIDDEN 0x00000002
39 #define _A_SYSTEM 0x00000004
40 #define _A_VOLID 0x00000008
41 #define _A_SUBDIR 0x00000010
42 #define _A_ARCH 0x00000020
44 #ifndef MSVCRT_TIME_T_DEFINED
45 typedef long MSVCRT(time_t);
46 #define MSVCRT_TIME_T_DEFINED
49 #ifndef MSVCRT_FSIZE_T_DEFINED
50 typedef unsigned long _fsize_t
;
51 #define MSVCRT_FSIZE_T_DEFINED
54 #ifndef MSVCRT_FINDDATA_T_DEFINED
55 #define MSVCRT_FINDDATA_T_DEFINED
59 MSVCRT(time_t) time_create
;
60 MSVCRT(time_t) time_access
;
61 MSVCRT(time_t) time_write
;
69 MSVCRT(time_t) time_create
;
70 MSVCRT(time_t) time_access
;
71 MSVCRT(time_t) time_write
;
75 #endif /* MSVCRT_FINDDATA_T_DEFINED */
77 #ifndef MSVCRT_WFINDDATA_T_DEFINED
78 #define MSVCRT_WFINDDATA_T_DEFINED
81 MSVCRT(time_t) time_create
;
82 MSVCRT(time_t) time_access
;
83 MSVCRT(time_t) time_write
;
85 MSVCRT(wchar_t) name
[260];
88 struct _wfinddatai64_t
{
90 MSVCRT(time_t) time_create
;
91 MSVCRT(time_t) time_access
;
92 MSVCRT(time_t) time_write
;
94 MSVCRT(wchar_t) name
[260];
96 #endif /* MSVCRT_WFINDDATA_T_DEFINED */
102 int _access(const char*,int);
103 int _chmod(const char*,int);
104 int _chsize(int,long);
107 int _creat(const char*,int);
111 __int64
_filelengthi64(int);
112 long _filelength(int);
113 int _findclose(long);
114 long _findfirst(const char*,struct _finddata_t
*);
115 long _findfirsti64(const char*, struct _finddatai64_t
*);
116 int _findnext(long,struct _finddata_t
*);
117 int _findnexti64(long, struct _finddatai64_t
*);
118 long _get_osfhandle(int);
120 int _locking(int,int,long);
121 long _lseek(int,long,int);
122 __int64
_lseeki64(int,__int64
,int);
123 char* _mktemp(char*);
124 int _open(const char*,int,...);
125 int _open_osfhandle(long,int);
126 int _pipe(int*,unsigned int,int);
127 int _read(int,void*,unsigned int);
128 int _setmode(int,int);
129 int _sopen(const char*,int,int,...);
131 __int64
_telli64(int);
133 int _unlink(const char*);
134 int _write(int,const void*,unsigned int);
136 int MSVCRT(remove
)(const char*);
137 int MSVCRT(rename
)(const char*,const char*);
139 #ifndef MSVCRT_WIO_DEFINED
140 #define MSVCRT_WIO_DEFINED
141 int _waccess(const MSVCRT(wchar_t)*,int);
142 int _wchmod(const MSVCRT(wchar_t)*,int);
143 int _wcreat(const MSVCRT(wchar_t)*,int);
144 long _wfindfirst(const MSVCRT(wchar_t)*,struct _wfinddata_t
*);
145 long _wfindfirsti64(const MSVCRT(wchar_t)*, struct _wfinddatai64_t
*);
146 int _wfindnext(long,struct _wfinddata_t
*);
147 int _wfindnexti64(long, struct _wfinddatai64_t
*);
148 MSVCRT(wchar_t)*_wmktemp(MSVCRT(wchar_t)*);
149 int _wopen(const MSVCRT(wchar_t)*,int,...);
150 int _wrename(const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*);
151 int _wsopen(const MSVCRT(wchar_t)*,int,int,...);
152 int _wunlink(const MSVCRT(wchar_t)*);
153 #endif /* MSVCRT_WIO_DEFINED */
160 #ifndef USE_MSVCRT_PREFIX
161 static inline int access(const char* path
, int mode
) { return _access(path
, mode
); }
162 static inline int chmod(const char* path
, int mode
) { return _chmod(path
, mode
); }
163 static inline int chsize(int fd
, long size
) { return _chsize(fd
, size
); }
164 static inline int close(int fd
) { return _close(fd
); }
165 static inline int creat(const char* path
, int mode
) { return _creat(path
, mode
); }
166 static inline int dup(int od
) { return _dup(od
); }
167 static inline int dup2(int od
, int nd
) { return _dup2(od
, nd
); }
168 static inline int eof(int fd
) { return _eof(fd
); }
169 static inline long filelength(int fd
) { return _filelength(fd
); }
170 static inline int isatty(int fd
) { return _isatty(fd
); }
171 static inline int locking(int fd
, int mode
, long size
) { return _locking(fd
, mode
, size
); }
172 static inline long lseek(int fd
, long off
, int where
) { return _lseek(fd
, off
, where
); }
173 static inline char* mktemp(char* pat
) { return _mktemp(pat
); }
174 static inline int read(int fd
, void* buf
, unsigned int size
) { return _read(fd
, buf
, size
); }
175 static inline int setmode(int fd
, int mode
) { return _setmode(fd
, mode
); }
176 static inline long tell(int fd
) { return _tell(fd
); }
177 #ifndef MSVCRT_UMASK_DEFINED
178 static inline int umask(int fd
) { return _umask(fd
); }
179 #define MSVCRT_UMASK_DEFINED
181 #ifndef MSVCRT_UNLINK_DEFINED
182 static inline int unlink(const char* path
) { return _unlink(path
); }
183 #define MSVCRT_UNLINK_DEFINED
185 static inline int write(int fd
, const void* buf
, unsigned int size
) { return _write(fd
, buf
, size
); }
188 extern int open(const char*,int,...) __attribute__((alias("_open")));
189 extern int sopen(const char*,int,int,...) __attribute__((alias("_sopen")));
193 #endif /* __GNUC__ */
195 #endif /* USE _MSVCRT_PREFIX */
197 #endif /* __WINE_IO_H */