1327e51cbSPeter Avalos 2327e51cbSPeter Avalos#------------------------------------------------------------------------------ 3*3b9cdfa3SAntonio Huete Jimenez# $File: palm,v 1.15 2021/12/16 21:50:06 christos Exp $ 4327e51cbSPeter Avalos# palm: file(1) magic for PalmOS {.prc,.pdb}: applications, docfiles, and hacks 5327e51cbSPeter Avalos# 6327e51cbSPeter Avalos# Brian Lalor <blalor@hcirisc.cs.binghamton.edu> 7327e51cbSPeter Avalos 89f86ab30SPeter Avalos# These are weak, byte 59 is not guaranteed to be 0 and there are 99f86ab30SPeter Avalos# 8 character identifiers at byte 60, one I found for appl is BIGb. 109f86ab30SPeter Avalos# What are the possibilities and where is this documented? 119f86ab30SPeter Avalos 12e8af9738SPeter Avalos# The common header format for PalmOS .pdb/.prc files is 13e8af9738SPeter Avalos# { 14e8af9738SPeter Avalos# char name[ 32 ]; 15e8af9738SPeter Avalos# Word attributes; 16e8af9738SPeter Avalos# Word version; 17e8af9738SPeter Avalos# DWord creationDate; 18e8af9738SPeter Avalos# DWord modificationDate; 19e8af9738SPeter Avalos# DWord lastBackupDate; 20e8af9738SPeter Avalos# DWord modificationNumber; 21e8af9738SPeter Avalos# DWord appInfoID; 22e8af9738SPeter Avalos# DWord sortInfoID; 23e8af9738SPeter Avalos# char type[4]; 24e8af9738SPeter Avalos# char creator[4]; 25e8af9738SPeter Avalos# DWord uniqueIDSeed; 26e8af9738SPeter Avalos# RecordListType recordList; 27e8af9738SPeter Avalos# }; 28e8af9738SPeter Avalos# 29e8af9738SPeter Avalos# Datestamps are unsigned seconds since the MacOS epoch (Jan 1, 1904), 30e8af9738SPeter Avalos# or Unix/POSIX time + 2082844800. 31e8af9738SPeter Avalos 32e8af9738SPeter Avalos0 name aportisdoc 33e8af9738SPeter Avalos# date is supposed to be big-endian seconds since 1 Jan 1904, but many 34e8af9738SPeter Avalos# files contain the timestamp in little-endian or a completely 35e8af9738SPeter Avalos# nonsensical value... 36e8af9738SPeter Avalos#>36 bedate-2082844800 >0 \b, created %s 37e8af9738SPeter Avalos# compression: 1=uncomp, 2=orig, 0x4448=HuffDic 38e8af9738SPeter Avalos>(78.L) beshort =1 \b, uncompressed 39e8af9738SPeter Avalos# compressed 40e8af9738SPeter Avalos>(78.L) beshort >1 41e8af9738SPeter Avalos>>(78.L+4) belong x \b, %d bytes uncompressed 42e8af9738SPeter Avalos 43327e51cbSPeter Avalos# appl 44e8af9738SPeter Avalos#60 string appl PalmOS application 4517b11469SPeter Avalos#>0 string >\0 "%s" 46e8af9738SPeter Avalos 47327e51cbSPeter Avalos# HACK 48e8af9738SPeter Avalos#60 string HACK HackMaster hack 4917b11469SPeter Avalos#>0 string >\0 "%s" 50327e51cbSPeter Avalos 51e8af9738SPeter Avalos# iSiloX e-book 52e8af9738SPeter Avalos60 string SDocSilX iSiloX E-book 53e8af9738SPeter Avalos>0 string >\0 "%s" 54e8af9738SPeter Avalos 55e8af9738SPeter Avalos# Mobipocket (www.mobipocket.com), donated by Carl Witty 56e8af9738SPeter Avalos# expanded by Ralf Brown 57e8af9738SPeter Avalos60 string BOOKMOBI Mobipocket E-book 58*3b9cdfa3SAntonio Huete Jimenez!:mime application/x-mobipocket-ebook 59e8af9738SPeter Avalos# MobiPocket stores a full title, pointed at by the belong at offset 60e8af9738SPeter Avalos# 0x54 in its header at (78.L), with length given by the belong at 61e8af9738SPeter Avalos# offset 0x58. 62e8af9738SPeter Avalos# there's no guarantee that the title string is null-terminated, but 63e8af9738SPeter Avalos# we currently can't specify a variable-length string where the length 64e8af9738SPeter Avalos# field is not at the start of the string; in practice, the data 65e8af9738SPeter Avalos# following the string always seems to start with a zero byte 66e8af9738SPeter Avalos>(78.L) belong x 67e8af9738SPeter Avalos>>&(&0x50.L-4) string >\0 "%s" 68e8af9738SPeter Avalos>0 use aportisdoc 69e8af9738SPeter Avalos>>(78.L+0x68) belong >0 \b, version %d 70e8af9738SPeter Avalos>>(78.L+0x1C) belong !0 \b, codepage %d 71e8af9738SPeter Avalos>>(78.L+0x0C) beshort >0 \b, encrypted (type %d) 72e8af9738SPeter Avalos 73e8af9738SPeter Avalos# AportisDoc/PalmDOC 74e8af9738SPeter Avalos60 string TEXtREAd AportisDoc/PalmDOC E-book 75e8af9738SPeter Avalos>0 string >\0 "%s" 76e8af9738SPeter Avalos>0 use aportisdoc 77e8af9738SPeter Avalos 78327e51cbSPeter Avalos# Variety of PalmOS document types 79327e51cbSPeter Avalos# Michael-John Turner <mj@debian.org> 80327e51cbSPeter Avalos# Thanks to Hasan Umit Ezerce <humit@tr-net.net.tr> for his DocType 81327e51cbSPeter Avalos60 string BVokBDIC BDicty PalmOS document 82327e51cbSPeter Avalos>0 string >\0 "%s" 83327e51cbSPeter Avalos60 string DB99DBOS DB PalmOS document 84327e51cbSPeter Avalos>0 string >\0 "%s" 85327e51cbSPeter Avalos60 string vIMGView FireViewer/ImageViewer PalmOS document 86327e51cbSPeter Avalos>0 string >\0 "%s" 87327e51cbSPeter Avalos60 string PmDBPmDB HanDBase PalmOS document 88327e51cbSPeter Avalos>0 string >\0 "%s" 89327e51cbSPeter Avalos60 string InfoINDB InfoView PalmOS document 90327e51cbSPeter Avalos>0 string >\0 "%s" 91327e51cbSPeter Avalos60 string ToGoToGo iSilo PalmOS document 92327e51cbSPeter Avalos>0 string >\0 "%s" 93327e51cbSPeter Avalos60 string JfDbJBas JFile PalmOS document 94327e51cbSPeter Avalos>0 string >\0 "%s" 95327e51cbSPeter Avalos60 string JfDbJFil JFile Pro PalmOS document 96327e51cbSPeter Avalos>0 string >\0 "%s" 97327e51cbSPeter Avalos60 string DATALSdb List PalmOS document 98327e51cbSPeter Avalos>0 string >\0 "%s" 99327e51cbSPeter Avalos60 string Mdb1Mdb1 MobileDB PalmOS document 100327e51cbSPeter Avalos>0 string >\0 "%s" 101327e51cbSPeter Avalos60 string PNRdPPrs PeanutPress PalmOS document 102327e51cbSPeter Avalos>0 string >\0 "%s" 103327e51cbSPeter Avalos60 string DataPlkr Plucker PalmOS document 104327e51cbSPeter Avalos>0 string >\0 "%s" 105327e51cbSPeter Avalos60 string DataSprd QuickSheet PalmOS document 106327e51cbSPeter Avalos>0 string >\0 "%s" 107327e51cbSPeter Avalos60 string SM01SMem SuperMemo PalmOS document 108327e51cbSPeter Avalos>0 string >\0 "%s" 10979343712SPeter Avalos60 string TEXtTlDc TealDoc PalmOS document 110327e51cbSPeter Avalos>0 string >\0 "%s" 111327e51cbSPeter Avalos60 string InfoTlIf TealInfo PalmOS document 112327e51cbSPeter Avalos>0 string >\0 "%s" 113327e51cbSPeter Avalos60 string DataTlMl TealMeal PalmOS document 114327e51cbSPeter Avalos>0 string >\0 "%s" 115327e51cbSPeter Avalos60 string DataTlPt TealPaint PalmOS document 116327e51cbSPeter Avalos>0 string >\0 "%s" 117327e51cbSPeter Avalos60 string dataTDBP ThinkDB PalmOS document 118327e51cbSPeter Avalos>0 string >\0 "%s" 119327e51cbSPeter Avalos60 string TdatTide Tides PalmOS document 120327e51cbSPeter Avalos>0 string >\0 "%s" 121327e51cbSPeter Avalos60 string ToRaTRPW TomeRaider PalmOS document 122327e51cbSPeter Avalos>0 string >\0 "%s" 123327e51cbSPeter Avalos 124327e51cbSPeter Avalos# A GutenPalm zTXT etext for use on Palm Pilots (http://gutenpalm.sf.net) 125327e51cbSPeter Avalos# For version 1.xx zTXTs, outputs version and numbers of bookmarks and 126327e51cbSPeter Avalos# annotations. 127327e51cbSPeter Avalos# For other versions, just outputs version. 128327e51cbSPeter Avalos# 129327e51cbSPeter Avalos60 string zTXT A GutenPalm zTXT e-book 130327e51cbSPeter Avalos>0 string >\0 "%s" 131327e51cbSPeter Avalos>(0x4E.L) byte 0 132327e51cbSPeter Avalos>>(0x4E.L+1) byte x (v0.%02d) 133327e51cbSPeter Avalos>(0x4E.L) byte 1 134327e51cbSPeter Avalos>>(0x4E.L+1) byte x (v1.%02d) 135327e51cbSPeter Avalos>>>(0x4E.L+10) beshort >0 136327e51cbSPeter Avalos>>>>(0x4E.L+10) beshort <2 - 1 bookmark 137327e51cbSPeter Avalos>>>>(0x4E.L+10) beshort >1 - %d bookmarks 138327e51cbSPeter Avalos>>>(0x4E.L+14) beshort >0 139327e51cbSPeter Avalos>>>>(0x4E.L+14) beshort <2 - 1 annotation 140327e51cbSPeter Avalos>>>>(0x4E.L+14) beshort >1 - %d annotations 141327e51cbSPeter Avalos>(0x4E.L) byte >1 (v%d. 142327e51cbSPeter Avalos>>(0x4E.L+1) byte x %02d) 143327e51cbSPeter Avalos 144327e51cbSPeter Avalos# Palm OS .prc file types 14582c5fa3eSPeter Avalos60 string libr 14682c5fa3eSPeter Avalos# flags, only bit 0 or bit 6 1476fca56fbSSascha Wildner# https://en.wikipedia.org/wiki/PRC_%28Palm_OS%29 1486fca56fbSSascha Wildner# https://web.mit.edu/tytso/www/pilot/prc-format.html 14982c5fa3eSPeter Avalos>0x20 beshort&0xffbe 0 15082c5fa3eSPeter Avalos>>0 string >\0 Palm OS dynamic library data "%s" 151327e51cbSPeter Avalos60 string ptch Palm OS operating system patch data 152327e51cbSPeter Avalos>0 string >\0 "%s" 153327e51cbSPeter Avalos 154327e51cbSPeter Avalos# Mobipocket (www.mobipocket.com), donated by Carl Witty 155327e51cbSPeter Avalos60 string BOOKMOBI Mobipocket E-book 156327e51cbSPeter Avalos>0 string >\0 "%s" 157