Пример #1
0
        private MemoryMappedFileSecurity MMFSecurity()
        {
            MemoryMappedFileSecurity security = new MemoryMappedFileSecurity();

            security.SetAccessRule(new AccessRule <MemoryMappedFileRights>(new SecurityIdentifier(WellKnownSidType.WorldSid, null), MemoryMappedFileRights.ReadWrite, AccessControlType.Allow));
            return(security);
        }
Пример #2
0
        private static void SetupMemoryMapFile()
        {
            var security = new MemoryMappedFileSecurity();

            security.SetAccessRule(
                new System.Security.AccessControl.AccessRule <MemoryMappedFileRights>(securityWorldSID,
                                                                                      MemoryMappedFileRights.FullControl,
                                                                                      System.Security.AccessControl.AccessControlType.Allow));

            mmFile = MemoryMappedFile.CreateOrOpen(cGlobalMapppingName,
                                                   cSharedBufferSize,
                                                   MemoryMappedFileAccess.ReadWrite,
                                                   MemoryMappedFileOptions.None,
                                                   security,
                                                   HandleInheritability.Inheritable);

            mmStream = mmFile.CreateViewStream(0, cSharedBufferSize);
        }