[io-layer] Extract error (#4279)
[mono.git] / mono / metadata / image.c
index 5bcd6e90adc75fd8b5629834716d20c6b6302173..84204ec073ba277e07f8d97f470945f943786297 100644 (file)
@@ -27,7 +27,6 @@
 #include "loader.h"
 #include "marshal.h"
 #include "coree.h"
-#include <mono/io-layer/io-layer.h>
 #include <mono/utils/checked-build.h>
 #include <mono/utils/mono-logger-internals.h>
 #include <mono/utils/mono-path.h>
@@ -46,6 +45,7 @@
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
+#include <mono/metadata/w32error.h>
 
 #define INVALID_ADDRESS 0xffffffff
 
@@ -1544,7 +1544,7 @@ mono_image_open_full (const char *fname, MonoImageOpenStatus *status, gboolean r
                fname_utf16 = g_utf8_to_utf16 (absfname, -1, NULL, NULL, NULL);
                module_handle = MonoLoadImage (fname_utf16);
                if (status && module_handle == NULL)
-                       last_error = GetLastError ();
+                       last_error = mono_w32error_get_last ();
 
                /* mono_image_open_from_module_handle is called by _CorDllMain. */
                image = g_hash_table_lookup (loaded_images, absfname);