Kayaker
September 10th, 2002, 00:53
Hi
Let me give a bit of explanation of what's going on here. Yes, W32Dasm fails to properly disassemble PE files which have a slightly "non-standard" resource section. If you look at this file in a resource editor you'll see certain "Named Resources" such as "PNG" "SERIAL" "WMF" that go along with the standard resources such as cursor, bitmap, icon, etc. WDasm can't handle these types of resources and a crash eventually occurs somewhere in Kernel UnhandledExceptionFilter code.
Specifically, if you look at the exe file in an editor like PEBrowse you can see the Named Resources listed:
NumberOfNamedEntries = 0x0007 ; Named Resources
NumberOfIdEntries = 0x000B ; Standard Resources
Named Entry #1 ; i.e. "PNG"
Type = 0x80009226
OffsetToData = 0x800000A0
Characteristics = 0x00000000
TimeDateStamp = 0x00000000
...follows the structure of each individual resource under the heading Named Entry #1
Named Entry #2 ; i.e. "SERIAL"
Type = 0x8000921E
OffsetToData = 0x800001E8
...follows the structure of each individual resource under the heading Named Entry #2
----------------------
The .rsrc section is built as a tree-like structure with pointers to branches and subbranches describing each resource. A resource editor follows these branches and compiles them for our convenience, but in the PE file it's built up beginning with pairs of dwords for each Named (or Id) Entry, giving the Type and OffsetToData, which is a pointer to the next branch of that particular resource. In hex mode it looks like this, where the first WORD is the NumberOfNamedEntries value and follows are the DWORD values for each Named Entry#
001F900C 0700 0B00 2692 0080 A000 0080 1E92 0080
001F901C E801 0080
If you were to change the NumberOfNamedEntries to 0 and delete the pairs of dwords, Type and OffsetToData, for each Named Entry by changing them to 0 as well, W32Dasm should be able to disassemble the file. This is why deleting the .rsrc section worked.
This is an old W32Dasm bug that I'm sure could be fixed if someone bothered trying. I'm assuming W32Dasm is reading this section to get the String Refs. Somewhere in that part of the code it chokes on these Named Entries, which could be as simple a thing as the way it parses the names and the " " characters. What do we need to do here, create a mini project "Improve W32Dasm" ?? ;-)
JMI's replies have in reality only ever meant to be helpful, and his 'search till you drop' advice is probably the best advice all around. If your search was thorough you also would have found an old archived post by me right next to the other ones you found, describing this exact problem and its cause, or references to it in earlier threads on this board. I'm not saying you should have or could have found it and related it to your problem, just that it does exist and is in the huge database of information available.
Heh, why do people keep calling you JMI JIM?
Cheers,
Kayaker