[corlib] Changed some MonoIO methods to use SafeHandle.
authorMarcos Henrich <marcos.henrich@xamarin.com>
Fri, 23 Jan 2015 15:44:22 +0000 (15:44 +0000)
committerMarcos Henrich <marcos.henrich@xamarin.com>
Mon, 26 Jan 2015 12:27:42 +0000 (12:27 +0000)
mcs/class/corlib/System.IO/MonoIO.cs
mcs/class/corlib/System/Environment.cs
mono/metadata/appdomain.c
mono/metadata/file-io.c
mono/metadata/file-io.h
mono/metadata/icall-def.h

index 24968f13de1a37472569f4a1c11cff96389438e7..c7cdc3772ebb98d9757de8d1af2f8352185e6f3b 100644 (file)
@@ -35,6 +35,7 @@ using System;
 using System.Runtime.CompilerServices;
 using System.Runtime.InteropServices;
 using System.Threading;
+using Microsoft.Win32.SafeHandles;
 #if NET_2_1
 using System.IO.IsolatedStorage;
 #endif
@@ -203,7 +204,7 @@ namespace System.IO
                public extern static bool SetFileAttributes (string path, FileAttributes attrs, out MonoIOError error);
 
                [MethodImplAttribute (MethodImplOptions.InternalCall)]
-               public extern static MonoFileType GetFileType (IntPtr handle, out MonoIOError error);
+               public extern static MonoFileType GetFileType (SafeHandle safeHandle, out MonoIOError error);
 
                //
                // Find file methods
@@ -288,41 +289,41 @@ namespace System.IO
                                                  FileShare share,
                                                  FileOptions options,
                                                  out MonoIOError error);
-               
+
                [MethodImplAttribute (MethodImplOptions.InternalCall)]
                public extern static bool Close (IntPtr handle,
                                                 out MonoIOError error);
                
                [MethodImplAttribute (MethodImplOptions.InternalCall)]
-               public extern static int Read (IntPtr handle, byte [] dest,
+               public extern static int Read (SafeHandle safeHandle, byte [] dest,
                                               int dest_offset, int count,
                                               out MonoIOError error);
                
                [MethodImplAttribute (MethodImplOptions.InternalCall)]
-               public extern static int Write (IntPtr handle, [In] byte [] src,
+               public extern static int Write (SafeHandle safeHandle, [In] byte [] src,
                                                int src_offset, int count,
                                                out MonoIOError error);
                
                [MethodImplAttribute (MethodImplOptions.InternalCall)]
-               public extern static long Seek (IntPtr handle, long offset,
+               public extern static long Seek (SafeHandle safeHandle, long offset,
                                                SeekOrigin origin,
                                                out MonoIOError error);
                
                [MethodImplAttribute (MethodImplOptions.InternalCall)]
-               public extern static bool Flush (IntPtr handle,
+               public extern static bool Flush (SafeHandle safeHandle,
                                                 out MonoIOError error);
 
                [MethodImplAttribute (MethodImplOptions.InternalCall)]
-               public extern static long GetLength (IntPtr handle,
+               public extern static long GetLength (SafeHandle handle,
                                                     out MonoIOError error);
 
                [MethodImplAttribute (MethodImplOptions.InternalCall)]
-               public extern static bool SetLength (IntPtr handle,
+               public extern static bool SetLength (SafeHandle safeHandle,
                                                     long length,
                                                     out MonoIOError error);
 
                [MethodImplAttribute (MethodImplOptions.InternalCall)]
-               public extern static bool SetFileTime (IntPtr handle,
+               public extern static bool SetFileTime (SafeHandle safeHandle,
                                                       long creation_time,
                                                       long last_access_time,
                                                       long last_write_time,
@@ -393,7 +394,7 @@ namespace System.IO
                                break;
                        }
 
-                       result = SetFileTime (handle, creation_time,
+                       result = SetFileTime (new SafeFileHandle(handle, false), creation_time,
                                              last_access_time,
                                              last_write_time, out error);
 
@@ -404,12 +405,12 @@ namespace System.IO
                }
 
                [MethodImplAttribute (MethodImplOptions.InternalCall)]
-               public extern static void Lock (IntPtr handle,
+               public extern static void Lock (SafeHandle safeHandle,
                                                long position, long length,
                                                out MonoIOError error);
 
                [MethodImplAttribute (MethodImplOptions.InternalCall)]
-               public extern static void Unlock (IntPtr handle,
+               public extern static void Unlock (SafeHandle safeHandle,
                                                  long position, long length,
                                                  out MonoIOError error);
 
index 84fcbef7a6897430964240e930c949d4f72d11e1..8c5cf4a6c41d467c5202a897ce6d100bec106764 100644 (file)
@@ -57,7 +57,7 @@ namespace System {
                 * of icalls, do not require an increment.
                 */
 #pragma warning disable 169
-               private const int mono_corlib_version = 114;
+               private const int mono_corlib_version = 115;
 #pragma warning restore 169
 
                [ComVisible (true)]
index f64684c588fbd85c9d7b2fe1a6bf555c52948180..aa8fe26fb68c72fe04ad8177bff15be9b0831182 100644 (file)
@@ -78,7 +78,7 @@
  * Changes which are already detected at runtime, like the addition
  * of icalls, do not require an increment.
  */
-#define MONO_CORLIB_VERSION 114
+#define MONO_CORLIB_VERSION 115
 
 typedef struct
 {
index 097da28a8c73806199a74aaed65c4010fa6dfcd4..576c173376cb8af8202fbe5693dedea48f77e833 100644 (file)
@@ -696,7 +696,7 @@ ves_icall_System_IO_MonoIO_SetFileAttributes (MonoString *path, gint32 attrs,
 }
 
 gint32
-ves_icall_System_IO_MonoIO_GetFileType (HANDLE handle, gint32 *error)
+ves_icall_System_IO_MonoIO_GetFileType (MonoSafeHandle *safeHandle, gint32 *error)
 {
        gboolean ret;
        
@@ -704,7 +704,7 @@ ves_icall_System_IO_MonoIO_GetFileType (HANDLE handle, gint32 *error)
 
        *error=ERROR_SUCCESS;
        
-       ret=GetFileType (handle);
+       ret=GetFileType (safeHandle->handle);
        if(ret==FILE_TYPE_UNKNOWN) {
                /* Not necessarily an error, but the caller will have
                 * to decide based on the error value.
@@ -812,7 +812,7 @@ ves_icall_System_IO_MonoIO_Close (HANDLE handle, gint32 *error)
 }
 
 gint32 
-ves_icall_System_IO_MonoIO_Read (HANDLE handle, MonoArray *dest,
+ves_icall_System_IO_MonoIO_Read (MonoSafeHandle *safeHandle, MonoArray *dest,
                                 gint32 dest_offset, gint32 count,
                                 gint32 *error)
 {
@@ -830,7 +830,7 @@ ves_icall_System_IO_MonoIO_Read (HANDLE handle, MonoArray *dest,
                mono_raise_exception (mono_get_exception_argument ("array", "array too small. numBytes/offset wrong."));
 
        buffer = mono_array_addr (dest, guchar, dest_offset);
-       result = ReadFile (handle, buffer, count, &n, NULL);
+       result = ReadFile (safeHandle->handle, buffer, count, &n, NULL);
 
        if (!result) {
                *error=GetLastError ();
@@ -841,7 +841,7 @@ ves_icall_System_IO_MonoIO_Read (HANDLE handle, MonoArray *dest,
 }
 
 gint32 
-ves_icall_System_IO_MonoIO_Write (HANDLE handle, MonoArray *src,
+ves_icall_System_IO_MonoIO_Write (MonoSafeHandle *safeHandle, MonoArray *src,
                                  gint32 src_offset, gint32 count,
                                  gint32 *error)
 {
@@ -859,7 +859,7 @@ ves_icall_System_IO_MonoIO_Write (HANDLE handle, MonoArray *src,
                mono_raise_exception (mono_get_exception_argument ("array", "array too small. numBytes/offset wrong."));
        
        buffer = mono_array_addr (src, guchar, src_offset);
-       result = WriteFile (handle, buffer, count, &n, NULL);
+       result = WriteFile (safeHandle->handle, buffer, count, &n, NULL);
 
        if (!result) {
                *error=GetLastError ();
@@ -870,7 +870,7 @@ ves_icall_System_IO_MonoIO_Write (HANDLE handle, MonoArray *src,
 }
 
 gint64 
-ves_icall_System_IO_MonoIO_Seek (HANDLE handle, gint64 offset, gint32 origin,
+ves_icall_System_IO_MonoIO_Seek (MonoSafeHandle *safeHandle, gint64 offset, gint32 origin,
                                 gint32 *error)
 {
        gint32 offset_hi;
@@ -880,7 +880,7 @@ ves_icall_System_IO_MonoIO_Seek (HANDLE handle, gint64 offset, gint32 origin,
        *error=ERROR_SUCCESS;
        
        offset_hi = offset >> 32;
-       offset = SetFilePointer (handle, (gint32) (offset & 0xFFFFFFFF), &offset_hi,
+       offset = SetFilePointer (safeHandle->handle, (gint32) (offset & 0xFFFFFFFF), &offset_hi,
                                 convert_seekorigin (origin));
 
        if(offset==INVALID_SET_FILE_POINTER) {
@@ -891,7 +891,7 @@ ves_icall_System_IO_MonoIO_Seek (HANDLE handle, gint64 offset, gint32 origin,
 }
 
 MonoBoolean
-ves_icall_System_IO_MonoIO_Flush (HANDLE handle, gint32 *error)
+ves_icall_System_IO_MonoIO_Flush (MonoSafeHandle *safeHandle, gint32 *error)
 {
        gboolean ret;
        
@@ -899,7 +899,7 @@ ves_icall_System_IO_MonoIO_Flush (HANDLE handle, gint32 *error)
 
        *error=ERROR_SUCCESS;
        
-       ret=FlushFileBuffers (handle);
+       ret=FlushFileBuffers (safeHandle->handle);
        if(ret==FALSE) {
                *error=GetLastError ();
        }
@@ -908,7 +908,7 @@ ves_icall_System_IO_MonoIO_Flush (HANDLE handle, gint32 *error)
 }
 
 gint64 
-ves_icall_System_IO_MonoIO_GetLength (HANDLE handle, gint32 *error)
+ves_icall_System_IO_MonoIO_GetLength (MonoSafeHandle *safeHandle, gint32 *error)
 {
        gint64 length;
        guint32 length_hi;
@@ -917,7 +917,7 @@ ves_icall_System_IO_MonoIO_GetLength (HANDLE handle, gint32 *error)
 
        *error=ERROR_SUCCESS;
        
-       length = GetFileSize (handle, &length_hi);
+       length = GetFileSize (safeHandle->handle, &length_hi);
        if(length==INVALID_FILE_SIZE) {
                *error=GetLastError ();
        }
@@ -926,7 +926,7 @@ ves_icall_System_IO_MonoIO_GetLength (HANDLE handle, gint32 *error)
 }
 
 MonoBoolean
-ves_icall_System_IO_MonoIO_SetLength (HANDLE handle, gint64 length,
+ves_icall_System_IO_MonoIO_SetLength (MonoSafeHandle *safeHandle, gint64 length,
                                      gint32 *error)
 {
        gint64 offset, offset_set;
@@ -941,7 +941,7 @@ ves_icall_System_IO_MonoIO_SetLength (HANDLE handle, gint64 length,
        /* save file pointer */
 
        offset_hi = 0;
-       offset = SetFilePointer (handle, 0, &offset_hi, FILE_CURRENT);
+       offset = SetFilePointer (safeHandle->handle, 0, &offset_hi, FILE_CURRENT);
        if(offset==INVALID_SET_FILE_POINTER) {
                *error=GetLastError ();
                return(FALSE);
@@ -950,14 +950,14 @@ ves_icall_System_IO_MonoIO_SetLength (HANDLE handle, gint64 length,
        /* extend or truncate */
 
        length_hi = length >> 32;
-       offset_set=SetFilePointer (handle, length & 0xFFFFFFFF, &length_hi,
+       offset_set=SetFilePointer (safeHandle->handle, length & 0xFFFFFFFF, &length_hi,
                                   FILE_BEGIN);
        if(offset_set==INVALID_SET_FILE_POINTER) {
                *error=GetLastError ();
                return(FALSE);
        }
 
-       result = SetEndOfFile (handle);
+       result = SetEndOfFile (safeHandle->handle);
        if(result==FALSE) {
                *error=GetLastError ();
                return(FALSE);
@@ -965,7 +965,7 @@ ves_icall_System_IO_MonoIO_SetLength (HANDLE handle, gint64 length,
 
        /* restore file pointer */
 
-       offset_set=SetFilePointer (handle, offset & 0xFFFFFFFF, &offset_hi,
+       offset_set=SetFilePointer (safeHandle->handle, offset & 0xFFFFFFFF, &offset_hi,
                                   FILE_BEGIN);
        if(offset_set==INVALID_SET_FILE_POINTER) {
                *error=GetLastError ();
@@ -976,7 +976,7 @@ ves_icall_System_IO_MonoIO_SetLength (HANDLE handle, gint64 length,
 }
 
 MonoBoolean
-ves_icall_System_IO_MonoIO_SetFileTime (HANDLE handle, gint64 creation_time,
+ves_icall_System_IO_MonoIO_SetFileTime (MonoSafeHandle *safeHandle, gint64 creation_time,
                                        gint64 last_access_time,
                                        gint64 last_write_time, gint32 *error)
 {
@@ -1004,7 +1004,7 @@ ves_icall_System_IO_MonoIO_SetFileTime (HANDLE handle, gint64 creation_time,
        else
                last_write_filetime = (FILETIME *)&last_write_time;
 
-       ret=SetFileTime (handle, creation_filetime, last_access_filetime, last_write_filetime);
+       ret=SetFileTime (safeHandle->handle, creation_filetime, last_access_filetime, last_write_filetime);
        if(ret==FALSE) {
                *error=GetLastError ();
        }
@@ -1189,28 +1189,28 @@ ves_icall_System_IO_MonoIO_GetTempPath (MonoString **mono_name)
        return(ret);
 }
 
-void ves_icall_System_IO_MonoIO_Lock (HANDLE handle, gint64 position,
+void ves_icall_System_IO_MonoIO_Lock (MonoSafeHandle *safeHandle, gint64 position,
                                      gint64 length, gint32 *error)
 {
        gboolean ret;
        
        *error=ERROR_SUCCESS;
        
-       ret=LockFile (handle, position & 0xFFFFFFFF, position >> 32,
+       ret=LockFile (safeHandle->handle, position & 0xFFFFFFFF, position >> 32,
                      length & 0xFFFFFFFF, length >> 32);
        if (ret == FALSE) {
                *error = GetLastError ();
        }
 }
 
-void ves_icall_System_IO_MonoIO_Unlock (HANDLE handle, gint64 position,
+void ves_icall_System_IO_MonoIO_Unlock (MonoSafeHandle *safeHandle, gint64 position,
                                        gint64 length, gint32 *error)
 {
        gboolean ret;
        
        *error=ERROR_SUCCESS;
        
-       ret=UnlockFile (handle, position & 0xFFFFFFFF, position >> 32,
+       ret=UnlockFile (safeHandle->handle, position & 0xFFFFFFFF, position >> 32,
                        length & 0xFFFFFFFF, length >> 32);
        if (ret == FALSE) {
                *error = GetLastError ();
index fa98eaa9105a39878974bad2ec5de98c70ecd8e6..0f489fa8bc8742c93d9aa0a3591276306ca81091 100644 (file)
@@ -163,7 +163,7 @@ ves_icall_System_IO_MonoIO_SetFileAttributes (MonoString *path, gint32 attrs,
                                              gint32 *error) MONO_INTERNAL;
 
 extern gint32
-ves_icall_System_IO_MonoIO_GetFileType (HANDLE handle, gint32 *error) MONO_INTERNAL;
+ves_icall_System_IO_MonoIO_GetFileType (MonoSafeHandle *safeHandle, gint32 *error) MONO_INTERNAL;
 
 extern MonoBoolean
 ves_icall_System_IO_MonoIO_GetFileStat (MonoString *path, MonoIOStat *stat,
@@ -178,31 +178,31 @@ extern MonoBoolean
 ves_icall_System_IO_MonoIO_Close (HANDLE handle, gint32 *error) MONO_INTERNAL;
 
 extern gint32 
-ves_icall_System_IO_MonoIO_Read (HANDLE handle, MonoArray *dest,
+ves_icall_System_IO_MonoIO_Read (MonoSafeHandle *safeHandle, MonoArray *dest,
                                 gint32 dest_offset, gint32 count,
                                 gint32 *error) MONO_INTERNAL;
 
 extern gint32 
-ves_icall_System_IO_MonoIO_Write (HANDLE handle, MonoArray *src,
+ves_icall_System_IO_MonoIO_Write (MonoSafeHandle *safeHandle, MonoArray *src,
                                  gint32 src_offset, gint32 count,
                                  gint32 *error) MONO_INTERNAL;
 
 extern gint64 
-ves_icall_System_IO_MonoIO_Seek (HANDLE handle, gint64 offset, gint32 origin,
+ves_icall_System_IO_MonoIO_Seek (MonoSafeHandle *safeHandle, gint64 offset, gint32 origin,
                                 gint32 *error) MONO_INTERNAL;
 
 extern MonoBoolean
-ves_icall_System_IO_MonoIO_Flush (HANDLE handle, gint32 *error) MONO_INTERNAL;
+ves_icall_System_IO_MonoIO_Flush (MonoSafeHandle *safeHandle, gint32 *error) MONO_INTERNAL;
 
 extern gint64 
-ves_icall_System_IO_MonoIO_GetLength (HANDLE handle, gint32 *error) MONO_INTERNAL;
+ves_icall_System_IO_MonoIO_GetLength (MonoSafeHandle *safeHandle, gint32 *error) MONO_INTERNAL;
 
 extern MonoBoolean
-ves_icall_System_IO_MonoIO_SetLength (HANDLE handle, gint64 length,
+ves_icall_System_IO_MonoIO_SetLength (MonoSafeHandle *safeHandle, gint64 length,
                                      gint32 *error) MONO_INTERNAL;
 
 extern MonoBoolean
-ves_icall_System_IO_MonoIO_SetFileTime (HANDLE handle, gint64 creation_time,
+ves_icall_System_IO_MonoIO_SetFileTime (MonoSafeHandle *safeHandle, gint64 creation_time,
                                        gint64 last_access_time,
                                        gint64 last_write_time, gint32 *error) MONO_INTERNAL;
 
@@ -241,9 +241,9 @@ ves_icall_System_IO_MonoIO_get_InvalidPathChars (void) MONO_INTERNAL;
 extern gint32
 ves_icall_System_IO_MonoIO_GetTempPath (MonoString **mono_name) MONO_INTERNAL;
 
-extern void ves_icall_System_IO_MonoIO_Lock (HANDLE handle, gint64 position,
+extern void ves_icall_System_IO_MonoIO_Lock (MonoSafeHandle *safeHandle, gint64 position,
                                             gint64 length, gint32 *error) MONO_INTERNAL;
-extern void ves_icall_System_IO_MonoIO_Unlock (HANDLE handle, gint64 position,
+extern void ves_icall_System_IO_MonoIO_Unlock (MonoSafeHandle *safeHandle, gint64 position,
                                               gint64 length, gint32 *error) MONO_INTERNAL;
 
 extern MonoBoolean
index f8dc1e8c5cf979f71d5a0bcccfa1b862b65cb805..87c3140690c819a79d1e072c5f23b3e777fd63cf 100644 (file)
@@ -332,33 +332,33 @@ ICALL(MONOIO_34, "DuplicateHandle", ves_icall_System_IO_MonoIO_DuplicateHandle)
 ICALL(MONOIO_37, "FindClose", ves_icall_System_IO_MonoIO_FindClose)
 ICALL(MONOIO_35, "FindFirst", ves_icall_System_IO_MonoIO_FindFirst)
 ICALL(MONOIO_36, "FindNext", ves_icall_System_IO_MonoIO_FindNext)
-ICALL(MONOIO_6, "Flush(intptr,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_Flush)
+ICALL(MONOIO_6, "Flush(System.Runtime.InteropServices.SafeHandle,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_Flush)
 ICALL(MONOIO_7, "GetCurrentDirectory(System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_GetCurrentDirectory)
 ICALL(MONOIO_8, "GetFileAttributes(string,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_GetFileAttributes)
 ICALL(MONOIO_9, "GetFileStat(string,System.IO.MonoIOStat&,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_GetFileStat)
 ICALL(MONOIO_10, "GetFileSystemEntries", ves_icall_System_IO_MonoIO_GetFileSystemEntries)
-ICALL(MONOIO_11, "GetFileType(intptr,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_GetFileType)
-ICALL(MONOIO_12, "GetLength(intptr,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_GetLength)
+ICALL(MONOIO_11, "GetFileType(System.Runtime.InteropServices.SafeHandle,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_GetFileType)
+ICALL(MONOIO_12, "GetLength(System.Runtime.InteropServices.SafeHandle,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_GetLength)
 #ifndef PLATFORM_RO_FS
 ICALL(MONOIO_13, "GetTempPath(string&)", ves_icall_System_IO_MonoIO_GetTempPath)
-ICALL(MONOIO_14, "Lock(intptr,long,long,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_Lock)
+ICALL(MONOIO_14, "Lock(System.Runtime.InteropServices.SafeHandle,long,long,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_Lock)
 ICALL(MONOIO_15, "MoveFile(string,string,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_MoveFile)
 #endif /* !PLATFORM_RO_FS */
 ICALL(MONOIO_16, "Open(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare,System.IO.FileOptions,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_Open)
-ICALL(MONOIO_17, "Read(intptr,byte[],int,int,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_Read)
+ICALL(MONOIO_17, "Read(System.Runtime.InteropServices.SafeHandle,byte[],int,int,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_Read)
 #ifndef PLATFORM_RO_FS
 ICALL(MONOIO_18, "RemoveDirectory(string,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_RemoveDirectory)
 ICALL(MONOIO_18M, "ReplaceFile(string,string,string,bool,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_ReplaceFile)
 #endif /* !PLATFORM_RO_FS */
-ICALL(MONOIO_19, "Seek(intptr,long,System.IO.SeekOrigin,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_Seek)
+ICALL(MONOIO_19, "Seek(System.Runtime.InteropServices.SafeHandle,long,System.IO.SeekOrigin,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_Seek)
 ICALL(MONOIO_20, "SetCurrentDirectory(string,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_SetCurrentDirectory)
 ICALL(MONOIO_21, "SetFileAttributes(string,System.IO.FileAttributes,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_SetFileAttributes)
-ICALL(MONOIO_22, "SetFileTime(intptr,long,long,long,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_SetFileTime)
-ICALL(MONOIO_23, "SetLength(intptr,long,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_SetLength)
+ICALL(MONOIO_22, "SetFileTime(System.Runtime.InteropServices.SafeHandle,long,long,long,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_SetFileTime)
+ICALL(MONOIO_23, "SetLength(System.Runtime.InteropServices.SafeHandle,long,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_SetLength)
 #ifndef PLATFORM_RO_FS
-ICALL(MONOIO_24, "Unlock(intptr,long,long,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_Unlock)
+ICALL(MONOIO_24, "Unlock(System.Runtime.InteropServices.SafeHandle,long,long,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_Unlock)
 #endif
-ICALL(MONOIO_25, "Write(intptr,byte[],int,int,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_Write)
+ICALL(MONOIO_25, "Write(System.Runtime.InteropServices.SafeHandle,byte[],int,int,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_Write)
 ICALL(MONOIO_26, "get_AltDirectorySeparatorChar", ves_icall_System_IO_MonoIO_get_AltDirectorySeparatorChar)
 ICALL(MONOIO_27, "get_ConsoleError", ves_icall_System_IO_MonoIO_get_ConsoleError)
 ICALL(MONOIO_28, "get_ConsoleInput", ves_icall_System_IO_MonoIO_get_ConsoleInput)