Is it possible to hook calls to ReadProcessMemory() in the win32 API? I would like to do it in C or C++.
What I mean is, anytime another process uses that function, it detours to my callback at some point with all the info.
You can inject your code into every running process and hook ReadProcessMemory in the calling process, just like you would any other function but there is no way for you to hook it from the target process.
Alternatively you can use obRegisterCallbacks() [1] from the kernel to detect OpenProcess() [2] by filtering by PsProcessType object type and OB_OPERATION_HANDLE_CREATE operation. This will show you any processes that need handles to call ReadProcessMemory() [3]. You would then have the ability to execute your own code when these events are triggered from the kernel. You could also speak to a usermode process from your obRegisterCallbacks routine.
[1] https://msdn.microsoft.com/en-us/library/windows/hardware/ff558692%28v=vs.85%29.aspx