Excellent (if quite dense) slide show about the PE format and doing surprising things with it. Here is his Google code site.
Binary data structure construction is another kind of templating, and unboiling a data file should be pretty much equivalent to unboiling text. A form of exegesis, in other words. Just a thought.