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

Using Memory-Mapped Files

To use a memory-mapped file, you must perform three steps:

  1. Create or open a file kernel object that identifies the file on disk that you want to use as a memory-mapped file.

  2. Create a file-mapping kernel object that tells the system the size of the file and how you intend to access the file.

  3. Tell the system to map all or part of the file-mapping object into your process’ address space.

When you are finished using the memory-mapped file, you must perform three steps to clean up:

  1. Tell the system to unmap the file-mapping kernel object from your process’ address space.

  2. Close the file-mapping kernel object.

  3. Close the file kernel object.

The next five sections discuss all these steps in more detail.

Step 1: Creating or Opening a File ...

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