Example #1
0
        /// <summary>
        /// Generic copy (either from kernel or to kernel)
        /// Determines if the thing we are moving is an endpoint and copies it accordingly.
        /// </summary>
        public static Allocation *MoveData(SharedHeap fromHeap,
                                           SharedHeap toHeap,
                                           Process newOwner,
                                           Allocation *data)
        {
            if (data == null)
            {
                return(data);
            }

            if (!fromHeap.Validate(data))
            {
                throw new ArgumentException("Bad argument. Not visible");
            }

            // We can only transfer either into our out of the kernel's heap
            DebugStub.Assert(fromHeap == SharedHeap.KernelSharedHeap ||
                             toHeap == SharedHeap.KernelSharedHeap);

            if (SystemType.IsSubtype(data, EndpointCoreSystemType))
            {
                // we have an endpoint
                DeliveryImpl di = EndpointCore.AllocationEndpointDeliveryImpl(data);
                return(di.MoveEndpoint(fromHeap, toHeap, newOwner));
            }
            else
            {
                // we have a NON-endpoint
                // TODO FIX this!
                return(null); // MoveNonEndpoint(fromHeap, toHeap, newOwner, data);
            }
        }
Example #2
0
        internal virtual void Connect(DeliveryImpl expDi,
                                      Allocation * /*EndpointCore* opt(ExHeap)!*/ securityEp)
        {
            // security principals are held in the delivery impl, not the endpoint core
            // since this allows them to be kept out of user memory in paging builds
            if (securityEp != null)
            {
                DeliveryImpl secImpl =
                    EndpointCore.AllocationEndpointDeliveryImpl(securityEp);
                if (secImpl != null &&
                    secImpl.OwnerDelegationState == DelegationState.Mediated)
                {
                    this.OwnerPrincipalHandle = secImpl.OwnerPrincipalHandle;
                }
            }

            int newChannelId = EndpointCore.GetNextChannelId();

            this.ChannelId  = -newChannelId;
            expDi.ChannelId = newChannelId;

            this.Closed  = false;
            expDi.Closed = false;
        }
 private DeliveryImpl PeerImpl()
 {
     return(EndpointCore.AllocationEndpointDeliveryImpl(Peer()));
 }