flat assembler
Message board for the users of flat assembler.

Index > Windows > PE resources

Author
Thread Post new topic Reply to topic
Hornet52



Joined: 20 Feb 2011
Posts: 11
Location: NULL
Hornet52 06 Mar 2011, 17:40
Hello,
Still on my quest to create a pure assembled PE file, I've come to the resource section. Looking through every article I could find yields little insight (most either skip the resource section or poorly document it). I know it's a binary linked list but I think something's missing in my code. I'm just trying to include a simple 16x16 icon (which it further reclassified under an icon group) and I can't seem to figure out why it's not being found by api functions etc. Also I'm not sure exactly of the format of an input icon/group icon's raw data?

Thanks, for any insight you can provide (this is what I've gotten so far):

Code:
Rsrc:                                            ;===================.rsrc===================
TypeList:                                        ;type resource directory table
   dd 0x00
   dd 0x00
   dw 0x00
   dw 0x00
   dw 0x00
   dw 0x02                                       ;number of resource types (2, icon/group)
.icon:
   dd 0x03                                       ;type ID 3 = icon resource
   dd (RVA(Icon_List) + 0x80000000)              ;pointer to icon resources
.icongroup:
   dd 0x0E                                       ;type ID 14 = icon group resource
   dd (RVA(Icongroup_List) + 0x80000000)         ;pointer to icon group resources

Icon_List:                                       ;icon resource directory table
   dd 0x00   
   dd 0x00
   dw 0x00
   dw 0x00
   dw 0x00
   dw 0x01                                       ;number of icons
.icon1:
   dd 0x01                                       ;icon ID = 1
   dd (RVA(Icon1Language) + 0x80000000)          ;pointer to language directory

Icongroup_List:
   dd 0x00
   dd 0x00
   dw 0x00
   dw 0x00
   dw 0x00
   dw 0x01                                       ;number of icon groups
.icongroup1:
   dd 0x01                                       ;icon group ID = 1
   dd (RVA(Icongroup1Language) + 0x80000000)     ;pointer to language directory

Icon1Language:                                   ;icon ID = 1 language directory table
   dd 0x00
   dd 0x00
   dw 0x00
   dw 0x00
   dw 0x00
   dw 0x01
.default:
   dd 0x00
   dd RVA(Icon1)

Icongroup1Language:                              ;icon group ID = 1 language directory table
   dd 0x00
   dd 0x00
   dw 0x00
   dw 0x00
   dw 0x00
   dw 0x01
.default:
   dd 0x00
   dd RVA(Icongroup1)

Icon1:
   dd RVA(Icon1.rawdata)                         ;location of raw data
   dd 0x02E8                                     ;size of icon
   dd 0x00                                       ;no codepage
   dd 0x00                                       ;reserved
.rawdata:
   incbin "Text.ico"

Icongroup1:
   dd RVA(Icongroup1.rawdata)                    ;location of raw data
   dd 0x14                                       ;size of group icon (structure)
   dd 0x00                                       ;no codepage
   dd 0x00                                       ;reserved 
.rawdata:
   incbin "Text.ico", 0x00, 0x12
   dw 0x01
    
Post 06 Mar 2011, 17:40
View user's profile Send private message Reply with quote
Hornet52



Joined: 20 Feb 2011
Posts: 11
Location: NULL
Hornet52 06 Mar 2011, 20:41
Got it, addresses of directories are specified as offsets from section start and not RVA's as I originally concluded.


Feel free to delete this thread.
Post 06 Mar 2011, 20:41
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.