I need to transfer some data - char buffer[100000];
- to a child process which is started by me.
Right now I\'m using an ordinary file to do so, the par
You can use an anonymous file mapping (David Heffernan's answer goes into more detail on this step) with handle inheritance / handle duplication. For example, pass the HANDLE from the parent process on the command-line, then in the child use DuplicateHandle
to get a valid HANDLE in the child.
The CreateFileMapping documentation says that
Multiple processes can share a view of the same file by either using a single shared file mapping object or creating separate file mapping objects backed by the same file. A single file mapping object can be shared by multiple processes through inheriting the handle at process creation, duplicating the handle, or opening the file mapping object by name. For more information, see the CreateProcess, DuplicateHandle and OpenFileMapping functions.
But it may be easier just to use a ramdisk.