Generated from Manticore v1.1.6 • 388 packages. View on pkg.go.dev

msmqmq

import "github.com/TheManticoreProject/Manticore/windows/protocols/ms-mqmq"

Package msmqmq holds the [MS-MQMQ] wire structures shared by the Message Queuing protocols. Only the subset required by [MS-MQDS] (the PROPVARIANT property variant, its counted-array arms, and the PROPID/VARTYPE aliases) is modelled here; other [MS-MQMQ] types are added as the protocols that need them are implemented.

Index

type BLOB

BLOB is a counted byte buffer ([MS-MQMQ] 2.2.18): a cbSize count followed by a [size_is(cbSize)] pointer to that many octets. It is the VT_BLOB arm of a PROPVARIANT.

type BLOB struct {
    CbSize    ndr.DWORD
    PBlobData []uint8 `ndr:"unique,size_is=CbSize"`
}

type CACLSID

CACLSID is a counted array of CLSID/GUID ([MS-MQMQ] 2.2.19): cElems followed by a [size_is(cElems)] pointer to that many GUIDs. It is the VT_VECTOR|VT_CLSID PROPVARIANT arm. The elements are msdtyp.GUID so each marshals as its 16 octets ([MS-DTYP] 2.3.4.2).

type CACLSID struct {
    CElems ndr.DWORD
    PElems []msdtyp.GUID `ndr:"unique,size_is=CElems"`
}

type CAL

CAL is a counted array of long ([MS-MQMQ] 2.2.15): cElems followed by a [size_is(cElems)] pointer to that many signed 32-bit elements. It is the VT_VECTOR|VT_I4 PROPVARIANT arm.

type CAL struct {
    CElems ndr.DWORD
    PElems []int32 `ndr:"unique,size_is=CElems"`
}

type CALPWSTR

CALPWSTR is a counted array of wide strings ([MS-MQMQ] 2.2.20): cElems followed by a [size_is(cElems)] pointer to that many [string] wchar_t* elements. It is the VT_VECTOR|VT_LPWSTR PROPVARIANT arm. Each element is a unique pointer to a wide string.

type CALPWSTR struct {
    CElems ndr.DWORD
    PElems []*ndr.WSTR `ndr:"unique,size_is=CElems"`
}

type CAPROPVARIANT

CAPROPVARIANT is a counted array of PROPVARIANT ([MS-MQMQ] 2.2.21): cElems followed by a [size_is(cElems)] pointer to that many PROPVARIANT elements. It is the VT_VECTOR|VT_VARIANT arm of a PROPVARIANT, so the type is (indirectly) recursive.

type CAPROPVARIANT struct {
    CElems ndr.DWORD
    PElems []PROPVARIANT `ndr:"unique,size_is=CElems"`
}

type CAUB

CAUB is a counted array of unsigned char ([MS-MQMQ] 2.2.13): cElems followed by a [size_is(cElems)] pointer to that many octets. It is the VT_VECTOR|VT_UI1 PROPVARIANT arm.

type CAUB struct {
    CElems ndr.DWORD
    PElems []uint8 `ndr:"unique,size_is=CElems"`
}

type CAUH

CAUH is a counted array of ULARGE_INTEGER ([MS-MQMQ] 2.2.17): cElems followed by a [size_is(cElems)] pointer to that many unsigned 64-bit elements. It is the VT_VECTOR|VT_UI8 PROPVARIANT arm.

type CAUH struct {
    CElems ndr.DWORD
    PElems []msdtyp.ULARGE_INTEGER `ndr:"unique,size_is=CElems"`
}

type CAUI

CAUI is a counted array of unsigned short ([MS-MQMQ] 2.2.14): cElems followed by a [size_is(cElems)] pointer to that many 16-bit elements. It is the VT_VECTOR|VT_UI2 arm.

type CAUI struct {
    CElems ndr.DWORD
    PElems []uint16 `ndr:"unique,size_is=CElems"`
}

type CAUL

CAUL is a counted array of unsigned long ([MS-MQMQ] 2.2.16): cElems followed by a [size_is(cElems)] pointer to that many unsigned 32-bit elements. It is the VT_VECTOR|VT_UI4 PROPVARIANT arm.

type CAUL struct {
    CElems ndr.DWORD
    PElems []ndr.DWORD `ndr:"unique,size_is=CElems"`
}

type DL\_ID

DL_ID identifies a distribution list ([MS-MQMQ] 2.2.9): a GUID and a unique pointer to the domain name string. It is the m_DlID arm of QUEUE_FORMAT.

type DL_ID struct {
    MDlGuid    msdtyp.GUID
    MPwzDomain *ndr.WSTR `ndr:"unique"`
}

type MULTICAST\_ID

MULTICAST_ID identifies a multicast queue ([MS-MQMQ] 2.2.10): an IP address and the port the queue is attached to. It is the m_MulticastID arm of QUEUE_FORMAT.

type MULTICAST_ID struct {
    MAddress ndr.DWORD // ULONG m_address
    MPort    ndr.DWORD // ULONG m_port
}

type OBJECTID

OBJECTID uniquely distinguishes objects of the same type within Message Queuing ([MS-MQMQ] 2.2.8): a GUID group identifier (Lineage) and a DWORD object identifier (Uniquifier). It is the m_oPrivateID arm of QUEUE_FORMAT (a private queue) and is reused by [MS-MQMP] as a message identifier.

type OBJECTID struct {
    Lineage    msdtyp.GUID
    Uniquifier ndr.DWORD
}

type PROPID

PROPID is a property identifier ([MS-MQMQ] 2.2.10.1): typedef unsigned long PROPID.

type PROPID = ndr.DWORD

type PROPVARIANT

PROPVARIANT is the Message Queuing property variant ([MS-MQMQ] 2.2.12): a VARTYPE discriminant (vt), three reserved fields, and a [switch_is(vt)] union carrying the typed value. It is the property value used throughout [MS-MQDS] (the aProp/apVar property arrays and MQPROPERTYRESTRICTION).

Wire modelling. The IDL union is non-encapsulated (its discriminant is the enclosing struct’s vt field). The codec’s declarative unions carry their own discriminant, so the union is modelled as the Value field whose own Vt switch mirrors the outer Vt. Keep the two equal (SetVt does this); a mismatch would marshal an inconsistent discriminant.

type PROPVARIANT struct {
    Vt         VARTYPE
    WReserved1 uint8
    WReserved2 uint8
    WReserved3 uint32
    Value      PropVariantUnion
}

func (*PROPVARIANT) SetVt

func (p *PROPVARIANT) SetVt(vt VARTYPE) *PROPVARIANT

SetVt sets both the outer discriminant and the union’s mirrored discriminant so they stay consistent, then returns the receiver for chaining.

type PropVariantUnion

PropVariantUnion is the [switch_is(vt)] union of a PROPVARIANT ([MS-MQMQ] 2.2.12). Each arm’s case value is the VARTYPE (or VT_VECTOR|<base>) that selects it. VT_EMPTY and VT_NULL select no arm (an empty union body). Pointer arms use the unique referent form mandated by the interface’s pointer_default(unique).

type PropVariantUnion struct {
    Vt  VARTYPE `ndr:"switch"`

    CVal    int8   `ndr:"case=16"` // VT_I1
    BVal    uint8  `ndr:"case=17"` // VT_UI1
    IVal    int16  `ndr:"case=2"`  // VT_I2
    UiVal   uint16 `ndr:"case=18"` // VT_UI2
    LVal    int32  `ndr:"case=3"`  // VT_I4
    UlVal   uint32 `ndr:"case=19"` // VT_UI4
    HVal    int64  `ndr:"case=20"` // VT_I8  (LARGE_INTEGER)
    UhVal   uint64 `ndr:"case=21"` // VT_UI8 (ULARGE_INTEGER)
    BoolVal int16  `ndr:"case=11"` // VT_BOOL (VARIANT_BOOL)

    Puuid   *msdtyp.GUID `ndr:"case=72,unique"` // VT_CLSID
    Blob    BLOB         `ndr:"case=65"`        // VT_BLOB
    PwszVal *ndr.WSTR    `ndr:"case=31,unique"` // VT_LPWSTR

    Caub      CAUB          `ndr:"case=0x1011"` // VT_VECTOR|VT_UI1
    Caui      CAUI          `ndr:"case=0x1012"` // VT_VECTOR|VT_UI2
    Cal       CAL           `ndr:"case=0x1003"` // VT_VECTOR|VT_I4
    Caul      CAUL          `ndr:"case=0x1013"` // VT_VECTOR|VT_UI4
    Cauh      CAUH          `ndr:"case=0x1015"` // VT_VECTOR|VT_UI8
    Cauuid    CACLSID       `ndr:"case=0x1048"` // VT_VECTOR|VT_CLSID
    Calpwstr  CALPWSTR      `ndr:"case=0x101F"` // VT_VECTOR|VT_LPWSTR
    Capropvar CAPROPVARIANT `ndr:"case=0x100C"` // VT_VECTOR|VT_VARIANT
}

type QUEUE\_FORMAT

QUEUE_FORMAT describes the type of a queue and an identifier for it ([MS-MQMQ] 2.2.7): an m_qft discriminant, an m_SuffixAndFlags byte (Suffix Type in the low nibble, Flags in the high nibble), a reserved padding word, and a [switch_is(m_qft)] union carrying the per-kind identifier.

Wire modelling. The IDL union is non-encapsulated (its discriminant is the enclosing struct’s m_qft field). The codec’s declarative unions carry their own discriminant, so the union is modelled as the Value field whose own MQft switch mirrors the outer MQft; keep the two equal with SetQft. This follows the same convention as PROPVARIANT in this package.

type QUEUE_FORMAT struct {
    MQft            QUEUE_FORMAT_TYPE
    MSuffixAndFlags uint8
    MReserved       uint16
    Value           QueueFormatUnion
}

func (*QUEUE_FORMAT) SetQft

func (q *QUEUE_FORMAT) SetQft(qft QUEUE_FORMAT_TYPE) *QUEUE_FORMAT

SetQft sets both the outer discriminant and the union’s mirrored discriminant so they stay consistent, then returns the receiver for chaining.

type QUEUE\_FORMAT\_TYPE

QUEUE_FORMAT_TYPE enumerates the queue format-name kinds ([MS-MQMQ] 2.2.7.1). Its values are the m_qft discriminant of QUEUE_FORMAT; m_qft is transmitted as an unsigned char, so the constants are modelled as byte values.

type QUEUE_FORMAT_TYPE = uint8
const (
    QUEUE_FORMAT_TYPE_UNKNOWN   QUEUE_FORMAT_TYPE = 0
    QUEUE_FORMAT_TYPE_PUBLIC    QUEUE_FORMAT_TYPE = 1
    QUEUE_FORMAT_TYPE_PRIVATE   QUEUE_FORMAT_TYPE = 2
    QUEUE_FORMAT_TYPE_DIRECT    QUEUE_FORMAT_TYPE = 3
    QUEUE_FORMAT_TYPE_MACHINE   QUEUE_FORMAT_TYPE = 4
    QUEUE_FORMAT_TYPE_CONNECTOR QUEUE_FORMAT_TYPE = 5
    QUEUE_FORMAT_TYPE_DL        QUEUE_FORMAT_TYPE = 6
    QUEUE_FORMAT_TYPE_MULTICAST QUEUE_FORMAT_TYPE = 7
    QUEUE_FORMAT_TYPE_SUBQUEUE  QUEUE_FORMAT_TYPE = 8
)

type QueueFormatUnion

QueueFormatUnion is the [switch_is(m_qft)] union of QUEUE_FORMAT ([MS-MQMQ] 2.2.7). The UNKNOWN discriminant (0) selects no arm (an empty union body). The direct/subqueue arms are unique pointers to wide strings, matching pointer_default(unique).

type QueueFormatUnion struct {
    MQft QUEUE_FORMAT_TYPE `ndr:"switch"`

    MGPublicID         msdtyp.GUID  `ndr:"case=1"`        // QUEUE_FORMAT_TYPE_PUBLIC
    MOPrivateID        OBJECTID     `ndr:"case=2"`        // QUEUE_FORMAT_TYPE_PRIVATE
    MPDirectID         *ndr.WSTR    `ndr:"case=3,unique"` // QUEUE_FORMAT_TYPE_DIRECT
    MGMachineID        msdtyp.GUID  `ndr:"case=4"`        // QUEUE_FORMAT_TYPE_MACHINE
    MGConnectorID      msdtyp.GUID  `ndr:"case=5"`        // QUEUE_FORMAT_TYPE_CONNECTOR
    MDlID              DL_ID        `ndr:"case=6"`        // QUEUE_FORMAT_TYPE_DL
    MMulticastID       MULTICAST_ID `ndr:"case=7"`        // QUEUE_FORMAT_TYPE_MULTICAST
    MPDirectSubqueueID *ndr.WSTR    `ndr:"case=8,unique"` // QUEUE_FORMAT_TYPE_SUBQUEUE
}

type VARTYPE

VARTYPE is the 2-octet discriminant of a PROPVARIANT ([MS-MQMQ] 2.2.12): typedef unsigned short VARTYPE. Its values come from the VARENUM enumeration below.

type VARTYPE = uint16

VARENUM values used as the PROPVARIANT discriminant ([MS-MQMQ] 2.2.12.1). The VT_VECTOR flag is OR’d with a base type to select a counted-array (CA*) arm.

const (
    VT_EMPTY   VARTYPE = 0
    VT_NULL    VARTYPE = 1
    VT_I2      VARTYPE = 2
    VT_I4      VARTYPE = 3
    VT_BOOL    VARTYPE = 11
    VT_VARIANT VARTYPE = 12
    VT_I1      VARTYPE = 16
    VT_UI1     VARTYPE = 17
    VT_UI2     VARTYPE = 18
    VT_UI4     VARTYPE = 19
    VT_I8      VARTYPE = 20
    VT_UI8     VARTYPE = 21
    VT_LPWSTR  VARTYPE = 31
    VT_BLOB    VARTYPE = 65
    VT_CLSID   VARTYPE = 72

    VT_VECTOR VARTYPE = 0x1000
)

Combined VT_VECTOR|<base> discriminants, precomputed for use as PROPVARIANT union arm case values (the NDR union arm tags below reference the same numeric values).

const (
    VT_VECTOR_UI1     VARTYPE = VT_VECTOR | VT_UI1     // 0x1011
    VT_VECTOR_UI2     VARTYPE = VT_VECTOR | VT_UI2     // 0x1012
    VT_VECTOR_I4      VARTYPE = VT_VECTOR | VT_I4      // 0x1003
    VT_VECTOR_UI4     VARTYPE = VT_VECTOR | VT_UI4     // 0x1013
    VT_VECTOR_UI8     VARTYPE = VT_VECTOR | VT_UI8     // 0x1015
    VT_VECTOR_CLSID   VARTYPE = VT_VECTOR | VT_CLSID   // 0x1048
    VT_VECTOR_LPWSTR  VARTYPE = VT_VECTOR | VT_LPWSTR  // 0x101F
    VT_VECTOR_VARIANT VARTYPE = VT_VECTOR | VT_VARIANT // 0x100C
)

type XACTUOW

XACTUOW is a transaction unit-of-work identifier ([MS-MQMQ] 2.2.18.1.8): a fixed 16-octet value. It identifies the transaction of a Send or Receive operation in [MS-MQMP].

type XACTUOW struct {
    Rgb [16]uint8
}