Reputation: 155
Which function is called in the current process when calling WriteProcessMemory from another process?
Upvotes: 3
Views: 2074
Reputation: 129374
No processing of WriteProcessMemory
in the current process. It happens inside the OS - it maps the foreign process into the address space of the current process, writes to the memory, and unmaps the memory again.
If you need to protect against this, you will have to block all processes from using WriteProcessMemory (or at least, intercept it and check if your process is targetted). This will probably prevent debuggers from working on that system, if you are not careful. This may upset people, and someone that knows what they are doing can probably bypass it.
Upvotes: 5