O'Reilly logo

Windows® via C/C++, Fifth Edition by Christophe Nasarre, Jeffrey Richter

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required