views:

169

answers:

4

Hi all,

I have lot of executable that I have compiled (long time back) for many of which I don't have sourcecode now. But when I compiled them I didn't put any icons for them, so they all look like same dull, bald default icon. So my questions are,

(1) is it possible for me to write a software that can change the resources section of the exe and change its looks? If so, can anyone plz point me to the location where its explained? (I am a beginner, I have no idea on the exe format and all) Also its fun to keep changing Icons without having the pain of recompiling everything just for the icon change...

(2) This is raises a natural converse question, Is it similarly possible to zap out the icon used by some file and use it for some other file? (If so, plz point me to location where I can get some details.

I am a C/C++ developers and I am looking for solution on Windows Platform...

Regards, MicroKernel

A: 

It is possible to do this. IIRC, Microangelo Librarian can do this.

bta
+5  A: 

It is possible to read and write resoures from an exe or DLL file. Reading the resources is easy(ish) - just use LoadLibraryEx(LOAD_AS_DATA_FILE) to load it, then you can enumerate the resources using the standard resource API's. All of this is documented on MSDN.

Writing the resources can also be done using the UpdateResource API and related functions.

You should bear in mind though that changing the resources of someone elses EXE file will invalidate any signing. Also, depending on OS resources is risky - windows has been known to remove resources without warning (since they are undocumented). Copying resources may not be legal too (although IANAL).

Stewart
+9  A: 

The icon used for the executable is nothing but the first ICON resource encountered in the EXE file. You can use a tool like ResHack to extract icons from existing binaries, and (I think) you can also use it to change the icons attached to a particular resource.

Billy ONeal
I've used *Resource Hacker* to change the icon for a self-extracting 7-Zip archive.
jschmier
+1  A: 

As far as I know you can open the EXE file in Visual Studio and edit the resources in live EXE file.

qbeuek