168349Sobrien 268349Sobrien#------------------------------------------------------------------------------ 3354939Sdelphij# $File: palm,v 1.14 2019/04/19 00:42:27 christos Exp $ 4234250Sobrien# palm: file(1) magic for PalmOS {.prc,.pdb}: applications, docfiles, and hacks 568349Sobrien# 668349Sobrien# Brian Lalor <blalor@hcirisc.cs.binghamton.edu> 768349Sobrien 8234250Sobrien# These are weak, byte 59 is not guaranteed to be 0 and there are 9234250Sobrien# 8 character identifiers at byte 60, one I found for appl is BIGb. 10234250Sobrien# What are the possibilities and where is this documented? 11234250Sobrien 12267843Sdelphij# The common header format for PalmOS .pdb/.prc files is 13267843Sdelphij# { 14267843Sdelphij# char name[ 32 ]; 15267843Sdelphij# Word attributes; 16267843Sdelphij# Word version; 17267843Sdelphij# DWord creationDate; 18267843Sdelphij# DWord modificationDate; 19267843Sdelphij# DWord lastBackupDate; 20267843Sdelphij# DWord modificationNumber; 21267843Sdelphij# DWord appInfoID; 22267843Sdelphij# DWord sortInfoID; 23267843Sdelphij# char type[4]; 24267843Sdelphij# char creator[4]; 25267843Sdelphij# DWord uniqueIDSeed; 26267843Sdelphij# RecordListType recordList; 27267843Sdelphij# }; 28267843Sdelphij# 29267843Sdelphij# Datestamps are unsigned seconds since the MacOS epoch (Jan 1, 1904), 30267843Sdelphij# or Unix/POSIX time + 2082844800. 31267843Sdelphij 32267843Sdelphij0 name aportisdoc 33267843Sdelphij# date is supposed to be big-endian seconds since 1 Jan 1904, but many 34267843Sdelphij# files contain the timestamp in little-endian or a completely 35267843Sdelphij# nonsensical value... 36267843Sdelphij#>36 bedate-2082844800 >0 \b, created %s 37267843Sdelphij# compression: 1=uncomp, 2=orig, 0x4448=HuffDic 38267843Sdelphij>(78.L) beshort =1 \b, uncompressed 39267843Sdelphij# compressed 40267843Sdelphij>(78.L) beshort >1 41267843Sdelphij>>(78.L+4) belong x \b, %d bytes uncompressed 42267843Sdelphij 4368349Sobrien# appl 44267843Sdelphij#60 string appl PalmOS application 45267843Sdelphij#>0 string >\0 "%s" 46267843Sdelphij 4768349Sobrien# HACK 48267843Sdelphij#60 string HACK HackMaster hack 49267843Sdelphij#>0 string >\0 "%s" 50133359Sobrien 51267843Sdelphij# iSiloX e-book 52267843Sdelphij60 string SDocSilX iSiloX E-book 53267843Sdelphij>0 string >\0 "%s" 54267843Sdelphij 55267843Sdelphij# Mobipocket (www.mobipocket.com), donated by Carl Witty 56267843Sdelphij# expanded by Ralf Brown 57267843Sdelphij60 string BOOKMOBI Mobipocket E-book 58267843Sdelphij# MobiPocket stores a full title, pointed at by the belong at offset 59267843Sdelphij# 0x54 in its header at (78.L), with length given by the belong at 60267843Sdelphij# offset 0x58. 61267843Sdelphij# there's no guarantee that the title string is null-terminated, but 62267843Sdelphij# we currently can't specify a variable-length string where the length 63267843Sdelphij# field is not at the start of the string; in practice, the data 64267843Sdelphij# following the string always seems to start with a zero byte 65267843Sdelphij>(78.L) belong x 66267843Sdelphij>>&(&0x50.L-4) string >\0 "%s" 67267843Sdelphij>0 use aportisdoc 68267843Sdelphij>>(78.L+0x68) belong >0 \b, version %d 69267843Sdelphij>>(78.L+0x1C) belong !0 \b, codepage %d 70267843Sdelphij>>(78.L+0x0C) beshort >0 \b, encrypted (type %d) 71267843Sdelphij 72267843Sdelphij# AportisDoc/PalmDOC 73267843Sdelphij60 string TEXtREAd AportisDoc/PalmDOC E-book 74267843Sdelphij>0 string >\0 "%s" 75267843Sdelphij>0 use aportisdoc 76267843Sdelphij 77133359Sobrien# Variety of PalmOS document types 78133359Sobrien# Michael-John Turner <mj@debian.org> 79133359Sobrien# Thanks to Hasan Umit Ezerce <humit@tr-net.net.tr> for his DocType 80234250Sobrien60 string BVokBDIC BDicty PalmOS document 81234250Sobrien>0 string >\0 "%s" 82234250Sobrien60 string DB99DBOS DB PalmOS document 83234250Sobrien>0 string >\0 "%s" 84234250Sobrien60 string vIMGView FireViewer/ImageViewer PalmOS document 85234250Sobrien>0 string >\0 "%s" 86234250Sobrien60 string PmDBPmDB HanDBase PalmOS document 87234250Sobrien>0 string >\0 "%s" 88234250Sobrien60 string InfoINDB InfoView PalmOS document 89234250Sobrien>0 string >\0 "%s" 90234250Sobrien60 string ToGoToGo iSilo PalmOS document 91234250Sobrien>0 string >\0 "%s" 92234250Sobrien60 string JfDbJBas JFile PalmOS document 93234250Sobrien>0 string >\0 "%s" 94234250Sobrien60 string JfDbJFil JFile Pro PalmOS document 95234250Sobrien>0 string >\0 "%s" 96234250Sobrien60 string DATALSdb List PalmOS document 97234250Sobrien>0 string >\0 "%s" 98234250Sobrien60 string Mdb1Mdb1 MobileDB PalmOS document 99234250Sobrien>0 string >\0 "%s" 100234250Sobrien60 string PNRdPPrs PeanutPress PalmOS document 101234250Sobrien>0 string >\0 "%s" 102234250Sobrien60 string DataPlkr Plucker PalmOS document 103234250Sobrien>0 string >\0 "%s" 104234250Sobrien60 string DataSprd QuickSheet PalmOS document 105234250Sobrien>0 string >\0 "%s" 106234250Sobrien60 string SM01SMem SuperMemo PalmOS document 107234250Sobrien>0 string >\0 "%s" 108234250Sobrien60 string TEXtTlDc TealDoc PalmOS document 109234250Sobrien>0 string >\0 "%s" 110234250Sobrien60 string InfoTlIf TealInfo PalmOS document 111234250Sobrien>0 string >\0 "%s" 112234250Sobrien60 string DataTlMl TealMeal PalmOS document 113234250Sobrien>0 string >\0 "%s" 114234250Sobrien60 string DataTlPt TealPaint PalmOS document 115234250Sobrien>0 string >\0 "%s" 116234250Sobrien60 string dataTDBP ThinkDB PalmOS document 117234250Sobrien>0 string >\0 "%s" 118234250Sobrien60 string TdatTide Tides PalmOS document 119234250Sobrien>0 string >\0 "%s" 120234250Sobrien60 string ToRaTRPW TomeRaider PalmOS document 121234250Sobrien>0 string >\0 "%s" 122133359Sobrien 123133359Sobrien# A GutenPalm zTXT etext for use on Palm Pilots (http://gutenpalm.sf.net) 124133359Sobrien# For version 1.xx zTXTs, outputs version and numbers of bookmarks and 125133359Sobrien# annotations. 126133359Sobrien# For other versions, just outputs version. 127133359Sobrien# 128133359Sobrien60 string zTXT A GutenPalm zTXT e-book 129133359Sobrien>0 string >\0 "%s" 130133359Sobrien>(0x4E.L) byte 0 131133359Sobrien>>(0x4E.L+1) byte x (v0.%02d) 132133359Sobrien>(0x4E.L) byte 1 133133359Sobrien>>(0x4E.L+1) byte x (v1.%02d) 134133359Sobrien>>>(0x4E.L+10) beshort >0 135133359Sobrien>>>>(0x4E.L+10) beshort <2 - 1 bookmark 136133359Sobrien>>>>(0x4E.L+10) beshort >1 - %d bookmarks 137133359Sobrien>>>(0x4E.L+14) beshort >0 138133359Sobrien>>>>(0x4E.L+14) beshort <2 - 1 annotation 139133359Sobrien>>>>(0x4E.L+14) beshort >1 - %d annotations 140133359Sobrien>(0x4E.L) byte >1 (v%d. 141133359Sobrien>>(0x4E.L+1) byte x %02d) 142133359Sobrien 143133359Sobrien# Palm OS .prc file types 144267843Sdelphij60 string libr 145267843Sdelphij# flags, only bit 0 or bit 6 146354939Sdelphij# https://en.wikipedia.org/wiki/PRC_%28Palm_OS%29 147354939Sdelphij# https://web.mit.edu/tytso/www/pilot/prc-format.html 148267843Sdelphij>0x20 beshort&0xffbe 0 149267843Sdelphij>>0 string >\0 Palm OS dynamic library data "%s" 150133359Sobrien60 string ptch Palm OS operating system patch data 151133359Sobrien>0 string >\0 "%s" 152133359Sobrien 153133359Sobrien# Mobipocket (www.mobipocket.com), donated by Carl Witty 154234250Sobrien60 string BOOKMOBI Mobipocket E-book 155234250Sobrien>0 string >\0 "%s" 156