Is there a function that you can use to provide a mapping an address to use?
I am trying to figure out a way to take advantage of large pages even when I have to map small files. I know I can waste memory. Optionally I could use VirtualAlloc to allocate a page sized block which I could then dice up and map multiple files into. I am assuming, since memory mapping is backed by the virtual memory subsystem, that this is not possible – a single page of memory probably has to be backed by a single file.
I thought I would ask before I did anything.
I suspect that it is impossible, but just an idea:
Address allocation decision belongs to
MapViewOfFile, not toCreateFileMapping. AndMapViewOfFilecertainly calls some native API stuff inNTDLL.DLL. You could figure out which function does it call to actually create a mapping, and who knows — that function might be more flexible and allow something which is impossible withKERNEL32. (e.g. we know that PE file sections are mapped in a manner you can’t imitate withMapViewOfFile).