Link to home
Start Free TrialLog in
Avatar of SNap
SNap

asked on

Changing image in an executable

Hi,

i'm trying to change a JPEG image that is in a compiled program. The program was compiled using Delphi . I don't know which exact version.

I've tried to make my own application, and change the picture in it using Resource Hacker. I have succeeded in doing so, by making another application with a picture, and coping the binary data from one to another.

I didn't succeed with this application. Perhaps I should use the same version of the compiler that was used to compile the original program? Or is there a tool to simplify all of this?

I have chosen the maximum of the points I can give for an answer.


Thank you,
Jaka "|SNap|" Jančar,
Slovenia
Avatar of CrazyOne
CrazyOne
Flag of United States of America image

I have used this by itself to change an immage in a exe or dll file

You need to use a tool like this in conjunction with a tool for developing the images.

Resource Hacker
http://www.users.on.net/johnson/resourcehacker/
Avatar of dschwartzer
dschwartzer

As far as I know, jpeg pictures cannot be stored inside the exe/dll. BMP pictures, icons, dialog boxes, string lists, shortcuts can.
Anyway I've always done similar things with MS Visual studio 5/6.
Open file -> select the exe -> select the "open as" - resource and open.

Make sure you store the backup of that exe
Avatar of SNap

ASKER

CrazyOne: I have written in my question, that i have used Resource Hacker, and it didn't work. Probably because delphi "encodes" the images in a different way on different versions.

dschwartzer: They _CAN_ be.
You probably ran into a software where as the developer wanted to ensure that their image is protected from being overlaid by another image.  They do this by hashing the image or crc the image and then stored the value in the data section (mangled if needed).  Then at launch time, the software would hash or crc the image and compare the value, if it's different then they exited the program.

You did everything correctly in terms of using Resource Hacker to replace the object.  This embedding is standard for Windows resource for storing (Windows expect to locate the resource at specific places) and is independent of delphi.

To hack it you should try a good debugger and trace the code object - find the hash alogrithm, the hash value, and the storage location of the hash value; and Then hash your image through the same alogrithm (you can embed your image and let the program hash it - and get the hash value) then change the hash value stored in the program.  

Cracking software or ill-use is illegal.

cheers
Avatar of SNap

ASKER

I could change some other picture in the program, so I also found this two options:
1) I can change BMPs but not JPEGs because of different size/encoding/whatever
2) a checksum, like you said

So i'll try to change the image with some other versions of Delphi, if that might be a problem.

The odd thing is that when I launch a program with the changed JPEG image, it doesn't crash or anything, but just closes instantly. That's a pretty good indication of a CRC.

Anyway, if it's a checksum I would definitely need more precise instructions how to achieve that.

Unfortunately, I can't post the program somewhere online, but I ensure you that what i'm doing isn't illegal.
If the program shuts down instead of crashes, it's an indication that the author is checking to make sure that it had NOT been modified by someone - perhaps to attach a trojan on the software.  You are right about swapping the BMP/JPG - it's because of different format and different rendering of the image.  The function that was called - handle only specific format.  So, you will have to stick the specific file type.

You will need to put it through debug and spend time (may be a lot of time) on getting to the hash signature's location in order to change it.  I am sure that if the author went through the process of securing his/her work from being cracked and a trojan/virus/worm inserted into the program.  It will be difficult but not impossible to get to it.

Since it's code dependent - I am sure that no one here would have the time to trace the code in order to tell you how to insert and patch the hash signature.

The question is, is it worth the time to do what you want to do?   Send the author a message to see what he/she did and if it's possible for you to obtain the direction on inserting your own graphic and hash signature.

cheers
Avatar of SNap

ASKER

I unfortunately can't contact the author.

Any advice on how to start debugging?
ASKER CERTIFIED SOLUTION
Avatar of Gnart
Gnart

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
May be the author is still debugging the code to get to the hash signature...<G>  It's the only way to crack a program.....

cheers
Avatar of SNap

ASKER

Actually, i have accomplished what i wanted with a much simpler trick. But Gnart obviously put a lot of effort into explaining debugging to me, so he deserves the points.