We are trying to port the following code from .Net Framework to .Net Core. The code creates an in-memory memory mapped file that is accessible by applications running under different logged in accounts (without admin privilege). MemoryMappedFileSecurity class does not exist in .Net Core, how can I set up the shared memory mapped file?
var security = new MemoryMappedFileSecurity();<br/>
security.AddAccessRule(new AccessRule<MemoryMappedFileRights>(
"everyone",
MemoryMappedFileRights.FullControl,
AccessControlType.Allow));
var memoryMappedFile = MemoryMappedFile.CreateNew(
"global\\SharedMap",
size,
MemoryMappedFileAccess.ReadWrite,
MemoryMappedFileOptions.DelayAllocatePages,
security,
HandleInheritability.Inheritable);
This is code which has been working for many years in .Net framework.
Memory is created (without a backing file) by a Windows service. Memory is then accessed by desktop client apps, which are not admins.
The security is needed, so that we can see the “admin” service memory from the desktop clients.
We are trying to convert our system, piece by piece, to .Net core 3.0. This system includes 100s of components made in several of our factories, in various countries around the world. So, We cannot just “replace all code” at once. We cannot change the protocol used by the server.
We have many years of experience with memory maps, but need to know what technology in .Net core is supposed to be equivalent to MemoryMappedFileSecurity?