Example #1
0
        internal void GetIndirectHandleAttribute(AlpcHandleMessageAttribute attribute, NtAlpc port, AlpcMessage message)
        {
            // Indirect handle attributes need to be queried from the port.
            var attr = GetAttribute <AlpcHandleAttrIndirect>(AlpcMessageAttributeFlags.Handle).Result;

            attribute.SetHandles(Enumerable.Range(0, attr.HandleCount).Select(i => port.GetHandleInformation(message, i)));
        }
Example #2
0
        internal void GetHandleAttribute(AlpcHandleMessageAttribute attribute, NtAlpc port, AlpcMessage message)
        {
            var attr = GetAttribute <AlpcHandleAttr>(AlpcMessageAttributeFlags.Handle).Result;

            if ((attr.Flags & AlpcHandleAttrFlags.Indirect) == AlpcHandleAttrFlags.Indirect)
            {
                if (port == null || message == null)
                {
                    throw new ArgumentException("Can't rebuild indirect handle attribute without port and message");
                }
                GetIndirectHandleAttribute(attribute, port, message);
            }
            else if (attr.Handle != IntPtr.Zero)
            {
                attribute.SetHandles(new AlpcHandleMessageAttributeEntry[] { new AlpcHandleMessageAttributeEntry(attr) });
            }
            else
            {
                attribute.SetHandles(new AlpcHandleMessageAttributeEntry[0]);
            }
        }