Mac OS X Support : Mach-O file recognition in loader.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,
Here is a patch which fix Mach-O file format recognition when loading a file.


Thanks,

Pierre.

Modified files:
loader/module.c

ChangeLog:
Add Mach-O file format recognition when loading a file.

Index: loader/module.c
===================================================================
RCS file: /home/wine/wine/loader/module.c,v
retrieving revision 1.182
diff -u -r1.182 module.c
--- loader/module.c	5 Apr 2003 05:13:33 -0000	1.182
+++ loader/module.c	3 May 2003 19:20:00 -0000
@@ -30,6 +30,9 @@
 #ifdef HAVE_UNISTD_H
 # include <unistd.h>
 #endif
+#ifdef HAVE_MACHO_LOADER_H_
+# include <mach-o/loader.h>
+#endif
 #include "wine/winbase16.h"
 #include "winerror.h"
 #include "winternl.h"
@@ -255,6 +258,18 @@
             unsigned char ignored[12];
             unsigned short type;
         } elf;
+#ifdef USE_MACHO
+        struct
+        {
+            unsigned long magic;
+            unsigned long cputype;
+            unsigned long cpusubtype;
+            unsigned long filetype;
+            unsigned long ncmds;
+            unsigned long sizeofcmds;
+            unsigned long flags;
+        } macho;
+#endif /* USE_MACHO */
         IMAGE_DOS_HEADER mz;
     } header;
 
@@ -277,6 +292,30 @@
         }
         return BINARY_UNKNOWN;
     }
+    
+#ifdef USE_MACHO
+Ê Ê Ê/* Mach-o File with Endian set to Big Endian */
+    Êif (header.macho.magic == 0xfeedface)
+Ê Ê Ê{
+         /* FIXME: we don't bother to check byte order, architecture, etc. */
+         switch(header.macho.filetype)
+         {
+           case MH_BUNDLE: return BINARY_UNIX_LIB;
+         }
+         return BINARY_UNKNOWN;
+    }
+
+Ê Ê /* Mach-o File with Endian set to Little Endian */
+    if (header.macho.magic == 0xecafdeef)
+    {
+Ê Ê Ê Ê Ê/* FIXME: we don't bother to check byte order, architecture, etc. */
+         switch(header.macho.filetype)
+         {
+           case MH_BUNDLE: return BINARY_UNIX_LIB;
+         }
+         return BINARY_UNKNOWN;
+    }
+#endif /* USE_MACHO */
 
     /* Not ELF, try DOS */
 

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux