Page 1 of 1

Embedding resource into PE executable

Posted: Thu Jan 18, 2007 12:13 am
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.

Posted: Thu Jan 18, 2007 3:27 am
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

Posted: Thu Jan 18, 2007 4:21 am
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

Posted: Thu Jan 18, 2007 5:27 am
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!