* Dan Lewis (dihlewis@yahoo.co.uk)
*
* (C) 2001 Ximian, Inc.
+ * Copyright 2012 Xamarin Inc (http://www.xamarin.com)
*/
#ifndef _MONO_METADATA_FILEIO_H_
#include <mono/metadata/object-internals.h>
#include <mono/io-layer/io-layer.h>
+#include <mono/utils/mono-compiler.h>
+
+G_BEGIN_DECLS
/* This is a copy of System.IO.FileAccess */
typedef enum {
FileShare_None=0x0,
FileShare_Read=0x01,
FileShare_Write=0x02,
- FileShare_ReadWrite=FileShare_Read|FileShare_Write
+ FileShare_ReadWrite=FileShare_Read|FileShare_Write,
+ FileShare_Delete=0x04
} MonoFileShare;
+/* This is a copy of System.IO.FileOptions */
+typedef enum {
+ FileOptions_None = 0,
+ FileOptions_Temporary = 1, // Internal. See note in System.IO.FileOptions
+ FileOptions_Encrypted = 0x4000,
+ FileOptions_DeleteOnClose = 0x4000000,
+ FileOptions_SequentialScan = 0x8000000,
+ FileOptions_RandomAccess = 0x10000000,
+ FileOptions_Asynchronous = 0x40000000,
+ FileOptions_WriteThrough = 0x80000000
+} MonoFileOptions;
+
/* This is a copy of System.IO.SeekOrigin */
typedef enum {
SeekOrigin_Begin=0,
/* This is a copy of System.IO.MonoIOStat */
typedef struct _MonoIOStat {
- MonoString *name;
gint32 attributes;
gint64 length;
gint64 creation_time;
FileAttributes_Encrypted=0x04000,
FileAttributes_MonoExecutable= (int) 0x80000000
} MonoFileAttributes;
-
+/* This is not used anymore
typedef struct _MonoFSAsyncResult {
MonoObject obj;
MonoObject *state;
gint bytes_read;
MonoDelegate *real_cb;
} MonoFSAsyncResult;
-
+*/
/* System.IO.MonoIO */
extern MonoBoolean
extern MonoBoolean
ves_icall_System_IO_MonoIO_RemoveDirectory (MonoString *path, gint32 *error);
-extern HANDLE
-ves_icall_System_IO_MonoIO_FindFirstFile (MonoString *path, MonoIOStat *stat,
- gint32 *error);
+MonoArray *
+ves_icall_System_IO_MonoIO_GetFileSystemEntries (MonoString *path,
+ MonoString *path_with_pattern,
+ gint mask, gint attrs,
+ gint32 *error);
-extern MonoBoolean
-ves_icall_System_IO_MonoIO_FindNextFile (HANDLE find, MonoIOStat *stat,
- gint32 *error);
+extern MonoString *
+ves_icall_System_IO_MonoIO_FindFirst (MonoString *path,
+ MonoString *path_with_pattern,
+ gint32 *result_mask,
+ gint32 *error,
+ gpointer *handle);
+extern MonoString *
+ves_icall_System_IO_MonoIO_FindNext (gpointer handle, gint32 *result_mask, gint32 *error);
-extern MonoBoolean
-ves_icall_System_IO_MonoIO_FindClose (HANDLE find, gint32 *error);
+extern int
+ves_icall_System_IO_MonoIO_FindClose (gpointer handle);
extern MonoString *
ves_icall_System_IO_MonoIO_GetCurrentDirectory (gint32 *error);
extern HANDLE
ves_icall_System_IO_MonoIO_Open (MonoString *filename, gint32 mode,
- gint32 access_mode, gint32 share,
- MonoBoolean async, gint32 *error);
+ gint32 access_mode, gint32 share, gint32 options,
+ gint32 *error);
extern MonoBoolean
ves_icall_System_IO_MonoIO_Close (HANDLE handle, gint32 *error);
ves_icall_System_IO_MonoIO_CreatePipe (HANDLE *read_handle,
HANDLE *write_handle);
+extern MonoBoolean ves_icall_System_IO_MonoIO_DuplicateHandle (HANDLE source_process_handle,
+ HANDLE source_handle, HANDLE target_process_handle, HANDLE *target_handle,
+ gint32 access, gint32 inherit, gint32 options);
+
extern gunichar2
ves_icall_System_IO_MonoIO_get_VolumeSeparatorChar (void);
extern void ves_icall_System_IO_MonoIO_Unlock (HANDLE handle, gint64 position,
gint64 length, gint32 *error);
+extern MonoBoolean
+ves_icall_System_IO_MonoIO_ReplaceFile (MonoString *sourceFileName, MonoString *destinationFileName,
+ MonoString *destinationBackupFileName, MonoBoolean ignoreMetadataErrors,
+ gint32 *error);
+
+extern gint64
+mono_filesize_from_path (MonoString *path);
+
+extern gint64
+mono_filesize_from_fd (int fd);
+
+G_END_DECLS
+
#endif /* _MONO_METADATA_FILEIO_H_ */