Move some fields (refCount, tls_index and module) from WINE_MODREF to
[wine] / include / msvcrt / io.h
1 /*
2  * System I/O definitions.
3  *
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.
7  */
8 #ifndef __WINE_IO_H
9 #define __WINE_IO_H
10 #define __WINE_USE_MSVCRT
11
12 #ifndef MSVCRT
13 # ifdef USE_MSVCRT_PREFIX
14 #  define MSVCRT(x)    MSVCRT_##x
15 # else
16 #  define MSVCRT(x)    x
17 # endif
18 #endif
19
20 #ifndef MSVCRT_WCHAR_T_DEFINED
21 #define MSVCRT_WCHAR_T_DEFINED
22 #ifndef __cplusplus
23 typedef unsigned short MSVCRT(wchar_t);
24 #endif
25 #endif
26
27 #ifndef _MSC_VER
28 # ifndef __int64
29 #  define __int64 long long
30 # endif
31 #endif
32
33 /* The following are also defined in dos.h */
34 #define _A_NORMAL 0x00000000
35 #define _A_RDONLY 0x00000001
36 #define _A_HIDDEN 0x00000002
37 #define _A_SYSTEM 0x00000004
38 #define _A_VOLID  0x00000008
39 #define _A_SUBDIR 0x00000010
40 #define _A_ARCH   0x00000020
41
42 #ifndef MSVCRT_TIME_T_DEFINED
43 typedef long MSVCRT(time_t);
44 #define MSVCRT_TIME_T_DEFINED
45 #endif
46
47 #ifndef MSVCRT_FSIZE_T_DEFINED
48 typedef unsigned long _fsize_t;
49 #define MSVCRT_FSIZE_T_DEFINED
50 #endif
51
52 #ifndef MSVCRT_FINDDATA_T_DEFINED
53 #define MSVCRT_FINDDATA_T_DEFINED
54 struct _finddata_t
55 {
56   unsigned attrib;
57   MSVCRT(time_t) time_create;
58   MSVCRT(time_t) time_access;
59   MSVCRT(time_t) time_write;
60   _fsize_t       size;
61   char           name[260];
62 };
63
64 struct _finddatai64_t
65 {
66   unsigned attrib;
67   MSVCRT(time_t) time_create;
68   MSVCRT(time_t) time_access;
69   MSVCRT(time_t) time_write;
70   __int64        size;
71   char           name[260];
72 };
73 #endif /* MSVCRT_FINDDATA_T_DEFINED */
74
75 #ifndef MSVCRT_WFINDDATA_T_DEFINED
76 #define MSVCRT_WFINDDATA_T_DEFINED
77 struct _wfinddata_t {
78   unsigned attrib;
79   MSVCRT(time_t) time_create;
80   MSVCRT(time_t) time_access;
81   MSVCRT(time_t) time_write;
82   _fsize_t       size;
83   MSVCRT(wchar_t) name[260];
84 };
85
86 struct _wfinddatai64_t {
87   unsigned attrib;
88   MSVCRT(time_t) time_create;
89   MSVCRT(time_t) time_access;
90   MSVCRT(time_t) time_write;
91   __int64        size;
92   MSVCRT(wchar_t) name[260];
93 };
94 #endif /* MSVCRT_WFINDDATA_T_DEFINED */
95
96 #ifdef __cplusplus
97 extern "C" {
98 #endif
99
100 int         _access(const char*,int);
101 int         _chmod(const char*,int);
102 int         _chsize(int,long);
103 int         _close(int);
104 int         _commit(int);
105 int         _creat(const char*,int);
106 int         _dup(int);
107 int         _dup2(int,int);
108 int         _eof(int);
109 __int64     _filelengthi64(int);
110 long        _filelength(int);
111 int         _findclose(long);
112 long        _findfirst(const char*,struct _finddata_t*);
113 long        _findfirsti64(const char*, struct _finddatai64_t*);
114 int         _findnext(long,struct _finddata_t*);
115 int         _findnexti64(long, struct _finddatai64_t*);
116 long        _get_osfhandle(int);
117 int         _isatty(int);
118 int         _locking(int,int,long);
119 long        _lseek(int,long,int);
120 __int64     _lseeki64(int,__int64,int);
121 char*       _mktemp(char*);
122 int         _open(const char*,int,...);
123 int         _open_osfhandle(long,int);
124 int         _pipe(int*,unsigned int,int);
125 int         _read(int,void*,unsigned int);
126 int         _setmode(int,int);
127 int         _sopen(const char*,int,int,...);
128 long        _tell(int);
129 __int64     _telli64(int);
130 int         _umask(int);
131 int         _unlink(const char*);
132 int         _write(int,const void*,unsigned int);
133
134 int         MSVCRT(remove)(const char*);
135 int         MSVCRT(rename)(const char*,const char*);
136
137 #ifndef MSVCRT_WIO_DEFINED
138 #define MSVCRT_WIO_DEFINED
139 int         _waccess(const MSVCRT(wchar_t)*,int);
140 int         _wchmod(const MSVCRT(wchar_t)*,int);
141 int         _wcreat(const MSVCRT(wchar_t)*,int);
142 long        _wfindfirst(const MSVCRT(wchar_t)*,struct _wfinddata_t*);
143 long        _wfindfirsti64(const MSVCRT(wchar_t)*, struct _wfinddatai64_t*);
144 int         _wfindnext(long,struct _wfinddata_t*);
145 int         _wfindnexti64(long, struct _wfinddatai64_t*);
146 MSVCRT(wchar_t)*_wmktemp(MSVCRT(wchar_t)*);
147 int         _wopen(const MSVCRT(wchar_t)*,int,...);
148 int         _wrename(const MSVCRT(wchar_t)*,const MSVCRT(wchar_t)*);
149 int         _wsopen(const MSVCRT(wchar_t)*,int,int,...);
150 int         _wunlink(const MSVCRT(wchar_t)*);
151 #endif /* MSVCRT_WIO_DEFINED */
152
153 #ifdef __cplusplus
154 }
155 #endif
156
157
158 #ifndef USE_MSVCRT_PREFIX
159 static inline int access(const char* path, int mode) { return _access(path, mode); }
160 static inline int chmod(const char* path, int mode) { return _chmod(path, mode); }
161 static inline int chsize(int fd, long size) { return _chsize(fd, size); }
162 static inline int close(int fd) { return _close(fd); }
163 static inline int creat(const char* path, int mode) { return _creat(path, mode); }
164 static inline int dup(int od) { return _dup(od); }
165 static inline int dup2(int od, int nd) { return _dup2(od, nd); }
166 static inline int eof(int fd) { return _eof(fd); }
167 static inline long filelength(int fd) { return _filelength(fd); }
168 static inline int isatty(int fd) { return _isatty(fd); }
169 static inline int locking(int fd, int mode, long size) { return _locking(fd, mode, size); }
170 static inline long lseek(int fd, long off, int where) { return _lseek(fd, off, where); }
171 static inline char* mktemp(char* pat) { return _mktemp(pat); }
172 #define open _open
173 static inline int read(int fd, void* buf, unsigned int size) { return _read(fd, buf, size); }
174 static inline int setmode(int fd, int mode) { return _setmode(fd, mode); }
175 #define sopen _sopen
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
180 #endif
181 #ifndef MSVCRT_UNLINK_DEFINED
182 static inline int unlink(const char* path) { return _unlink(path); }
183 #define MSVCRT_UNLINK_DEFINED
184 #endif
185 static inline int write(int fd, const void* buf, unsigned int size) { return _write(fd, buf, size); }
186 #endif /* USE _MSVCRT_PREFIX */
187
188 #endif /* __WINE_IO_H */