
On 10/10/2010 08:31 PM, Domagoj Saric wrote:
- AFAIK the POSIX 'anonymous inheritable' shared memory functionality is also available on Win32 - kernel-life time shared memory emulation with memory mapped files on Windows is also unnecessary. It can be either provided directly by bypassing the Win32 APIs using the native NT API (I volunteer to help with the implementation or can do it from scratch by myself)
Be aware that native API calls are not always documented and are subject to change.
AFAICT the only thing the Win32 API lacks for this is getting the size of the mapped region which could perhaps be emulated by passing the size at the begining of the mapped region...
You might be able to do something with VirtualQueryEx, it fills in a MEMORY_BASIC_INFORMATION structure about a specified address. http://msdn.microsoft.com/en-us/library/aa366907.aspx http://msdn.microsoft.com/en-us/library/aa366775.aspx This gives the base address and size of the page range with the same attributes. You can walk through the regions (I wouldn't assume that it's always going to be reported as one contiguous range) and total up the pages with the MEM_MAPPED type ("Indicates that the memory pages within the region are mapped into the view of a section."). Just to ensure another mapped view isn't placed immediately after it, you might want to make a sort of guard page (with VirtualAllocEx) having some non-MEM_MAPPED type right at the end of the mapped view. - Marsh