PREAD_PROCESS_MEMORY_ROUTINE is incorrectly defined as:
typedef BOOL(STDCALL*PREAD_PROCESS_MEMORY_ROUTINE)(HANDLE ,LPCVOID,LPVOID,DWORD,LPDWORD);
It should be as this:
typedef BOOL (STDCALL *PREAD_PROCESS_MEMORY_ROUTINE)(HANDLE, DWORD, PVOID, DWORD, PDWORD)
This causes issues for cross platform applications.
I used the following package for my w32api: w32api-3.15-1-mingw32-dev.tar.lzma
Just to be clear, the issue is that the second parameter is defined as LPCVOID instead of DWORD.
This is still present in the latest source.
Here is some more information with some links to corroborate my statements:
See the remarks section here: http://msdn.microsoft.com/en-us/library/ms680559%28v=vs.85%29.aspx
You will notice that it says for DbgHelp.h, but there is no mention of the stackwalking api here: http://msdn.microsoft.com/en-us/library/ms680181%28v=vs.85%29.aspx
Though it is present in ImageHlp, and it identical to the one in DbgHelp (I've confirmed this in SDK headers).
I've confirmed the definition in the first link (and the OP) of PREAD_PROCESS_MEMORY_ROUTINE with ms sdk headers.
I believe this issue was introduced so that ReadProcessMemory ( http://msdn.microsoft.com/en-us/library/ms680553%28v=vs.85%29.aspx ) could be used as call back to StackWalk ( see remark at the bottom of http://msdn.microsoft.com/en-us/library/ms680650%28v=VS.85%29.aspx )
Misc.:
Wine commit fixing this issue in their source (2007): http://www.winehq.org/pipermail/wine-patches/2007-September/043982.html
This is present in cygwin as well (but not wine, as seen in previous comment).
I checked mingw-w64'sr imagehlp.h and it does not have this issue. It has been correct (w.r.t. to this issue) since its initial import.
Thank you for the report, I've committed a fix to CVS.