# Magic local data for file(1) command.
# Insert here your local magic data. Format is described in magic(5).

# Various Microsoft OS. formats
#------------------------
#
# Windows NT magic numbers
#
# All NT executable and DLL files have a MS-DOS header stub
# which has the "MZ" identifiable string
#
# The offset to find the PE signature (the string "PE\0\0")
# is given at address 60.
# After the signature (4bytes long) is the PE file header.
# 
#  offset [ (60+offset) ]
#  ------
#    0  PE signature  (4 bytes)
#    4   machine type (2bytes)
#    ...
#    22  characteristics (2 bytes)
#        if 0x2000 bit set, then its a DLL
#
#    24  [ Start of optional headers ]
#
#    92  subsystem type
#    94  DLLCharacteristics (NT obsolete) 
#          - but used by Interix GNU ld to indicate shared library
#         
#
#
0	string		MZ		
>(60)	string		PE		Windows NT PE format (EXE),
# check if a DLL (or a .so) then
>>(60+22)	short	&0x2000	
>>>(60+94)	short	1		Interix dynamic shared library
>>>(60+94)	short	0		Windows DLL
#endif
# if its not a DLL then print out image characteristics
>>(60+22)	short	>0
>>>(60+94)	short	1		dynamically linked
>>>(60+22)	short	&0x2		executable
>>>(60+22)	short	^0x2		incomplete executable
>>>(60+22)	short	^0x200		not stripped
#endif
>>(60+4)	short		0x14c		Intel
>>(60+4)	short		0x200		IA64
>>(60+4)	short		0x8664		AMD64
>>(60+4)	short		0x166		MIPS
>>(60+4)	short		0x184		Alpha
>>(60+4)	short		0x1F0		PowerPC
>>(60+4)	short		0x290		HP-Risc
>>(60+92)	short		7	Posix-CUI
>>(60+92)	short		3	Windows-CUI
>>(60+92)	short		2	Windows-GUI
>>(60+92)	short		1	NT-native
#
# currently 0x80 is the offset used by NT executable to get to the NT headers
# that follow the MSDOS stub header.
#
>60		long		>0x80	DOS executable (EXE)
>60		long		<0x80	DOS executable (EXE)

#
# DBG file format
#
0	string		DI		Microsoft debugging symbols (.DBG)

#
# Object file formats (COFF)
#
0       short           0x14c           X86 COFF object or executable
>12     long            >0              not stripped
0       short           0x200           IA64 COFF object or executable
>12     long            >0              not stripped
0       short           0x8664          AMD64 COFF object or executable
>12     long            >0              not stripped
0       short           0x166           MIPS COFF object or executable 
>12     long            >0              not stripped
0       short           0x184           Alpha COFF object or executable
>12     long            >0              not stripped
0       short           0x1F0           PowerPC COFF object or executable
>12     long            >0              not stripped
0       short           0x268           MC68000 COFF object or executable
>12     long            >0              not stripped
0       short           0x290           PA-RISC COFF object or executable
>12     long            >0              not stripped
#------------------------
#
# Various MS-DOS magic numbers
#
0	string		MZ		DOS executable (EXE)
0	string		LZ		DOS executable (built-in)
0	byte		0xe9		DOS executable (COM)
0	byte		0xeb		DOS executable (COM)
0	byte		0xf0		MS-DOS program library
