Click here to Skip to main content
14,272,716 members
Rate this:
Please Sign up or sign in to vote.
See more:
I'm trying to detect when application writes to the memory. For that reason I'm using VirtualAlloc with MEM_COMMIT | MEM_RESERVE | MEM_WRITE_WATCH flags, ResetWriteWatch and GetWriteWatch. For x86 applications this works excellent. But I have problem with x64 apps: While VirtualAlloc and ResetWriteWatch are successfully executed, GetWriteWatch returns error. GetLastError returns "Invalid access to memory location" code. Does anyone know why it happens?

I installed hooks on DX9. So on Idirect3DIndexBuffer::Lock and IDirect3DVertexBuffer::Lock I allocate new buffer by VirtualAlloc with MEM_COMMIT | MEM_RESERVE | MEM_WRITE_WATCH flags, reset memory by ResetWriteWatch. And outout it instead the one which is returned by Lock. On Unlock (before it actually happens) I want to get the array of pages where write was performed by GetWriteWatch. Result: ok for x86 application and fail for x64. I wonder if there any limitations for using that API on x64 platform?
So to summarize: X64 paltform -> on x86 application GetWriteWatch succeeded, on x64 failed.
Posted
Updated 18-Sep-11 21:13pm
v3

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

From MSDN : "64-bit Windows on Itanium-based systems: Due to the difference in page sizes, GetWriteWatch is not supported for 32-bit applications."

Take a look at the following link also : here
   
Comments
Eldethar88 19-Sep-11 2:59am
   
Thank you for you answer, Mendi. I saw this info on MSDN. The problem is that I run x64 application on x64 platform. I don't see any obvious reasons for GetWriteWatch to fail.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100