Introduction and Overview — 7
Usually you just need to try every option the program has available and see what
those options change in the file. This is very tedious work, because you only want to
change one thing at a time and you need to save it and get a dump each time. If you
change more than one thing between dumps, you don't know which of the changes
caused which values to change.
It would be nice if there was an easier way than this, but there really isn't. Some-
times, once you've gotten started, you can build custom tools for specific files. When
working on the WinHelp file format, Ron Burk and I wrote a program called HELP-
DUMP (a variation by the same name was released with my article on the .HLP file
format). HELPDUMP started out as a custom hex-dump program. Instead of
hex-dumping an entire .HLP file, though, once we figured out the internal .HLP file
system, we could dump individual internal files within the .HLP file. Then as we fig-
ured out each of those internal files, we wrote a piece of code to handle them. If we
had unknown fields, we'd have it print the values so that we could test specific fields
of different test files.
It really helps to have a good knowledge of data structures and algorithms. I didn't
have as good a knowledge as I originally thought. I certainly didn't know anything
about compression when I started working on the different compression file formats,
and I didn't remember much about b-trees when I started on the .HLP file format. So,
I read up on them (see the annotated bibliography).
To sum up, you need good eyes, good glasses, lots of time, DUMP.EXE, SETVAL.EXE,
and a good library of data structures and algorithm books. Now you're really armed to
the teeth.
Listing 1.1 is the code for DUMP. The program is pretty straight forward. What I
usually do is pipe the results to a file, so I can either print the file or examine it from
an editor.
Listing 1.2 is the source code for SETVAL. Again, it's a very simple program but
is invaluable in the art of reverse-engineering file formats.
Getting in Touch with Us
If we've screwed something up or you've figured out an unknown field, or if you have
suggestions about how we can improve future editions of this book, we'd really like to
hear from you. As far as we're concerned, this book is a living document and will con-
tinue to evolve as new information comes our way.
To contact us, send e-mail to
[email protected] or
[email protected].
A lot of work has gone into producing this book. We really hope you find it useful.
We look forward to hearing your comments, suggestions, and yes, even complaints (if
you've paid for the book, you're entitled to them).