![]() |
|
|
|
#1
|
|||
|
|||
|
I'm using FreePascal, it's compiler is not so smart as C++ compiler, so, FPC passed 5th parameters as dword and generated below asm:
mov rcx, qword prt [rsp + $44] mov edx, 4 mov r8d, 0 mov r9d, 0 mov dword prt [rsp+$20], ebx call MapViewOfFile Kernel does not take this parameter as dword, it takes it as qword, so the data at [rsp+$24] was not empty and kernel thought that 5th parameter is not empty and so failed... To solve - just change function declaration. Sorry, this is only FPC bug... But VirtualQuery really works not same as in x86... |
|
#2
|
|||
|
|||
|
What exactly are you passing into the VirtualQuery call? (all the arguments, I mean, maybe even with the corresponding disassembly)
|
|
#3
|
|||
|
|||
|
I've had no problems using VirtualQuery in my x64 apps, and have not noticed the behavior you are describing (I am able to enumerate free memory blocks fine). I think that either your code is wrong, or your compiler is doing something wrong.
Would you mind posting the relevant snippets of your source code, along with a disassembly of the code generated by the compiler, so we can try and figure out what's going on? As a reference, here's my memory region enumeration code which works for both native x86 and x64. https://code.google.com/p/hadesmem/source/browse/trunk/Include/Memory/HadesMemory/Region.hpp https://code.google.com/p/hadesmem/source/browse/trunk/Src/Memory/Memory/Region.cpp |
![]() |
| Thread Tools | |
| Display Modes | |
|
|