Embedding resource into PE executable

Programming, for all ages and all languages.
Post Reply
User avatar
AndrewAPrice
Member
Member
Posts: 2299
Joined: Mon Jun 05, 2006 11:00 pm
Location: USA (and Australia)

Embedding resource into PE executable

Post by AndrewAPrice »

I have two questions:
a) Does anyone know how to embed a resource (such as a text file) into a PE executable after it's been compiled?

b) How to I change a program's icon after it's been compiled?

I'm looking for how to do it within my program (code examples/articles) not tools that can do it.
My OS is Perception.
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Post by AJ »

Hi,

I think I can answer question 1:

IIRC, in a PE EXE, you can simple tag anything you like on to the end of the file. If the last thing you append is some kind of index in to this data, you can then locate the individual resources (this is not from knowlege of PE's, it is from my dabbling in Windows games development, where I stored a few textures in just this way).

Hope this helps,
Adam
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Post by Combuster »

you might want to look at GNU stuff for implementations.

However these may be easier to read:
http://win32assembly.online.fr/tutorials.html
http://www.x86.org/ftp/manuals/tools/pe.pdf
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
AndrewAPrice
Member
Member
Posts: 2299
Joined: Mon Jun 05, 2006 11:00 pm
Location: USA (and Australia)

Post by AndrewAPrice »

After a bit of playing around, I've worked out how to embed data without causing the executable to become corrupt. All I have to do now is find where the icon is stored :)

Thanks for all your help!
My OS is Perception.
Post Reply