PALMDUMP

Database and Resource File Dumper
for the Palm Computing® Platform

by John Walker


Developers for the Palm Computing® Platform quickly discover that the end-product of their labours consists of Palm resource (.prc) and/or Palm database (.pdb) files, developed on the desktop environment and subsequently installed onto the handheld (or emulator) for testing and eventual use. Before long, particularly if you're engaged in conduit development or creation of databases intended for downloading and use by applications on the handheld, you'll probably feel the need to "look under the hood" at one of these files--examine an interpreted dump of its contents.

Palmdump is a program for the desktop platform which dumps .prc and .pdb files with header and record information in human readable form and the contents of each record or resource in side-by-side hexadecimal and ASCII/ISO character form. Palmdump isn't the first dump utility for these files, but as of the date of its release it's the only one I'm aware of which...

Documentation for Palmdump follows, in Unix manual page style.

NAME

palmdump - dump Palm Computing database and resource files

SYNOPSIS

palmdump [ -n -u ] infile [ outfile ]

DESCRIPTION

palmdump dumps Palm Computing database (.pdb) or resource (.prc) files in hexadecimal and ISO character format, side by side. The file header and individual record headers are edited into human readable form.

OPTIONS

-n
Dump only record or resource headers, not the items' content.
-u
Print how-to-call information.

FILES

If no outfile is given, output is sent to standard output.

BUGS

Character codes between decimal 128 and 255 are printed assuming the host system displays them in the ISO-8859 or (equivalently) Unicode character set. If you're running on a system with a different native character set, for example a DOS window in Windows using the original DOS "code page", these characters will display as whatever the system's code page defines them to be, not the standard values. Further, fonts on the Palm are not completely compliant with ISO or Unicode, so some characters may display with different glyphs than they do on the handheld.

Source code assumes that an "rb" mode specification to fopen will open a file in binary mode on platforms which (unlike Unix) distinguish between text and binary files and that the presence of the "b" in the mode string will not cause problems on platforms which make no such distinction. I know of no platform on which this would create a problem, but you never know.

SEE ALSO

xd(1), fopen(3)

About Time (and Dates)

PalmOSTM uses the Macintosh representation for time: a 32 bit unsigned quantity representing seconds elapsed since January 1st, 1904. Most Unix and POSIX-compatible programs use a different epoch or date and time origin, measuring instead seconds elapsed since January 1st, 1970. Both are, of course, short-sighted and ill-conceived; the Unix time convention goes negative on January 19th, 2038, torpedoing many programs written without taking into account the unsigned nature of time() values or coercing differences to signed when required. The Palm/Macintosh convention was adopted at a time when the distinction between signed and unsigned values was more clearly cut, but blows up in 2040 when the value wraps around to zero.

Unfortunately, third-party Palm Computing utilities are less than scrupulous in distinguishing these two distinct date conventions; you'll find Palm resource and database files containing either of these formats. Palmdump attempts to guess which by deeming any value which, using the Palm convention, is prior to January 1st 1970 as being in the Unix/POSIX convention. Date and time items in the file header are identified with the convention used to interpret them.

Just in case you need to know, and don't want to work it out for yourself, the number of seconds elapsed between the first days of 1904 and 1970 is 2082844800LU, the appended letters identifying the quantity as a C language unsigned long (32 bits or more).

Sample Output

The following is output from dumping a .pdb database file. Only the first two of 19 database records are shown.
Database name:           Months-HkDt
Flags:                   0x8 Backup
Version:                 0x0
Creation time:           PC/Unix time: Fri Jun 25 13:04:34 1999
Modification time:       PC/Unix time: Thu Jul  1 13:13:28 1999
Backup time:             PC/Unix time: Wed Jun 30 13:22:08 1999
Modification number:     116
Application Info offset: 0
Sort Info offset:        0
Type:                    Mlog
Creator:                 HkDt
Unique ID:               0
Next record ID:          0
Number of records:       19

Record 0:  Length 108, Offset = 232, Attributes 0x40 Dirty, Category 0, UniqueID 8163335
     0: 07 CE 00 00 00 00 00 00  00 00 00 00 FF FF FF FF | .Î..........ÿÿÿÿ
    10: FF FF FF FF FF FF FF FF  FF FF FF FF FF FF FF FF | ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
    20: FF FF FF FF FF FF FF FF  FF FF FF 00 21 70 21 98 | ÿÿÿÿÿÿÿÿÿÿÿ.!p!.
    30: 21 84 21 AC 21 48 21 AC  21 98 21 70 21 D4 21 84 | !.!¬!H!¬!.!p!Ô!.
    40: 21 70 21 84 21 C0 21 98  21 E8 21 70 21 48 21 34 | !p!.!À!.!è!p!H!4
    50: 21 20 20 E4 21 0C 21 34  21 5C 21 34 21 34 21 34 | !  ä!.!4!\!4!4!4
    60: 21 5C 21 20 21 AC 21 84  21 84 00 00             | !\! !¬!.!...

Record 1:  Length 108, Offset = 340, Attributes 0x40 Dirty, Category 0, UniqueID 8163336
     0: 07 CE 01 86 05 17 88 FE  00 00 00 00 FF FF FF FF | .Î.....þ....ÿÿÿÿ
    10: FF FF FF FF FF FF FF FF  FF FF FF FF FF FF FF FF | ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
    20: FF FF FF FF FF FF FF FF  6C 69 6F 6D 21 70 21 34 | ÿÿÿÿÿÿÿÿliom!p!4
    30: 21 48 21 5C 21 AC 21 C0  21 98 21 84 21 20 21 AC | !H!\!¬!À!.!.! !¬
    40: 21 48 21 34 21 20 21 0C  21 34 21 0C 21 98 20 F8 | !H!4! !.!4!.!. ø
    50: 21 48 20 A8 20 BC 20 D0  21 5C 21 34 21 5C 21 48 | !H ¨ ¼ Ð!\!4!\!H
    60: 21 34 20 A8 6C 69 6F 6D  61 72 00 04             | !4 ¨liomar..

Here is a dump of a .prc file; data from the code resource has been elided after the first line, along with numerous other resource entries in the interest of brevity.

Database name:           Hackdiet
Flags:                   0x1 Resource
Version:                 0x1 Read-only
Creation time:           Palm time: Mon Jul 12 19:31:39 1999
Modification time:       Palm time: Mon Jul 12 19:31:39 1999
Backup time:             Never
Modification number:     0
Application Info offset: 0
Sort Info offset:        0
Type:                    appl
Creator:                 HkDt
Unique ID:               0
Next record ID:          0
Number of records:       36

Resource 0:  Length 24582, Offset = 440, Type "code", ID = 1
     0: 00 00 00 01 48 7A 00 04  06 97 00 00 00 06 4E 75 | ....Hz........Nu
                    . . .

Resource 14:  Length 128, Offset = 29721, Type "Talt", ID = 1101
     0: 00 00 00 00 00 01 00 00  41 62 6F 75 74 54 68 65 | ........AboutThe
    10: 20 48 61 63 6B 65 72 27  73 20 44 69 65 74 00 54 |  Hacker's Diet.T
    20: 68 65 20 48 61 63 6B 65  72 27 73 20 44 69 65 74 | he Hacker's Diet
    30: 0A 20 20 20 20 20 28 50  61 6C 6D 20 54 6F 6F 6C | .     (Palm Tool
    40: 73 29 0A 20 20 20 20 20  20 20 56 65 72 73 69 6F | s).       Versio
    50: 6E 20 31 2E 30 0A 20 20  20 20 62 79 20 4A 6F 68 | n 1.0.    by Joh
    60: 6E 20 57 61 6C 6B 65 72  0A 77 77 77 2E 66 6F 75 | n Walker.www.fou
    70: 72 6D 69 6C 61 62 2E 0A  63 68 0A 0A 00 4F 4B 00 | rmilab..ch...OK.

Resource 15:  Length 113, Offset = 29849, Type "data", ID = 0
     0: 00 00 00 65 FF FF FF A4  13 40 81 01 03 44 80 01 | ...eÿÿÿ¤.@...D..
    10: 41 86 01 00 02 00 05 3F  F0 45 99 40 01 A3 11 2C | A......?ðE.@.£.,
    20: 78 2E 0F 3F A0 96 A9 7A  37 53 A9 3F DD 07 A8 4A | x..? .©z7S©?Ý.¨J
    30: B7 5E 51 3F F0 45 91 3F  B2 49 24 8C 26 69 76 40 | ·^Q?ðE‘?²I$.&iv@
    40: 3E DD 5E 07 1C 53 F3 40  2C 45 81 3F F0 45 00 00 | >Ý^..Só@,E.?ðE..
    50: 00 00 28 00 00 00 00 28  00 00 00 00 00 00 00 00 | ..(....(........
    60: 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 | ................
    70: 00                                               | .

Resource 16:  Length 89, Offset = 29962, Type "tSTL", ID = 1000
     0: 00 00 0C 4A 61 6E 75 61  72 79 00 46 65 62 72 75 | ...January.Febru
    10: 61 72 79 00 4D 61 72 63  68 00 41 70 72 69 6C 00 | ary.March.April.
    20: 4D 61 79 00 4A 75 6E 65  00 4A 75 6C 79 00 41 75 | May.June.July.Au
    30: 67 75 73 74 00 53 65 70  74 65 6D 62 65 72 00 4F | gust.September.O
    40: 63 74 6F 62 65 72 00 4E  6F 76 65 6D 62 65 72 00 | ctober.November.
    50: 44 65 63 65 6D 62 65 72  00                      | December.

Resource 34:  Length 5, Offset = 30505, Type "tSTR", ID = 1500
     0: 44 6F 6E 65 00                                   | Done.

Resource 35:  Length 4, Offset = 30510, Type "tver", ID = 1000
     0: 31 2E 30 00                                      | 1.0.

Download

Palmdump is supplied as a Zipped archive containing complete source code and palmdump.exe, a ready-to-run 32-bit Windows (WIN32) command-line utility built with Visual C++ 5.0. A Makefile is included which should build an executable on most Unix platforms.

Download palmdump.zip

Support

This software is utterly unsupported; you're entirely on your own. If you're developing software for the Palm Computing Platform, you should probably sign up for the Palm Solution Provider program.

Other Palm Computing Resources at Fourmilab

Fourmilab Home Page


by John Walker
Moon Day, 1999