# How do some games save without creating data files?

I downloaded a game called Brain Exercise with Dr.Kawashima. It contains only one executable and no data files. However, it's still possible to save the game!

Where does the save data go?

• Is it even possible to modify you own exe for game saves? I'm primarily a Linux/Mac guy so I don't know what Windows allows in this area. – deft_code Sep 2 '10 at 16:21
• caspin, yes it is possible! Check out LockNote (steganos.com/us/products/for-free/locknote/overview) for an incredibly useful example of saving data into an executable. – Ricket Sep 2 '10 at 16:47
• @Ricket - that's bolting an executable onto existing data, sort of like self extracting archives. I suspect that they're not actually modifying the file itself, rather recreating it on "save". – dash-tom-bang Sep 2 '10 at 17:10
• You may want to be careful it's not picked up as a virus. – The Communist Duck Sep 2 '10 at 19:56
• I would suggest downloading Process Monitor to verify that the program in question is in fact writing to it's own executable. I think you will find that it is writing to other files or the registry. – Benjamin Manns Sep 3 '10 at 0:01

It may be making saves in the Registry or somewhere under your %APPDATA% folder, or in your homedir's "My Documents" or "My Games" subfolders. Or anywhere else on your hard drive, for that matter. It is unlikely to be modifying its own exe to save, although I suppose that is possible (if a very bad idea: see AttackingHobo's comment below for a sample of the reasons why).

When looking into this kind of thing on Windows, I tend to use tools like Sysinternals Process Monitor (aka procmon.exe), which will display filesystem and registry activity (among other things, it is verbose -- spend some time filtering down to what you want to see).

• It is really really bad practice to even attempt to change the exe. First off you run into the problem of not being able to modify files that are open. Secondly after you have worked around that problem, if you are saving to exe and there is an error, or something crashes, you are going to have a corrupt game exe and users will be comfused. – AttackingHobo Sep 2 '10 at 16:20
• And if it wants to communicates with the internet, some desktop firewalls will constantly ask again for permission because the checksum does not match. – Hendrik Brummermann Sep 2 '10 at 17:52
• I don't have data to back this up, but a self-editing .exe might even be interfered with by antivirus software. That said, Window's shadow copy service allows you to do some cool, somewhat non-intuitive things with locked files. en.wikipedia.org/wiki/Shadow_Copy – ojrac Sep 2 '10 at 22:10
• On Windows Vista or 7, elevated privileges are needed in order to modify files in the Program Files directory. It is reasonable to run an installer as admin, but running the executable as a normal user will not allow this type of modification. (Just strengthening AttackingHobo's comment.) – eli Sep 3 '10 at 21:25

While it's perfectly possible to modify the executable (it's what viruses do all the time, and you can append whatever you want to an exe and read from the end of the file - not sure how windows user levels interfere with it, haven't done it since the golden days of MS-DOS) I'd indeed suspect the registry is used.
Copy the executable over an install on another system and see if it has your savegame, if it does you know it's the exe being modified.

While it might not have been that common when this question was originally created, some games today store their savegames on a server connected to the internet in The Cloud™. This usually requires that the user authenticates itself with a username and password. When the game itself has no account management, a digital distribution system can provide this. Steam, for example, offers an API for storing game data on their servers.