So, I made a simple memory scanner that you can see right here:
https://github.com/nyeecola/lovscan/
It actually works fine and I'm very happy with it, but there's one thing I can't quite understand yet.
Maybe some of you guys that are more familiar with the Win32 API can help me a little bit?
Here's the issue:
- I call WriteProcessMemory to a region retrieved by VirtualQueryEx and it works just fine, but sometimes when I close the program it hangs the application with the "stopped responding" message.
- It only really happens when I close the program
- It actually is related to the WriteProcessMemory call, because it only happens to some memory locations and not to others. (this is actually reproducible)
My guess:
- Maybe it hangs because it is writing to a memory location that isn't supposed to be written to.
- If that is true, why does it only hang after the program is done running?
- Also, why does it still write to it anyway? (I can see this by calling ReadProcessMemory on the same address)
- And one last thing: Why would it hang my program and not the one I'm writing to? I mean, it would make sense to hang the program whose memory is being written, right? Why is this not the case here?