How to write a self-modifying executable
Posted on 1998-11-19
Is it possible to write an executable which is able to change itself at runtime? Specifically, I'd like to store some customization data in the executable file itself, so that if that exe is passed to someone else, the data can be retrieved.
I'm thinking that it might be possible to modify the exe's resources somehow, but have no idea if that would work as a scheme for persistence.
The essential point to this problem is that the information MUST be stored in the executable, not in the registry or in a separate file.
If the executable cannot modify itself while it is running, can it spawn another process and close itself? Could the other process then go and make the necessary changes to the exe? Just a thought...
Thanks for your help,