Reputation: 11522
When a Windows EXE is loaded it is mapped into memory. This map locks the file and prevents any normal modifications to, or replacements of, the file. However, since it is mapped as Copy-on-Write, could you change it to Write and then modify memory to change the contents of the file?
Upvotes: 1
Views: 302
Reputation: 45173
No. Changing the protection to Write and updating the memory merely updates your process's private copy of the file's bytes. (You have effectively created process-local memory that is conveniently initialized to the file's current contents.) The actual file remains unchanged.
Upvotes: 2