Storing persistant data within the .exe

Started by
6 comments, last by Antheus 13 years, 8 months ago
How difficult with something like this be?

It would be a decent asset for auto/quicksaves in a small game I'm working on.
Advertisement
Near impossible. You cannot modify the exe at runtime, and you cannot change the size of the EXE without changing the relocation table as well.
===========================";" is the best key ever; you can use it to end lines when you are too lazy to use ENTER;
Well, not quite near impossible, but so difficult as to be non-justifiable. You can modify the .exe with some devilry (at least on earlier versions of Windows, probably not anymore in Vista and Win7), and you can append data to the end of the file at will without worrying about modifying anything else in there (this is, as a vast oversimplification, more or less how resource tables work anyways).

However, you're far better off just using the local userdata folders and sticking your game files in there.

Wielder of the Sacred Wands
[Work - ArenaNet] [Epoch Language] [Scribblings]

It could also draw attention of some firewalls/antiviruses.

[Edited by - Tom KQT on August 22, 2010 3:17:30 AM]
Also, keep in mind that self-modifying exe's will probably be flagged by anti-virus software.

EDIT:
You beat me to it, Tom!
Pretty difficult as mentioned due to the fact that you can't modify an open file. You could write out another application to the temp folder (for example) which stores the save data into the exe after your main app quits as part of it's resources.

But, why?
[size="1"]
But...

If you set up the space before you compile you can mod the exe as long as your 100 percent sure of where in the exe your data is.

Not reccomended but it use to be done frequently in days long gone by.
Quote:Original post by guitarstar26
How difficult with something like this be?

It would be a decent asset for auto/quicksaves in a small game I'm working on.


Each OS tells very specifically where such files go.

I agree with Apple on enforcing such rules - software that doesn't obey them should be banned and burned.

For reference, see Windows Registry and pre-Vista times, when every application felt it was its god given right to crap all over the system. Under Windows, there are specific folders for that. Linux distros have similar conventions as well. Mac probably too.

Any system in active use today should make modification of executables impossible by default.

This topic is closed to new replies.

Advertisement