xref: /freebsd/contrib/file/magic/Magdir/palm (revision 48c779cdecb5f803e5fe5d761987e976ca9609db)
1b6cee71dSXin LI
2b6cee71dSXin LI#------------------------------------------------------------------------------
3*48c779cdSXin LI# $File: palm,v 1.14 2019/04/19 00:42:27 christos Exp $
4b6cee71dSXin LI# palm:	 file(1) magic for PalmOS {.prc,.pdb}: applications, docfiles, and hacks
5b6cee71dSXin LI#
6b6cee71dSXin LI# Brian Lalor <blalor@hcirisc.cs.binghamton.edu>
7b6cee71dSXin LI
8b6cee71dSXin LI# These are weak, byte 59 is not guaranteed to be 0 and there are
9b6cee71dSXin LI# 8 character identifiers at byte 60, one I found for appl is BIGb.
10b6cee71dSXin LI# What are the possibilities and where is this documented?
11b6cee71dSXin LI
12b6cee71dSXin LI# The common header format for PalmOS .pdb/.prc files is
13b6cee71dSXin LI# {
14b6cee71dSXin LI#         char            name[ 32 ];
15b6cee71dSXin LI#         Word            attributes;
16b6cee71dSXin LI#         Word            version;
17b6cee71dSXin LI#         DWord           creationDate;
18b6cee71dSXin LI#         DWord           modificationDate;
19b6cee71dSXin LI#         DWord           lastBackupDate;
20b6cee71dSXin LI#         DWord           modificationNumber;
21b6cee71dSXin LI#         DWord           appInfoID;
22b6cee71dSXin LI#         DWord           sortInfoID;
23b6cee71dSXin LI#         char            type[4];
24b6cee71dSXin LI#         char            creator[4];
25b6cee71dSXin LI#         DWord           uniqueIDSeed;
26b6cee71dSXin LI#         RecordListType  recordList;
27b6cee71dSXin LI# };
28b6cee71dSXin LI#
29b6cee71dSXin LI# Datestamps are unsigned seconds since the MacOS epoch (Jan 1, 1904),
30b6cee71dSXin LI# or Unix/POSIX time + 2082844800.
31b6cee71dSXin LI
32b6cee71dSXin LI0		name		aportisdoc
33b6cee71dSXin LI# date is supposed to be big-endian seconds since 1 Jan 1904, but many
34b6cee71dSXin LI# files contain the timestamp in little-endian or a completely
35b6cee71dSXin LI# nonsensical value...
36b6cee71dSXin LI#>36		bedate-2082844800	>0	\b, created %s
37b6cee71dSXin LI# compression: 1=uncomp, 2=orig, 0x4448=HuffDic
38b6cee71dSXin LI>(78.L)		beshort		=1		\b, uncompressed
39b6cee71dSXin LI# compressed
40b6cee71dSXin LI>(78.L)		beshort		>1
41b6cee71dSXin LI>>(78.L+4)	belong		x		\b, %d bytes uncompressed
42b6cee71dSXin LI
43b6cee71dSXin LI# appl
44b6cee71dSXin LI#60		string		appl		PalmOS application
45b6cee71dSXin LI#>0		string		>\0		"%s"
46b6cee71dSXin LI
47b6cee71dSXin LI# HACK
48b6cee71dSXin LI#60		string		HACK		HackMaster hack
49b6cee71dSXin LI#>0		string		>\0		"%s"
50b6cee71dSXin LI
51b6cee71dSXin LI# iSiloX e-book
52b6cee71dSXin LI60		string		SDocSilX	iSiloX E-book
53b6cee71dSXin LI>0		string		>\0		"%s"
54b6cee71dSXin LI
55b6cee71dSXin LI# Mobipocket (www.mobipocket.com), donated by Carl Witty
56b6cee71dSXin LI# expanded by Ralf Brown
57b6cee71dSXin LI60		string	 	BOOKMOBI	Mobipocket E-book
58b6cee71dSXin LI# MobiPocket stores a full title, pointed at by the belong at offset
59b6cee71dSXin LI# 0x54 in its header at (78.L), with length given by the belong at
60b6cee71dSXin LI# offset 0x58.
61b6cee71dSXin LI# there's no guarantee that the title string is null-terminated, but
62b6cee71dSXin LI# we currently can't specify a variable-length string where the length
63b6cee71dSXin LI# field is not at the start of the string; in practice, the data
64b6cee71dSXin LI# following the string always seems to start with a zero byte
65b6cee71dSXin LI>(78.L)		belong		x
66b6cee71dSXin LI>>&(&0x50.L-4)	string		>\0		"%s"
67b6cee71dSXin LI>0		use		aportisdoc
68b6cee71dSXin LI>>(78.L+0x68)	belong		>0		\b, version %d
69b6cee71dSXin LI>>(78.L+0x1C)	belong		!0		\b, codepage %d
70b6cee71dSXin LI>>(78.L+0x0C)	beshort	 	>0		\b, encrypted (type %d)
71b6cee71dSXin LI
72b6cee71dSXin LI# AportisDoc/PalmDOC
73b6cee71dSXin LI60		string		TEXtREAd	AportisDoc/PalmDOC E-book
74b6cee71dSXin LI>0		string		>\0		"%s"
75b6cee71dSXin LI>0		use		aportisdoc
76b6cee71dSXin LI
77b6cee71dSXin LI# Variety of PalmOS document types
78b6cee71dSXin LI# Michael-John Turner <mj@debian.org>
79b6cee71dSXin LI# Thanks to Hasan Umit Ezerce <humit@tr-net.net.tr> for his DocType
80b6cee71dSXin LI60	string			BVokBDIC	BDicty PalmOS document
81b6cee71dSXin LI>0	string			>\0		"%s"
82b6cee71dSXin LI60	string			DB99DBOS	DB PalmOS document
83b6cee71dSXin LI>0	string			>\0		"%s"
84b6cee71dSXin LI60	string			vIMGView	FireViewer/ImageViewer PalmOS document
85b6cee71dSXin LI>0	string			>\0		"%s"
86b6cee71dSXin LI60	string			PmDBPmDB	HanDBase PalmOS document
87b6cee71dSXin LI>0	string			>\0		"%s"
88b6cee71dSXin LI60	string			InfoINDB	InfoView PalmOS document
89b6cee71dSXin LI>0	string			>\0		"%s"
90b6cee71dSXin LI60	string			ToGoToGo	iSilo PalmOS document
91b6cee71dSXin LI>0	string			>\0		"%s"
92b6cee71dSXin LI60	string			JfDbJBas	JFile PalmOS document
93b6cee71dSXin LI>0	string			>\0		"%s"
94b6cee71dSXin LI60	string			JfDbJFil	JFile Pro PalmOS document
95b6cee71dSXin LI>0	string			>\0		"%s"
96b6cee71dSXin LI60	string			DATALSdb	List PalmOS document
97b6cee71dSXin LI>0	string			>\0		"%s"
98b6cee71dSXin LI60	string			Mdb1Mdb1	MobileDB PalmOS document
99b6cee71dSXin LI>0	string			>\0		"%s"
100b6cee71dSXin LI60	string			PNRdPPrs	PeanutPress PalmOS document
101b6cee71dSXin LI>0	string			>\0		"%s"
102b6cee71dSXin LI60	string			DataPlkr	Plucker PalmOS document
103b6cee71dSXin LI>0	string			>\0		"%s"
104b6cee71dSXin LI60	string			DataSprd	QuickSheet PalmOS document
105b6cee71dSXin LI>0	string			>\0		"%s"
106b6cee71dSXin LI60	string			SM01SMem	SuperMemo PalmOS document
107b6cee71dSXin LI>0	string			>\0		"%s"
108b6cee71dSXin LI60	string			TEXtTlDc	TealDoc PalmOS document
109b6cee71dSXin LI>0	string			>\0		"%s"
110b6cee71dSXin LI60	string			InfoTlIf	TealInfo PalmOS document
111b6cee71dSXin LI>0	string			>\0		"%s"
112b6cee71dSXin LI60	string			DataTlMl	TealMeal PalmOS document
113b6cee71dSXin LI>0	string			>\0		"%s"
114b6cee71dSXin LI60	string			DataTlPt	TealPaint PalmOS document
115b6cee71dSXin LI>0	string			>\0		"%s"
116b6cee71dSXin LI60	string			dataTDBP	ThinkDB PalmOS document
117b6cee71dSXin LI>0	string			>\0		"%s"
118b6cee71dSXin LI60	string			TdatTide	Tides PalmOS document
119b6cee71dSXin LI>0	string			>\0		"%s"
120b6cee71dSXin LI60	string			ToRaTRPW	TomeRaider PalmOS document
121b6cee71dSXin LI>0	string			>\0		"%s"
122b6cee71dSXin LI
123b6cee71dSXin LI# A GutenPalm zTXT etext for use on Palm Pilots (http://gutenpalm.sf.net)
124b6cee71dSXin LI# For version 1.xx zTXTs, outputs version and numbers of bookmarks and
125b6cee71dSXin LI#   annotations.
126b6cee71dSXin LI# For other versions, just outputs version.
127b6cee71dSXin LI#
128b6cee71dSXin LI60		string		zTXT		A GutenPalm zTXT e-book
129b6cee71dSXin LI>0		string		>\0		"%s"
130b6cee71dSXin LI>(0x4E.L)	byte		0
131b6cee71dSXin LI>>(0x4E.L+1)	byte		x		(v0.%02d)
132b6cee71dSXin LI>(0x4E.L)	byte		1
133b6cee71dSXin LI>>(0x4E.L+1)	byte		x		(v1.%02d)
134b6cee71dSXin LI>>>(0x4E.L+10)	beshort		>0
135b6cee71dSXin LI>>>>(0x4E.L+10) beshort		<2		- 1 bookmark
136b6cee71dSXin LI>>>>(0x4E.L+10) beshort		>1		- %d bookmarks
137b6cee71dSXin LI>>>(0x4E.L+14)	beshort		>0
138b6cee71dSXin LI>>>>(0x4E.L+14) beshort		<2		- 1 annotation
139b6cee71dSXin LI>>>>(0x4E.L+14) beshort		>1		- %d annotations
140b6cee71dSXin LI>(0x4E.L)	byte		>1		(v%d.
141b6cee71dSXin LI>>(0x4E.L+1)	byte		x		%02d)
142b6cee71dSXin LI
143b6cee71dSXin LI# Palm OS .prc file types
144b6cee71dSXin LI60		string		libr
145b6cee71dSXin LI# flags, only bit 0 or bit 6
146*48c779cdSXin LI# https://en.wikipedia.org/wiki/PRC_%28Palm_OS%29
147*48c779cdSXin LI# https://web.mit.edu/tytso/www/pilot/prc-format.html
148b6cee71dSXin LI>0x20		beshort&0xffbe	0
149b6cee71dSXin LI>>0		string		>\0		Palm OS dynamic library data "%s"
150b6cee71dSXin LI60		string		ptch		Palm OS operating system patch data
151b6cee71dSXin LI>0		string		>\0		"%s"
152b6cee71dSXin LI
153b6cee71dSXin LI# Mobipocket (www.mobipocket.com), donated by Carl Witty
154b6cee71dSXin LI60	string			BOOKMOBI	Mobipocket E-book
155b6cee71dSXin LI>0	string			>\0		"%s"
156