Hi Folks, yesterday had noticed incorrect work of these 2 functions in the x64 application.. Just have not ideas what is wrong there..Please advise...
1. VirtualQuery, if I call this function to know the status of the unallocated memory page then it always fails and GetLastError says that something like "Function access to the invalid memory". If I call VirtualQuery to know a status of some allocated memory, then it works well.
What would be the reason that I can't know status of unallocated memory? In usual 32 application this works well and jus return page status as MEM_FREE..?
2. More strange thing with MapViewOfFile function, simple code that I've used for a years in 32bits does not work in 64bits application:
PHP Code:
HANDLE hFile, hfMap, pMap;
hFile = CreateFile(name,GENERIC_READ | GENERIC_WRITE,FILE_SHARE_READ,0,OPEN_EXISTING,0,0);
if (hFile == INVALID_HANDLE_VALUE) {return 0;}
hfMap = CreateFileMapping(hFile, NULL, PAGE_READONLY, 0, 0, NULL);
if (hfMap == NULL) {return 0;}
pMap = MapViewOfFile(hfMap,FILE_MAP_READ,0,0,0);
CreateFile and CreateFileMapping are working well, but MapViewOfFile returns null. Debugging MapViewOfFile I noticed that NtMapViewOfSection returns with the status 0xC00000F1 - "Invalid third parameter".. it is more strange..
Can anybody suggest?