Skip to content

Instantly share code, notes, and snippets.

@mvankuipers
Created August 13, 2017 22:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mvankuipers/36bec0aef16fbbeb141596beb6484c89 to your computer and use it in GitHub Desktop.
Save mvankuipers/36bec0aef16fbbeb141596beb6484c89 to your computer and use it in GitHub Desktop.
// Create a section object to demonstrate shared memory.
HANDLE Mapping = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, 4096, L"memdemosec");
// Map the section into our process.
PVOID Shared = MapViewOfFile(Mapping, FILE_MAP_ALL_ACCESS, 0, 0, 4096);
// Use the memory to make sure it's resident.
reinterpret_cast<PBYTE>(Shared)[0] = 0xFF;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment