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