What's the result with Polink?
Hi Vortex,
polink works pretty good - but it's no cigar. The link step finishes without error, and polink did even set the resource directory values in the PE header automatically. However, it has problems with section-relative fixups ( created by Masm operator SECTIONREL ) if there's an addend. Here's an excerpt:
;--- root level: enum the resource types
IMAGE_RESOURCE_DIRECTORY <0,0,0,0,0,2>
IMAGE_RESOURCE_DIRECTORY_ENTRY < RT_BITMAP, SECTIONREL bms + 80000000h >
IMAGE_RESOURCE_DIRECTORY_ENTRY < RT_MENU, SECTIONREL menus + 80000000h >
;--- second level: enum the IDs of resource type X
bms IMAGE_RESOURCE_DIRECTORY <0,0,0,0,0,1>
IMAGE_RESOURCE_DIRECTORY_ENTRY < IDR_BITMAP1, SECTIONREL bm1 + 80000000h >
menus IMAGE_RESOURCE_DIRECTORY <0,0,0,0,0,1>
IMAGE_RESOURCE_DIRECTORY_ENTRY < IDR_MENU1, SECTIONREL menu1 + 80000000h >
polink ignores the "+ 80000000h" addend and hence bit 31 isn't set in the field. However, if I set the bit manually with a hex editor after polink is done, the binary works just as expected.
Now, as far as the sample is concerned, one can probably make it work without using SECTIONREL at all, but as soon as more than one object module with a .rsrc section is involved, you'll get into problems.
I attached source and binary of my test case.