+/*
+ * io.h: File, console and find handles
+ *
+ * Author:
+ * Dick Porter (dick@ximian.com)
+ *
+ * (C) 2002 Ximian, Inc.
+ */
+
#ifndef _WAPI_IO_H_
#define _WAPI_IO_H_
#include <stdlib.h>
#include "mono/io-layer/wapi.h"
+#include "mono/io-layer/timefuncs.h"
typedef struct _WapiSecurityAttributes WapiSecurityAttributes;
guint32 InternalHigh;
guint32 Offset;
guint32 OffsetHigh;
- WapiHandle *hEvent;
+ gpointer hEvent;
+ gpointer handle1;
+ gpointer handle2;
};
+typedef void (*WapiOverlappedCB) (guint32 error, guint32 numbytes,
+ WapiOverlapped *overlapped);
+
#define GENERIC_READ 0x80000000
#define GENERIC_WRITE 0x40000000
#define GENERIC_EXECUTE 0x20000000
typedef enum {
STD_INPUT_HANDLE=-10,
STD_OUTPUT_HANDLE=-11,
- STD_ERROR_HANDLE=-12,
+ STD_ERROR_HANDLE=-12
} WapiStdHandle;
typedef enum {
FILE_BEGIN=0,
FILE_CURRENT=1,
- FILE_END=2,
+ FILE_END=2
} WapiSeekMethod;
typedef enum {
FILE_TYPE_DISK=0x0001,
FILE_TYPE_CHAR=0x0002,
FILE_TYPE_PIPE=0x0003,
- FILE_TYPE_REMOTE=0x8000,
+ FILE_TYPE_REMOTE=0x8000
} WapiFileType;
typedef enum {
GetFileExMaxInfoLevel=0x0001
} WapiGetFileExInfoLevels;
-typedef struct
-{
- guint32 dwLowDateTime;
- guint32 dwHighDateTime;
-} WapiFileTime;
-
typedef struct
{
guint16 wYear;
guint32 nFileSizeLow;
guint32 dwReserved0;
guint32 dwReserved1;
- guchar cFileName [MAX_PATH];
- guchar cAlternateFileName [14];
+ gunichar2 cFileName [MAX_PATH];
+ gunichar2 cAlternateFileName [14];
} WapiFindData;
typedef struct
#define INVALID_SET_FILE_POINTER ((guint32)-1)
#define INVALID_FILE_SIZE ((guint32)0xFFFFFFFF)
-
-extern WapiHandle *CreateFile(const guchar *name, guint32 fileaccess,
- guint32 sharemode,
- WapiSecurityAttributes *security,
- guint32 createmode,
- guint32 attrs, WapiHandle *tmplate);
-extern gboolean DeleteFile(const guchar *name);
-extern WapiHandle *GetStdHandle(WapiStdHandle stdhandle);
-extern gboolean ReadFile(WapiHandle *handle, gpointer buffer, guint32 numbytes,
+#define INVALID_FILE_ATTRIBUTES ((guint32)-1)
+
+extern gpointer CreateFile(const gunichar2 *name, guint32 fileaccess,
+ guint32 sharemode,
+ WapiSecurityAttributes *security,
+ guint32 createmode,
+ guint32 attrs, gpointer tmplate);
+extern gboolean DeleteFile(const gunichar2 *name);
+extern gpointer GetStdHandle(WapiStdHandle stdhandle);
+extern gboolean ReadFile(gpointer handle, gpointer buffer, guint32 numbytes,
guint32 *bytesread, WapiOverlapped *overlapped);
-extern gboolean WriteFile(WapiHandle *handle, gconstpointer buffer,
+extern gboolean WriteFile(gpointer handle, gconstpointer buffer,
guint32 numbytes, guint32 *byteswritten,
WapiOverlapped *overlapped);
-extern gboolean FlushFileBuffers(WapiHandle *handle);
-extern gboolean SetEndOfFile(WapiHandle *handle);
-extern guint32 SetFilePointer(WapiHandle *handle, gint32 movedistance,
+extern gboolean FlushFileBuffers(gpointer handle);
+extern gboolean SetEndOfFile(gpointer handle);
+extern guint32 SetFilePointer(gpointer handle, gint32 movedistance,
gint32 *highmovedistance, WapiSeekMethod method);
-extern WapiFileType GetFileType(WapiHandle *handle);
-extern guint32 GetFileSize(WapiHandle *handle, guint32 *highsize);
-extern gboolean GetFileTime(WapiHandle *handle, WapiFileTime *create_time, WapiFileTime *last_access, WapiFileTime *last_write);
-extern gboolean SetFileTime(WapiHandle *handle, const WapiFileTime *create_time, const WapiFileTime *last_access, const WapiFileTime *last_write);
-extern gboolean FileTimeToSystemTime(const WapiFileTime *file_time, WapiSystemTime *system_time);
-extern WapiHandle *FindFirstFile (const guchar *pattern, WapiFindData *find_data);
-extern gboolean FindNextFile (WapiHandle *handle, WapiFindData *find_data);
-extern gboolean FindClose (WapiHandle *handle);
-extern gboolean CreateDirectory (const guchar *name, WapiSecurityAttributes *security);
-extern gboolean RemoveDirectory (const guchar *name);
-extern gboolean MoveFile (const guchar *name, const guchar *dest_name);
-extern gboolean CopyFile (const guchar *name, const guchar *dest_name, gboolean fail_if_exists);
-extern guint32 GetFileAttributes (const guchar *name);
-extern gboolean GetFileAttributesEx (const guchar *name, WapiGetFileExInfoLevels level, gpointer info);
+extern WapiFileType GetFileType(gpointer handle);
+extern guint32 GetFileSize(gpointer handle, guint32 *highsize);
+extern gboolean GetFileTime(gpointer handle, WapiFileTime *create_time,
+ WapiFileTime *last_access,
+ WapiFileTime *last_write);
+extern gboolean SetFileTime(gpointer handle, const WapiFileTime *create_time,
+ const WapiFileTime *last_access,
+ const WapiFileTime *last_write);
+extern gboolean FileTimeToSystemTime(const WapiFileTime *file_time,
+ WapiSystemTime *system_time);
+extern gpointer FindFirstFile (const gunichar2 *pattern,
+ WapiFindData *find_data);
+extern gboolean FindNextFile (gpointer handle, WapiFindData *find_data);
+extern gboolean FindClose (gpointer handle);
+extern gboolean CreateDirectory (const gunichar2 *name,
+ WapiSecurityAttributes *security);
+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 guint32 GetFileAttributes (const gunichar2 *name);
+extern gboolean GetFileAttributesEx (const gunichar2 *name,
+ WapiGetFileExInfoLevels level,
+ gpointer info);
+extern gboolean SetFileAttributes (const gunichar2 *name, guint32 attrs);
+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 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);
#endif /* _WAPI_IO_H_ */