[reflection] Use coop handles for MonoMethod icalls (#4272)
[mono.git] / mono / io-layer / io.h
index a9b68208f4d468c17694b6c078bc762f9c05d7ef..6e518b60e4596bb7be514d12a7a90f3db8ff39df 100644 (file)
@@ -13,7 +13,8 @@
 #include <stdlib.h>
 
 #include "mono/io-layer/wapi.h"
-#include "mono/io-layer/timefuncs.h"
+
+G_BEGIN_DECLS
 
 typedef struct _WapiSecurityAttributes WapiSecurityAttributes;
 
@@ -80,6 +81,9 @@ typedef void (*WapiOverlappedCB) (guint32 error, guint32 numbytes,
 #define FILE_FLAG_OVERLAPPED                   0x40000000
 #define FILE_FLAG_WRITE_THROUGH                        0x80000000
 
+#define REPLACEFILE_WRITE_THROUGH       0x00000001
+#define REPLACEFILE_IGNORE_MERGE_ERRORS 0x00000002
+
 #define MAX_PATH       260
 
 typedef enum {
@@ -102,6 +106,16 @@ typedef enum {
        FILE_TYPE_REMOTE=0x8000
 } WapiFileType;
 
+typedef enum {
+       DRIVE_UNKNOWN=0,
+       DRIVE_NO_ROOT_DIR=1,
+       DRIVE_REMOVABLE=2,
+       DRIVE_FIXED=3,
+       DRIVE_REMOTE=4,
+       DRIVE_CDROM=5,
+       DRIVE_RAMDISK=6
+} WapiDriveType;
+
 typedef enum {
        GetFileExInfoStandard=0x0000,
        GetFileExMaxInfoLevel=0x0001
@@ -119,6 +133,16 @@ typedef struct
        guint16 wMilliseconds;
 } WapiSystemTime;
 
+typedef struct {
+#if G_BYTE_ORDER == G_BIG_ENDIAN
+       guint32 dwHighDateTime;
+       guint32 dwLowDateTime;
+#else
+       guint32 dwLowDateTime;
+       guint32 dwHighDateTime;
+#endif
+} WapiFileTime;
+
 typedef struct
 {
        guint32 dwFileAttributes;
@@ -143,6 +167,14 @@ typedef struct
        guint32 nFileSizeLow;
 } WapiFileAttributesData;
 
+typedef union {
+       struct {
+               guint32 LowPart;
+               guint32 HighPart;
+       } u;
+       guint64 QuadPart;
+} ULARGE_INTEGER;
+
 #define INVALID_SET_FILE_POINTER ((guint32)-1)
 #define INVALID_FILE_SIZE ((guint32)0xFFFFFFFF)
 #define INVALID_FILE_ATTRIBUTES ((guint32)-1)
@@ -162,7 +194,7 @@ extern gboolean WriteFile(gpointer handle, gconstpointer buffer,
 extern gboolean FlushFileBuffers(gpointer handle);
 extern gboolean SetEndOfFile(gpointer handle);
 extern guint32 SetFilePointer(gpointer handle, gint32 movedistance,
-                             gint32 *highmovedistance, WapiSeekMethod method);
+                             gint32 *highmovedistance, guint32 method);
 extern WapiFileType GetFileType(gpointer handle);
 extern guint32 GetFileSize(gpointer handle, guint32 *highsize);
 extern gboolean GetFileTime(gpointer handle, WapiFileTime *create_time,
@@ -183,6 +215,9 @@ extern gboolean RemoveDirectory (const gunichar2 *name);
 extern gboolean MoveFile (const gunichar2 *name, const gunichar2 *dest_name);
 extern gboolean CopyFile (const gunichar2 *name, const gunichar2 *dest_name,
                          gboolean fail_if_exists);
+extern gboolean ReplaceFile (const gunichar2 *replacedFileName, const gunichar2 *replacementFileName,
+                            const gunichar2 *backupFileName, guint32 replaceFlags, 
+                            gpointer exclude, gpointer reserved);
 extern guint32 GetFileAttributes (const gunichar2 *name);
 extern gboolean GetFileAttributesEx (const gunichar2 *name,
                                     WapiGetFileExInfoLevels level,
@@ -192,13 +227,23 @@ extern guint32 GetCurrentDirectory (guint32 length, gunichar2 *buffer);
 extern gboolean SetCurrentDirectory (const gunichar2 *path);
 extern gboolean CreatePipe (gpointer *readpipe, gpointer *writepipe,
                            WapiSecurityAttributes *security, guint32 size);
-extern guint32 GetTempPath (guint32 len, gunichar2 *buf);
 extern gint32 GetLogicalDriveStrings (guint32 len, gunichar2 *buf);
+extern gboolean GetDiskFreeSpaceEx(const gunichar2 *path_name, ULARGE_INTEGER *free_bytes_avail,
+                                  ULARGE_INTEGER *total_number_of_bytes,
+                                  ULARGE_INTEGER *total_number_of_free_bytes);
+extern guint32 GetDriveType(const gunichar2 *root_path_name);
 extern gboolean LockFile (gpointer handle, guint32 offset_low,
                          guint32 offset_high, guint32 length_low,
                          guint32 length_high);
 extern gboolean UnlockFile (gpointer handle, guint32 offset_low,
                            guint32 offset_high, guint32 length_low,
                            guint32 length_high);
+extern gboolean GetVolumeInformation (const gunichar2 *path, gunichar2 *volumename, int volumesize, int *outserial, int *maxcomp, int *fsflags, gunichar2 *fsbuffer, int fsbuffersize);
+
+
+extern void _wapi_io_init (void);
+extern void _wapi_io_cleanup (void);
+
+G_END_DECLS
 
 #endif /* _WAPI_IO_H_ */