[io-layer] Extract file (#4255)
[mono.git] / mono / metadata / icall.c
index b798a6e7c29f7b328ee0a02ac9c906587f9b07a1..f0dc4ef12388e9e8d7c8225536fbe2167062c753 100644 (file)
@@ -46,7 +46,7 @@
 #include <mono/metadata/tabledefs.h>
 #include <mono/metadata/exception.h>
 #include <mono/metadata/exception-internals.h>
-#include <mono/metadata/file-io.h>
+#include <mono/metadata/w32file.h>
 #include <mono/metadata/console-io.h>
 #include <mono/metadata/mono-route.h>
 #include <mono/metadata/w32socket.h>
@@ -6691,7 +6691,7 @@ mono_icall_get_logical_drives (void)
        ptr = buf;
 
        while (size > initial_size) {
-               size = (guint) GetLogicalDriveStrings (initial_size, ptr);
+               size = (guint) mono_w32file_get_logical_drive (initial_size, ptr);
                if (size > initial_size) {
                        if (ptr != buf)
                                g_free (ptr);
@@ -6747,7 +6747,7 @@ ves_icall_System_IO_DriveInfo_GetDriveFormat (MonoString *path)
        MonoError error;
        gunichar2 volume_name [MAX_PATH + 1];
        
-       if (GetVolumeInformation (mono_string_chars (path), NULL, 0, NULL, NULL, NULL, volume_name, MAX_PATH + 1) == FALSE)
+       if (mono_w32file_get_volume_information (mono_string_chars (path), NULL, 0, NULL, NULL, NULL, volume_name, MAX_PATH + 1) == FALSE)
                return NULL;
        MonoString *result = mono_string_from_utf16_checked (volume_name, &error);
        mono_error_set_pending_exception (&error);
@@ -7026,24 +7026,12 @@ ves_icall_System_IO_DriveInfo_GetDiskFreeSpace (MonoString *path_name, guint64 *
                                                gint32 *error)
 {
        gboolean result;
-       ULARGE_INTEGER wapi_free_bytes_avail;
-       ULARGE_INTEGER wapi_total_number_of_bytes;
-       ULARGE_INTEGER wapi_total_number_of_free_bytes;
 
        *error = ERROR_SUCCESS;
-       result = GetDiskFreeSpaceEx (mono_string_chars (path_name), &wapi_free_bytes_avail, &wapi_total_number_of_bytes,
-                                    &wapi_total_number_of_free_bytes);
 
-       if (result) {
-               *free_bytes_avail = wapi_free_bytes_avail.QuadPart;
-               *total_number_of_bytes = wapi_total_number_of_bytes.QuadPart;
-               *total_number_of_free_bytes = wapi_total_number_of_free_bytes.QuadPart;
-       } else {
-               *free_bytes_avail = 0;
-               *total_number_of_bytes = 0;
-               *total_number_of_free_bytes = 0;
+       result = mono_w32file_get_disk_free_space (mono_string_chars (path_name), free_bytes_avail, total_number_of_bytes, total_number_of_free_bytes);
+       if (!result)
                *error = GetLastError ();
-       }
 
        return result;
 }
@@ -7052,7 +7040,7 @@ ves_icall_System_IO_DriveInfo_GetDiskFreeSpace (MonoString *path_name, guint64 *
 static inline guint32
 mono_icall_drive_info_get_drive_type (MonoString *root_path_name)
 {
-       return GetDriveType (mono_string_chars (root_path_name));
+       return mono_w32file_get_drive_type (mono_string_chars (root_path_name));
 }
 #endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */