[Mono-bugs] [Bug 543199] mono.exe crush with error "The assembly mscorlib.dll was not found or could not be loaded." if path to it contains non latin symbols (example russian)

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Fri Oct 2 08:31:47 EDT 2009


http://bugzilla.novell.com/show_bug.cgi?id=543199

User vargaz at gmail.com added comment
http://bugzilla.novell.com/show_bug.cgi?id=543199#c2





--- Comment #2 from Zoltan Varga <vargaz at gmail.com>  2009-10-02 06:31:46 MDT ---
A patch by Alex:
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
static MonoImage *
do_mono_image_open (const char *fname, MonoImageOpenStatus *status,
                   gboolean care_about_cli, gboolean refonly)
{
       MonoCLIImageInfo *iinfo;
       MonoImage *image;
       FILE *filed;
       struct stat stat_buf;
       guint16 *fname_utf16 = 0;


       //Alex A Ermoshenko: Fix Bug
https://bugzilla.novell.com/show_bug.cgi?id=543199
       //using _wfopen instead of fopen
       fname_utf16 = g_utf8_to_utf16 (fname, -1, NULL, NULL, NULL);
       if ((filed = _wfopen (fname_utf16, L"rb")) == NULL){
               if (IS_PORTABILITY_SET) {
                       gchar *ffname = mono_portability_find_file (fname,
TRUE);
                       if (ffname) {
                               filed = fopen (ffname, "rb");
                               g_free (ffname);
                       }
               }

               if (filed == NULL) {
                       if (status)
                               *status = MONO_IMAGE_ERROR_ERRNO;
                       if(fname_utf16)
                       {
                               g_free(fname_utf16);
                               fname_utf16 = 0;
                       }
                       return NULL;
               }
       }
       if(fname_utf16)
       {
               g_free(fname_utf16);
               fname_utf16 = 0;
       }

       if (fstat (fileno (filed), &stat_buf)) {
               fclose (filed);
               if (status)
                       *status = MONO_IMAGE_ERROR_ERRNO;
               return NULL;
       }
       image = g_new0 (MonoImage, 1);
       image->raw_buffer_used = TRUE;
       image->raw_data_len = stat_buf.st_size;
       image->raw_data = mono_file_map (stat_buf.st_size,
MONO_MMAP_READ|MONO_MMAP_PRIVATE, fileno (filed), 0, &image->raw_data_handle);
       if (!image->raw_data) {
               fclose (filed);
               g_free (image);
               if (status)
                       *status = MONO_IMAGE_IMAGE_INVALID;
               return NULL;
       }
       iinfo = g_new0 (MonoCLIImageInfo, 1);
       image->image_info = iinfo;
       image->name = mono_path_resolve_symlinks (fname);
       image->ref_only = refonly;
       image->ref_count = 1;

       fclose (filed);

       return do_mono_image_load (image, status, care_about_cli);
}
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

-- 
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list