コード例 #1
0
        internal void FromSafeBuffer(SafeAlpcMessageAttributesBuffer buffer, NtAlpc port, AlpcMessage message)
        {
            var result      = buffer.Result;
            var valid_attrs = result.ValidAttributes;

            if (valid_attrs.HasFlag(AlpcMessageAttributeFlags.Token))
            {
                AddAttribute <AlpcTokenMessageAttribute>(buffer, port, message);
            }
            if (valid_attrs.HasFlag(AlpcMessageAttributeFlags.Context))
            {
                AddAttribute <AlpcContextMessageAttribute>(buffer, port, message);
            }
            if (valid_attrs.HasFlag(AlpcMessageAttributeFlags.Handle))
            {
                var attribute = AddAttribute <AlpcHandleMessageAttribute>(buffer, port, message);
                _handles.AddRange(attribute.Handles.Select(h => NtObjectUtils.FromHandle(h.Handle, true)));
            }
            if (valid_attrs.HasFlag(AlpcMessageAttributeFlags.Security))
            {
                var attr = AddAttribute <AlpcSecurityMessageAttribute>(buffer, port, message);
                SecurityContext = new SafeAlpcSecurityContextHandle(attr.ContextHandle, true, port, attr.Flags, attr.SecurityQoS);
            }
            if (valid_attrs.HasFlag(AlpcMessageAttributeFlags.View))
            {
                var attr = AddAttribute <AlpcDataViewMessageAttribute>(buffer, port, message);
                DataView = new SafeAlpcDataViewBuffer(new IntPtr(attr.ViewBase), attr.ViewSize,
                                                      new SafeAlpcPortSectionHandle(attr.SectionHandle, true, port), attr.Flags, true);
            }
            if (valid_attrs.HasFlag(AlpcMessageAttributeFlags.WorkOnBehalfOf))
            {
                AddAttribute <AlpcWorkOnBehalfMessageAttribute>(buffer, port, message);
            }
        }
コード例 #2
0
 /// <summary>
 /// Constructor.
 /// </summary>
 public AlpcReceiveMessageAttributes(AlpcMessageAttributeFlags allocated_attributes)
 {
     AllocatedAttributes = allocated_attributes;
     _attributes         = new Dictionary <AlpcMessageAttributeFlags, AlpcMessageAttribute>();
     _handles            = new DisposableList <NtObject>();
     DataView            = new SafeAlpcDataViewBuffer();
     SecurityContext     = new SafeAlpcSecurityContextHandle();
 }