
typedef enum _ALPC_PORT_INFORMATION_CLASS
{
    AlpcBasicInformation,
    AlpcPortInformation,
    AlpcAssociateCompletionPortInformation,
    AlpcConnectedSIDInformation,
    AlpcServerInformation,
    AlpcMessageZoneInformation,
    AlpcRegisterCompletionListInformation,
    AlpcUnregisterCompletionListInformation,
    AlpcAdjustCompletionListConcurrencyCountInformation,
    AlpcRegisterCallbackInformation,
    AlpcCompletionListRundownInformation,
    AlpcWaitForPortReferences,
    MaxAlpcPortInfoClass
} ALPC_PORT_INFORMATION_CLASS;

typedef enum _ALPC_MESSAGE_INFORMATION_CLASS
{
    AlpcMessageSidInformation,
    AlpcMessageTokenModifiedIdInformation,
    MaxAlpcMessageInfoClass,
    AlpcMessageHandleInformation,
} ALPC_MESSAGE_INFORMATION_CLASS, *PALPC_MESSAGE_INFORMATION_CLASS;

typedef struct _ALPC_PORT_ATTRIBUTES32
{
    ULONG Flags;
    SECURITY_QUALITY_OF_SERVICE SecurityQos;
    SIZE_T MaxMessageLength;
    SIZE_T MemoryBandwidth;
    SIZE_T MaxPoolUsage;
    SIZE_T MaxSectionSize;
    SIZE_T MaxViewSize;
    SIZE_T MaxTotalSectionSize;
    ULONG DupObjectTypes;
} ALPC_PORT_ATTRIBUTES32, *PALPC_PORT_ATTRIBUTES32;


typedef struct _ALPC_PORT_ATTRIBUTES64
{
    ULONG Flags;
    SECURITY_QUALITY_OF_SERVICE SecurityQos;
    SIZE_T MaxMessageLength;
    SIZE_T MemoryBandwidth;
    SIZE_T MaxPoolUsage;
    SIZE_T MaxSectionSize;
    SIZE_T MaxViewSize;
    SIZE_T MaxTotalSectionSize;
    ULONG DupObjectTypes;
    ULONG Reserved;
} ALPC_PORT_ATTRIBUTES64, *PALPC_PORT_ATTRIBUTES64;

typedef struct _ALPC_MESSAGE_ATTRIBUTES
{
    ULONG AllocatedAttributes;
    ULONG ValidAttributes;
} ALPC_MESSAGE_ATTRIBUTES, *PALPC_MESSAGE_ATTRIBUTES;


typedef union _PORT_MESSAGE32_TMP_UNION
{
        ULONG ClientViewSize;
        ULONG CallbackId;
} PORT_MESSAGE_TMP_UNION;

typedef union _PORT_MESSAGE64_TMP_UNION
{
        ULONGLONG ClientViewSize;
        ULONG CallbackId;
} PORT_MESSAGE_TMP_UNION;


typedef struct _PORT_MESSAGE_TMP_SUBSTRUCT_S1
{
    CSHORT DataLength;
    CSHORT TotalLength;
} _PORT_MESSAGE_TMP_SUBSTRUCT_S1;


typedef union _PORT_MESSAGE_TMP_UNION_U1
{
    ULONG Length;
    _PORT_MESSAGE_TMP_SUBSTRUCT_S1 s1;
} _PORT_MESSAGE_TMP_UNION_U1;


typedef struct _PORT_MESSAGE_TMP_SUBSTRUCT_S2
{
    CSHORT Type;
    CSHORT DataInfoOffset;
} _PORT_MESSAGE_TMP_SUBSTRUCT_S2;


typedef union _PORT_MESSAGE_TMP_UNION_U2
{
        ULONG ZeroInit;
        _PORT_MESSAGE_TMP_SUBSTRUCT_S2 s2;
} _PORT_MESSAGE_TMP_UNION_U2;


typedef struct _PORT_MESSAGE32
{
    _PORT_MESSAGE_TMP_UNION_U1 u1;
    _PORT_MESSAGE_TMP_UNION_U2 u2;
    CLIENT_ID32 ClientId;
    ULONG MessageId;
    _PORT_MESSAGE32_TMP_UNION tmp_union;
} PORT_MESSAGE32, *PPORT_MESSAGE32;

typedef struct _PORT_MESSAGE64
{
    _PORT_MESSAGE_TMP_UNION_U1 u1;
    _PORT_MESSAGE_TMP_UNION_U2 u2;
    CLIENT_ID64 ClientId;
    ULONG MessageId;
    _PORT_MESSAGE64_TMP_UNION tmp_union;
} PORT_MESSAGE64, *PPORT_MESSAGE64;


typedef struct _ALPC_SERVER_INFORMATION_TMP_IN
{
    HANDLE ThreadHandle;
} ALPC_SERVER_INFORMATION_TMP_IN;

typedef struct _ALPC_SERVER_INFORMATION_TMP_OUT
{
    BOOLEAN ThreadBlocked;
    HANDLE ConnectedProcessId;
    UNICODE_STRING ConnectionPortName;
} ALPC_SERVER_INFORMATION_TMP_OUT;

typedef union ALPC_SERVER_INFORMATION
{
    ALPC_SERVER_INFORMATION_TMP_IN In;
    ALPC_SERVER_INFORMATION_TMP_OUT Out;
} ALPC_SERVER_INFORMATION;


typedef struct _ALPC_CONTEXT_ATTR
{
    PVOID PortContext;
    PVOID MessageContext;
    ULONG Sequence;
    ULONG MessageId;
    ULONG CallbackId;
} ALPC_CONTEXT_ATTR, *PALPC_CONTEXT_ATTR;

typedef struct _ALPC_CONTEXT_ATTR32
{
    ULONG PortContext;
    ULONG MessageContext;
    ULONG Sequence;
    ULONG MessageId;
    ULONG CallbackId;
} ALPC_CONTEXT_ATTR32, *PALPC_CONTEXT_ATTR32;

typedef struct _ALPC_CONTEXT_ATTR64
{
    ULONGLONG PortContext;
    ULONGLONG MessageContext;
    ULONG Sequence;
    ULONG MessageId;
    ULONG CallbackId;
} ALPC_CONTEXT_ATTR64, *PALPC_CONTEXT_ATTR64;


typedef struct _ALPC_HANDLE_ATTR
{
    ULONG Flags;
    HANDLE Handle;
    ULONG ObjectType;
    ACCESS_MASK DesiredAccess;
} ALPC_HANDLE_ATTR, *PALPC_HANDLE_ATTR;

typedef struct _ALPC_HANDLE_ATTR32
{
    ULONG Flags;
    ULONG Handle;
    ULONG ObjectType;
    ACCESS_MASK DesiredAccess;
} ALPC_HANDLE_ATTR32, *PALPC_HANDLE_ATTR32;


typedef struct _ALPC_HANDLE_ATTR64
{
    ULONG Flags;
    ULONGLONG Handle;
    ULONG ObjectType;
    ACCESS_MASK DesiredAccess;
} ALPC_HANDLE_ATTR64, *PALPC_HANDLE_ATTR64;


typedef struct _ALPC_SECURITY_ATTR
{
    ULONG Flags;
    PSECURITY_QUALITY_OF_SERVICE QoS;
    ALPC_HANDLE ContextHandle;
} ALPC_SECURITY_ATTR, *PALPC_SECURITY_ATTR;

typedef struct _ALPC_SECURITY_ATTR32
{
    ULONG Flags;
    ULONG QoS;
    ULONG ContextHandle;
} ALPC_SECURITY_ATTR32, *PALPC_SECURITY_ATTR32;


typedef struct _ALPC_SECURITY_ATTR64
{
    ULONGLONG Flags;
    ULONGLONG QoS;
    ULONGLONG ContextHandle;
} ALPC_SECURITY_ATTR64, *PALPC_SECURITY_ATTR64;

typedef struct _ALPC_DATA_VIEW_ATTR
{
    ULONG Flags;
    ALPC_HANDLE SectionHandle;
    PVOID ViewBase;
    PVOID ViewSize;
} ALPC_DATA_VIEW_ATTR, *PALPC_DATA_VIEW_ATTR;

typedef struct _ALPC_DATA_VIEW_ATTR32
{
    ULONG Flags;
    ULONG SectionHandle;
    ULONG ViewBase;
    ULONG ViewSize;
} ALPC_DATA_VIEW_ATTR32, *PALPC_DATA_VIEW_ATTR32;


typedef struct _ALPC_DATA_VIEW_ATTR64
{
    ULONG Flags;
    ULONGLONG SectionHandle;
    ULONGLONG ViewBase;
    ULONGLONG ViewSize;
} ALPC_DATA_VIEW_ATTR64, *PALPC_DATA_VIEW_ATTR64;


typedef struct _ALPC_TOKEN_ATTR
{
    ULONGLONG TokenId;
    ULONGLONG AuthenticationId;
    ULONGLONG ModifiedId;
} ALPC_TOKEN_ATTR, *PALPC_TOKEN_ATTR;


typedef struct _ALPC_DIRECT_ATTR
{
    HANDLE Event;
} ALPC_DIRECT_ATTR, *PALPC_DIRECT_ATTR;

typedef struct _ALPC_DIRECT_ATTR32
{
    ULONG Event;
} ALPC_DIRECT_ATTR32, *PALPC_DIRECT_ATTR32;

typedef struct _ALPC_DIRECT_ATTR64
{
    ULONGLONG Event;
} ALPC_DIRECT_ATTR64, *PALPC_DIRECT_ATTR64;


typedef struct _ALPC_WORK_ON_BEHALF_ATTR
{
    ULONGLONG Ticket;
} ALPC_WORK_ON_BEHALF_ATTR, *PALPC_WORK_ON_BEHALF_ATTR;

typedef struct _RPC_IF_ID {
  IID           Uuid;
  USHORT VersMajor;
  USHORT VersMinor;
} RPC_IF_ID;


typedef struct _PORT_VIEW  {
    ULONG  Length;
    HANDLE  SectionHandle;
    ULONG  SectionOffset;
    ULONG  ViewSize;
    PVOID  ViewBase;
    PVOID  TargetViewBase;
} PORT_VIEW, *PPORT_VIEW;

typedef struct _REMOTE_PORT_VIEW {
    ULONG  Length;
    ULONG  ViewSize;
    PVOID  ViewBase;
} REMOTE_PORT_VIEW, *PREMOTE_PORT_VIEW;

 typedef struct tagCOMVERSION
 {
     USHORT MajorVersion;
     USHORT MinorVersion;
 } COMVERSION;

typedef struct tagORPCTHIS {
   COMVERSION version;
   ULONG flags;
   ULONG reserved1;
   GUID cid;
   PVOID extensions; // [unique] ORPC_EXTENT_ARRAY *extensions;
 } ORPCTHIS;


typedef struct __MIDL_XmitDefs_0001 {
    GUID asyncOperationId;
    ULONG64 oxidClientProcessNA;
    GUID originalClientLogicalThreadId;
    ULONG64 uClientCausalityTraceId;
} MIDL_XmitDefs_0001;

typedef struct _LOCALTHIS {
    DWORD dwFlags;
    DWORD dwClientThread;
    GUID passthroughTraceActivity;
    GUID callTraceActivity;
    MIDL_XmitDefs_0001 asyncRequestBlock;
    DWORD reserved;
    PVOID pTouchedAstaArray; // Ptr32 __MIDL_XmitDefs_0002
} LOCALTHIS;




