The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: ramguru on December 23, 2005, 01:42:35 PM

Title: How to deal with RECORD directive
Post by: ramguru on December 23, 2005, 01:42:35 PM
I decided to dig into PE resource section instead of using particular APIs. Now I'm supposed to use struct IMAGE_RESOURCE_DIRECTORY_ENTRY and don't know how to access its members (check if bit is set and so on). I've read documentation but it's too vague for me :) I need one example to get it clear. Of cource I can convert structure to other format, but this isn't a way to learn new things...

IMAGE_RESOURCE_DIRECTORY_ENTRY STRUCT
    union
        rName RECORD NameIsString:1,NameOffset:31
        Name1 dd ?
        Id dw ?
    ends
    union
        OffsetToData dd ?
rDirectory RECORD DataIsDirectory:1,OffsetToDirectory:31
    ends
IMAGE_RESOURCE_DIRECTORY_ENTRY ENDS
Title: Re: How to deal with RECORD directive
Post by: GregL on December 23, 2005, 07:22:10 PM
ramguru,

This might help, it's an example I wrote that uses RECORD and MASK.

http://www.masmforum.com/simple/index.php?topic=975.msg7490#msg7490


Title: Re: How to deal with RECORD directive
Post by: ramguru on December 23, 2005, 08:43:06 PM
Thanks...
...not exactly what I was expecting (I mean it looks a little primitive)
but I see here a few disadvantages like you have to have whole object (which will be devided into bits)
but  "mov    eax,(IMAGE_RESOURCE_DIRECTORY_ENTRY ptr [esi]).rDirectory" dosn't work :(
       "and    eax, MASK DataIsDirectory" seems to work
Now I have a doubt: would it be quicker not to use record, but instead check bits I need to check myself