PDA

View Full Version : How to edit internal data in a executable



Momergil
19th October 2011, 18:50
Hello!

I pretend to something but I'm not sure if it will work. The idea is the following:

I developed a software that should read texts from a .txt file but thoose text may be expanded by the user. For the time being, I insert the .txt files in a Resource File and always when I need to uptade the files everything that I do is to update the file in the resource and recompile.

But imagine that I want it to be a final product and I want to use only the executable, so the data will be in it. How could I change thoose texts without having to create a way for the software to consult an external folder? Is there such a way or, in case of needing to do such updates, I will have to compile it with a code pointing to a external folder (external to the .exe)?

I hope you understood my point. Any case, just ask.

Thanks,

Momergil

fullmetalcoder
19th October 2011, 20:38
Any data embedded in your application via Qt resource system is essentially read-only. If you reserved enough space in embedded file you might be able to write back changes to the binary but that would be rather complicated because most operating systems frown upon this practice (besides I seem to remember that resources can be stored in a compressed form which could make "space reservation difficult).

The generally accepted way of storing read/write application data is to place it in the filesystem, either in a location relative to the executable or in some (platform-specific) absolute location dedicated to that purpose (e.g /usr/share on Unix).

ChrisW67
19th October 2011, 23:06
Even if you could edit the executable on-the-fly, which is what you are asking for, the operating system will block most attempts because of file permissions and anti-virus/anti-trojan software will probably block any remaining attempts.

wysota
20th October 2011, 09:18
Moreover resources in the binary are in a compressed form (unless you explicitly disable compression) thus it would practically be impossible to append something to the compressed stream.

nish
20th October 2011, 09:46
Windows only ->. Read about Exe-holes/Exe-dens on reverse engineering forums. Take a look at how "Installer programs" works, they have a exe and at the end of the that normal exe they append data.