Read & Write to EXE file

BlitzMax Forums/BlitzMax Programming/Read & Write to EXE file

Rhodesy(Posted 2009) [#1]
Just wondering if anyone know if it's possible to read and write data to an EXE....

like incbin adds the data files to the EXE when it's built, I wondered if it's possible to read and write to a file included with incbin..

I'm trying to create a self contained program that can save settings to itself... I cannot use the registry as this program will be ran over networks and move about...


I doubt it's possible, but I just thought I'd ask.


GfK(Posted 2009) [#2]
You can't modify an exe when its running.

If you're using the app on a LAN, why not just store it one one PC with its settings kept in an INI file along with it? Failing that, how about using a web server?


*(Posted 2009) [#3]
not with max, you used to be able to in the old days but these days Windows prevents it as an application thats already running is run in protected mode.


DavidDC(Posted 2009) [#4]
If you're using the app on a LAN, why not just store it one one PC with its settings kept in an INI file along with it? Failing that, how about using a web server?

Or a networked database on the local server


grable(Posted 2009) [#5]
You can with some trickery though ;)

By incbinning a batch script and a second exeutable that can write to the end of another executable.
Writing them out and then launching the script (in non-blocking mode!) then exit the application.

After waiting for the parent process to exit, the script calls the second executable and then deletes all the files and itself.


ziggy(Posted 2009) [#6]
If you manage todo this (protected mode should prevent it), you can expect any anti-virus to throw all available varnings, messages and warning sounds at the same time!