xref: /freebsd/contrib/file/magic/Magdir/apple (revision 43a5ec4eb41567cc92586503212743d89686d78f)
1b6cee71dSXin LI
2b6cee71dSXin LI#------------------------------------------------------------------------------
3*43a5ec4eSXin LI# $File: apple,v 1.45 2021/04/26 15:56:00 christos Exp $
4b6cee71dSXin LI# apple:  file(1) magic for Apple file formats
5b6cee71dSXin LI#
6b6cee71dSXin LI0	search/1/t	FiLeStArTfIlEsTaRt	binscii (apple ][) text
7b6cee71dSXin LI0	string		\x0aGL			Binary II (apple ][) data
8b6cee71dSXin LI0	string		\x76\xff		Squeezed (apple ][) data
9b6cee71dSXin LI0	string		NuFile			NuFile archive (apple ][) data
10b6cee71dSXin LI0	string		N\xf5F\xe9l\xe5		NuFile archive (apple ][) data
11b6cee71dSXin LI0	belong		0x00051600		AppleSingle encoded Macintosh file
12b6cee71dSXin LI0	belong		0x00051607		AppleDouble encoded Macintosh file
13b6cee71dSXin LI
1448c779cdSXin LI# Type: Apple Emulator WOZ format
1548c779cdSXin LI# From: Greg Wildman <greg@apple2.org.za>
1648c779cdSXin LI# Ref: https://applesaucefdc.com/woz/reference/
1748c779cdSXin LI# Ref: https://applesaucefdc.com/woz/reference2/
1848c779cdSXin LI#
1948c779cdSXin LI# Note: The following test are mostly identical. I would rather not
2048c779cdSXin LI# use a regex to identify the WOZ format number.
2148c779cdSXin LI0	string		WOZ1
2248c779cdSXin LI>4	string		\xFF\x0A\x0D\x0A	Apple ][ WOZ 1.0 Disk Image
2348c779cdSXin LI>12	string		INFO
2448c779cdSXin LI>>21	byte		01			\b, 5.25 inch
2548c779cdSXin LI>>21	byte		02			\b, 3.5 inch
2648c779cdSXin LI>>22	byte		01			\b, write protected
2748c779cdSXin LI>>23	byte		01			\b, cross track synchronized
2848c779cdSXin LI>>25	string/T	x			\b, %.32s
2948c779cdSXin LI0	string		WOZ2
3048c779cdSXin LI>4	string		\xFF\x0A\x0D\x0A	Apple ][ WOZ 2.0 Disk Image
3148c779cdSXin LI>12	string		INFO
3248c779cdSXin LI>>21	byte		01			\b, 5.25 inch
3348c779cdSXin LI>>21	byte		02			\b, 3.5 inch
3448c779cdSXin LI>>22	byte		01			\b, write protected
3548c779cdSXin LI>>23	byte		01			\b, cross track synchronized
3648c779cdSXin LI>>25	string/T	x			\b, %.32s
3748c779cdSXin LI
3848c779cdSXin LI# Type: Apple Emulator disk images
3948c779cdSXin LI# From: Greg Wildman <greg@apple2.org.za>
4048c779cdSXin LI# ProDOS boot loader?
4148c779cdSXin LI0		string	\x01\x38\xB0\x03\x4C	Apple ProDOS Image
4248c779cdSXin LI# Detect Volume Directory block ($02)
4348c779cdSXin LI>0x400		string	\x00\x00\x03\x00
4448c779cdSXin LI>>0x404		byte	&0xF0
4548c779cdSXin LI>>>0x405	string	x			\b, Volume /%s
4648c779cdSXin LI>>>0x429	leshort	x			\b, %u Blocks
4748c779cdSXin LI# ProDOS ordered ?
4848c779cdSXin LI>0xb00		string	\x00\x00\x03\x00
4948c779cdSXin LI>>0xb04		byte	&0xF0
5048c779cdSXin LI>>>0xb05	string	x			\b, Volume /%s
5148c779cdSXin LI>>>0xb29	leshort	x			\b, %u Blocks
5248c779cdSXin LI#
5348c779cdSXin LI# DOS3.3 boot loader?
5448c779cdSXin LI0		string	\x01\xA5\x27\xC9\x09\xD0\x18\xA5\x2B
5548c779cdSXin LI>0x11001	string	\x11\x0F\x03	Apple DOS 3.3 Image
5648c779cdSXin LI>>0x11006	byte	x		\b, Volume %u
5748c779cdSXin LI>>0x11034	byte	x		\b, %u Tracks
5848c779cdSXin LI>>0x11035	byte	x		\b, %u Sectors
5948c779cdSXin LI>>0x11036	leshort	x		\b, %u bytes per sector
6048c779cdSXin LI# DOS3.2 ?
6148c779cdSXin LI>0x11001	string	\x11\x0C\x02	Apple DOS 3.2 Image
6248c779cdSXin LI>>0x11006	byte	x		\b, Volume %u
6348c779cdSXin LI>>0x11034	byte	x		\b, %u Tracks
6448c779cdSXin LI>>0x11035	byte	x		\b, %u Sectors
6548c779cdSXin LI>>0x11036	leshort	x		\b, %u bytes per sector
6648c779cdSXin LI# DOS3.1 ?
6748c779cdSXin LI>0x11001	string	\x11\x0C\x01
6848c779cdSXin LI>>0x11c00	string	\x00\x11\x0B	Apple DOS 3.1 Image
6948c779cdSXin LI#
7048c779cdSXin LI# Pascal boot loader?
7148c779cdSXin LI0		string	\x01\xE0\x60\xF0\x03\x4C\xE3\x08\xAD
7248c779cdSXin LI>0xd6		pstring SYSTEM.APPLE
7348c779cdSXin LI>>0xb00		leshort	0x0000
7448c779cdSXin LI>>>0xb04	leshort 0x0000		Apple Pascal Image
7548c779cdSXin LI>>>>0xb06	pstring x		\b, Volume %s:
7648c779cdSXin LI>>>>0xb0e	leshort x		\b, %u Blocks
7748c779cdSXin LI>>>>0xb10	leshort x		\b, %u Files
78d38c30c0SXin LI#
79d38c30c0SXin LI# Diversi Dos boot loader?
80d38c30c0SXin LI0		string	\x01\xA8\xAD\x81\xC0\xEE\x09\x08\xAD
81d38c30c0SXin LI>0x11001	string	\x11\x0F\x03	Apple Diversi Dos Image
82d38c30c0SXin LI>>0x11006	byte	x		\b, Volume %u
83d38c30c0SXin LI>>0x11034	byte	x		\b, %u Tracks
84d38c30c0SXin LI>>0x11035	byte	x		\b, %u Sectors
85d38c30c0SXin LI>>0x11036	leshort	x		\b, %u bytes per sector
8648c779cdSXin LI
87b6cee71dSXin LI# Type: Apple Emulator 2IMG format
88b6cee71dSXin LI# From: Radek Vokal <rvokal@redhat.com>
8948c779cdSXin LI# Update: Greg Wildman <greg@apple2.org.za>
90b6cee71dSXin LI0		string	2IMG		Apple ][ 2IMG Disk Image
9148c779cdSXin LI>4		clear	x
92b6cee71dSXin LI>4		string	XGS!		\b, XGS
93b6cee71dSXin LI>4		string	CTKG		\b, Catakig
94b6cee71dSXin LI>4		string	ShIm		\b, Sheppy's ImageMaker
9548c779cdSXin LI>4		string	SHEP		\b, Sheppy's ImageMaker
96b6cee71dSXin LI>4		string	WOOF		\b, Sweet 16
97b6cee71dSXin LI>4		string	B2TR		\b, Bernie ][ the Rescue
9848c779cdSXin LI>4		string	\!nfc		\b, ASIMOV2
9948c779cdSXin LI>4		string	\>BD\<		\b, Brutal Deluxe's Cadius
10048c779cdSXin LI>4		string	CdrP		\b, CiderPress
10148c779cdSXin LI>4		string	Vi][		\b, Virtual ][
10248c779cdSXin LI>4		string	PRFS		\b, ProFUSE
10348c779cdSXin LI>4		string	FISH		\b, FishWings
10448c779cdSXin LI>4		string	RVLW		\b, Revival for Windows
10548c779cdSXin LI>4		default	x
10648c779cdSXin LI>>4		string	x		\b, Creator tag "%-4.4s"
107b6cee71dSXin LI>0xc		byte	00		\b, DOS 3.3 sector order
108b6cee71dSXin LI>>0x10		byte	00		\b, Volume 254
109b6cee71dSXin LI>>0x10		byte&0x7f x		\b, Volume %u
110b6cee71dSXin LI>0xc		byte	01		\b, ProDOS sector order
111d38c30c0SXin LI# Detect Volume Directory block ($02) + 2mg header offset
112d38c30c0SXin LI>>0x440		string	\x00\x00\x03\x00
113d38c30c0SXin LI>>>0x444	byte	&0xF0
114d38c30c0SXin LI>>>>0x445	string	x		\b, Volume /%s
115d38c30c0SXin LI>>>>0x469	leshort	x		\b, %u Blocks
116b6cee71dSXin LI>0xc		byte	02		\b, NIB data
117b6cee71dSXin LI
118b6cee71dSXin LI# magic for Newton PDA package formats
119b6cee71dSXin LI# from Ruda Moura <ruda@helllabs.org>
120b6cee71dSXin LI0	string	package0	Newton package, NOS 1.x,
121b6cee71dSXin LI>12	belong	&0x80000000	AutoRemove,
122b6cee71dSXin LI>12	belong	&0x40000000	CopyProtect,
123b6cee71dSXin LI>12	belong	&0x10000000	NoCompression,
124b6cee71dSXin LI>12	belong	&0x04000000	Relocation,
125b6cee71dSXin LI>12	belong	&0x02000000	UseFasterCompression,
126b6cee71dSXin LI>16	belong	x		version %d
127b6cee71dSXin LI
128b6cee71dSXin LI0	string	package1	Newton package, NOS 2.x,
129b6cee71dSXin LI>12	belong	&0x80000000	AutoRemove,
130b6cee71dSXin LI>12	belong	&0x40000000	CopyProtect,
131b6cee71dSXin LI>12	belong	&0x10000000	NoCompression,
132b6cee71dSXin LI>12	belong	&0x04000000	Relocation,
133b6cee71dSXin LI>12	belong	&0x02000000	UseFasterCompression,
134b6cee71dSXin LI>16	belong	x		version %d
135b6cee71dSXin LI
136b6cee71dSXin LI0	string	package4	Newton package,
137b6cee71dSXin LI>8	byte	8		NOS 1.x,
138b6cee71dSXin LI>8	byte	9		NOS 2.x,
139b6cee71dSXin LI>12	belong	&0x80000000	AutoRemove,
140b6cee71dSXin LI>12	belong	&0x40000000	CopyProtect,
141b6cee71dSXin LI>12	belong	&0x10000000	NoCompression,
142b6cee71dSXin LI
143b6cee71dSXin LI# The following entries for the Apple II are for files that have
144b6cee71dSXin LI# been transferred as raw binary data from an Apple, without having
145b6cee71dSXin LI# been encapsulated by any of the above archivers.
146b6cee71dSXin LI#
147b6cee71dSXin LI# In general, Apple II formats are hard to identify because Apple DOS
148b6cee71dSXin LI# and especially Apple ProDOS have strong typing in the file system and
149b6cee71dSXin LI# therefore programmers never felt much need to include type information
150b6cee71dSXin LI# in the files themselves.
151b6cee71dSXin LI#
152b6cee71dSXin LI# Eric Fischer <enf@pobox.com>
153b6cee71dSXin LI
154b6cee71dSXin LI# AppleWorks word processor:
1553e41d09dSXin LI# URL: https://en.wikipedia.org/wiki/AppleWorks
1563e41d09dSXin LI# Reference: http://www.gno.org/pub/apple2/doc/apple/filetypes/ftn.1a.xxxx
1573e41d09dSXin LI# Update: Joerg Jenderek
1583e41d09dSXin LI# NOTE:
159b6cee71dSXin LI# The "O" is really the magic number, but that's so common that it's
160b6cee71dSXin LI# necessary to check the tab stops that follow it to avoid false positives.
1613e41d09dSXin LI# and/or look for unused bits of booleans bytes like zoom, paginated, mail merge
1623e41d09dSXin LI# the newer AppleWorks is from claris with extension CWK
1633e41d09dSXin LI4	string		O
1643e41d09dSXin LI# test for unused bits of zoom- , paginated-boolean bytes
1653e41d09dSXin LI>84	ubequad		^0x00Fe00000000Fe00
1663e41d09dSXin LI# look for tabstop definitions "=" no tab, "|" no tab
1673e41d09dSXin LI# "<" left tab,"^" center tab,">" right tab, "." decimal tab,
1683e41d09dSXin LI# unofficial "!" other , "\x8a" other
1693e41d09dSXin LI# official only if SFMinVers is nonzero
1703e41d09dSXin LI>>5	regex/s	[=.<>|!^\x8a]{79}	AppleWorks Word Processor
1713e41d09dSXin LI# AppleWorks Word Processor File (Apple II)
1723e41d09dSXin LI# ./apple (version 5.25) labeled the entry as "AppleWorks word processor data"
1733e41d09dSXin LI# application/x-appleworks is mime type for claris version with cwk extension
1743e41d09dSXin LI!:mime	application/x-appleworks3
1753e41d09dSXin LI# http://home.earthlink.net/~hughhood/appleiiworksenvoy/
1763e41d09dSXin LI# ('p' + 1-byte ProDOS File Type + 2-byte ProDOS Aux Type')
1773e41d09dSXin LI# $70 $1A $F8 $FF is this the apple type ?
17848c779cdSXin LI#:apple pdosp^Z\xf8\xff
1793e41d09dSXin LI!:ext awp
1803e41d09dSXin LI# minimum version needed to read this files. SFMinVers (0 , 30~3.0 )
1813e41d09dSXin LI>>>183	ubyte		30	3.0
1823e41d09dSXin LI>>>183	ubyte		!30
183*43a5ec4eSXin LI>>>>183	ubyte		!0	%#x
1843e41d09dSXin LI# usual tabstop start sequence "=====<"
1853e41d09dSXin LI>>>5	string		x	\b, tabstop ruler "%6.6s"
1863e41d09dSXin LI# tabstop ruler
1873e41d09dSXin LI#>>>5	string		>\0	\b, tabstops "%-79s"
1883e41d09dSXin LI# zoom switch
1893e41d09dSXin LI>>>85	  byte&0x01	>0	\b, zoomed
1903e41d09dSXin LI# whether paginated
1913e41d09dSXin LI>>>90	  byte&0x01	>0	\b, paginated
1923e41d09dSXin LI# contains any mail-merge commands
1933e41d09dSXin LI>>>92	  byte&0x01	>0	\b, with mail merge
1943e41d09dSXin LI# left margin in 1/10 inches ( normally 0 or 10 )
1953e41d09dSXin LI>>>91	ubyte		>0
1963e41d09dSXin LI>>>>91	ubyte		x	\b, %d/10 inch left margin
197b6cee71dSXin LI
198b6cee71dSXin LI# AppleWorks database:
199b6cee71dSXin LI#
200b6cee71dSXin LI# This isn't really a magic number, but it's the closest thing to one
201b6cee71dSXin LI# that I could find.  The 1 and 2 really mean "order in which you defined
202b6cee71dSXin LI# categories" and "left to right, top to bottom," respectively; the D and R
203b6cee71dSXin LI# mean that the cursor should move either down or right when you press Return.
204b6cee71dSXin LI
205b6cee71dSXin LI#30	string		\x01D	AppleWorks database data
206b6cee71dSXin LI#30	string		\x02D	AppleWorks database data
207b6cee71dSXin LI#30	string		\x01R	AppleWorks database data
208b6cee71dSXin LI#30	string		\x02R	AppleWorks database data
209b6cee71dSXin LI
210b6cee71dSXin LI# AppleWorks spreadsheet:
211b6cee71dSXin LI#
212b6cee71dSXin LI# Likewise, this isn't really meant as a magic number.  The R or C means
213b6cee71dSXin LI# row- or column-order recalculation; the A or M means automatic or manual
214b6cee71dSXin LI# recalculation.
215b6cee71dSXin LI
216b6cee71dSXin LI#131	string		RA	AppleWorks spreadsheet data
217b6cee71dSXin LI#131	string		RM	AppleWorks spreadsheet data
218b6cee71dSXin LI#131	string		CA	AppleWorks spreadsheet data
219b6cee71dSXin LI#131	string		CM	AppleWorks spreadsheet data
220b6cee71dSXin LI
221b6cee71dSXin LI# Applesoft BASIC:
222b6cee71dSXin LI#
223b6cee71dSXin LI# This is incredibly sloppy, but will be true if the program was
224b6cee71dSXin LI# written at its usual memory location of 2048 and its first line
225b6cee71dSXin LI# number is less than 256.  Yuck.
226b6cee71dSXin LI# update by Joerg Jenderek at Feb 2013
227b6cee71dSXin LI
228b6cee71dSXin LI# GRR: this test is still too general as it catches also Gujin BOOT144.SYS (0xfa080000)
229b6cee71dSXin LI#0       belong&0xff00ff 0x80000 Applesoft BASIC program data
230b6cee71dSXin LI0	belong&0x00ff00ff	0x00080000
231b6cee71dSXin LI# assuming that line number must be positive
232b6cee71dSXin LI>2	leshort			>0		Applesoft BASIC program data, first line number %d
233b6cee71dSXin LI#>2     leshort         x       \b, first line number %d
234b6cee71dSXin LI
235b6cee71dSXin LI# ORCA/EZ assembler:
236b6cee71dSXin LI#
237b6cee71dSXin LI# This will not identify ORCA/M source files, since those have
238b6cee71dSXin LI# some sort of date code instead of the two zero bytes at 6 and 7
239b6cee71dSXin LI# XXX Conflicts with ELF
240b6cee71dSXin LI#4       belong&0xff00ffff       0x01000000      ORCA/EZ assembler source data
241b6cee71dSXin LI#>5      byte                    x               \b, build number %d
242b6cee71dSXin LI
243b6cee71dSXin LI# Broderbund Fantavision
244b6cee71dSXin LI#
245b6cee71dSXin LI# I don't know what these values really mean, but they seem to recur.
246b6cee71dSXin LI# Will they cause too many conflicts?
247b6cee71dSXin LI
248b6cee71dSXin LI# Probably :-)
249b6cee71dSXin LI#2	belong&0xFF00FF		0x040008	Fantavision movie data
250b6cee71dSXin LI
251b6cee71dSXin LI# Some attempts at images.
252b6cee71dSXin LI#
253b6cee71dSXin LI# These are actually just bit-for-bit dumps of the frame buffer, so
254b6cee71dSXin LI# there's really no reasonably way to distinguish them except for their
255b6cee71dSXin LI# address (if preserved) -- 8192 or 16384 -- and their length -- 8192
256b6cee71dSXin LI# or, occasionally, 8184.
257b6cee71dSXin LI#
258b6cee71dSXin LI# Nevertheless this will manage to catch a lot of images that happen
259b6cee71dSXin LI# to have a solid-colored line at the bottom of the screen.
260b6cee71dSXin LI
261b6cee71dSXin LI# GRR: Magic too weak
262b6cee71dSXin LI#8144	string	\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F	Apple II image with white background
263b6cee71dSXin LI#8144	string	\x55\x2A\x55\x2A\x55\x2A\x55\x2A	Apple II image with purple background
264b6cee71dSXin LI#8144	string	\x2A\x55\x2A\x55\x2A\x55\x2A\x55	Apple II image with green background
265b6cee71dSXin LI#8144	string	\xD5\xAA\xD5\xAA\xD5\xAA\xD5\xAA	Apple II image with blue background
266b6cee71dSXin LI#8144	string	\xAA\xD5\xAA\xD5\xAA\xD5\xAA\xD5	Apple II image with orange background
267b6cee71dSXin LI
268b6cee71dSXin LI# Beagle Bros. Apple Mechanic fonts
269b6cee71dSXin LI
270b6cee71dSXin LI0	belong&0xFF00FFFF	0x6400D000	Apple Mechanic font
271b6cee71dSXin LI
272b6cee71dSXin LI# Apple Universal Disk Image Format (UDIF) - dmg files.
273b6cee71dSXin LI# From Johan Gade.
274b6cee71dSXin LI# These entries are disabled for now until we fix the following issues.
275b6cee71dSXin LI#
276b6cee71dSXin LI# Note there might be some problems with the "VAX COFF executable"
277b6cee71dSXin LI# entry. Note this entry should be placed before the mac filesystem section,
278b6cee71dSXin LI# particularly the "Apple Partition data" entry.
279b6cee71dSXin LI#
280b6cee71dSXin LI# The intended meaning of these tests is, that the file is only of the
281b6cee71dSXin LI# specified type if both of the lines are correct - i.e. if the first
282b6cee71dSXin LI# line matches and the second doesn't then it is not of that type.
283b6cee71dSXin LI#
284b6cee71dSXin LI#0	long	0x7801730d
285b6cee71dSXin LI#>4	long	0x62626060	UDIF read-only zlib-compressed image (UDZO)
286b6cee71dSXin LI#
287b6cee71dSXin LI# Note that this entry is recognized correctly by the "Apple Partition
288b6cee71dSXin LI# data" entry - however since this entry is more specific - this
289b6cee71dSXin LI# information seems to be more useful.
290b6cee71dSXin LI#0	long	0x45520200
291b6cee71dSXin LI#>0x410	string	disk\ image	UDIF read/write image (UDRW)
292b6cee71dSXin LI
293b6cee71dSXin LI# From: Toby Peterson <toby@apple.com>
294b6cee71dSXin LI0	string	bplist00	Apple binary property list
295b6cee71dSXin LI
296b6cee71dSXin LI# Apple binary property list (bplist)
297b6cee71dSXin LI#  Assumes version bytes are hex.
298b6cee71dSXin LI#  Provides content hints for version 0 files. Assumes that the root
299b6cee71dSXin LI#  object is the first object (true for CoreFoundation implementation).
300b6cee71dSXin LI# From: David Remahl <dremahl@apple.com>
301b6cee71dSXin LI0		string	bplist
302*43a5ec4eSXin LI>6		byte	x	\bCoreFoundation binary property list data, version %#c
303b6cee71dSXin LI>>7		byte	x	\b%c
304b6cee71dSXin LI>6		string		00		\b
305b6cee71dSXin LI>>8		byte&0xF0	0x00	\b
306b6cee71dSXin LI>>>8	byte&0x0F	0x00	\b, root type: null
307b6cee71dSXin LI>>>8	byte&0x0F	0x08	\b, root type: false boolean
308b6cee71dSXin LI>>>8	byte&0x0F	0x09	\b, root type: true boolean
309b6cee71dSXin LI>>8		byte&0xF0	0x10	\b, root type: integer
310b6cee71dSXin LI>>8		byte&0xF0	0x20	\b, root type: real
311b6cee71dSXin LI>>8		byte&0xF0	0x30	\b, root type: date
312b6cee71dSXin LI>>8		byte&0xF0	0x40    \b, root type: data
313b6cee71dSXin LI>>8		byte&0xF0	0x50	\b, root type: ascii string
314b6cee71dSXin LI>>8		byte&0xF0	0x60	\b, root type: unicode string
315b6cee71dSXin LI>>8		byte&0xF0	0x80	\b, root type: uid (CORRUPT)
316b6cee71dSXin LI>>8		byte&0xF0	0xa0	\b, root type: array
317b6cee71dSXin LI>>8		byte&0xF0	0xd0	\b, root type: dictionary
318b6cee71dSXin LI
319b6cee71dSXin LI# Apple/NeXT typedstream data
320b6cee71dSXin LI#  Serialization format used by NeXT and Apple for various
321b6cee71dSXin LI#  purposes in YellowStep/Cocoa, including some nib files.
322b6cee71dSXin LI# From: David Remahl <dremahl@apple.com>
323b6cee71dSXin LI2		string		typedstream	NeXT/Apple typedstream data, big endian
324b6cee71dSXin LI>0		byte		x		\b, version %d
325b6cee71dSXin LI>0		byte		<5		\b
326b6cee71dSXin LI>>13	byte		0x81	\b
327b6cee71dSXin LI>>>14	ubeshort	x		\b, system %d
328b6cee71dSXin LI2		string		streamtyped NeXT/Apple typedstream data, little endian
329b6cee71dSXin LI>0		byte		x		\b, version %d
330b6cee71dSXin LI>0		byte		<5		\b
331b6cee71dSXin LI>>13	byte		0x81	\b
332b6cee71dSXin LI>>>14	uleshort	x		\b, system %d
333b6cee71dSXin LI
334b6cee71dSXin LI#------------------------------------------------------------------------------
335b6cee71dSXin LI# CAF: Apple CoreAudio File Format
336b6cee71dSXin LI#
337b6cee71dSXin LI# Container format for high-end audio purposes.
338b6cee71dSXin LI# From: David Remahl <dremahl@apple.com>
339b6cee71dSXin LI#
340b6cee71dSXin LI0	string		caff		CoreAudio Format audio file
341b6cee71dSXin LI>4	beshort		<10		version %d
342b6cee71dSXin LI>6	beshort		x
343b6cee71dSXin LI
344b6cee71dSXin LI
345b6cee71dSXin LI#------------------------------------------------------------------------------
346b6cee71dSXin LI# Keychain database files
347b6cee71dSXin LI0	string		kych		Mac OS X Keychain File
348b6cee71dSXin LI
349b6cee71dSXin LI#------------------------------------------------------------------------------
350b6cee71dSXin LI# Code Signing related file types
351b6cee71dSXin LI0	belong		0xfade0c00	Mac OS X Code Requirement
352b6cee71dSXin LI>8	belong		1			(opExpr)
353b6cee71dSXin LI>4	belong		x			- %d bytes
354b6cee71dSXin LI
355b6cee71dSXin LI0	belong		0xfade0c01	Mac OS X Code Requirement Set
356b6cee71dSXin LI>8	belong		>1			containing %d items
357b6cee71dSXin LI>4	belong		x			- %d bytes
358b6cee71dSXin LI
359b6cee71dSXin LI0	belong		0xfade0c02	Mac OS X Code Directory
360b6cee71dSXin LI>8	belong		x			version %x
361*43a5ec4eSXin LI>12	belong		>0			flags %#x
362b6cee71dSXin LI>4	belong		x			- %d bytes
363b6cee71dSXin LI
364b6cee71dSXin LI0	belong		0xfade0cc0	Mac OS X Detached Code Signature (non-executable)
365b6cee71dSXin LI>4	belong		x			- %d bytes
366b6cee71dSXin LI
367b6cee71dSXin LI0	belong		0xfade0cc1	Mac OS X Detached Code Signature
368b6cee71dSXin LI>8	belong		>1			(%d elements)
369b6cee71dSXin LI>4	belong		x			- %d bytes
370b6cee71dSXin LI
371b6cee71dSXin LI# From: "Nelson A. de Oliveira" <naoliv@gmail.com>
372b6cee71dSXin LI# .vdi
373b6cee71dSXin LI4	string innotek\ VirtualBox\ Disk\ Image %s
374b6cee71dSXin LI
375a5d223e6SXin LI# Apple disk partition stuff
376a5d223e6SXin LI# URL: https://en.wikipedia.org/wiki/Apple_Partition_Map
377a5d223e6SXin LI# Reference: https://ftp.netbsd.org/pub/NetBSD/NetBSD-current/src/sys/sys/bootblock.h
378a5d223e6SXin LI# Update: Joerg Jenderek
379a5d223e6SXin LI# "ER" is APPLE_DRVR_MAP_MAGIC signature
380b6cee71dSXin LI0	beshort	0x4552
381a5d223e6SXin LI# display Apple Driver Map (strength=50) after Syslinux bootloader (71)
382a5d223e6SXin LI#!:strength +0
383a5d223e6SXin LI# strengthen the magic by looking for used blocksizes 512 2048
384a5d223e6SXin LI>2	ubeshort&0xf1FF		0	Apple Driver Map
385a5d223e6SXin LI# last 6 bytes for padding found are 0 or end with 55AAh marker for MBR hybrid
386a5d223e6SXin LI#>>504	ubequad&0x0000FFffFFff0000	0
387a5d223e6SXin LI!:mime	application/x-apple-diskimage
388a5d223e6SXin LI!:apple	????devr
389a5d223e6SXin LI# https://en.wikipedia.org/wiki/Apple_Disk_Image
390a5d223e6SXin LI!:ext	dmg/iso
391a5d223e6SXin LI# sbBlkSize for driver descriptor map 512 2048
392b6cee71dSXin LI>>2	beshort	x			\b, blocksize %d
393a5d223e6SXin LI# sbBlkCount sometimes garbish like
394a5d223e6SXin LI# 0xb0200000 for unzlibed install_flash_player_19.0.0.245_osx.dmg
395a5d223e6SXin LI# 0xf2720100 for bunziped Firefox 48.0-2.dmg
396a5d223e6SXin LI# 0xeb02ffff for super_grub2_disk_hybrid_2.02s3.iso
397a5d223e6SXin LI# 0x00009090 by syslinux-6.03/utils/isohybrid.c
398a5d223e6SXin LI>>4	ubelong	x			\b, blockcount %u
399a5d223e6SXin LI# following device/driver information not very useful
400a5d223e6SXin LI# device type 0 1 (37008 garbage for super_grub2_disk_hybrid_2.02s3.iso)
401a5d223e6SXin LI>>8	ubeshort	x		\b, devtype %u
402a5d223e6SXin LI# device id 0 1 (37008 garbage for super_grub2_disk_hybrid_2.02s3.iso)
403a5d223e6SXin LI>>10	ubeshort	x		\b, devid %u
404a5d223e6SXin LI# driver data 0 (2425393296 garbage for super_grub2_disk_hybrid_2.02s3.iso)
405a5d223e6SXin LI>>12	ubelong		>0
406a5d223e6SXin LI>>>12	ubelong		x		\b, driver data %u
407a5d223e6SXin LI# number of driver descriptors sbDrvrCount <= 61
408a5d223e6SXin LI# (37008 garbage for super_grub2_disk_hybrid_2.02s3.iso)
409a5d223e6SXin LI>>16	ubeshort	x		\b, driver count %u
410a5d223e6SXin LI# 61 * apple_drvr_descriptor[8]. information not very useful or same as in partition map
411a5d223e6SXin LI# >>18	use		apple-driver-map
412a5d223e6SXin LI# >>26	use		apple-driver-map
413a5d223e6SXin LI# # ...
414a5d223e6SXin LI# >>500	use		apple-driver-map
415a5d223e6SXin LI# number of partitions is always same in every partition (map block count)
416a5d223e6SXin LI#>>0x0204	ubelong		x	\b, %u partitions
417a5d223e6SXin LI>>0x0204	ubelong		>0	\b, contains[@0x200]:
418a5d223e6SXin LI>>>0x0200	use		apple-apm
419a5d223e6SXin LI>>0x0204	ubelong		>1	\b, contains[@0x400]:
420a5d223e6SXin LI>>>0x0400	use		apple-apm
421a5d223e6SXin LI>>0x0204	ubelong		>2	\b, contains[@0x600]:
422a5d223e6SXin LI>>>0x0600	use		apple-apm
423a5d223e6SXin LI>>0x0204	ubelong		>3	\b, contains[@0x800]:
424a5d223e6SXin LI>>>0x0800	use		apple-apm
425a5d223e6SXin LI>>0x0204	ubelong		>4	\b, contains[@0xA00]:
426a5d223e6SXin LI>>>0x0A00	use		apple-apm
427a5d223e6SXin LI>>0x0204	ubelong		>5	\b, contains[@0xC00]:
428a5d223e6SXin LI>>>0x0C00	use		apple-apm
429a5d223e6SXin LI>>0x0204	ubelong		>6	\b, contains[@0xE00]:
430a5d223e6SXin LI>>>0x0E00	use		apple-apm
431a5d223e6SXin LI>>0x0204	ubelong		>7	\b, contains[@0x1000]:
432a5d223e6SXin LI>>>0x1000	use		apple-apm
433a5d223e6SXin LI#	display apple driver descriptor map (start-block, # blocks in sbBlkSize sizes, type)
434a5d223e6SXin LI0	name				apple-driver-map
435a5d223e6SXin LI>0	ubequad		!0
436a5d223e6SXin LI# descBlock first block of driver
437a5d223e6SXin LI>>0	ubelong	x			\b, driver start block %u
438a5d223e6SXin LI# descSize driver size in blocks
439a5d223e6SXin LI>>4	ubeshort	x		\b, size %u
440a5d223e6SXin LI# descType driver system type 1 701h F8FFh FFFFh
441*43a5ec4eSXin LI>>6	ubeshort	x		\b, type %#x
442b6cee71dSXin LI
443a5d223e6SXin LI# URL: https://en.wikipedia.org/wiki/Apple_Partition_Map
44448c779cdSXin LI# Reference: https://opensource.apple.com/source/IOStorageFamily/IOStorageFamily-116/IOApplePartitionScheme.h
445a5d223e6SXin LI# Update: Joerg Jenderek
446a5d223e6SXin LI# Yes, the 3rd and 4th bytes pmSigPad are reserved, but we use them to make the
447b6cee71dSXin LI# magic stronger.
448a5d223e6SXin LI# for apple partition map stored as a single file
449a5d223e6SXin LI0	belong	0x504d0000
450a5d223e6SXin LI# to display Apple Partition Map (strength=70) after Syslinux bootloader (71)
451a5d223e6SXin LI#!:strength +0
452a5d223e6SXin LI>0	use		apple-apm
453a5d223e6SXin LI# magic/Magdir/apple14.test, 365: Warning: Current entry does not yet have a description for adding a EXTENSION type
454a5d223e6SXin LI# file: could not find any valid magic files!
455a5d223e6SXin LI#!:ext	bin
456a5d223e6SXin LI#	display apple partition map. Normally called after Apple driver map
457a5d223e6SXin LI0	name				apple-apm
458a5d223e6SXin LI>0	belong	0x504d0000		Apple Partition Map
459a5d223e6SXin LI# number of partitions
460a5d223e6SXin LI>>4	ubelong	x			\b, map block count %u
461a5d223e6SXin LI# logical block (512 bytes) start of partition
462a5d223e6SXin LI>>8	ubelong	x			\b, start block %u
463a5d223e6SXin LI>>12	ubelong	x			\b, block count %u
464a5d223e6SXin LI>>16	string >0			\b, name %s
465a5d223e6SXin LI>>48	string >0			\b, type %s
466a5d223e6SXin LI# processor type dpme_process_id[16] e.g. "68000" "68020"
467a5d223e6SXin LI>>120	string >0			\b, processor %s
468a5d223e6SXin LI# A/UX boot arguments BootArgs[128]
469a5d223e6SXin LI>>136	string >0			\b, boot arguments %s
470a5d223e6SXin LI# status of partition dpme_flags
471a5d223e6SXin LI>>88	belong	& 1			\b, valid
472a5d223e6SXin LI>>88	belong	& 2			\b, allocated
473a5d223e6SXin LI>>88	belong	& 4			\b, in use
474a5d223e6SXin LI>>88	belong	& 8			\b, has boot info
475a5d223e6SXin LI>>88	belong	& 16			\b, readable
476a5d223e6SXin LI>>88	belong	& 32			\b, writable
477a5d223e6SXin LI>>88	belong	& 64			\b, pic boot code
478a5d223e6SXin LI>>88	belong	& 128			\b, chain compatible driver
479a5d223e6SXin LI>>88	belong	& 256			\b, real driver
480a5d223e6SXin LI>>88	belong	& 512			\b, chain driver
481a5d223e6SXin LI# mount automatically at startup APPLE_PS_AUTO_MOUNT
482a5d223e6SXin LI>>88	ubelong	&0x40000000		\b, mount at startup
483a5d223e6SXin LI# is the startup partition APPLE_PS_STARTUP
484a5d223e6SXin LI>>88	ubelong	&0x80000000		\b, is the startup partition
485b6cee71dSXin LI
48648c779cdSXin LI#https://wiki.mozilla.org/DS_Store_File_Format
48748c779cdSXin LI#https://en.wikipedia.org/wiki/.DS_Store
488b6cee71dSXin LI0	string	\0\0\0\1Bud1\0		Apple Desktop Services Store
4895f0216bdSXin LI
4905f0216bdSXin LI# HFS/HFS+ Resource fork files (andrew.roazen@nau.edu Apr 13 2015)
4915f0216bdSXin LI# Usually not in separate files, but have either filename rsrc with
4925f0216bdSXin LI# no extension, or a filename corresponding to another file, with
4935f0216bdSXin LI# extensions rsr/rsrc
4945f0216bdSXin LI0	string  \000\000\001\000
4955f0216bdSXin LI>4	leshort 0
4965f0216bdSXin LI>>16	lelong  0			Apple HFS/HFS+ resource fork
4975f0216bdSXin LI
498a5d223e6SXin LI#https://en.wikipedia.org/wiki/AppleScript
499a5d223e6SXin LI0	string	FasdUAS			AppleScript compiled
500a5d223e6SXin LI
501a5d223e6SXin LI# AppleWorks/ClarisWorks
502a5d223e6SXin LI# https://github.com/joshenders/appleworks_format
503a5d223e6SXin LI# http://fileformats.archiveteam.org/wiki/AppleWorks
504a5d223e6SXin LI0	name			appleworks
505a5d223e6SXin LI>0	belong&0x00ffffff	0x07e100	AppleWorks CWK Document
506a5d223e6SXin LI>0	belong&0x00ffffff	0x008803	ClarisWorks CWK Document
507a5d223e6SXin LI>0	default			x
508a5d223e6SXin LI>>0	belong			x		AppleWorks/ClarisWorks CWK Document
509a5d223e6SXin LI>0	byte			x		\b, version %d
510a5d223e6SXin LI>30	beshort			x		\b, %d
511a5d223e6SXin LI>32	beshort			x		\bx%d
512a5d223e6SXin LI!:ext cwk
513a5d223e6SXin LI
514a5d223e6SXin LI4	string	BOBO
515a5d223e6SXin LI>0	byte	>4
516a5d223e6SXin LI>>12	belong	0
517a5d223e6SXin LI>>>26	belong	0
518a5d223e6SXin LI>>>>0	use	appleworks
519a5d223e6SXin LI>0	belong	0x0481ad00
520a5d223e6SXin LI>>0	use 	appleworks
52158a0f0d0SEitan Adler
52258a0f0d0SEitan Adler# magic for Apple File System (APFS)
52358a0f0d0SEitan Adler# from Alex Myczko <alex@aiei.ch>
52458a0f0d0SEitan Adler32		string	NXSB		Apple File System (APFS)
52558a0f0d0SEitan Adler>36		ulelong	x		\b, blocksize %u
52658a0f0d0SEitan Adler
52758a0f0d0SEitan Adler# iTunes cover art (versions 1 and 2)
52858a0f0d0SEitan Adler4		string	itch
52958a0f0d0SEitan Adler>24		string	artw
53058a0f0d0SEitan Adler>>0x1e8		string	data		iTunes cover art
53158a0f0d0SEitan Adler>>>0x1ed	string	PNG		(PNG)
53258a0f0d0SEitan Adler>>>0x1ec	beshort 0xffd8		(JPEG)
53358a0f0d0SEitan Adler
53458a0f0d0SEitan Adler# MacPaint image
53558a0f0d0SEitan Adler65		string	PNTGMPNT	MacPaint image data
53658a0f0d0SEitan Adler#0		belong	2		MacPaint image data
537