Specifying the Base Address of a Memory-Mapped File
Just as you can use the VirtualAlloc
function to suggest an initial address to reserve address space, you can also use the MapViewOfFileEx
function instead of the MapViewOfFile
function to suggest that a file be mapped into a particular address:
PVOID MapViewOfFileEx( HANDLE hFileMappingObject, DWORD dwDesiredAccess, DWORD dwFileOffsetHigh, DWORD dwFileOffsetLow, SIZE_T dwNumberOfBytesToMap, PVOID pvBaseAddress);
All the parameters and the return value for this function are identical to those of the MapViewOfFile
function with the single exception of the last parameter, pvBaseAddress
. In this parameter, you specify a target address for the file you’re mapping. As with VirtualAlloc
, the target address ...
Get Windows® via C/C++, Fifth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.