Revert "update rx to the latest rx-oss-v1.1 build."
[mono-project.git] / mono / io-layer / io.h
blob6d7c6f575c412a4386d4473f7a7178b4f9305906
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"
16 #include "mono/io-layer/timefuncs.h"
18 G_BEGIN_DECLS
20 typedef struct _WapiSecurityAttributes WapiSecurityAttributes;
22 struct _WapiSecurityAttributes
24 guint32 nLength;
25 gpointer lpSecurityDescriptor;
26 gboolean bInheritHandle;
29 typedef struct _WapiOverlapped WapiOverlapped;
31 struct _WapiOverlapped
33 guint32 Internal;
34 guint32 InternalHigh;
35 guint32 Offset;
36 guint32 OffsetHigh;
37 gpointer hEvent;
38 gpointer handle1;
39 gpointer handle2;
42 typedef void (*WapiOverlappedCB) (guint32 error, guint32 numbytes,
43 WapiOverlapped *overlapped);
45 #define GENERIC_READ 0x80000000
46 #define GENERIC_WRITE 0x40000000
47 #define GENERIC_EXECUTE 0x20000000
48 #define GENERIC_ALL 0x10000000
50 #define FILE_SHARE_READ 0x00000001
51 #define FILE_SHARE_WRITE 0x00000002
52 #define FILE_SHARE_DELETE 0x00000004
54 #define CREATE_NEW 1
55 #define CREATE_ALWAYS 2
56 #define OPEN_EXISTING 3
57 #define OPEN_ALWAYS 4
58 #define TRUNCATE_EXISTING 5
61 #define FILE_ATTRIBUTE_READONLY 0x00000001
62 #define FILE_ATTRIBUTE_HIDDEN 0x00000002
63 #define FILE_ATTRIBUTE_SYSTEM 0x00000004
64 #define FILE_ATTRIBUTE_DIRECTORY 0x00000010
65 #define FILE_ATTRIBUTE_ARCHIVE 0x00000020
66 #define FILE_ATTRIBUTE_ENCRYPTED 0x00000040
67 #define FILE_ATTRIBUTE_NORMAL 0x00000080
68 #define FILE_ATTRIBUTE_TEMPORARY 0x00000100
69 #define FILE_ATTRIBUTE_SPARSE_FILE 0x00000200
70 #define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400
71 #define FILE_ATTRIBUTE_COMPRESSED 0x00000800
72 #define FILE_ATTRIBUTE_OFFLINE 0x00001000
73 #define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000
74 #define FILE_FLAG_OPEN_NO_RECALL 0x00100000
75 #define FILE_FLAG_OPEN_REPARSE_POINT 0x00200000
76 #define FILE_FLAG_POSIX_SEMANTICS 0x01000000
77 #define FILE_FLAG_BACKUP_SEMANTICS 0x02000000
78 #define FILE_FLAG_DELETE_ON_CLOSE 0x04000000
79 #define FILE_FLAG_SEQUENTIAL_SCAN 0x08000000
80 #define FILE_FLAG_RANDOM_ACCESS 0x10000000
81 #define FILE_FLAG_NO_BUFFERING 0x20000000
82 #define FILE_FLAG_OVERLAPPED 0x40000000
83 #define FILE_FLAG_WRITE_THROUGH 0x80000000
85 #define REPLACEFILE_WRITE_THROUGH 0x00000001
86 #define REPLACEFILE_IGNORE_MERGE_ERRORS 0x00000002
88 #define MAX_PATH 260
90 typedef enum {
91 STD_INPUT_HANDLE=-10,
92 STD_OUTPUT_HANDLE=-11,
93 STD_ERROR_HANDLE=-12
94 } WapiStdHandle;
96 typedef enum {
97 FILE_BEGIN=0,
98 FILE_CURRENT=1,
99 FILE_END=2
100 } WapiSeekMethod;
102 typedef enum {
103 FILE_TYPE_UNKNOWN=0x0000,
104 FILE_TYPE_DISK=0x0001,
105 FILE_TYPE_CHAR=0x0002,
106 FILE_TYPE_PIPE=0x0003,
107 FILE_TYPE_REMOTE=0x8000
108 } WapiFileType;
110 typedef enum {
111 DRIVE_UNKNOWN=0,
112 DRIVE_NO_ROOT_DIR=1,
113 DRIVE_REMOVABLE=2,
114 DRIVE_FIXED=3,
115 DRIVE_REMOTE=4,
116 DRIVE_CDROM=5,
117 DRIVE_RAMDISK=6
118 } WapiDriveType;
120 typedef enum {
121 GetFileExInfoStandard=0x0000,
122 GetFileExMaxInfoLevel=0x0001
123 } WapiGetFileExInfoLevels;
125 typedef struct
127 guint16 wYear;
128 guint16 wMonth;
129 guint16 wDayOfWeek;
130 guint16 wDay;
131 guint16 wHour;
132 guint16 wMinute;
133 guint16 wSecond;
134 guint16 wMilliseconds;
135 } WapiSystemTime;
137 typedef struct
139 guint32 dwFileAttributes;
140 WapiFileTime ftCreationTime;
141 WapiFileTime ftLastAccessTime;
142 WapiFileTime ftLastWriteTime;
143 guint32 nFileSizeHigh;
144 guint32 nFileSizeLow;
145 guint32 dwReserved0;
146 guint32 dwReserved1;
147 gunichar2 cFileName [MAX_PATH];
148 gunichar2 cAlternateFileName [14];
149 } WapiFindData;
151 typedef struct
153 guint32 dwFileAttributes;
154 WapiFileTime ftCreationTime;
155 WapiFileTime ftLastAccessTime;
156 WapiFileTime ftLastWriteTime;
157 guint32 nFileSizeHigh;
158 guint32 nFileSizeLow;
159 } WapiFileAttributesData;
161 #define INVALID_SET_FILE_POINTER ((guint32)-1)
162 #define INVALID_FILE_SIZE ((guint32)0xFFFFFFFF)
163 #define INVALID_FILE_ATTRIBUTES ((guint32)-1)
165 extern gpointer CreateFile(const gunichar2 *name, guint32 fileaccess,
166 guint32 sharemode,
167 WapiSecurityAttributes *security,
168 guint32 createmode,
169 guint32 attrs, gpointer tmplate);
170 extern gboolean DeleteFile(const gunichar2 *name);
171 extern gpointer GetStdHandle(WapiStdHandle stdhandle);
172 extern gboolean ReadFile(gpointer handle, gpointer buffer, guint32 numbytes,
173 guint32 *bytesread, WapiOverlapped *overlapped);
174 extern gboolean WriteFile(gpointer handle, gconstpointer buffer,
175 guint32 numbytes, guint32 *byteswritten,
176 WapiOverlapped *overlapped);
177 extern gboolean FlushFileBuffers(gpointer handle);
178 extern gboolean SetEndOfFile(gpointer handle);
179 extern guint32 SetFilePointer(gpointer handle, gint32 movedistance,
180 gint32 *highmovedistance, WapiSeekMethod method);
181 extern WapiFileType GetFileType(gpointer handle);
182 extern guint32 GetFileSize(gpointer handle, guint32 *highsize);
183 extern gboolean GetFileTime(gpointer handle, WapiFileTime *create_time,
184 WapiFileTime *last_access,
185 WapiFileTime *last_write);
186 extern gboolean SetFileTime(gpointer handle, const WapiFileTime *create_time,
187 const WapiFileTime *last_access,
188 const WapiFileTime *last_write);
189 extern gboolean FileTimeToSystemTime(const WapiFileTime *file_time,
190 WapiSystemTime *system_time);
191 extern gpointer FindFirstFile (const gunichar2 *pattern,
192 WapiFindData *find_data);
193 extern gboolean FindNextFile (gpointer handle, WapiFindData *find_data);
194 extern gboolean FindClose (gpointer handle);
195 extern gboolean CreateDirectory (const gunichar2 *name,
196 WapiSecurityAttributes *security);
197 extern gboolean RemoveDirectory (const gunichar2 *name);
198 extern gboolean MoveFile (const gunichar2 *name, const gunichar2 *dest_name);
199 extern gboolean CopyFile (const gunichar2 *name, const gunichar2 *dest_name,
200 gboolean fail_if_exists);
201 extern gboolean ReplaceFile (const gunichar2 *replacedFileName, const gunichar2 *replacementFileName,
202 const gunichar2 *backupFileName, guint32 replaceFlags,
203 gpointer exclude, gpointer reserved);
204 extern guint32 GetFileAttributes (const gunichar2 *name);
205 extern gboolean GetFileAttributesEx (const gunichar2 *name,
206 WapiGetFileExInfoLevels level,
207 gpointer info);
208 extern gboolean SetFileAttributes (const gunichar2 *name, guint32 attrs);
209 extern guint32 GetCurrentDirectory (guint32 length, gunichar2 *buffer);
210 extern gboolean SetCurrentDirectory (const gunichar2 *path);
211 extern gboolean CreatePipe (gpointer *readpipe, gpointer *writepipe,
212 WapiSecurityAttributes *security, guint32 size);
213 extern guint32 GetTempPath (guint32 len, gunichar2 *buf);
214 extern gint32 GetLogicalDriveStrings (guint32 len, gunichar2 *buf);
215 extern gboolean GetDiskFreeSpaceEx(const gunichar2 *path_name, WapiULargeInteger *free_bytes_avail,
216 WapiULargeInteger *total_number_of_bytes,
217 WapiULargeInteger *total_number_of_free_bytes);
218 extern guint32 GetDriveType(const gunichar2 *root_path_name);
219 extern gboolean LockFile (gpointer handle, guint32 offset_low,
220 guint32 offset_high, guint32 length_low,
221 guint32 length_high);
222 extern gboolean UnlockFile (gpointer handle, guint32 offset_low,
223 guint32 offset_high, guint32 length_low,
224 guint32 length_high);
225 extern gboolean GetVolumeInformation (const gunichar2 *path, gunichar2 *volumename, int volumesize, int *outserial, int *maxcomp, int *fsflags, gunichar2 *fsbuffer, int fsbuffersize);
227 G_END_DECLS
229 #endif /* _WAPI_IO_H_ */