/// <summary> /// Creates or reopens channel for reading. Channel will be visible from processes in all user sessions. /// </summary> /// <param name="name">Channel name.</param> /// <param name="capacity">Capacity of the cannel's queue in bytes.</param> /// <param name="acl"> /// The list of security indentifiers for entities allowed to access this channel. /// Use new System.Security.Principal.SecurityIdentifier(yourUwpAppContainerSidString) to grant access to UWP app. /// Empty list is equivalent of WellKnownSidType.AuthenticatedUserSid. /// </param> /// <returns> /// OperationResult with InboundChannel and OperationStatus.Completed, OperationStatus.ObjectAlreadyInUse (when channel is already in use by another reader), /// OperationStatus.ElevationRequired (when current process does not have "Create global objects" permission) or OperationStatus.CapacityIsGreaterThanLogicalAddressSpace /// </returns> public static OperationResult <InboundChannel> CreateInboundGlobal(string name, long capacity, IEnumerable <IdentityReference> acl) { if (name == null) { throw new ArgumentNullException(nameof(name)); } if (name.Length == 0) { throw new ArgumentException("Channel name required to create shared memory channel"); } if (capacity < Header.Size) { throw new ArgumentException($"Channel capacity must be at least {Header.Size} bytes"); } return(InboundChannel.Create(LifecycleHelper.GlobalVisibilityPrefix + "\\" + name, name, capacity, WhenEmptyUse(acl, WellKnownSidType.AuthenticatedUserSid))); }
/// <summary> /// Creates or reopens channel for reading. Channel will be visible from processes in the local user session. /// </summary> /// <param name="name">Channel name.</param> /// <param name="capacity">Capacity of the cannel's queue in bytes.</param> /// <returns> /// OperationResult with OutboundChannel and OperationStatus.Completed, OperationStatus.ObjectAlreadyInUse (when channel is already in use by another writer) /// or OperationStatus.CapacityIsGreaterThanLogicalAddressSpace /// </returns> public static OperationResult <InboundChannel> CreateInboundLocal(string name, long capacity) { if (name == null) { throw new ArgumentNullException(nameof(name)); } if (name.Length == 0) { throw new ArgumentException("Channel name required to create shared memory channel"); } if (capacity < Header.Size) { throw new ArgumentException($"Channel capacity must be greater than {Header.Size} bytes"); } return(InboundChannel.Create(LifecycleHelper.LocalVisibilityPrefix + "\\" + name, name, capacity, null)); }