[sgen] Always use one concurrent worker
[mono-project.git] / mono / io-layer / io.h
blob6e518b60e4596bb7be514d12a7a90f3db8ff39df
1 /*
2 * io.h: File, console and find handles
4 * Author:
5 * Dick Porter (dick@ximian.com)
7 * (C) 2002 Ximian, Inc.
8 */
10 #ifndef _WAPI_IO_H_
11 #define _WAPI_IO_H_
13 #include <stdlib.h>
15 #include "mono/io-layer/wapi.h"
17 G_BEGIN_DECLS
19 typedef struct _WapiSecurityAttributes WapiSecurityAttributes;
21 struct _WapiSecurityAttributes
23 guint32 nLength;
24 gpointer lpSecurityDescriptor;
25 gboolean bInheritHandle;
28 typedef struct _WapiOverlapped WapiOverlapped;
30 struct _WapiOverlapped
32 guint32 Internal;
33 guint32 InternalHigh;
34 guint32 Offset;
35 guint32 OffsetHigh;
36 gpointer hEvent;
37 gpointer handle1;
38 gpointer handle2;
41 typedef void (*WapiOverlappedCB) (guint32 error, guint32 numbytes,
42 WapiOverlapped *overlapped);
44 #define GENERIC_READ 0x80000000
45 #define GENERIC_WRITE 0x40000000
46 #define GENERIC_EXECUTE 0x20000000
47 #define GENERIC_ALL 0x10000000
49 #define FILE_SHARE_READ 0x00000001
50 #define FILE_SHARE_WRITE 0x00000002
51 #define FILE_SHARE_DELETE 0x00000004
53 #define CREATE_NEW 1
54 #define CREATE_ALWAYS 2
55 #define OPEN_EXISTING 3
56 #define OPEN_ALWAYS 4
57 #define TRUNCATE_EXISTING 5
60 #define FILE_ATTRIBUTE_READONLY 0x00000001
61 #define FILE_ATTRIBUTE_HIDDEN 0x00000002
62 #define FILE_ATTRIBUTE_SYSTEM 0x00000004
63 #define FILE_ATTRIBUTE_DIRECTORY 0x00000010
64 #define FILE_ATTRIBUTE_ARCHIVE 0x00000020
65 #define FILE_ATTRIBUTE_ENCRYPTED 0x00000040
66 #define FILE_ATTRIBUTE_NORMAL 0x00000080
67 #define FILE_ATTRIBUTE_TEMPORARY 0x00000100
68 #define FILE_ATTRIBUTE_SPARSE_FILE 0x00000200
69 #define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400
70 #define FILE_ATTRIBUTE_COMPRESSED 0x00000800
71 #define FILE_ATTRIBUTE_OFFLINE 0x00001000
72 #define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000
73 #define FILE_FLAG_OPEN_NO_RECALL 0x00100000
74 #define FILE_FLAG_OPEN_REPARSE_POINT 0x00200000
75 #define FILE_FLAG_POSIX_SEMANTICS 0x01000000
76 #define FILE_FLAG_BACKUP_SEMANTICS 0x02000000
77 #define FILE_FLAG_DELETE_ON_CLOSE 0x04000000
78 #define FILE_FLAG_SEQUENTIAL_SCAN 0x08000000
79 #define FILE_FLAG_RANDOM_ACCESS 0x10000000
80 #define FILE_FLAG_NO_BUFFERING 0x20000000
81 #define FILE_FLAG_OVERLAPPED 0x40000000
82 #define FILE_FLAG_WRITE_THROUGH 0x80000000
84 #define REPLACEFILE_WRITE_THROUGH 0x00000001
85 #define REPLACEFILE_IGNORE_MERGE_ERRORS 0x00000002
87 #define MAX_PATH 260
89 typedef enum {
90 STD_INPUT_HANDLE=-10,
91 STD_OUTPUT_HANDLE=-11,
92 STD_ERROR_HANDLE=-12
93 } WapiStdHandle;
95 typedef enum {
96 FILE_BEGIN=0,
97 FILE_CURRENT=1,
98 FILE_END=2
99 } WapiSeekMethod;
101 typedef enum {
102 FILE_TYPE_UNKNOWN=0x0000,
103 FILE_TYPE_DISK=0x0001,
104 FILE_TYPE_CHAR=0x0002,
105 FILE_TYPE_PIPE=0x0003,
106 FILE_TYPE_REMOTE=0x8000
107 } WapiFileType;
109 typedef enum {
110 DRIVE_UNKNOWN=0,
111 DRIVE_NO_ROOT_DIR=1,
112 DRIVE_REMOVABLE=2,
113 DRIVE_FIXED=3,
114 DRIVE_REMOTE=4,
115 DRIVE_CDROM=5,
116 DRIVE_RAMDISK=6
117 } WapiDriveType;
119 typedef enum {
120 GetFileExInfoStandard=0x0000,
121 GetFileExMaxInfoLevel=0x0001
122 } WapiGetFileExInfoLevels;
124 typedef struct
126 guint16 wYear;
127 guint16 wMonth;
128 guint16 wDayOfWeek;
129 guint16 wDay;
130 guint16 wHour;
131 guint16 wMinute;
132 guint16 wSecond;
133 guint16 wMilliseconds;
134 } WapiSystemTime;
136 typedef struct {
137 #if G_BYTE_ORDER == G_BIG_ENDIAN
138 guint32 dwHighDateTime;
139 guint32 dwLowDateTime;
140 #else
141 guint32 dwLowDateTime;
142 guint32 dwHighDateTime;
143 #endif
144 } WapiFileTime;
146 typedef struct
148 guint32 dwFileAttributes;
149 WapiFileTime ftCreationTime;
150 WapiFileTime ftLastAccessTime;
151 WapiFileTime ftLastWriteTime;
152 guint32 nFileSizeHigh;
153 guint32 nFileSizeLow;
154 guint32 dwReserved0;
155 guint32 dwReserved1;
156 gunichar2 cFileName [MAX_PATH];
157 gunichar2 cAlternateFileName [14];
158 } WapiFindData;
160 typedef struct
162 guint32 dwFileAttributes;
163 WapiFileTime ftCreationTime;
164 WapiFileTime ftLastAccessTime;
165 WapiFileTime ftLastWriteTime;
166 guint32 nFileSizeHigh;
167 guint32 nFileSizeLow;
168 } WapiFileAttributesData;
170 typedef union {
171 struct {
172 guint32 LowPart;
173 guint32 HighPart;
174 } u;
175 guint64 QuadPart;
176 } ULARGE_INTEGER;
178 #define INVALID_SET_FILE_POINTER ((guint32)-1)
179 #define INVALID_FILE_SIZE ((guint32)0xFFFFFFFF)
180 #define INVALID_FILE_ATTRIBUTES ((guint32)-1)
182 extern gpointer CreateFile(const gunichar2 *name, guint32 fileaccess,
183 guint32 sharemode,
184 WapiSecurityAttributes *security,
185 guint32 createmode,
186 guint32 attrs, gpointer tmplate);
187 extern gboolean DeleteFile(const gunichar2 *name);
188 extern gpointer GetStdHandle(WapiStdHandle stdhandle);
189 extern gboolean ReadFile(gpointer handle, gpointer buffer, guint32 numbytes,
190 guint32 *bytesread, WapiOverlapped *overlapped);
191 extern gboolean WriteFile(gpointer handle, gconstpointer buffer,
192 guint32 numbytes, guint32 *byteswritten,
193 WapiOverlapped *overlapped);
194 extern gboolean FlushFileBuffers(gpointer handle);
195 extern gboolean SetEndOfFile(gpointer handle);
196 extern guint32 SetFilePointer(gpointer handle, gint32 movedistance,
197 gint32 *highmovedistance, guint32 method);
198 extern WapiFileType GetFileType(gpointer handle);
199 extern guint32 GetFileSize(gpointer handle, guint32 *highsize);
200 extern gboolean GetFileTime(gpointer handle, WapiFileTime *create_time,
201 WapiFileTime *last_access,
202 WapiFileTime *last_write);
203 extern gboolean SetFileTime(gpointer handle, const WapiFileTime *create_time,
204 const WapiFileTime *last_access,
205 const WapiFileTime *last_write);
206 extern gboolean FileTimeToSystemTime(const WapiFileTime *file_time,
207 WapiSystemTime *system_time);
208 extern gpointer FindFirstFile (const gunichar2 *pattern,
209 WapiFindData *find_data);
210 extern gboolean FindNextFile (gpointer handle, WapiFindData *find_data);
211 extern gboolean FindClose (gpointer handle);
212 extern gboolean CreateDirectory (const gunichar2 *name,
213 WapiSecurityAttributes *security);
214 extern gboolean RemoveDirectory (const gunichar2 *name);
215 extern gboolean MoveFile (const gunichar2 *name, const gunichar2 *dest_name);
216 extern gboolean CopyFile (const gunichar2 *name, const gunichar2 *dest_name,
217 gboolean fail_if_exists);
218 extern gboolean ReplaceFile (const gunichar2 *replacedFileName, const gunichar2 *replacementFileName,
219 const gunichar2 *backupFileName, guint32 replaceFlags,
220 gpointer exclude, gpointer reserved);
221 extern guint32 GetFileAttributes (const gunichar2 *name);
222 extern gboolean GetFileAttributesEx (const gunichar2 *name,
223 WapiGetFileExInfoLevels level,
224 gpointer info);
225 extern gboolean SetFileAttributes (const gunichar2 *name, guint32 attrs);
226 extern guint32 GetCurrentDirectory (guint32 length, gunichar2 *buffer);
227 extern gboolean SetCurrentDirectory (const gunichar2 *path);
228 extern gboolean CreatePipe (gpointer *readpipe, gpointer *writepipe,
229 WapiSecurityAttributes *security, guint32 size);
230 extern gint32 GetLogicalDriveStrings (guint32 len, gunichar2 *buf);
231 extern gboolean GetDiskFreeSpaceEx(const gunichar2 *path_name, ULARGE_INTEGER *free_bytes_avail,
232 ULARGE_INTEGER *total_number_of_bytes,
233 ULARGE_INTEGER *total_number_of_free_bytes);
234 extern guint32 GetDriveType(const gunichar2 *root_path_name);
235 extern gboolean LockFile (gpointer handle, guint32 offset_low,
236 guint32 offset_high, guint32 length_low,
237 guint32 length_high);
238 extern gboolean UnlockFile (gpointer handle, guint32 offset_low,
239 guint32 offset_high, guint32 length_low,
240 guint32 length_high);
241 extern gboolean GetVolumeInformation (const gunichar2 *path, gunichar2 *volumename, int volumesize, int *outserial, int *maxcomp, int *fsflags, gunichar2 *fsbuffer, int fsbuffersize);
244 extern void _wapi_io_init (void);
245 extern void _wapi_io_cleanup (void);
247 G_END_DECLS
249 #endif /* _WAPI_IO_H_ */