168349Sobrien
268349Sobrien#------------------------------------------------------------------------------
3360521Sdelphij# $File: macintosh,v 1.30 2019/12/14 20:40:26 christos Exp $
468349Sobrien# macintosh description
568349Sobrien#
668349Sobrien# BinHex is the Macintosh ASCII-encoded file format (see also "apple")
768349Sobrien# Daniel Quinlan, quinlan@yggdrasil.com
8360521Sdelphij# Update:	Joerg Jenderek
9360521Sdelphij# URL:		https://en.wikipedia.org/wiki/BinHex
10360521Sdelphij# Reference:	http://fileformats.archiveteam.org/wiki/BinHex
11360521Sdelphij# Note:		only tested with version 4.0 and hqx extension
12360521Sdelphij# Any text/binary before the characteristic comment sentence is to be ignored like in
13360521Sdelphij# http://ftp.vim.org/pub/ftp/ftp/infomac/disk/mac-update-40b7.hqx
14360521Sdelphij0	search/1602	(This\ file\ 
15360521Sdelphij>&0	use		binhex
16360521Sdelphij# http://ftp.vim.org/pub/ftp/ftp/infomac/_Disk_&_File/zap-res-forks-101.hqx
17360521Sdelphij0	search/2652/b	(This\ file\ 
18360521Sdelphij>&0	use		binhex
19360521Sdelphij0	name				binhex
20360521Sdelphij# keep splitted search string format similar like in version 5.37
21360521Sdelphij>0	string	must\ be\ converted\ with\ BinHex\ 	BinHex binary text, version
22360521Sdelphij# http://www.macdisk.com/binhexen.php3
23360521Sdelphij!:apple	BNHQTEXT
24360521Sdelphij# http://www.faqs.org/faqs/macintosh/comm-faq/part1/
25360521Sdelphij>>&0	string	1.0					1.0
26360521Sdelphij!:mime	application/mac-binhex
27360521Sdelphij!:ext	hex
28360521Sdelphij>>&0	string	2.0					2.0
29360521Sdelphij!:mime	application/mac-binhex
30360521Sdelphij!:ext	hcx
31360521Sdelphij# BinHex	3.0 never existed
32360521Sdelphij>>&0	string	4.0					4.0
33186690Sobrien!:mime	application/mac-binhex40
34360521Sdelphij!:ext	hqx
35360521Sdelphij# BinHex	5.0 also MacBinary I
36360521Sdelphij>>&0	string	5.0					5.0
37360521Sdelphij!:mime	application/mac-binhex40
38360521Sdelphij!:ext	hqx
39360521Sdelphij# this should never happen
40360521Sdelphij>>&0	default	x					
41360521Sdelphij>>>&0	string	x					%.3s
42360521Sdelphij!:mime	application/mac-binhex
43360521Sdelphij!:ext	hqx
4468349Sobrien
4568349Sobrien# Stuffit archives are the de facto standard of compression for Macintosh
4668349Sobrien# files obtained from most archives. (franklsm@tuns.ca)
4768349Sobrien0	string		SIT!			StuffIt Archive (data)
48191736Sobrien!:mime	application/x-stuffit
49191736Sobrien!:apple	SIT!SIT!
5068349Sobrien>2	string		x			: %s
5168349Sobrien0	string		SITD			StuffIt Deluxe (data)
5268349Sobrien>2	string		x			: %s
5368349Sobrien0	string		Seg			StuffIt Deluxe Segment (data)
5468349Sobrien>2	string		x			: %s
5568349Sobrien
56111658Sobrien# Newer StuffIt archives (grant@netbsd.org)
57111658Sobrien0	string		StuffIt			StuffIt Archive
58186690Sobrien!:mime	application/x-stuffit
59191736Sobrien!:apple	SIT!SIT!
60159764Sobrien#>162	string		>0			: %s
61111658Sobrien
6268349Sobrien# Macintosh Applications and Installation binaries (franklsm@tuns.ca)
63186690Sobrien# GRR: Too weak
64186690Sobrien#0	string		APPL			Macintosh Application (data)
65186690Sobrien#>2	string		x			\b: %s
6668349Sobrien
6768349Sobrien# Macintosh System files (franklsm@tuns.ca)
68186690Sobrien# GRR: Too weak
69186690Sobrien#0	string		zsys			Macintosh System File (data)
70186690Sobrien#0	string		FNDR			Macintosh Finder (data)
71186690Sobrien#0	string		libr			Macintosh Library (data)
72186690Sobrien#>2	string		x			: %s
73186690Sobrien#0	string		shlb			Macintosh Shared Library (data)
74186690Sobrien#>2	string		x			: %s
75186690Sobrien#0	string		cdev			Macintosh Control Panel (data)
76186690Sobrien#>2	string		x			: %s
77186690Sobrien#0	string		INIT			Macintosh Extension (data)
78186690Sobrien#>2	string		x			: %s
79186690Sobrien#0	string		FFIL			Macintosh Truetype Font (data)
80186690Sobrien#>2	string		x			: %s
81186690Sobrien#0	string		LWFN			Macintosh Postscript Font (data)
82186690Sobrien#>2	string		x			: %s
8368349Sobrien
8468349Sobrien# Additional Macintosh Files (franklsm@tuns.ca)
85186690Sobrien# GRR: Too weak
86186690Sobrien#0	string		PACT			Macintosh Compact Pro Archive (data)
87186690Sobrien#>2	string		x			: %s
88186690Sobrien#0	string		ttro			Macintosh TeachText File (data)
89186690Sobrien#>2	string		x			: %s
90186690Sobrien#0	string		TEXT			Macintosh TeachText File (data)
91186690Sobrien#>2	string		x			: %s
92186690Sobrien#0	string		PDF			Macintosh PDF File (data)
93186690Sobrien#>2	string		x			: %s
9468349Sobrien
9568349Sobrien# MacBinary format (Eric Fischer, enf@pobox.com)
96337827Seadler# Update: Joerg Jenderek 
97337827Seadler# URL: https://en.wikipedia.org/wiki/MacBinary
98354939Sdelphij# Reference: https://files.stairways.com/other/macbinaryii-standard-info.txt
9968349Sobrien#
10068349Sobrien# Unfortunately MacBinary doesn't really have a magic number prior
101337827Seadler# to the MacBinary III format.
10268349Sobrien#
103337827Seadler
104337827Seadler# old version number, must be kept at zero for compatibility
105337827Seadler0	byte	0
106337827Seadler# length of filename (must be in the range 1-63)
107337827Seadler>1	ubyte	>0
108337827Seadler# skip T.PIC.LZ INSTRUMENT.7T INVENTORY
109337827Seadler>>1	ubyte	<64
110337827Seadler# skip Docs.MWII ReadMe.MacWrite "Notes (MacWrite II)"
111337827Seadler# by looking for printable characters at beginning of file name
112337827Seadler>>>2	ubelong	>0x1F000000
113337827Seadler# zero fill, must be zero for compatibility
114337827Seadler>>>>74	byte	0
115337827Seadler# zero fill, must be zero for compatibility
116337827Seadler>>>>>82	byte	0
117337827Seadler# MacBinary I		test for valid version numbers
118337827Seadler>>>>>>122	ubeshort	0
119337827Seadler# additional check for creation date after 1 Jan 1970 ~ 7C25B080h
120337827Seadler#>>>>>>>91	ubelong		>0x7c25b07F
121337827Seadler# additional check for undefined header fields in MacBinary I
122337827Seadler#>>>>>>>101	ulong		0
123337827Seadler>>>>>>>0	use	mac-bin
124337827Seadler# MacBinary II		the newer versions begins at 129
125337827Seadler>>>>>>122	ubeshort	0x8181
126337827Seadler>>>>>>>0	use	mac-bin
127337827Seadler# MacBinary III with MacBinary II to read
128337827Seadler>>>>>122	ubeshort	0x8281
129337827Seadler>>>>>>0	use	mac-bin
130337827Seadler
131337827Seadler#	display information of MacBinary file
132337827Seadler0	name		mac-bin
133337827Seadler>122	ubyte	x	MacBinary
134337827Seadler# versions for MacBinary II/III
135337827Seadler>122	ubyte	129		II
136337827Seadler>122	ubyte	130		III
137337827Seadler# only in MacBinary III
138337827Seadler>>102	string	!mBIN		with surprising version
139337827Seadler!:mime	application/x-macbinary
140337827Seadler!:apple	PSPTBINA
141337827Seadler!:ext	bin/macbin
142337827Seadler# THIS SHOULD NEVER HAPPEN! Maybe another file type is misidetified as MacBinary
143337827Seadler#>1	ubyte	>63		\b, name length %u too BIG!
144337827Seadler#>122	ubeshort	x	\b, version 0x%x
145337827Seadler# Finder flags if not 0
146337827Seadler# >73	byte		!0		\b, flags 0x
147337827Seadler# >73	byte		=0		
148337827Seadler# >>101	byte		!0		\b, flags 0x
149337827Seadler# # original Finder flags (Bits 8-15)
150337827Seadler# >73	byte		!0		\b%x
151337827Seadler# # finder flags, bits 0-7
152337827Seadler# >101	byte		!0		\b%x
153337827Seadler>73	byte		&0x01		\b, inited
154337827Seadler>73	byte		&0x02		\b, changed
155337827Seadler>73	byte		&0x04		\b, busy
156337827Seadler>73	byte		&0x08		\b, bozo
157337827Seadler>73	byte		&0x10		\b, system
158337827Seadler>73	byte		&0x20		\b, bundle
159337827Seadler>73	byte		&0x40		\b, invisible
160337827Seadler>73	byte		&0x80		\b, locked
161337827Seadler
16268349Sobrien# 75	beshort				# vertical posn in window
163337827Seadler#>75	beshort		!0		\b, v.pos %u
16468349Sobrien# 77	beshort				# horiz posn in window
165337827Seadler#>77	beshort		!0		\b, h.pos %u
16668349Sobrien# 79	beshort				# window or folder ID
167337827Seadler>79	ubeshort	!0		\b, ID 0x%x
168337827Seadler# protected flag
169337827Seadler>81	byte		!0		\b, protected 0x%x
170337827Seadler# length of comment after resource
171337827Seadler>99	ubeshort	!0		\b, comment length %u
172337827Seadler# char. code of file name
173337827Seadler>106	ubyte		!0		\b, char. code 0x%x
174337827Seadler# still more Finder flags
175337827Seadler>107	ubyte		!0		\b, more flags 0x%x
176337827Seadler# length of total files when unpacked only used when pack and unpack on the fly
177337827Seadler>116	ubelong		!0		\b, total length %u
17868349Sobrien# 120	beshort				# length of add'l header
179337827Seadler>120	ubeshort	!0		\b, 2nd header length %u
18068349Sobrien# 124	beshort				# checksum
181337827Seadler#>124	ubeshort	!0		\b, CRC 0x%x
182337827Seadler# creation date in seconds since MacOS epoch start. So 1 Jan 1970 ~ 7C25B080
183337827Seadler>91	beldate-0x7C25B080	x	\b, %s
184337827Seadler# THIS SHOULD NEVER HAPPEN! Maybe another file type is misidetified or time overflow
185337827Seadler>91	ubelong		<0x7c25b080	INVALID date
186337827Seadler#>91	belong-0x7C25B080	x	\b, DEBUG DATE %d
187337827Seadler# last modified date
188337827Seadler>95	beldate-0x7C25B080	x	\b, modified %s
189337827Seadler# Apple creator+typ if not null
190337827Seadler# file creator (normally expressed as four characters)
191337827Seadler>69	ulong			!0	\b, creator
192337827Seadler# instead 4 character code display full creator name
193337827Seadler>>69	use			apple-creator
194337827Seadler# file type (normally expressed as four characters)
195337827Seadler>65	ulong			!0	\b, type
196337827Seadler>>65	use			apple-type
197337827Seadler# length of data segment
198337827Seadler>83	ubelong			!0	\b, %u bytes
199337827Seadler# filename (in the range 1-63)
200337827Seadler>1	pstring			x	"%s"
201337827Seadler# print 1 space and then at offset 128 inspect data fork content if it has one
202337827Seadler>83	ubelong			!0	\b 
203337827Seadler>>128	indirect		x
204337827Seadler# Afterwards resource fork if length of resource segment not zero
205337827Seadler>87	ubelong			!0
206337827Seadler# calculate resource fork offset
207337827Seadler>>83	ubelong+128		x	\b, at 0x%x
208337827Seadler# length of resource segment
209337827Seadler>>87	ubelong			!0	%u bytes
210337827Seadler>>(83.S+128)	ubequad		x	resource 
211337827Seadler# further resource fork content inspection 
212337827Seadler>>>&-8	indirect		x
21368349Sobrien
214337827Seadler# Apple Type/Creator Database
215337827Seadler# URL: https://en.wikipedia.org/wiki/Type_code
216354939Sdelphij# Reference:	https://www.lacikam.co.il/tcdb/
217354939Sdelphij#		https://www.macdisk.com/macsigen.php
218337827Seadler# Note:	classic Mac OS files have two 4 character codes for type and creator.
219337827Seadler#	Thereby the Finder attach documents types to applications.
22068349Sobrien
221133359Sobrien#>65	string		x		\b, type "%4.4s"
22268349Sobrien
223337827Seadler#	display information about apple type
224337827Seadler0	name		apple-type
225337827Seadler>0	string		8BIM		PhotoShop
226337827Seadler>0	string		ALB3		PageMaker 3
227337827Seadler>0	string		ALB4		PageMaker 4
228337827Seadler>0	string		ALT3		PageMaker 3
229337827Seadler>0	string		APPL		application
230337827Seadler>0	string		AWWP		AppleWorks word processor
231337827Seadler>0	string		CIRC		simulated circuit
232337827Seadler>0	string		DRWG		MacDraw
233337827Seadler>0	string		EPSF		Encapsulated PostScript
234337827Seadler>0	string		FFIL		font suitcase
235337827Seadler>0	string		FKEY		function key
236337827Seadler>0	string		FNDR		Macintosh Finder
237337827Seadler>0	string		GIFf		GIF image
238337827Seadler>0	string		Gzip		GNU gzip
239337827Seadler>0	string		INIT		system extension
240337827Seadler>0	string		LIB\ 		library
241337827Seadler>0	string		LWFN		PostScript font
242337827Seadler>0	string		MSBC		Microsoft BASIC
243337827Seadler>0	string		PACT		Compact Pro archive
244337827Seadler>0	string		PDF\ 		Portable Document Format
245337827Seadler>0	string		PICT		picture
246337827Seadler>0	string		PNTG		MacPaint picture
247337827Seadler>0	string		PREF		preferences
248337827Seadler>0	string		PROJ		Think C project
249337827Seadler>0	string		QPRJ		Think Pascal project
250337827Seadler>0	string		SCFL		Defender scores
251337827Seadler>0	string		SCRN		startup screen
252337827Seadler>0	string		SITD		StuffIt Deluxe
253337827Seadler>0	string		SPn3		SuperPaint
254337827Seadler>0	string		STAK		HyperCard stack
255337827Seadler>0	string		Seg\ 		StuffIt segment
256337827Seadler>0	string		TARF		Unix tar archive
257337827Seadler>0	string		TEXT		ASCII
258337827Seadler>0	string		TIFF		TIFF image
259337827Seadler>0	string		TOVF		Eudora table of contents
260337827Seadler>0	string		WDBN		Microsoft Word word processor
261337827Seadler>0	string		WORD		MacWrite word processor
262337827Seadler>0	string		XLS\ 		Microsoft Excel
263337827Seadler>0	string		ZIVM		compress (.Z)
264337827Seadler>0	string		ZSYS		Pre-System 7 system file
265337827Seadler>0	string		acf3		Aldus FreeHand
266337827Seadler>0	string		cdev		control panel
267337827Seadler>0	string		dfil		Desk Accessory suitcase
268337827Seadler>0	string		libr		library
269337827Seadler>0	string		nX^d		WriteNow word processor
270337827Seadler>0	string		nX^w		WriteNow dictionary
271337827Seadler>0	string		rsrc		resource
272337827Seadler>0	string		scbk		Scrapbook
273337827Seadler>0	string		shlb		shared library
274337827Seadler>0	string		ttro		SimpleText read-only
275337827Seadler>0	string		zsys		system file
27668349Sobrien
277337827Seadler#	additional types added in Dec 2017
278337827Seadler>0	string		BINA		binary file
279337827Seadler>0	string		BMPp		BMP image
280337827Seadler>0	string		JPEG		JPEG image
281337827Seadler#>0	string		W4BN		Microsoft Word x.y word processor?
282337827Seadler# if type name is not known display 4 character identifier
283337827Seadler>0	default		x		
284337827Seadler>>0	string		x		'%4.4s'
285337827Seadler
286133359Sobrien#>69	string		x		\b, creator "%4.4s"
28768349Sobrien
288337827Seadler# Now Apple has no repository of registered Creator IDs any more. These are
28968349Sobrien# just the ones that I happened to have files from and was able to identify.
29068349Sobrien
291337827Seadler#	display information about apple creator
292337827Seadler0	name		apple-creator
293337827Seadler>0	string		8BIM		Adobe Photoshop
294337827Seadler>0	string		ALD3		PageMaker 3
295337827Seadler>0	string		ALD4		PageMaker 4
296337827Seadler>0	string		ALFA		Alpha editor
297337827Seadler>0	string		APLS		Apple Scanner
298337827Seadler>0	string		APSC		Apple Scanner
299337827Seadler>0	string		BRKL		Brickles
300337827Seadler>0	string		BTFT		BitFont
301337827Seadler>0	string		CCL2		Common Lisp 2
302337827Seadler>0	string		CCL\ 		Common Lisp
303337827Seadler>0	string		CDmo		The Talking Moose
304337827Seadler>0	string		CPCT		Compact Pro
305337827Seadler>0	string		CSOm		Eudora
306337827Seadler>0	string		DMOV		Font/DA Mover
307337827Seadler>0	string		DSIM		DigSim
308337827Seadler>0	string		EDIT		Macintosh Edit
309337827Seadler>0	string		ERIK		Macintosh Finder
310337827Seadler>0	string		EXTR		self-extracting archive
311337827Seadler>0	string		Gzip		GNU gzip
312337827Seadler>0	string		KAHL		Think C
313337827Seadler>0	string		LWFU		LaserWriter Utility
314337827Seadler>0	string		LZIV		compress
315337827Seadler>0	string		MACA		MacWrite
316337827Seadler>0	string		MACS		Macintosh operating system
317337827Seadler>0	string		MAcK		MacKnowledge terminal emulator
318337827Seadler>0	string		MLND		Defender
319337827Seadler>0	string		MPNT		MacPaint
320337827Seadler>0	string		MSBB		Microsoft BASIC (binary)
321337827Seadler>0	string		MSWD		Microsoft Word
322337827Seadler>0	string		NCSA		NCSA Telnet
323337827Seadler>0	string		PJMM		Think Pascal
324337827Seadler>0	string		PSAL		Hunt the Wumpus
325337827Seadler#>0	string		PSI2		Apple File Exchange
326337827Seadler>0	string		R*ch		BBEdit
327337827Seadler>0	string		RMKR		Resource Maker
328337827Seadler>0	string		RSED		Resource Editor
329337827Seadler>0	string		Rich		BBEdit
330337827Seadler>0	string		SIT!		StuffIt
331337827Seadler>0	string		SPNT		SuperPaint
332337827Seadler>0	string		Unix		NeXT Mac filesystem
333337827Seadler>0	string		VIM!		Vim editor
334337827Seadler>0	string		WILD		HyperCard
335337827Seadler>0	string		XCEL		Microsoft Excel
336337827Seadler>0	string		aCa2		Fontographer
337337827Seadler>0	string		aca3		Aldus FreeHand
338337827Seadler>0	string		dosa		Macintosh MS-DOS file system
339337827Seadler>0	string		movr		Font/DA Mover
340337827Seadler>0	string		nX^n		WriteNow
341337827Seadler>0	string		pdos		Apple ProDOS file system
342337827Seadler>0	string		scbk		Scrapbook
343337827Seadler>0	string		ttxt		SimpleText
344337827Seadler>0	string		ufox		Foreign File Access
345337827Seadler#	additional creators added in Dec 2017
346337827Seadler# Claris/Apple Works
347337827Seadler>0	string		BOBO		Apple Works
348337827Seadler# CU-SeeMe_0.87b3_(68K).bin
349337827Seadler#>0	string		CUce		bar
350337827Seadler>0	string		PSPT		Apple File Exchange
351337827Seadler# Disk_Copy_4.2.sea.bin
352337827Seadler#>0	string		NCse		foo
353337827Seadler# probably StuffIt/Aladdin by Smith Micro Software, Inc.
354337827Seadler>0	string		STi0		stuffit
355337827Seadler# MacGzip-1.1.3.sea.bin
356337827Seadler#>0	string		aust		bar
357337827Seadler# D-Disk_Copy_6.3.3.smi.bin 
358337827Seadler>0	string		oneb		Disk Copy Self Mounting
359337827Seadler# if creator name is not known display 4 character identifier
360337827Seadler>0	default		x		
361337827Seadler>>0	string		x		'%4.4s'
36268349Sobrien
36369216Sobrien# sas magic from Bruce Foster (bef@nwu.edu)
36469216Sobrien#
36569216Sobrien#0	string		SAS		SAS
36669216Sobrien#>8	string		x		%s
36769216Sobrien0	string		SAS		SAS
36869216Sobrien>24	string		DATA		data file
36969216Sobrien>24	string		CATALOG		catalog
37069216Sobrien>24	string		INDEX		data file index
37169216Sobrien>24	string		VIEW		data view
372133359Sobrien# sas 7+ magic from Reinhold Koch (reinhold.koch@roche.com)
373133359Sobrien#
374133359Sobrien0x54    string          SAS             SAS 7+
375133359Sobrien>0x9C   string          DATA            data file
376133359Sobrien>0x9C   string          CATALOG         catalog
377133359Sobrien>0x9C   string          INDEX           data file index
378133359Sobrien>0x9C   string          VIEW            data view
379133359Sobrien
380328874Seadler# spss magic for SPSS system and portable files,
38169216Sobrien#	 from Bruce Foster (bef@nwu.edu).
38269216Sobrien
38369216Sobrien0	long		0xc1e2c3c9	SPSS Portable File
38469216Sobrien>40	string 		x		%s
38569216Sobrien
38669216Sobrien0	string		$FL2		SPSS System File
38769216Sobrien>24	string		x		%s
38880588Sobrien
389267843Sdelphij0	string		$FL3		SPSS System File
390267843Sdelphij>24	string		x		%s
391267843Sdelphij
39280588Sobrien# Macintosh filesystem data
39380588Sobrien# From "Tom N Harris" <telliamed@mac.com>
394133359Sobrien# Fixed HFS+ and Partition map magic: Ethan Benson <erbenson@alaska.net>
39580588Sobrien# The MacOS epoch begins on 1 Jan 1904 instead of 1 Jan 1970, so these
39680588Sobrien# entries depend on the data arithmetic added after v.35
39780588Sobrien# There's also some Pascal strings in here, ditto...
39880588Sobrien
399328874Seadler# The boot block signature, according to IM:Files, is
40080588Sobrien# "for HFS volumes, this field always contains the value 0x4C4B."
40180588Sobrien# But if this is true for MFS or HFS+ volumes, I don't know.
40280588Sobrien# Alternatively, the boot block is supposed to be zeroed if it's
40380588Sobrien# unused, so a simply >0 should suffice.
40480588Sobrien
40580588Sobrien0x400	beshort			0xD2D7		Macintosh MFS data
40680588Sobrien>0	beshort			0x4C4B		(bootable)
40780588Sobrien>0x40a	beshort			&0x8000		(locked)
40880588Sobrien>0x402	beldate-0x7C25B080	x		created: %s,
40980588Sobrien>0x406	beldate-0x7C25B080	>0		last backup: %s,
41080588Sobrien>0x414	belong			x		block size: %d,
41180588Sobrien>0x412	beshort			x		number of blocks: %d,
41280588Sobrien>0x424	pstring			x		volume name: %s
41380588Sobrien
414275698Sdelphij# *.hfs updated by Joerg Jenderek
415354939Sdelphij# https://en.wikipedia.org/wiki/Hierarchical_File_System
416226048Sobrien# "BD" gives many false positives
417328874Seadler0x400	beshort			0x4244
418275698Sdelphij# ftp://ftp.mars.org/pub/hfs/hfsutils-3.2.6.tar.gz/hfsutils-3.2.6/libhfs/apple.h
419275698Sdelphij# first block of volume bit map (always 3)
420328874Seadler>0x40e	ubeshort		0x0003
421275698Sdelphij# maximal length of volume name is 27
422275698Sdelphij>>0x424		ubyte			<28	Macintosh HFS data
423275698Sdelphij!:mime	application/x-apple-diskimage
424275698Sdelphij#!:apple	hfsdINIT
425275698Sdelphij#!:apple	MACSdisk
426354939Sdelphij# https://www.macdisk.com/macsigen.php
427298192Sdelphij#!:apple	ddskdevi
428298192Sdelphij!:apple	????devi
429298192Sdelphij# https://en.wikipedia.org/wiki/Apple_Disk_Image
430298192Sdelphij!:ext hfs/dmg
431275698Sdelphij>>>0		beshort			0x4C4B	(bootable)
432275698Sdelphij#>>>0		beshort			0x0000	(not bootable)
433275698Sdelphij>>>0x40a	beshort			&0x8000	(locked)
434275698Sdelphij>>>0x40a	beshort			^0x0100	(mounted)
435275698Sdelphij>>>0x40a	beshort			&0x0200	(spared blocks)
436275698Sdelphij>>>0x40a	beshort			&0x0800	(unclean)
437275698Sdelphij>>>0x47C	beshort			0x482B	(Embedded HFS+ Volume)
438354939Sdelphij# https://www.epochconverter.com/
439275698Sdelphij# 0x7C245F00 seconds	~ 2082758400	~ 01 Jan 2036 00:00:00	~ 66 years to 1970
440275698Sdelphij# 0x7C25B080 seconds	~ 2082844800	~ 02 Jan 2036 00:00:00
441275698Sdelphij# construct not working
442275698Sdelphij#>>>0x402	beldate-0x7C25B080	x	created: %s,
443275698Sdelphij#>>>0x406	beldate-0x7C25B080	x	last modified: %s,
444275698Sdelphij#>>>0x440	beldate-0x7C25B080	>0	last backup: %s,
445275698Sdelphij# found block sizes 200h,1200h,2800h
446275698Sdelphij>>>0x414	belong			x	block size: %d,
447275698Sdelphij>>>0x412	beshort			x	number of blocks: %d,
448275698Sdelphij>>>0x424	pstring			x	volume name: %s
44980588Sobrien
45080588Sobrien0x400	beshort			0x482B		Macintosh HFS Extended
451133359Sobrien>&0	beshort			x		version %d data
45280588Sobrien>0	beshort			0x4C4B		(bootable)
453133359Sobrien>0x404	belong			^0x00000100	(mounted)
454133359Sobrien>&2	belong			&0x00000200	(spared blocks)
455133359Sobrien>&2	belong			&0x00000800	(unclean)
456133359Sobrien>&2	belong			&0x00008000	(locked)
457133359Sobrien>&6	string			x		last mounted by: '%.4s',
45880588Sobrien# really, that should be treated as a belong and we print a string
45980588Sobrien# based on the value. TN1150 only mentions '8.10' for "MacOS 8.1"
460133359Sobrien>&14	beldate-0x7C25B080	x		created: %s,
461133359Sobrien# only the creation date is local time, all other timestamps in HFS+ are UTC.
462133359Sobrien>&18	bedate-0x7C25B080	x		last modified: %s,
463133359Sobrien>&22	bedate-0x7C25B080	>0		last backup: %s,
464133359Sobrien>&26	bedate-0x7C25B080	>0		last checked: %s,
465133359Sobrien>&38	belong			x		block size: %d,
466133359Sobrien>&42	belong			x		number of blocks: %d,
467133359Sobrien>&46	belong			x		free blocks: %d
46880588Sobrien
469186690Sobrien## AFAIK, only the signature is different
470275698Sdelphij# same as Apple Partition Map
471275698Sdelphij# GRR: This magic is too weak, it is just "TS"
472186690Sobrien#0x200		beshort		0x5453		Apple Old Partition data
473186690Sobrien#>0x2		beshort		x		block size: %d,
474186690Sobrien#>0x230		string		x		first type: %s,
475186690Sobrien#>0x210		string		x		name: %s,
476186690Sobrien#>0x254		belong		x		number of blocks: %d,
477328874Seadler#>0x400		beshort		0x504D
478186690Sobrien#>>0x430		string		x		second type: %s,
479186690Sobrien#>>0x410		string		x		name: %s,
480186690Sobrien#>>0x454		belong		x		number of blocks: %d,
481328874Seadler#>>0x800		beshort		0x504D
482186690Sobrien#>>>0x830	string		x		third type: %s,
483186690Sobrien#>>>0x810	string		x		name: %s,
484186690Sobrien#>>>0x854	belong		x		number of blocks: %d,
485328874Seadler#>>>0xa00	beshort		0x504D
486186690Sobrien#>>>>0xa30	string		x		fourth type: %s,
487186690Sobrien#>>>>0xa10	string		x		name: %s,
488186690Sobrien#>>>>0xa54	belong		x		number of blocks: %d
489133359Sobrien
490133359Sobrien# From: Remi Mommsen <mommsen@slac.stanford.edu>
491175296Sobrien0		string		BOMStore	Mac OS X bill of materials (BOM) file
492226048Sobrien
493226048Sobrien# From: Adam Buchbinder <adam.buchbinder@gmail.com>
494354939Sdelphij# URL: https://en.wikipedia.org/wiki/Datafork_TrueType
495226048Sobrien# Derived from the 'fondu' and 'ufond' source code (fondu.sf.net). 'sfnt' is
496226048Sobrien# TrueType; 'POST' is PostScript. 'FONT' and 'NFNT' sometimes appear, but I
497226048Sobrien# don't know what they mean.
498226048Sobrien0	belong	0x100
499226048Sobrien>(0x4.L+24)	beshort	x
500226048Sobrien>>&4	belong	0x73666e74	Mac OSX datafork font, TrueType
501226048Sobrien>>&4	belong	0x464f4e54	Mac OSX datafork font, 'FONT'
502226048Sobrien>>&4	belong	0x4e464e54	Mac OSX datafork font, 'NFNT'
503226048Sobrien>>&4	belong	0x504f5354	Mac OSX datafork font, PostScript
504