Add Mach-O (Darwin file format) support.

oldstable
Pierre d'Herbemont 2003-07-21 20:02:50 +00:00 committed by Alexandre Julliard
parent 5ef127a000
commit 89321f49bd
1 changed files with 17 additions and 0 deletions

View File

@ -145,6 +145,13 @@ enum binary_type MODULE_GetBinaryType( HANDLE hfile )
unsigned char ignored[12];
unsigned short type;
} elf;
struct
{
unsigned long magic;
unsigned long cputype;
unsigned long cpusubtype;
unsigned long filetype;
} macho;
IMAGE_DOS_HEADER mz;
} header;
@ -168,6 +175,16 @@ enum binary_type MODULE_GetBinaryType( HANDLE hfile )
return BINARY_UNKNOWN;
}
/* Mach-o File with Endian set to Big Endian or Little Endian*/
if (header.macho.magic == 0xfeedface || header.macho.magic == 0xecafdeef)
{
switch(header.macho.filetype)
{
case 0x8: /* MH_BUNDLE */ return BINARY_UNIX_LIB;
}
return BINARY_UNKNOWN;
}
/* Not ELF, try DOS */
if (header.mz.e_magic == IMAGE_DOS_SIGNATURE)