/// <summary> /// Create a new buffer with allocations for a specified set of attributes. /// </summary> /// <param name="flags">The attributes to allocate.</param> /// <returns>The allocated buffed.</returns> public static SafeAlpcMessageAttributesBuffer Create(AlpcMessageAttributeFlags flags) { NtStatus status = NtAlpcNativeMethods.AlpcInitializeMessageAttribute(flags, Null, 0, out int size); if (status != NtStatus.STATUS_BUFFER_TOO_SMALL) { throw new NtException(status); } SafeAlpcMessageAttributesBuffer buffer = new SafeAlpcMessageAttributesBuffer(size); NtAlpcNativeMethods.AlpcInitializeMessageAttribute(flags, buffer, buffer.Length, out size).ToNtException(); return(buffer); }
/// <summary> /// Get a pointer to an allocated attribute. Returns NULL if not available. /// </summary> /// <param name="attribute">The attribute to get.</param> /// <returns>The pointer to the attribute buffer, IntPtr.Zero if not found.</returns> public IntPtr GetAttributePointer(AlpcMessageAttributeFlags attribute) { return(NtAlpcNativeMethods.AlpcGetMessageAttribute(this, attribute)); }