# SPDX-License-Identifier: GPL-2.0-only
# This file is part of Scapy RPC
# See https://scapy.net/ for more information
# Copyright (C) Gabriel Potter

# [ms-comev] v9.0 (Tue, 09 Sep 2025)

"""
RPC definitions for the following interfaces:
- IUnknown (v0.0): 00000000-0000-0000-C000-000000000046
- IDispatch (v0.0): 00020400-0000-0000-C000-000000000046
- IEventObjectCollection (v0.0): f89ac270-d4eb-11d1-b682-00805fc79216
- IEventSystem (v0.0): 4E14FB9F-2E22-11D1-9964-00C04FBBB345
- IEventClass (v0.0): fb2b72a0-7a68-11d1-88f9-0080c7d771bf
- IEventClass2 (v0.0): fb2b72a1-7a68-11d1-88f9-0080c7d771bf
- IEnumEventObject (v0.0): F4A07D63-2E25-11D1-9964-00C04FBBB345
- IEventSubscription (v0.0): 4A6B0E15-2E38-11D1-9965-00C04FBBB345
- IEventSubscription2 (v0.0): 4A6B0E16-2E38-11D1-9965-00C04FBBB345
- IEventClass3 (v0.0): 7FB7EA43-2D76-4ea8-8CD9-3DECC270295E
- IEventSubscription3 (v0.0): FBC1D17D-C498-43a0-81AF-423DDD530AF6
- IEventSystem2 (v0.0): 99CC098F-A48A-4e9c-8E58-965C0AFC19D5
- IEventSystemInitialize (v0.0): a0e8f27a-888c-11d1-b763-00c04fb926af
This file is auto-generated by midl-to-scapy, do not modify.
"""

from enum import IntEnum
import uuid

from scapy.fields import PacketListField, StrFixedLenField
from scapy.layers.dcerpc import (
    NDRPacket,
    DceRpcOp,
    NDRConfFieldListField,
    NDRConfPacketListField,
    NDRConfStrLenField,
    NDRConfStrLenFieldUtf16,
    NDRConfVarPacketListField,
    NDRConfVarStrNullField,
    NDRConfVarStrNullFieldUtf16,
    NDRFullEmbPointerField,
    NDRFullPointerField,
    NDRIEEEDoubleField,
    NDRIEEEFloatField,
    NDRInt3264Field,
    NDRIntField,
    NDRLongField,
    NDRPacketField,
    NDRRecursiveClass,
    NDRRefEmbPointerField,
    NDRShortField,
    NDRSignedByteField,
    NDRSignedIntField,
    NDRSignedLongField,
    NDRSignedShortField,
    NDRUnionField,
    register_com_interface,
    register_dcerpc_interface,
)

IUNKNOWN_OPNUMS = {  # 0: Opnum0NotUsedOnWire,
    # 1: Opnum1NotUsedOnWire,
    # 2: Opnum2NotUsedOnWire
}
register_com_interface(
    name="IUnknown",
    uuid=uuid.UUID("00000000-0000-0000-C000-000000000046"),
    opnums=IUNKNOWN_OPNUMS,
)


class GetTypeInfoCount_Request(NDRPacket):
    fields_desc = []


class GetTypeInfoCount_Response(NDRPacket):
    fields_desc = [NDRIntField("pctinfo", 0), NDRIntField("status", 0)]


class MInterfacePointer(NDRPacket):
    ALIGNMENT = (4, 4)
    DEPORTED_CONFORMANTS = ["abData"]
    fields_desc = [
        NDRIntField("ulCntData", None, size_of="abData"),
        NDRConfStrLenField(
            "abData", "", size_is=lambda pkt: pkt.ulCntData, conformant_in_struct=True
        ),
    ]


class GetTypeInfo_Request(NDRPacket):
    fields_desc = [NDRIntField("iTInfo", 0), NDRIntField("lcid", 0)]


class GetTypeInfo_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("ppTInfo", MInterfacePointer(), MInterfacePointer)
        ),
        NDRIntField("status", 0),
    ]


class GUID(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [
        NDRIntField("Data1", 0),
        NDRShortField("Data2", 0),
        NDRShortField("Data3", 0),
        StrFixedLenField("Data4", "", length=8),
    ]


class GetIDsOfNames_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("riid", GUID(), GUID),
        NDRConfFieldListField(
            "rgszNames",
            [],
            NDRFullPointerField(NDRConfVarStrNullFieldUtf16("", "")),
            size_is=lambda pkt: pkt.cNames,
        ),
        NDRIntField("cNames", None, size_of="rgszNames"),
        NDRIntField("lcid", 0),
    ]


class GetIDsOfNames_Response(NDRPacket):
    fields_desc = [
        NDRConfFieldListField(
            "rgDispId", [], NDRSignedIntField("", 0), size_is=lambda pkt: pkt.cNames
        ),
        NDRIntField("status", 0),
    ]


class VARENUM(IntEnum):
    VT_EMPTY = 0
    VT_NULL = 1
    VT_I2 = 2
    VT_I4 = 3
    VT_R4 = 4
    VT_R8 = 5
    VT_CY = 6
    VT_DATE = 7
    VT_BSTR = 8
    VT_DISPATCH = 9
    VT_ERROR = 10
    VT_BOOL = 11
    VT_VARIANT = 12
    VT_UNKNOWN = 13
    VT_DECIMAL = 14
    VT_I1 = 16
    VT_UI1 = 17
    VT_UI2 = 18
    VT_UI4 = 19
    VT_I8 = 20
    VT_UI8 = 21
    VT_INT = 22
    VT_UINT = 23
    VT_VOID = 24
    VT_HRESULT = 25
    VT_PTR = 26
    VT_SAFEARRAY = 27
    VT_CARRAY = 28
    VT_USERDEFINED = 29
    VT_LPSTR = 30
    VT_LPWSTR = 31
    VT_RECORD = 36
    VT_INT_PTR = 37
    VT_UINT_PTR = 38
    VT_ARRAY = 8192
    VT_BYREF = 16384


class CURRENCY(NDRPacket):
    ALIGNMENT = (8, 8)
    fields_desc = [NDRSignedLongField("int64", 0)]


class FLAGGED_WORD_BLOB(NDRPacket):
    ALIGNMENT = (4, 4)
    DEPORTED_CONFORMANTS = ["asData"]
    fields_desc = [
        NDRIntField("cBytes", 0),
        NDRIntField("clSize", None, size_of="asData"),
        NDRConfStrLenFieldUtf16(
            "asData", "", size_is=lambda pkt: pkt.clSize, conformant_in_struct=True
        ),
    ]


class SF_TYPE(IntEnum):
    SF_ERROR = VARENUM.VT_ERROR
    SF_I1 = VARENUM.VT_I1
    SF_I2 = VARENUM.VT_I2
    SF_I4 = VARENUM.VT_I4
    SF_I8 = VARENUM.VT_I8
    SF_BSTR = VARENUM.VT_BSTR
    SF_UNKNOWN = VARENUM.VT_UNKNOWN
    SF_DISPATCH = VARENUM.VT_DISPATCH
    SF_VARIANT = VARENUM.VT_VARIANT
    SF_RECORD = VARENUM.VT_RECORD
    SF_HAVEIID = VARENUM.VT_UNKNOWN | 32768


class SAFEARR_BSTR(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("Size", None, size_of="aBstr"),
        NDRRefEmbPointerField(
            NDRConfPacketListField(
                "aBstr", [], FLAGGED_WORD_BLOB, size_is=lambda pkt: pkt.Size, ptr_lvl=1
            )
        ),
    ]


class SAFEARR_UNKNOWN(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("Size", None, size_of="apUnknown"),
        NDRRefEmbPointerField(
            NDRConfPacketListField(
                "apUnknown",
                [],
                MInterfacePointer,
                size_is=lambda pkt: pkt.Size,
                ptr_lvl=1,
            )
        ),
    ]


class SAFEARR_DISPATCH(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("Size", None, size_of="apDispatch"),
        NDRRefEmbPointerField(
            NDRConfPacketListField(
                "apDispatch",
                [],
                MInterfacePointer,
                size_is=lambda pkt: pkt.Size,
                ptr_lvl=1,
            )
        ),
    ]


class SAFEARR_VARIANT(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("Size", None, size_of="aVariant"),
        NDRRefEmbPointerField(
            NDRConfPacketListField(
                "aVariant",
                [],
                NDRRecursiveClass("wireVARIANTStr"),
                size_is=lambda pkt: pkt.Size,
                ptr_lvl=1,
            )
        ),
    ]


class wireBRECORDStr(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("fFlags", 0),
        NDRIntField("clSize", None, size_of="pRecord"),
        NDRFullEmbPointerField(
            NDRPacketField("pRecInfo", MInterfacePointer(), MInterfacePointer)
        ),
        NDRFullEmbPointerField(
            NDRConfStrLenField("pRecord", "", size_is=lambda pkt: pkt.clSize)
        ),
    ]


class SAFEARR_BRECORD(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("Size", None, size_of="aRecord"),
        NDRRefEmbPointerField(
            NDRConfPacketListField(
                "aRecord", [], wireBRECORDStr, size_is=lambda pkt: pkt.Size, ptr_lvl=1
            )
        ),
    ]


class SAFEARR_HAVEIID(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("Size", None, size_of="apUnknown"),
        NDRRefEmbPointerField(
            NDRConfPacketListField(
                "apUnknown",
                [],
                MInterfacePointer,
                size_is=lambda pkt: pkt.Size,
                ptr_lvl=1,
            )
        ),
        NDRPacketField("iid", GUID(), GUID),
    ]


class BYTE_SIZEDARR(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("clSize", None, size_of="pData"),
        NDRFullEmbPointerField(
            NDRConfStrLenField("pData", "", size_is=lambda pkt: pkt.clSize)
        ),
    ]


class WORD_SIZEDARR(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("clSize", None, size_of="pData"),
        NDRFullEmbPointerField(
            NDRConfStrLenFieldUtf16("pData", "", size_is=lambda pkt: pkt.clSize)
        ),
    ]


class DWORD_SIZEDARR(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("clSize", None, size_of="pData"),
        NDRFullEmbPointerField(
            NDRConfFieldListField(
                "pData", [], NDRIntField("", 0), size_is=lambda pkt: pkt.clSize
            )
        ),
    ]


class HYPER_SIZEDARR(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("clSize", None, size_of="pData"),
        NDRFullEmbPointerField(
            NDRConfFieldListField(
                "pData", [], NDRSignedLongField("", 0), size_is=lambda pkt: pkt.clSize
            )
        ),
    ]


class SAFEARRAYBOUND(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [NDRIntField("cElements", 0), NDRSignedIntField("lLbound", 0)]


class SAFEARRAY(NDRPacket):
    ALIGNMENT = (4, 8)
    DEPORTED_CONFORMANTS = ["rgsabound"]
    fields_desc = [
        NDRShortField("cDims", None, size_of="rgsabound"),
        NDRShortField("fFeatures", 0),
        NDRIntField("cbElements", 0),
        NDRIntField("cLocks", 0),
        NDRUnionField(
            [
                (
                    NDRPacketField("uArrayStructs", SAFEARR_BSTR(), SAFEARR_BSTR),
                    (
                        (lambda pkt: None == SF_TYPE.SF_BSTR),
                        (lambda _, val: val.tag == SF_TYPE.SF_BSTR),
                    ),
                ),
                (
                    NDRPacketField("uArrayStructs", SAFEARR_UNKNOWN(), SAFEARR_UNKNOWN),
                    (
                        (lambda pkt: None == SF_TYPE.SF_UNKNOWN),
                        (lambda _, val: val.tag == SF_TYPE.SF_UNKNOWN),
                    ),
                ),
                (
                    NDRPacketField(
                        "uArrayStructs", SAFEARR_DISPATCH(), SAFEARR_DISPATCH
                    ),
                    (
                        (lambda pkt: None == SF_TYPE.SF_DISPATCH),
                        (lambda _, val: val.tag == SF_TYPE.SF_DISPATCH),
                    ),
                ),
                (
                    NDRPacketField("uArrayStructs", SAFEARR_VARIANT(), SAFEARR_VARIANT),
                    (
                        (lambda pkt: None == SF_TYPE.SF_VARIANT),
                        (lambda _, val: val.tag == SF_TYPE.SF_VARIANT),
                    ),
                ),
                (
                    NDRPacketField("uArrayStructs", SAFEARR_BRECORD(), SAFEARR_BRECORD),
                    (
                        (lambda pkt: None == SF_TYPE.SF_RECORD),
                        (lambda _, val: val.tag == SF_TYPE.SF_RECORD),
                    ),
                ),
                (
                    NDRPacketField("uArrayStructs", SAFEARR_HAVEIID(), SAFEARR_HAVEIID),
                    (
                        (lambda pkt: None == SF_TYPE.SF_HAVEIID),
                        (lambda _, val: val.tag == SF_TYPE.SF_HAVEIID),
                    ),
                ),
                (
                    NDRPacketField("uArrayStructs", BYTE_SIZEDARR(), BYTE_SIZEDARR),
                    (
                        (lambda pkt: None == SF_TYPE.SF_I1),
                        (lambda _, val: val.tag == SF_TYPE.SF_I1),
                    ),
                ),
                (
                    NDRPacketField("uArrayStructs", WORD_SIZEDARR(), WORD_SIZEDARR),
                    (
                        (lambda pkt: None == SF_TYPE.SF_I2),
                        (lambda _, val: val.tag == SF_TYPE.SF_I2),
                    ),
                ),
                (
                    NDRPacketField("uArrayStructs", DWORD_SIZEDARR(), DWORD_SIZEDARR),
                    (
                        (lambda pkt: None == SF_TYPE.SF_I4),
                        (lambda _, val: val.tag == SF_TYPE.SF_I4),
                    ),
                ),
                (
                    NDRPacketField("uArrayStructs", HYPER_SIZEDARR(), HYPER_SIZEDARR),
                    (
                        (lambda pkt: None == SF_TYPE.SF_I8),
                        (lambda _, val: val.tag == SF_TYPE.SF_I8),
                    ),
                ),
            ],
            StrFixedLenField("uArrayStructs", "", length=0),
            align=(4, 8),
            switch_fmt=("I", "I"),
        ),
        NDRConfPacketListField(
            "rgsabound",
            [],
            SAFEARRAYBOUND,
            size_is=lambda pkt: pkt.cDims,
            conformant_in_struct=True,
        ),
    ]


class DECIMAL(NDRPacket):
    ALIGNMENT = (8, 8)
    fields_desc = [
        NDRShortField("wReserved", 0),
        NDRSignedByteField("scale", 0),
        NDRSignedByteField("sign", 0),
        NDRIntField("Hi32", 0),
        NDRLongField("Lo64", 0),
    ]


class wireVARIANTStr(NDRPacket):
    ALIGNMENT = (8, 8)
    fields_desc = [
        NDRIntField("clSize", 0),
        NDRIntField("rpcReserved", 0),
        NDRShortField("vt", 0),
        NDRShortField("wReserved1", 0),
        NDRShortField("wReserved2", 0),
        NDRShortField("wReserved3", 0),
        NDRUnionField(
            [
                (
                    NDRSignedLongField("_varUnion", 0),
                    (
                        (lambda pkt: getattr(pkt, "vt", None) == VARENUM.VT_I8),
                        (lambda _, val: val.tag == VARENUM.VT_I8),
                    ),
                ),
                (
                    NDRSignedIntField("_varUnion", 0),
                    (
                        (lambda pkt: getattr(pkt, "vt", None) == VARENUM.VT_I4),
                        (lambda _, val: val.tag == VARENUM.VT_I4),
                    ),
                ),
                (
                    NDRSignedByteField("_varUnion", 0),
                    (
                        (lambda pkt: getattr(pkt, "vt", None) == VARENUM.VT_UI1),
                        (lambda _, val: val.tag == VARENUM.VT_UI1),
                    ),
                ),
                (
                    NDRSignedShortField("_varUnion", 0),
                    (
                        (lambda pkt: getattr(pkt, "vt", None) == VARENUM.VT_I2),
                        (lambda _, val: val.tag == VARENUM.VT_I2),
                    ),
                ),
                (
                    NDRIEEEFloatField("_varUnion", 0),
                    (
                        (lambda pkt: getattr(pkt, "vt", None) == VARENUM.VT_R4),
                        (lambda _, val: val.tag == VARENUM.VT_R4),
                    ),
                ),
                (
                    NDRIEEEDoubleField("_varUnion", 0),
                    (
                        (lambda pkt: getattr(pkt, "vt", None) == VARENUM.VT_R8),
                        (lambda _, val: val.tag == VARENUM.VT_R8),
                    ),
                ),
                (
                    NDRSignedShortField("_varUnion", 0),
                    (
                        (lambda pkt: getattr(pkt, "vt", None) == VARENUM.VT_BOOL),
                        (lambda _, val: val.tag == VARENUM.VT_BOOL),
                    ),
                ),
                (
                    NDRSignedIntField("_varUnion", 0),
                    (
                        (lambda pkt: getattr(pkt, "vt", None) == VARENUM.VT_ERROR),
                        (lambda _, val: val.tag == VARENUM.VT_ERROR),
                    ),
                ),
                (
                    NDRPacketField("_varUnion", CURRENCY(), CURRENCY),
                    (
                        (lambda pkt: getattr(pkt, "vt", None) == VARENUM.VT_CY),
                        (lambda _, val: val.tag == VARENUM.VT_CY),
                    ),
                ),
                (
                    NDRIEEEDoubleField("_varUnion", 0),
                    (
                        (lambda pkt: getattr(pkt, "vt", None) == VARENUM.VT_DATE),
                        (lambda _, val: val.tag == VARENUM.VT_DATE),
                    ),
                ),
                (
                    NDRFullEmbPointerField(
                        NDRPacketField(
                            "_varUnion", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "vt", None) == VARENUM.VT_BSTR),
                        (lambda _, val: val.tag == VARENUM.VT_BSTR),
                    ),
                ),
                (
                    NDRFullEmbPointerField(
                        NDRPacketField(
                            "_varUnion", MInterfacePointer(), MInterfacePointer
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "vt", None) == VARENUM.VT_UNKNOWN),
                        (lambda _, val: val.tag == VARENUM.VT_UNKNOWN),
                    ),
                ),
                (
                    NDRFullEmbPointerField(
                        NDRPacketField(
                            "_varUnion", MInterfacePointer(), MInterfacePointer
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "vt", None) == VARENUM.VT_DISPATCH),
                        (lambda _, val: val.tag == VARENUM.VT_DISPATCH),
                    ),
                ),
                (
                    NDRFullEmbPointerField(
                        NDRFullEmbPointerField(
                            NDRPacketField("_varUnion", SAFEARRAY(), SAFEARRAY)
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "vt", None) == VARENUM.VT_ARRAY),
                        (lambda _, val: val.tag == VARENUM.VT_ARRAY),
                    ),
                ),
                (
                    NDRFullEmbPointerField(
                        NDRPacketField("_varUnion", wireBRECORDStr(), wireBRECORDStr)
                    ),
                    (
                        (
                            lambda pkt: getattr(pkt, "vt", None)
                            in [
                                VARENUM.VT_RECORD,
                                (VARENUM.VT_RECORD | VARENUM.VT_BYREF),
                            ]
                        ),
                        (
                            lambda _, val: val.tag
                            in [
                                VARENUM.VT_RECORD,
                                (VARENUM.VT_RECORD | VARENUM.VT_BYREF),
                            ]
                        ),
                    ),
                ),
                (
                    NDRFullEmbPointerField(NDRSignedByteField("_varUnion", 0)),
                    (
                        (
                            lambda pkt: getattr(pkt, "vt", None)
                            == (VARENUM.VT_UI1 | VARENUM.VT_BYREF)
                        ),
                        (lambda _, val: val.tag == (VARENUM.VT_UI1 | VARENUM.VT_BYREF)),
                    ),
                ),
                (
                    NDRFullEmbPointerField(NDRSignedShortField("_varUnion", 0)),
                    (
                        (
                            lambda pkt: getattr(pkt, "vt", None)
                            == (VARENUM.VT_I2 | VARENUM.VT_BYREF)
                        ),
                        (lambda _, val: val.tag == (VARENUM.VT_I2 | VARENUM.VT_BYREF)),
                    ),
                ),
                (
                    NDRFullEmbPointerField(NDRSignedIntField("_varUnion", 0)),
                    (
                        (
                            lambda pkt: getattr(pkt, "vt", None)
                            == (VARENUM.VT_I4 | VARENUM.VT_BYREF)
                        ),
                        (lambda _, val: val.tag == (VARENUM.VT_I4 | VARENUM.VT_BYREF)),
                    ),
                ),
                (
                    NDRFullEmbPointerField(NDRSignedLongField("_varUnion", 0)),
                    (
                        (
                            lambda pkt: getattr(pkt, "vt", None)
                            == (VARENUM.VT_I8 | VARENUM.VT_BYREF)
                        ),
                        (lambda _, val: val.tag == (VARENUM.VT_I8 | VARENUM.VT_BYREF)),
                    ),
                ),
                (
                    NDRFullEmbPointerField(NDRIEEEFloatField("_varUnion", 0)),
                    (
                        (
                            lambda pkt: getattr(pkt, "vt", None)
                            == (VARENUM.VT_R4 | VARENUM.VT_BYREF)
                        ),
                        (lambda _, val: val.tag == (VARENUM.VT_R4 | VARENUM.VT_BYREF)),
                    ),
                ),
                (
                    NDRFullEmbPointerField(NDRIEEEDoubleField("_varUnion", 0)),
                    (
                        (
                            lambda pkt: getattr(pkt, "vt", None)
                            == (VARENUM.VT_R8 | VARENUM.VT_BYREF)
                        ),
                        (lambda _, val: val.tag == (VARENUM.VT_R8 | VARENUM.VT_BYREF)),
                    ),
                ),
                (
                    NDRFullEmbPointerField(NDRSignedShortField("_varUnion", 0)),
                    (
                        (
                            lambda pkt: getattr(pkt, "vt", None)
                            == (VARENUM.VT_BOOL | VARENUM.VT_BYREF)
                        ),
                        (
                            lambda _, val: val.tag
                            == (VARENUM.VT_BOOL | VARENUM.VT_BYREF)
                        ),
                    ),
                ),
                (
                    NDRFullEmbPointerField(NDRSignedIntField("_varUnion", 0)),
                    (
                        (
                            lambda pkt: getattr(pkt, "vt", None)
                            == (VARENUM.VT_ERROR | VARENUM.VT_BYREF)
                        ),
                        (
                            lambda _, val: val.tag
                            == (VARENUM.VT_ERROR | VARENUM.VT_BYREF)
                        ),
                    ),
                ),
                (
                    NDRFullEmbPointerField(
                        NDRPacketField("_varUnion", CURRENCY(), CURRENCY)
                    ),
                    (
                        (
                            lambda pkt: getattr(pkt, "vt", None)
                            == (VARENUM.VT_CY | VARENUM.VT_BYREF)
                        ),
                        (lambda _, val: val.tag == (VARENUM.VT_CY | VARENUM.VT_BYREF)),
                    ),
                ),
                (
                    NDRFullEmbPointerField(NDRIEEEDoubleField("_varUnion", 0)),
                    (
                        (
                            lambda pkt: getattr(pkt, "vt", None)
                            == (VARENUM.VT_DATE | VARENUM.VT_BYREF)
                        ),
                        (
                            lambda _, val: val.tag
                            == (VARENUM.VT_DATE | VARENUM.VT_BYREF)
                        ),
                    ),
                ),
                (
                    NDRFullEmbPointerField(
                        NDRFullEmbPointerField(
                            NDRPacketField(
                                "_varUnion", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB
                            )
                        )
                    ),
                    (
                        (
                            lambda pkt: getattr(pkt, "vt", None)
                            == (VARENUM.VT_BSTR | VARENUM.VT_BYREF)
                        ),
                        (
                            lambda _, val: val.tag
                            == (VARENUM.VT_BSTR | VARENUM.VT_BYREF)
                        ),
                    ),
                ),
                (
                    NDRFullEmbPointerField(
                        NDRFullEmbPointerField(
                            NDRPacketField(
                                "_varUnion", MInterfacePointer(), MInterfacePointer
                            )
                        )
                    ),
                    (
                        (
                            lambda pkt: getattr(pkt, "vt", None)
                            == (VARENUM.VT_UNKNOWN | VARENUM.VT_BYREF)
                        ),
                        (
                            lambda _, val: val.tag
                            == (VARENUM.VT_UNKNOWN | VARENUM.VT_BYREF)
                        ),
                    ),
                ),
                (
                    NDRFullEmbPointerField(
                        NDRFullEmbPointerField(
                            NDRPacketField(
                                "_varUnion", MInterfacePointer(), MInterfacePointer
                            )
                        )
                    ),
                    (
                        (
                            lambda pkt: getattr(pkt, "vt", None)
                            == (VARENUM.VT_DISPATCH | VARENUM.VT_BYREF)
                        ),
                        (
                            lambda _, val: val.tag
                            == (VARENUM.VT_DISPATCH | VARENUM.VT_BYREF)
                        ),
                    ),
                ),
                (
                    NDRFullEmbPointerField(
                        NDRFullEmbPointerField(
                            NDRFullEmbPointerField(
                                NDRPacketField("_varUnion", SAFEARRAY(), SAFEARRAY)
                            )
                        )
                    ),
                    (
                        (
                            lambda pkt: getattr(pkt, "vt", None)
                            == (VARENUM.VT_ARRAY | VARENUM.VT_BYREF)
                        ),
                        (
                            lambda _, val: val.tag
                            == (VARENUM.VT_ARRAY | VARENUM.VT_BYREF)
                        ),
                    ),
                ),
                (
                    NDRFullEmbPointerField(
                        NDRFullEmbPointerField(
                            NDRPacketField(
                                "_varUnion", None, NDRRecursiveClass("wireVARIANTStr")
                            )
                        )
                    ),
                    (
                        (
                            lambda pkt: getattr(pkt, "vt", None)
                            == (VARENUM.VT_VARIANT | VARENUM.VT_BYREF)
                        ),
                        (
                            lambda _, val: val.tag
                            == (VARENUM.VT_VARIANT | VARENUM.VT_BYREF)
                        ),
                    ),
                ),
                (
                    NDRSignedByteField("_varUnion", 0),
                    (
                        (lambda pkt: getattr(pkt, "vt", None) == VARENUM.VT_I1),
                        (lambda _, val: val.tag == VARENUM.VT_I1),
                    ),
                ),
                (
                    NDRShortField("_varUnion", 0),
                    (
                        (lambda pkt: getattr(pkt, "vt", None) == VARENUM.VT_UI2),
                        (lambda _, val: val.tag == VARENUM.VT_UI2),
                    ),
                ),
                (
                    NDRIntField("_varUnion", 0),
                    (
                        (lambda pkt: getattr(pkt, "vt", None) == VARENUM.VT_UI4),
                        (lambda _, val: val.tag == VARENUM.VT_UI4),
                    ),
                ),
                (
                    NDRLongField("_varUnion", 0),
                    (
                        (lambda pkt: getattr(pkt, "vt", None) == VARENUM.VT_UI8),
                        (lambda _, val: val.tag == VARENUM.VT_UI8),
                    ),
                ),
                (
                    NDRSignedIntField("_varUnion", 0),
                    (
                        (lambda pkt: getattr(pkt, "vt", None) == VARENUM.VT_INT),
                        (lambda _, val: val.tag == VARENUM.VT_INT),
                    ),
                ),
                (
                    NDRIntField("_varUnion", 0),
                    (
                        (lambda pkt: getattr(pkt, "vt", None) == VARENUM.VT_UINT),
                        (lambda _, val: val.tag == VARENUM.VT_UINT),
                    ),
                ),
                (
                    NDRPacketField("_varUnion", DECIMAL(), DECIMAL),
                    (
                        (lambda pkt: getattr(pkt, "vt", None) == VARENUM.VT_DECIMAL),
                        (lambda _, val: val.tag == VARENUM.VT_DECIMAL),
                    ),
                ),
                (
                    NDRFullEmbPointerField(NDRSignedByteField("_varUnion", 0)),
                    (
                        (
                            lambda pkt: getattr(pkt, "vt", None)
                            == (VARENUM.VT_I1 | VARENUM.VT_BYREF)
                        ),
                        (lambda _, val: val.tag == (VARENUM.VT_I1 | VARENUM.VT_BYREF)),
                    ),
                ),
                (
                    NDRFullEmbPointerField(NDRShortField("_varUnion", 0)),
                    (
                        (
                            lambda pkt: getattr(pkt, "vt", None)
                            == (VARENUM.VT_UI2 | VARENUM.VT_BYREF)
                        ),
                        (lambda _, val: val.tag == (VARENUM.VT_UI2 | VARENUM.VT_BYREF)),
                    ),
                ),
                (
                    NDRFullEmbPointerField(NDRIntField("_varUnion", 0)),
                    (
                        (
                            lambda pkt: getattr(pkt, "vt", None)
                            == (VARENUM.VT_UI4 | VARENUM.VT_BYREF)
                        ),
                        (lambda _, val: val.tag == (VARENUM.VT_UI4 | VARENUM.VT_BYREF)),
                    ),
                ),
                (
                    NDRFullEmbPointerField(NDRLongField("_varUnion", 0)),
                    (
                        (
                            lambda pkt: getattr(pkt, "vt", None)
                            == (VARENUM.VT_UI8 | VARENUM.VT_BYREF)
                        ),
                        (lambda _, val: val.tag == (VARENUM.VT_UI8 | VARENUM.VT_BYREF)),
                    ),
                ),
                (
                    NDRFullEmbPointerField(NDRSignedIntField("_varUnion", 0)),
                    (
                        (
                            lambda pkt: getattr(pkt, "vt", None)
                            == (VARENUM.VT_INT | VARENUM.VT_BYREF)
                        ),
                        (lambda _, val: val.tag == (VARENUM.VT_INT | VARENUM.VT_BYREF)),
                    ),
                ),
                (
                    NDRFullEmbPointerField(NDRIntField("_varUnion", 0)),
                    (
                        (
                            lambda pkt: getattr(pkt, "vt", None)
                            == (VARENUM.VT_UINT | VARENUM.VT_BYREF)
                        ),
                        (
                            lambda _, val: val.tag
                            == (VARENUM.VT_UINT | VARENUM.VT_BYREF)
                        ),
                    ),
                ),
                (
                    NDRFullEmbPointerField(
                        NDRPacketField("_varUnion", DECIMAL(), DECIMAL)
                    ),
                    (
                        (
                            lambda pkt: getattr(pkt, "vt", None)
                            == (VARENUM.VT_DECIMAL | VARENUM.VT_BYREF)
                        ),
                        (
                            lambda _, val: val.tag
                            == (VARENUM.VT_DECIMAL | VARENUM.VT_BYREF)
                        ),
                    ),
                ),
                (
                    StrFixedLenField("_varUnion", "", length=0),
                    (
                        (lambda pkt: getattr(pkt, "vt", None) == VARENUM.VT_EMPTY),
                        (lambda _, val: val.tag == VARENUM.VT_EMPTY),
                    ),
                ),
                (
                    StrFixedLenField("_varUnion", "", length=0),
                    (
                        (lambda pkt: getattr(pkt, "vt", None) == VARENUM.VT_NULL),
                        (lambda _, val: val.tag == VARENUM.VT_NULL),
                    ),
                ),
            ],
            StrFixedLenField("_varUnion", "", length=0),
            align=(2, 8),
            switch_fmt=("H", "H"),
        ),
    ]


class DISPPARAMS(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRFullEmbPointerField(
            NDRConfPacketListField(
                "rgvarg", [], wireVARIANTStr, size_is=lambda pkt: pkt.cArgs, ptr_lvl=1
            )
        ),
        NDRFullEmbPointerField(
            NDRConfFieldListField(
                "rgdispidNamedArgs",
                [],
                NDRSignedIntField("", 0),
                size_is=lambda pkt: pkt.cNamedArgs,
            )
        ),
        NDRIntField("cArgs", None, size_of="rgvarg"),
        NDRIntField("cNamedArgs", None, size_of="rgdispidNamedArgs"),
    ]


class EXCEPINFO(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRShortField("wCode", 0),
        NDRShortField("wReserved", 0),
        NDRFullEmbPointerField(
            NDRPacketField("bstrSource", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
        ),
        NDRFullEmbPointerField(
            NDRPacketField("bstrDescription", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
        ),
        NDRFullEmbPointerField(
            NDRPacketField("bstrHelpFile", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
        ),
        NDRIntField("dwHelpContext", 0),
        NDRInt3264Field("pvReserved", 0),
        NDRInt3264Field("pfnDeferredFillIn", 0),
        NDRSignedIntField("scode", 0),
    ]


class Invoke_Request(NDRPacket):
    fields_desc = [
        NDRSignedIntField("dispIdMember", 0),
        NDRPacketField("riid", GUID(), GUID),
        NDRIntField("lcid", 0),
        NDRIntField("dwFlags", 0),
        NDRPacketField("pDispParams", DISPPARAMS(), DISPPARAMS),
        NDRIntField("cVarRef", None, size_of="rgVarRef"),
        NDRConfFieldListField(
            "rgVarRefIdx", [], NDRIntField("", 0), size_is=lambda pkt: pkt.cVarRef
        ),
        NDRConfPacketListField(
            "rgVarRef", [], wireVARIANTStr, size_is=lambda pkt: pkt.cVarRef, ptr_lvl=1
        ),
    ]


class Invoke_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRFullPointerField(
                NDRPacketField("pVarResult", wireVARIANTStr(), wireVARIANTStr)
            )
        ),
        NDRPacketField("pExcepInfo", EXCEPINFO(), EXCEPINFO),
        NDRIntField("pArgErr", 0),
        NDRConfPacketListField(
            "rgVarRef", [], wireVARIANTStr, size_is=lambda pkt: pkt.cVarRef, ptr_lvl=1
        ),
        NDRIntField("status", 0),
    ]


IDISPATCH_OPNUMS = {  # 0: Opnum0NotUsedOnWire,
    # 1: Opnum1NotUsedOnWire,
    # 2: Opnum2NotUsedOnWire,
    3: DceRpcOp(GetTypeInfoCount_Request, GetTypeInfoCount_Response),
    4: DceRpcOp(GetTypeInfo_Request, GetTypeInfo_Response),
    5: DceRpcOp(GetIDsOfNames_Request, GetIDsOfNames_Response),
    6: DceRpcOp(Invoke_Request, Invoke_Response),
}
register_com_interface(
    name="IDispatch",
    uuid=uuid.UUID("00020400-0000-0000-C000-000000000046"),
    opnums=IDISPATCH_OPNUMS,
)


class get_IEventObjectCollection__NewEnum_Request(NDRPacket):
    fields_desc = []


class get_IEventObjectCollection__NewEnum_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("ppUnkEnum", MInterfacePointer(), MInterfacePointer)
        ),
        NDRIntField("status", 0),
    ]


class get_IEventObjectCollection_Item_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("objectID", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
        )
    ]


class get_IEventObjectCollection_Item_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRFullPointerField(
                NDRPacketField("pItem", wireVARIANTStr(), wireVARIANTStr)
            )
        ),
        NDRIntField("status", 0),
    ]


class get_IEventObjectCollection_NewEnum_Request(NDRPacket):
    fields_desc = []


class get_IEventObjectCollection_NewEnum_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("ppEnum", MInterfacePointer(), MInterfacePointer)
        ),
        NDRIntField("status", 0),
    ]


class get_IEventObjectCollection_Count_Request(NDRPacket):
    fields_desc = []


class get_IEventObjectCollection_Count_Response(NDRPacket):
    fields_desc = [NDRSignedIntField("pCount", 0), NDRIntField("status", 0)]


class Add_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRFullPointerField(
                NDRPacketField("item", wireVARIANTStr(), wireVARIANTStr)
            )
        ),
        NDRFullPointerField(
            NDRPacketField("objectID", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
        ),
    ]


class Add_Response(NDRPacket):
    fields_desc = [NDRIntField("status", 0)]


class Remove_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("objectID", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
        )
    ]


class Remove_Response(NDRPacket):
    fields_desc = [NDRIntField("status", 0)]


IEVENTOBJECTCOLLECTION_OPNUMS = {  # 0: Opnum0NotUsedOnWire,
    # 1: Opnum1NotUsedOnWire,
    # 2: Opnum2NotUsedOnWire,
    3: DceRpcOp(GetTypeInfoCount_Request, GetTypeInfoCount_Response),
    4: DceRpcOp(GetTypeInfo_Request, GetTypeInfo_Response),
    5: DceRpcOp(GetIDsOfNames_Request, GetIDsOfNames_Response),
    6: DceRpcOp(Invoke_Request, Invoke_Response),
    7: DceRpcOp(
        get_IEventObjectCollection__NewEnum_Request,
        get_IEventObjectCollection__NewEnum_Response,
    ),
    8: DceRpcOp(
        get_IEventObjectCollection_Item_Request,
        get_IEventObjectCollection_Item_Response,
    ),
    9: DceRpcOp(
        get_IEventObjectCollection_NewEnum_Request,
        get_IEventObjectCollection_NewEnum_Response,
    ),
    10: DceRpcOp(
        get_IEventObjectCollection_Count_Request,
        get_IEventObjectCollection_Count_Response,
    ),
    11: DceRpcOp(Add_Request, Add_Response),
    12: DceRpcOp(Remove_Request, Remove_Response),
}
register_com_interface(
    name="IEventObjectCollection",
    uuid=uuid.UUID("f89ac270-d4eb-11d1-b682-00805fc79216"),
    opnums=IEVENTOBJECTCOLLECTION_OPNUMS,
)


class Query_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("progID", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
        ),
        NDRFullPointerField(
            NDRPacketField("queryCriteria", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
        ),
    ]


class Query_Response(NDRPacket):
    fields_desc = [
        NDRSignedIntField("errorIndex", 0),
        NDRFullPointerField(
            NDRPacketField("ppInterface", MInterfacePointer(), MInterfacePointer)
        ),
        NDRIntField("status", 0),
    ]


class Store_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("ProgID", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
        ),
        NDRPacketField("pInterface", MInterfacePointer(), MInterfacePointer),
    ]


class Store_Response(NDRPacket):
    fields_desc = [NDRIntField("status", 0)]


class Remove_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("progID", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
        ),
        NDRFullPointerField(
            NDRPacketField("queryCriteria", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
        ),
    ]


class Remove_Response(NDRPacket):
    fields_desc = [NDRSignedIntField("errorIndex", 0), NDRIntField("status", 0)]


class get_IEventSystem_EventObjectChangeEventClassID_Request(NDRPacket):
    fields_desc = []


class get_IEventSystem_EventObjectChangeEventClassID_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRFullPointerField(
                NDRPacketField(
                    "pbstrEventClassID", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB
                )
            )
        ),
        NDRIntField("status", 0),
    ]


class QueryS_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("progID", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
        ),
        NDRFullPointerField(
            NDRPacketField("queryCriteria", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
        ),
    ]


class QueryS_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("ppInterface", MInterfacePointer(), MInterfacePointer)
        ),
        NDRIntField("status", 0),
    ]


class RemoveS_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("progID", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
        ),
        NDRFullPointerField(
            NDRPacketField("queryCriteria", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
        ),
    ]


class RemoveS_Response(NDRPacket):
    fields_desc = [NDRIntField("status", 0)]


IEVENTSYSTEM_OPNUMS = {  # 0: Opnum0NotUsedOnWire,
    # 1: Opnum1NotUsedOnWire,
    # 2: Opnum2NotUsedOnWire,
    3: DceRpcOp(GetTypeInfoCount_Request, GetTypeInfoCount_Response),
    4: DceRpcOp(GetTypeInfo_Request, GetTypeInfo_Response),
    5: DceRpcOp(GetIDsOfNames_Request, GetIDsOfNames_Response),
    6: DceRpcOp(Invoke_Request, Invoke_Response),
    7: DceRpcOp(Query_Request, Query_Response),
    8: DceRpcOp(Store_Request, Store_Response),
    9: DceRpcOp(Remove_Request, Remove_Response),
    10: DceRpcOp(
        get_IEventSystem_EventObjectChangeEventClassID_Request,
        get_IEventSystem_EventObjectChangeEventClassID_Response,
    ),
    11: DceRpcOp(QueryS_Request, QueryS_Response),
    12: DceRpcOp(RemoveS_Request, RemoveS_Response),
}
register_com_interface(
    name="IEventSystem",
    uuid=uuid.UUID("4E14FB9F-2E22-11D1-9964-00C04FBBB345"),
    opnums=IEVENTSYSTEM_OPNUMS,
)


class get_IEventClass_EventClassID_Request(NDRPacket):
    fields_desc = []


class get_IEventClass_EventClassID_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRFullPointerField(
                NDRPacketField(
                    "pbstrEventClassID", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB
                )
            )
        ),
        NDRIntField("status", 0),
    ]


class put_IEventClass_EventClassID_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("bstrEventClassID", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
        )
    ]


class put_IEventClass_EventClassID_Response(NDRPacket):
    fields_desc = [NDRIntField("status", 0)]


class get_IEventClass_EventClassName_Request(NDRPacket):
    fields_desc = []


class get_IEventClass_EventClassName_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRFullPointerField(
                NDRPacketField(
                    "pbstrEventClassName", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB
                )
            )
        ),
        NDRIntField("status", 0),
    ]


class put_IEventClass_EventClassName_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("bstrEventClassName", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
        )
    ]


class put_IEventClass_EventClassName_Response(NDRPacket):
    fields_desc = [NDRIntField("status", 0)]


class get_IEventClass_OwnerSID_Request(NDRPacket):
    fields_desc = []


class get_IEventClass_OwnerSID_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRFullPointerField(
                NDRPacketField("pbstrOwnerSID", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
            )
        ),
        NDRIntField("status", 0),
    ]


class put_IEventClass_OwnerSID_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("bstrOwnerSID", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
        )
    ]


class put_IEventClass_OwnerSID_Response(NDRPacket):
    fields_desc = [NDRIntField("status", 0)]


class get_IEventClass_FiringInterfaceID_Request(NDRPacket):
    fields_desc = []


class get_IEventClass_FiringInterfaceID_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRFullPointerField(
                NDRPacketField(
                    "pbstrFiringInterfaceID", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB
                )
            )
        ),
        NDRIntField("status", 0),
    ]


class put_IEventClass_FiringInterfaceID_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField(
                "bstrFiringInterfaceID", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB
            )
        )
    ]


class put_IEventClass_FiringInterfaceID_Response(NDRPacket):
    fields_desc = [NDRIntField("status", 0)]


class get_IEventClass_Description_Request(NDRPacket):
    fields_desc = []


class get_IEventClass_Description_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRFullPointerField(
                NDRPacketField(
                    "pbstrDescription", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB
                )
            )
        ),
        NDRIntField("status", 0),
    ]


class put_IEventClass_Description_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("bstrDescription", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
        )
    ]


class put_IEventClass_Description_Response(NDRPacket):
    fields_desc = [NDRIntField("status", 0)]


class get_IEventClass_TypeLib_Request(NDRPacket):
    fields_desc = []


class get_IEventClass_TypeLib_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRFullPointerField(
                NDRPacketField("pbstrTypeLib", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
            )
        ),
        NDRIntField("status", 0),
    ]


class put_IEventClass_TypeLib_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("bstrTypeLib", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
        )
    ]


class put_IEventClass_TypeLib_Response(NDRPacket):
    fields_desc = [NDRIntField("status", 0)]


IEVENTCLASS_OPNUMS = {  # 0: Opnum0NotUsedOnWire,
    # 1: Opnum1NotUsedOnWire,
    # 2: Opnum2NotUsedOnWire,
    3: DceRpcOp(GetTypeInfoCount_Request, GetTypeInfoCount_Response),
    4: DceRpcOp(GetTypeInfo_Request, GetTypeInfo_Response),
    5: DceRpcOp(GetIDsOfNames_Request, GetIDsOfNames_Response),
    6: DceRpcOp(Invoke_Request, Invoke_Response),
    7: DceRpcOp(
        get_IEventClass_EventClassID_Request, get_IEventClass_EventClassID_Response
    ),
    8: DceRpcOp(
        put_IEventClass_EventClassID_Request, put_IEventClass_EventClassID_Response
    ),
    9: DceRpcOp(
        get_IEventClass_EventClassName_Request, get_IEventClass_EventClassName_Response
    ),
    10: DceRpcOp(
        put_IEventClass_EventClassName_Request, put_IEventClass_EventClassName_Response
    ),
    11: DceRpcOp(get_IEventClass_OwnerSID_Request, get_IEventClass_OwnerSID_Response),
    12: DceRpcOp(put_IEventClass_OwnerSID_Request, put_IEventClass_OwnerSID_Response),
    13: DceRpcOp(
        get_IEventClass_FiringInterfaceID_Request,
        get_IEventClass_FiringInterfaceID_Response,
    ),
    14: DceRpcOp(
        put_IEventClass_FiringInterfaceID_Request,
        put_IEventClass_FiringInterfaceID_Response,
    ),
    15: DceRpcOp(
        get_IEventClass_Description_Request, get_IEventClass_Description_Response
    ),
    16: DceRpcOp(
        put_IEventClass_Description_Request, put_IEventClass_Description_Response
    ),
    # 17: Opnum17NotUsedOnWire,
    # 18: Opnum18NotUsedOnWire,
    19: DceRpcOp(get_IEventClass_TypeLib_Request, get_IEventClass_TypeLib_Response),
    20: DceRpcOp(put_IEventClass_TypeLib_Request, put_IEventClass_TypeLib_Response),
}
register_com_interface(
    name="IEventClass",
    uuid=uuid.UUID("fb2b72a0-7a68-11d1-88f9-0080c7d771bf"),
    opnums=IEVENTCLASS_OPNUMS,
)


class get_IEventClass2_PublisherID_Request(NDRPacket):
    fields_desc = []


class get_IEventClass2_PublisherID_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRFullPointerField(
                NDRPacketField(
                    "pbstrPublisherID", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB
                )
            )
        ),
        NDRIntField("status", 0),
    ]


class put_IEventClass2_PublisherID_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("bstrPublisherID", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
        )
    ]


class put_IEventClass2_PublisherID_Response(NDRPacket):
    fields_desc = [NDRIntField("status", 0)]


class get_IEventClass2_MultiInterfacePublisherFilterCLSID_Request(NDRPacket):
    fields_desc = []


class get_IEventClass2_MultiInterfacePublisherFilterCLSID_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRFullPointerField(
                NDRPacketField(
                    "pbstrPubFilCLSID", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB
                )
            )
        ),
        NDRIntField("status", 0),
    ]


class put_IEventClass2_MultiInterfacePublisherFilterCLSID_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("bstrPubFilCLSID", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
        )
    ]


class put_IEventClass2_MultiInterfacePublisherFilterCLSID_Response(NDRPacket):
    fields_desc = [NDRIntField("status", 0)]


class get_IEventClass2_AllowInprocActivation_Request(NDRPacket):
    fields_desc = []


class get_IEventClass2_AllowInprocActivation_Response(NDRPacket):
    fields_desc = [
        NDRSignedIntField("pfAllowInprocActivation", 0),
        NDRIntField("status", 0),
    ]


class put_IEventClass2_AllowInprocActivation_Request(NDRPacket):
    fields_desc = [NDRSignedIntField("fAllowInprocActivation", 0)]


class put_IEventClass2_AllowInprocActivation_Response(NDRPacket):
    fields_desc = [NDRIntField("status", 0)]


class get_IEventClass2_FireInParallel_Request(NDRPacket):
    fields_desc = []


class get_IEventClass2_FireInParallel_Response(NDRPacket):
    fields_desc = [NDRSignedIntField("pfFireInParallel", 0), NDRIntField("status", 0)]


class put_IEventClass2_FireInParallel_Request(NDRPacket):
    fields_desc = [NDRSignedIntField("fFireInParallel", 0)]


class put_IEventClass2_FireInParallel_Response(NDRPacket):
    fields_desc = [NDRIntField("status", 0)]


IEVENTCLASS2_OPNUMS = {  # 0: Opnum0NotUsedOnWire,
    # 1: Opnum1NotUsedOnWire,
    # 2: Opnum2NotUsedOnWire,
    3: DceRpcOp(GetTypeInfoCount_Request, GetTypeInfoCount_Response),
    4: DceRpcOp(GetTypeInfo_Request, GetTypeInfo_Response),
    5: DceRpcOp(GetIDsOfNames_Request, GetIDsOfNames_Response),
    6: DceRpcOp(Invoke_Request, Invoke_Response),
    7: DceRpcOp(
        get_IEventClass_EventClassID_Request, get_IEventClass_EventClassID_Response
    ),
    8: DceRpcOp(
        put_IEventClass_EventClassID_Request, put_IEventClass_EventClassID_Response
    ),
    9: DceRpcOp(
        get_IEventClass_EventClassName_Request, get_IEventClass_EventClassName_Response
    ),
    10: DceRpcOp(
        put_IEventClass_EventClassName_Request, put_IEventClass_EventClassName_Response
    ),
    11: DceRpcOp(get_IEventClass_OwnerSID_Request, get_IEventClass_OwnerSID_Response),
    12: DceRpcOp(put_IEventClass_OwnerSID_Request, put_IEventClass_OwnerSID_Response),
    13: DceRpcOp(
        get_IEventClass_FiringInterfaceID_Request,
        get_IEventClass_FiringInterfaceID_Response,
    ),
    14: DceRpcOp(
        put_IEventClass_FiringInterfaceID_Request,
        put_IEventClass_FiringInterfaceID_Response,
    ),
    15: DceRpcOp(
        get_IEventClass_Description_Request, get_IEventClass_Description_Response
    ),
    16: DceRpcOp(
        put_IEventClass_Description_Request, put_IEventClass_Description_Response
    ),
    # 17: Opnum17NotUsedOnWire,
    # 18: Opnum18NotUsedOnWire,
    19: DceRpcOp(get_IEventClass_TypeLib_Request, get_IEventClass_TypeLib_Response),
    20: DceRpcOp(put_IEventClass_TypeLib_Request, put_IEventClass_TypeLib_Response),
    21: DceRpcOp(
        get_IEventClass2_PublisherID_Request, get_IEventClass2_PublisherID_Response
    ),
    22: DceRpcOp(
        put_IEventClass2_PublisherID_Request, put_IEventClass2_PublisherID_Response
    ),
    23: DceRpcOp(
        get_IEventClass2_MultiInterfacePublisherFilterCLSID_Request,
        get_IEventClass2_MultiInterfacePublisherFilterCLSID_Response,
    ),
    24: DceRpcOp(
        put_IEventClass2_MultiInterfacePublisherFilterCLSID_Request,
        put_IEventClass2_MultiInterfacePublisherFilterCLSID_Response,
    ),
    25: DceRpcOp(
        get_IEventClass2_AllowInprocActivation_Request,
        get_IEventClass2_AllowInprocActivation_Response,
    ),
    26: DceRpcOp(
        put_IEventClass2_AllowInprocActivation_Request,
        put_IEventClass2_AllowInprocActivation_Response,
    ),
    27: DceRpcOp(
        get_IEventClass2_FireInParallel_Request,
        get_IEventClass2_FireInParallel_Response,
    ),
    28: DceRpcOp(
        put_IEventClass2_FireInParallel_Request,
        put_IEventClass2_FireInParallel_Response,
    ),
}
register_com_interface(
    name="IEventClass2",
    uuid=uuid.UUID("fb2b72a1-7a68-11d1-88f9-0080c7d771bf"),
    opnums=IEVENTCLASS2_OPNUMS,
)


class Clone_Request(NDRPacket):
    fields_desc = []


class Clone_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("ppInterface", MInterfacePointer(), MInterfacePointer)
        ),
        NDRIntField("status", 0),
    ]


class Next_Request(NDRPacket):
    fields_desc = [NDRIntField("cReqElem", 0)]


class Next_Response(NDRPacket):
    fields_desc = [
        NDRConfVarPacketListField(
            "ppInterface",
            [],
            MInterfacePointer,
            size_is=lambda pkt: pkt.cReqElem,
            length_is=lambda pkt: pkt.cRetElem,
            ptr_lvl=1,
        ),
        NDRIntField("cRetElem", None, size_of="ppInterface"),
        NDRIntField("status", 0),
    ]


class Reset_Request(NDRPacket):
    fields_desc = []


class Reset_Response(NDRPacket):
    fields_desc = [NDRIntField("status", 0)]


class Skip_Request(NDRPacket):
    fields_desc = [NDRIntField("cSkipElem", 0)]


class Skip_Response(NDRPacket):
    fields_desc = [NDRIntField("status", 0)]


IENUMEVENTOBJECT_OPNUMS = {  # 0: Opnum0NotUsedOnWire,
    # 1: Opnum1NotUsedOnWire,
    # 2: Opnum2NotUsedOnWire,
    3: DceRpcOp(Clone_Request, Clone_Response),
    4: DceRpcOp(Next_Request, Next_Response),
    5: DceRpcOp(Reset_Request, Reset_Response),
    6: DceRpcOp(Skip_Request, Skip_Response),
}
register_com_interface(
    name="IEnumEventObject",
    uuid=uuid.UUID("F4A07D63-2E25-11D1-9964-00C04FBBB345"),
    opnums=IENUMEVENTOBJECT_OPNUMS,
)


class get_IEventSubscription_SubscriptionID_Request(NDRPacket):
    fields_desc = []


class get_IEventSubscription_SubscriptionID_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRFullPointerField(
                NDRPacketField(
                    "pbstrSubscriptionID", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB
                )
            )
        ),
        NDRIntField("status", 0),
    ]


class put_IEventSubscription_SubscriptionID_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("bstrSubscriptionID", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
        )
    ]


class put_IEventSubscription_SubscriptionID_Response(NDRPacket):
    fields_desc = [NDRIntField("status", 0)]


class get_IEventSubscription_SubscriptionName_Request(NDRPacket):
    fields_desc = []


class get_IEventSubscription_SubscriptionName_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRFullPointerField(
                NDRPacketField(
                    "pbstrSubscriptionName", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB
                )
            )
        ),
        NDRIntField("status", 0),
    ]


class put_IEventSubscription_SubscriptionName_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField(
                "bstrSubscriptionName", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB
            )
        )
    ]


class put_IEventSubscription_SubscriptionName_Response(NDRPacket):
    fields_desc = [NDRIntField("status", 0)]


class get_IEventSubscription_PublisherID_Request(NDRPacket):
    fields_desc = []


class get_IEventSubscription_PublisherID_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRFullPointerField(
                NDRPacketField(
                    "pbstrPublisherID", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB
                )
            )
        ),
        NDRIntField("status", 0),
    ]


class put_IEventSubscription_PublisherID_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("bstrPublisherID", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
        )
    ]


class put_IEventSubscription_PublisherID_Response(NDRPacket):
    fields_desc = [NDRIntField("status", 0)]


class get_IEventSubscription_EventClassID_Request(NDRPacket):
    fields_desc = []


class get_IEventSubscription_EventClassID_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRFullPointerField(
                NDRPacketField(
                    "pbstrEventClassID", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB
                )
            )
        ),
        NDRIntField("status", 0),
    ]


class put_IEventSubscription_EventClassID_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("bstrEventClassID", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
        )
    ]


class put_IEventSubscription_EventClassID_Response(NDRPacket):
    fields_desc = [NDRIntField("status", 0)]


class get_IEventSubscription_MethodName_Request(NDRPacket):
    fields_desc = []


class get_IEventSubscription_MethodName_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRFullPointerField(
                NDRPacketField(
                    "pbstrMethodName", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB
                )
            )
        ),
        NDRIntField("status", 0),
    ]


class put_IEventSubscription_MethodName_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("bstrMethodName", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
        )
    ]


class put_IEventSubscription_MethodName_Response(NDRPacket):
    fields_desc = [NDRIntField("status", 0)]


class get_IEventSubscription_SubscriberCLSID_Request(NDRPacket):
    fields_desc = []


class get_IEventSubscription_SubscriberCLSID_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRFullPointerField(
                NDRPacketField(
                    "pbstrSubscriberCLSID", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB
                )
            )
        ),
        NDRIntField("status", 0),
    ]


class put_IEventSubscription_SubscriberCLSID_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField(
                "bstrSubscriberCLSID", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB
            )
        )
    ]


class put_IEventSubscription_SubscriberCLSID_Response(NDRPacket):
    fields_desc = [NDRIntField("status", 0)]


class get_IEventSubscription_SubscriberInterface_Request(NDRPacket):
    fields_desc = []


class get_IEventSubscription_SubscriberInterface_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField(
                "ppSubscriberInterface", MInterfacePointer(), MInterfacePointer
            )
        ),
        NDRIntField("status", 0),
    ]


class put_IEventSubscription_SubscriberInterface_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("pSubscriberInterface", MInterfacePointer(), MInterfacePointer)
    ]


class put_IEventSubscription_SubscriberInterface_Response(NDRPacket):
    fields_desc = [NDRIntField("status", 0)]


class get_IEventSubscription_PerUser_Request(NDRPacket):
    fields_desc = []


class get_IEventSubscription_PerUser_Response(NDRPacket):
    fields_desc = [NDRSignedIntField("pfPerUser", 0), NDRIntField("status", 0)]


class put_IEventSubscription_PerUser_Request(NDRPacket):
    fields_desc = [NDRSignedIntField("fPerUser", 0)]


class put_IEventSubscription_PerUser_Response(NDRPacket):
    fields_desc = [NDRIntField("status", 0)]


class get_IEventSubscription_OwnerSID_Request(NDRPacket):
    fields_desc = []


class get_IEventSubscription_OwnerSID_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRFullPointerField(
                NDRPacketField("pbstrOwnerSID", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
            )
        ),
        NDRIntField("status", 0),
    ]


class put_IEventSubscription_OwnerSID_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("bstrOwnerSID", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
        )
    ]


class put_IEventSubscription_OwnerSID_Response(NDRPacket):
    fields_desc = [NDRIntField("status", 0)]


class get_IEventSubscription_Enabled_Request(NDRPacket):
    fields_desc = []


class get_IEventSubscription_Enabled_Response(NDRPacket):
    fields_desc = [NDRSignedIntField("pfEnabled", 0), NDRIntField("status", 0)]


class put_IEventSubscription_Enabled_Request(NDRPacket):
    fields_desc = [NDRSignedIntField("fEnabled", 0)]


class put_IEventSubscription_Enabled_Response(NDRPacket):
    fields_desc = [NDRIntField("status", 0)]


class get_IEventSubscription_Description_Request(NDRPacket):
    fields_desc = []


class get_IEventSubscription_Description_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRFullPointerField(
                NDRPacketField(
                    "pbstrDescription", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB
                )
            )
        ),
        NDRIntField("status", 0),
    ]


class put_IEventSubscription_Description_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("bstrDescription", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
        )
    ]


class put_IEventSubscription_Description_Response(NDRPacket):
    fields_desc = [NDRIntField("status", 0)]


class get_IEventSubscription_MachineName_Request(NDRPacket):
    fields_desc = []


class get_IEventSubscription_MachineName_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRFullPointerField(
                NDRPacketField(
                    "pbstrMachineName", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB
                )
            )
        ),
        NDRIntField("status", 0),
    ]


class put_IEventSubscription_MachineName_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("bstrMachineName", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
        )
    ]


class put_IEventSubscription_MachineName_Response(NDRPacket):
    fields_desc = [NDRIntField("status", 0)]


class GetPublisherProperty_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("bstrPropertyName", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
        )
    ]


class GetPublisherProperty_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRFullPointerField(
                NDRPacketField("propertyValue", wireVARIANTStr(), wireVARIANTStr)
            )
        ),
        NDRIntField("status", 0),
    ]


class PutPublisherProperty_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("bstrPropertyName", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
        ),
        NDRFullPointerField(
            NDRFullPointerField(
                NDRPacketField("propertyValue", wireVARIANTStr(), wireVARIANTStr)
            )
        ),
    ]


class PutPublisherProperty_Response(NDRPacket):
    fields_desc = [NDRIntField("status", 0)]


class RemovePublisherProperty_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("bstrPropertyName", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
        )
    ]


class RemovePublisherProperty_Response(NDRPacket):
    fields_desc = [NDRIntField("status", 0)]


class GetPublisherPropertyCollection_Request(NDRPacket):
    fields_desc = []


class GetPublisherPropertyCollection_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("collection", MInterfacePointer(), MInterfacePointer)
        ),
        NDRIntField("status", 0),
    ]


class GetSubscriberProperty_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("bstrPropertyName", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
        )
    ]


class GetSubscriberProperty_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRFullPointerField(
                NDRPacketField("propertyValue", wireVARIANTStr(), wireVARIANTStr)
            )
        ),
        NDRIntField("status", 0),
    ]


class PutSubscriberProperty_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("bstrPropertyName", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
        ),
        NDRFullPointerField(
            NDRFullPointerField(
                NDRPacketField("propertyValue", wireVARIANTStr(), wireVARIANTStr)
            )
        ),
    ]


class PutSubscriberProperty_Response(NDRPacket):
    fields_desc = [NDRIntField("status", 0)]


class RemoveSubscriberProperty_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("bstrPropertyName", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
        )
    ]


class RemoveSubscriberProperty_Response(NDRPacket):
    fields_desc = [NDRIntField("status", 0)]


class GetSubscriberPropertyCollection_Request(NDRPacket):
    fields_desc = []


class GetSubscriberPropertyCollection_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("collection", MInterfacePointer(), MInterfacePointer)
        ),
        NDRIntField("status", 0),
    ]


class get_IEventSubscription_InterfaceID_Request(NDRPacket):
    fields_desc = []


class get_IEventSubscription_InterfaceID_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRFullPointerField(
                NDRPacketField(
                    "pbstrInterfaceID", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB
                )
            )
        ),
        NDRIntField("status", 0),
    ]


class put_IEventSubscription_InterfaceID_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("bstrInterfaceID", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
        )
    ]


class put_IEventSubscription_InterfaceID_Response(NDRPacket):
    fields_desc = [NDRIntField("status", 0)]


IEVENTSUBSCRIPTION_OPNUMS = {  # 0: Opnum0NotUsedOnWire,
    # 1: Opnum1NotUsedOnWire,
    # 2: Opnum2NotUsedOnWire,
    3: DceRpcOp(GetTypeInfoCount_Request, GetTypeInfoCount_Response),
    4: DceRpcOp(GetTypeInfo_Request, GetTypeInfo_Response),
    5: DceRpcOp(GetIDsOfNames_Request, GetIDsOfNames_Response),
    6: DceRpcOp(Invoke_Request, Invoke_Response),
    7: DceRpcOp(
        get_IEventSubscription_SubscriptionID_Request,
        get_IEventSubscription_SubscriptionID_Response,
    ),
    8: DceRpcOp(
        put_IEventSubscription_SubscriptionID_Request,
        put_IEventSubscription_SubscriptionID_Response,
    ),
    9: DceRpcOp(
        get_IEventSubscription_SubscriptionName_Request,
        get_IEventSubscription_SubscriptionName_Response,
    ),
    10: DceRpcOp(
        put_IEventSubscription_SubscriptionName_Request,
        put_IEventSubscription_SubscriptionName_Response,
    ),
    11: DceRpcOp(
        get_IEventSubscription_PublisherID_Request,
        get_IEventSubscription_PublisherID_Response,
    ),
    12: DceRpcOp(
        put_IEventSubscription_PublisherID_Request,
        put_IEventSubscription_PublisherID_Response,
    ),
    13: DceRpcOp(
        get_IEventSubscription_EventClassID_Request,
        get_IEventSubscription_EventClassID_Response,
    ),
    14: DceRpcOp(
        put_IEventSubscription_EventClassID_Request,
        put_IEventSubscription_EventClassID_Response,
    ),
    15: DceRpcOp(
        get_IEventSubscription_MethodName_Request,
        get_IEventSubscription_MethodName_Response,
    ),
    16: DceRpcOp(
        put_IEventSubscription_MethodName_Request,
        put_IEventSubscription_MethodName_Response,
    ),
    17: DceRpcOp(
        get_IEventSubscription_SubscriberCLSID_Request,
        get_IEventSubscription_SubscriberCLSID_Response,
    ),
    18: DceRpcOp(
        put_IEventSubscription_SubscriberCLSID_Request,
        put_IEventSubscription_SubscriberCLSID_Response,
    ),
    19: DceRpcOp(
        get_IEventSubscription_SubscriberInterface_Request,
        get_IEventSubscription_SubscriberInterface_Response,
    ),
    20: DceRpcOp(
        put_IEventSubscription_SubscriberInterface_Request,
        put_IEventSubscription_SubscriberInterface_Response,
    ),
    21: DceRpcOp(
        get_IEventSubscription_PerUser_Request, get_IEventSubscription_PerUser_Response
    ),
    22: DceRpcOp(
        put_IEventSubscription_PerUser_Request, put_IEventSubscription_PerUser_Response
    ),
    23: DceRpcOp(
        get_IEventSubscription_OwnerSID_Request,
        get_IEventSubscription_OwnerSID_Response,
    ),
    24: DceRpcOp(
        put_IEventSubscription_OwnerSID_Request,
        put_IEventSubscription_OwnerSID_Response,
    ),
    25: DceRpcOp(
        get_IEventSubscription_Enabled_Request, get_IEventSubscription_Enabled_Response
    ),
    26: DceRpcOp(
        put_IEventSubscription_Enabled_Request, put_IEventSubscription_Enabled_Response
    ),
    27: DceRpcOp(
        get_IEventSubscription_Description_Request,
        get_IEventSubscription_Description_Response,
    ),
    28: DceRpcOp(
        put_IEventSubscription_Description_Request,
        put_IEventSubscription_Description_Response,
    ),
    29: DceRpcOp(
        get_IEventSubscription_MachineName_Request,
        get_IEventSubscription_MachineName_Response,
    ),
    30: DceRpcOp(
        put_IEventSubscription_MachineName_Request,
        put_IEventSubscription_MachineName_Response,
    ),
    31: DceRpcOp(GetPublisherProperty_Request, GetPublisherProperty_Response),
    32: DceRpcOp(PutPublisherProperty_Request, PutPublisherProperty_Response),
    33: DceRpcOp(RemovePublisherProperty_Request, RemovePublisherProperty_Response),
    34: DceRpcOp(
        GetPublisherPropertyCollection_Request, GetPublisherPropertyCollection_Response
    ),
    35: DceRpcOp(GetSubscriberProperty_Request, GetSubscriberProperty_Response),
    36: DceRpcOp(PutSubscriberProperty_Request, PutSubscriberProperty_Response),
    37: DceRpcOp(RemoveSubscriberProperty_Request, RemoveSubscriberProperty_Response),
    38: DceRpcOp(
        GetSubscriberPropertyCollection_Request,
        GetSubscriberPropertyCollection_Response,
    ),
    39: DceRpcOp(
        get_IEventSubscription_InterfaceID_Request,
        get_IEventSubscription_InterfaceID_Response,
    ),
    40: DceRpcOp(
        put_IEventSubscription_InterfaceID_Request,
        put_IEventSubscription_InterfaceID_Response,
    ),
}
register_com_interface(
    name="IEventSubscription",
    uuid=uuid.UUID("4A6B0E15-2E38-11D1-9965-00C04FBBB345"),
    opnums=IEVENTSUBSCRIPTION_OPNUMS,
)


class get_IEventSubscription2_FilterCriteria_Request(NDRPacket):
    fields_desc = []


class get_IEventSubscription2_FilterCriteria_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRFullPointerField(
                NDRPacketField(
                    "pbstrFilterCriteria", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB
                )
            )
        ),
        NDRIntField("status", 0),
    ]


class put_IEventSubscription2_FilterCriteria_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("bstrFilterCriteria", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
        )
    ]


class put_IEventSubscription2_FilterCriteria_Response(NDRPacket):
    fields_desc = [NDRIntField("status", 0)]


class get_IEventSubscription2_SubscriberMoniker_Request(NDRPacket):
    fields_desc = []


class get_IEventSubscription2_SubscriberMoniker_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRFullPointerField(
                NDRPacketField("pbstrMoniker", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
            )
        ),
        NDRIntField("status", 0),
    ]


class put_IEventSubscription2_SubscriberMoniker_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("bstrMoniker", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
        )
    ]


class put_IEventSubscription2_SubscriberMoniker_Response(NDRPacket):
    fields_desc = [NDRIntField("status", 0)]


IEVENTSUBSCRIPTION2_OPNUMS = {  # 0: Opnum0NotUsedOnWire,
    # 1: Opnum1NotUsedOnWire,
    # 2: Opnum2NotUsedOnWire,
    3: DceRpcOp(GetTypeInfoCount_Request, GetTypeInfoCount_Response),
    4: DceRpcOp(GetTypeInfo_Request, GetTypeInfo_Response),
    5: DceRpcOp(GetIDsOfNames_Request, GetIDsOfNames_Response),
    6: DceRpcOp(Invoke_Request, Invoke_Response),
    7: DceRpcOp(
        get_IEventSubscription_SubscriptionID_Request,
        get_IEventSubscription_SubscriptionID_Response,
    ),
    8: DceRpcOp(
        put_IEventSubscription_SubscriptionID_Request,
        put_IEventSubscription_SubscriptionID_Response,
    ),
    9: DceRpcOp(
        get_IEventSubscription_SubscriptionName_Request,
        get_IEventSubscription_SubscriptionName_Response,
    ),
    10: DceRpcOp(
        put_IEventSubscription_SubscriptionName_Request,
        put_IEventSubscription_SubscriptionName_Response,
    ),
    11: DceRpcOp(
        get_IEventSubscription_PublisherID_Request,
        get_IEventSubscription_PublisherID_Response,
    ),
    12: DceRpcOp(
        put_IEventSubscription_PublisherID_Request,
        put_IEventSubscription_PublisherID_Response,
    ),
    13: DceRpcOp(
        get_IEventSubscription_EventClassID_Request,
        get_IEventSubscription_EventClassID_Response,
    ),
    14: DceRpcOp(
        put_IEventSubscription_EventClassID_Request,
        put_IEventSubscription_EventClassID_Response,
    ),
    15: DceRpcOp(
        get_IEventSubscription_MethodName_Request,
        get_IEventSubscription_MethodName_Response,
    ),
    16: DceRpcOp(
        put_IEventSubscription_MethodName_Request,
        put_IEventSubscription_MethodName_Response,
    ),
    17: DceRpcOp(
        get_IEventSubscription_SubscriberCLSID_Request,
        get_IEventSubscription_SubscriberCLSID_Response,
    ),
    18: DceRpcOp(
        put_IEventSubscription_SubscriberCLSID_Request,
        put_IEventSubscription_SubscriberCLSID_Response,
    ),
    19: DceRpcOp(
        get_IEventSubscription_SubscriberInterface_Request,
        get_IEventSubscription_SubscriberInterface_Response,
    ),
    20: DceRpcOp(
        put_IEventSubscription_SubscriberInterface_Request,
        put_IEventSubscription_SubscriberInterface_Response,
    ),
    21: DceRpcOp(
        get_IEventSubscription_PerUser_Request, get_IEventSubscription_PerUser_Response
    ),
    22: DceRpcOp(
        put_IEventSubscription_PerUser_Request, put_IEventSubscription_PerUser_Response
    ),
    23: DceRpcOp(
        get_IEventSubscription_OwnerSID_Request,
        get_IEventSubscription_OwnerSID_Response,
    ),
    24: DceRpcOp(
        put_IEventSubscription_OwnerSID_Request,
        put_IEventSubscription_OwnerSID_Response,
    ),
    25: DceRpcOp(
        get_IEventSubscription_Enabled_Request, get_IEventSubscription_Enabled_Response
    ),
    26: DceRpcOp(
        put_IEventSubscription_Enabled_Request, put_IEventSubscription_Enabled_Response
    ),
    27: DceRpcOp(
        get_IEventSubscription_Description_Request,
        get_IEventSubscription_Description_Response,
    ),
    28: DceRpcOp(
        put_IEventSubscription_Description_Request,
        put_IEventSubscription_Description_Response,
    ),
    29: DceRpcOp(
        get_IEventSubscription_MachineName_Request,
        get_IEventSubscription_MachineName_Response,
    ),
    30: DceRpcOp(
        put_IEventSubscription_MachineName_Request,
        put_IEventSubscription_MachineName_Response,
    ),
    31: DceRpcOp(GetPublisherProperty_Request, GetPublisherProperty_Response),
    32: DceRpcOp(PutPublisherProperty_Request, PutPublisherProperty_Response),
    33: DceRpcOp(RemovePublisherProperty_Request, RemovePublisherProperty_Response),
    34: DceRpcOp(
        GetPublisherPropertyCollection_Request, GetPublisherPropertyCollection_Response
    ),
    35: DceRpcOp(GetSubscriberProperty_Request, GetSubscriberProperty_Response),
    36: DceRpcOp(PutSubscriberProperty_Request, PutSubscriberProperty_Response),
    37: DceRpcOp(RemoveSubscriberProperty_Request, RemoveSubscriberProperty_Response),
    38: DceRpcOp(
        GetSubscriberPropertyCollection_Request,
        GetSubscriberPropertyCollection_Response,
    ),
    39: DceRpcOp(
        get_IEventSubscription_InterfaceID_Request,
        get_IEventSubscription_InterfaceID_Response,
    ),
    40: DceRpcOp(
        put_IEventSubscription_InterfaceID_Request,
        put_IEventSubscription_InterfaceID_Response,
    ),
    41: DceRpcOp(
        get_IEventSubscription2_FilterCriteria_Request,
        get_IEventSubscription2_FilterCriteria_Response,
    ),
    42: DceRpcOp(
        put_IEventSubscription2_FilterCriteria_Request,
        put_IEventSubscription2_FilterCriteria_Response,
    ),
    43: DceRpcOp(
        get_IEventSubscription2_SubscriberMoniker_Request,
        get_IEventSubscription2_SubscriberMoniker_Response,
    ),
    44: DceRpcOp(
        put_IEventSubscription2_SubscriberMoniker_Request,
        put_IEventSubscription2_SubscriberMoniker_Response,
    ),
}
register_com_interface(
    name="IEventSubscription2",
    uuid=uuid.UUID("4A6B0E16-2E38-11D1-9965-00C04FBBB345"),
    opnums=IEVENTSUBSCRIPTION2_OPNUMS,
)


class get_IEventClass3_EventClassPartitionID_Request(NDRPacket):
    fields_desc = []


class get_IEventClass3_EventClassPartitionID_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRFullPointerField(
                NDRPacketField(
                    "pbstrEventClassPartitionID", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB
                )
            )
        ),
        NDRIntField("status", 0),
    ]


class put_IEventClass3_EventClassPartitionID_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField(
                "bstrEventClassPartitionID", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB
            )
        )
    ]


class put_IEventClass3_EventClassPartitionID_Response(NDRPacket):
    fields_desc = [NDRIntField("status", 0)]


class get_IEventClass3_EventClassApplicationID_Request(NDRPacket):
    fields_desc = []


class get_IEventClass3_EventClassApplicationID_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRFullPointerField(
                NDRPacketField(
                    "pbstrEventClassApplicationID",
                    FLAGGED_WORD_BLOB(),
                    FLAGGED_WORD_BLOB,
                )
            )
        ),
        NDRIntField("status", 0),
    ]


class put_IEventClass3_EventClassApplicationID_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField(
                "bstrEventClassApplicationID", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB
            )
        )
    ]


class put_IEventClass3_EventClassApplicationID_Response(NDRPacket):
    fields_desc = [NDRIntField("status", 0)]


IEVENTCLASS3_OPNUMS = {  # 0: Opnum0NotUsedOnWire,
    # 1: Opnum1NotUsedOnWire,
    # 2: Opnum2NotUsedOnWire,
    3: DceRpcOp(GetTypeInfoCount_Request, GetTypeInfoCount_Response),
    4: DceRpcOp(GetTypeInfo_Request, GetTypeInfo_Response),
    5: DceRpcOp(GetIDsOfNames_Request, GetIDsOfNames_Response),
    6: DceRpcOp(Invoke_Request, Invoke_Response),
    7: DceRpcOp(
        get_IEventClass_EventClassID_Request, get_IEventClass_EventClassID_Response
    ),
    8: DceRpcOp(
        put_IEventClass_EventClassID_Request, put_IEventClass_EventClassID_Response
    ),
    9: DceRpcOp(
        get_IEventClass_EventClassName_Request, get_IEventClass_EventClassName_Response
    ),
    10: DceRpcOp(
        put_IEventClass_EventClassName_Request, put_IEventClass_EventClassName_Response
    ),
    11: DceRpcOp(get_IEventClass_OwnerSID_Request, get_IEventClass_OwnerSID_Response),
    12: DceRpcOp(put_IEventClass_OwnerSID_Request, put_IEventClass_OwnerSID_Response),
    13: DceRpcOp(
        get_IEventClass_FiringInterfaceID_Request,
        get_IEventClass_FiringInterfaceID_Response,
    ),
    14: DceRpcOp(
        put_IEventClass_FiringInterfaceID_Request,
        put_IEventClass_FiringInterfaceID_Response,
    ),
    15: DceRpcOp(
        get_IEventClass_Description_Request, get_IEventClass_Description_Response
    ),
    16: DceRpcOp(
        put_IEventClass_Description_Request, put_IEventClass_Description_Response
    ),
    # 17: Opnum17NotUsedOnWire,
    # 18: Opnum18NotUsedOnWire,
    19: DceRpcOp(get_IEventClass_TypeLib_Request, get_IEventClass_TypeLib_Response),
    20: DceRpcOp(put_IEventClass_TypeLib_Request, put_IEventClass_TypeLib_Response),
    21: DceRpcOp(
        get_IEventClass2_PublisherID_Request, get_IEventClass2_PublisherID_Response
    ),
    22: DceRpcOp(
        put_IEventClass2_PublisherID_Request, put_IEventClass2_PublisherID_Response
    ),
    23: DceRpcOp(
        get_IEventClass2_MultiInterfacePublisherFilterCLSID_Request,
        get_IEventClass2_MultiInterfacePublisherFilterCLSID_Response,
    ),
    24: DceRpcOp(
        put_IEventClass2_MultiInterfacePublisherFilterCLSID_Request,
        put_IEventClass2_MultiInterfacePublisherFilterCLSID_Response,
    ),
    25: DceRpcOp(
        get_IEventClass2_AllowInprocActivation_Request,
        get_IEventClass2_AllowInprocActivation_Response,
    ),
    26: DceRpcOp(
        put_IEventClass2_AllowInprocActivation_Request,
        put_IEventClass2_AllowInprocActivation_Response,
    ),
    27: DceRpcOp(
        get_IEventClass2_FireInParallel_Request,
        get_IEventClass2_FireInParallel_Response,
    ),
    28: DceRpcOp(
        put_IEventClass2_FireInParallel_Request,
        put_IEventClass2_FireInParallel_Response,
    ),
    29: DceRpcOp(
        get_IEventClass3_EventClassPartitionID_Request,
        get_IEventClass3_EventClassPartitionID_Response,
    ),
    30: DceRpcOp(
        put_IEventClass3_EventClassPartitionID_Request,
        put_IEventClass3_EventClassPartitionID_Response,
    ),
    31: DceRpcOp(
        get_IEventClass3_EventClassApplicationID_Request,
        get_IEventClass3_EventClassApplicationID_Response,
    ),
    32: DceRpcOp(
        put_IEventClass3_EventClassApplicationID_Request,
        put_IEventClass3_EventClassApplicationID_Response,
    ),
}
register_com_interface(
    name="IEventClass3",
    uuid=uuid.UUID("7FB7EA43-2D76-4ea8-8CD9-3DECC270295E"),
    opnums=IEVENTCLASS3_OPNUMS,
)


class get_IEventSubscription3_EventClassPartitionID_Request(NDRPacket):
    fields_desc = []


class get_IEventSubscription3_EventClassPartitionID_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRFullPointerField(
                NDRPacketField(
                    "pbstrEventClassPartitionID", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB
                )
            )
        ),
        NDRIntField("status", 0),
    ]


class put_IEventSubscription3_EventClassPartitionID_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField(
                "bstrEventClassPartitionID", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB
            )
        )
    ]


class put_IEventSubscription3_EventClassPartitionID_Response(NDRPacket):
    fields_desc = [NDRIntField("status", 0)]


class get_IEventSubscription3_EventClassApplicationID_Request(NDRPacket):
    fields_desc = []


class get_IEventSubscription3_EventClassApplicationID_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRFullPointerField(
                NDRPacketField(
                    "pbstrEventClassApplicationID",
                    FLAGGED_WORD_BLOB(),
                    FLAGGED_WORD_BLOB,
                )
            )
        ),
        NDRIntField("status", 0),
    ]


class put_IEventSubscription3_EventClassApplicationID_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField(
                "bstrEventClassApplicationID", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB
            )
        )
    ]


class put_IEventSubscription3_EventClassApplicationID_Response(NDRPacket):
    fields_desc = [NDRIntField("status", 0)]


class get_IEventSubscription3_SubscriberPartitionID_Request(NDRPacket):
    fields_desc = []


class get_IEventSubscription3_SubscriberPartitionID_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRFullPointerField(
                NDRPacketField(
                    "pbstrSubscriberPartitionID", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB
                )
            )
        ),
        NDRIntField("status", 0),
    ]


class put_IEventSubscription3_SubscriberPartitionID_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField(
                "bstrSubscriberPartitionID", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB
            )
        )
    ]


class put_IEventSubscription3_SubscriberPartitionID_Response(NDRPacket):
    fields_desc = [NDRIntField("status", 0)]


class get_IEventSubscription3_SubscriberApplicationID_Request(NDRPacket):
    fields_desc = []


class get_IEventSubscription3_SubscriberApplicationID_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRFullPointerField(
                NDRPacketField(
                    "pbstrSubscriberApplicationID",
                    FLAGGED_WORD_BLOB(),
                    FLAGGED_WORD_BLOB,
                )
            )
        ),
        NDRIntField("status", 0),
    ]


class put_IEventSubscription3_SubscriberApplicationID_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField(
                "bstrSubscriberApplicationID", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB
            )
        )
    ]


class put_IEventSubscription3_SubscriberApplicationID_Response(NDRPacket):
    fields_desc = [NDRIntField("status", 0)]


IEVENTSUBSCRIPTION3_OPNUMS = {  # 0: Opnum0NotUsedOnWire,
    # 1: Opnum1NotUsedOnWire,
    # 2: Opnum2NotUsedOnWire,
    3: DceRpcOp(GetTypeInfoCount_Request, GetTypeInfoCount_Response),
    4: DceRpcOp(GetTypeInfo_Request, GetTypeInfo_Response),
    5: DceRpcOp(GetIDsOfNames_Request, GetIDsOfNames_Response),
    6: DceRpcOp(Invoke_Request, Invoke_Response),
    7: DceRpcOp(
        get_IEventSubscription_SubscriptionID_Request,
        get_IEventSubscription_SubscriptionID_Response,
    ),
    8: DceRpcOp(
        put_IEventSubscription_SubscriptionID_Request,
        put_IEventSubscription_SubscriptionID_Response,
    ),
    9: DceRpcOp(
        get_IEventSubscription_SubscriptionName_Request,
        get_IEventSubscription_SubscriptionName_Response,
    ),
    10: DceRpcOp(
        put_IEventSubscription_SubscriptionName_Request,
        put_IEventSubscription_SubscriptionName_Response,
    ),
    11: DceRpcOp(
        get_IEventSubscription_PublisherID_Request,
        get_IEventSubscription_PublisherID_Response,
    ),
    12: DceRpcOp(
        put_IEventSubscription_PublisherID_Request,
        put_IEventSubscription_PublisherID_Response,
    ),
    13: DceRpcOp(
        get_IEventSubscription_EventClassID_Request,
        get_IEventSubscription_EventClassID_Response,
    ),
    14: DceRpcOp(
        put_IEventSubscription_EventClassID_Request,
        put_IEventSubscription_EventClassID_Response,
    ),
    15: DceRpcOp(
        get_IEventSubscription_MethodName_Request,
        get_IEventSubscription_MethodName_Response,
    ),
    16: DceRpcOp(
        put_IEventSubscription_MethodName_Request,
        put_IEventSubscription_MethodName_Response,
    ),
    17: DceRpcOp(
        get_IEventSubscription_SubscriberCLSID_Request,
        get_IEventSubscription_SubscriberCLSID_Response,
    ),
    18: DceRpcOp(
        put_IEventSubscription_SubscriberCLSID_Request,
        put_IEventSubscription_SubscriberCLSID_Response,
    ),
    19: DceRpcOp(
        get_IEventSubscription_SubscriberInterface_Request,
        get_IEventSubscription_SubscriberInterface_Response,
    ),
    20: DceRpcOp(
        put_IEventSubscription_SubscriberInterface_Request,
        put_IEventSubscription_SubscriberInterface_Response,
    ),
    21: DceRpcOp(
        get_IEventSubscription_PerUser_Request, get_IEventSubscription_PerUser_Response
    ),
    22: DceRpcOp(
        put_IEventSubscription_PerUser_Request, put_IEventSubscription_PerUser_Response
    ),
    23: DceRpcOp(
        get_IEventSubscription_OwnerSID_Request,
        get_IEventSubscription_OwnerSID_Response,
    ),
    24: DceRpcOp(
        put_IEventSubscription_OwnerSID_Request,
        put_IEventSubscription_OwnerSID_Response,
    ),
    25: DceRpcOp(
        get_IEventSubscription_Enabled_Request, get_IEventSubscription_Enabled_Response
    ),
    26: DceRpcOp(
        put_IEventSubscription_Enabled_Request, put_IEventSubscription_Enabled_Response
    ),
    27: DceRpcOp(
        get_IEventSubscription_Description_Request,
        get_IEventSubscription_Description_Response,
    ),
    28: DceRpcOp(
        put_IEventSubscription_Description_Request,
        put_IEventSubscription_Description_Response,
    ),
    29: DceRpcOp(
        get_IEventSubscription_MachineName_Request,
        get_IEventSubscription_MachineName_Response,
    ),
    30: DceRpcOp(
        put_IEventSubscription_MachineName_Request,
        put_IEventSubscription_MachineName_Response,
    ),
    31: DceRpcOp(GetPublisherProperty_Request, GetPublisherProperty_Response),
    32: DceRpcOp(PutPublisherProperty_Request, PutPublisherProperty_Response),
    33: DceRpcOp(RemovePublisherProperty_Request, RemovePublisherProperty_Response),
    34: DceRpcOp(
        GetPublisherPropertyCollection_Request, GetPublisherPropertyCollection_Response
    ),
    35: DceRpcOp(GetSubscriberProperty_Request, GetSubscriberProperty_Response),
    36: DceRpcOp(PutSubscriberProperty_Request, PutSubscriberProperty_Response),
    37: DceRpcOp(RemoveSubscriberProperty_Request, RemoveSubscriberProperty_Response),
    38: DceRpcOp(
        GetSubscriberPropertyCollection_Request,
        GetSubscriberPropertyCollection_Response,
    ),
    39: DceRpcOp(
        get_IEventSubscription_InterfaceID_Request,
        get_IEventSubscription_InterfaceID_Response,
    ),
    40: DceRpcOp(
        put_IEventSubscription_InterfaceID_Request,
        put_IEventSubscription_InterfaceID_Response,
    ),
    41: DceRpcOp(
        get_IEventSubscription2_FilterCriteria_Request,
        get_IEventSubscription2_FilterCriteria_Response,
    ),
    42: DceRpcOp(
        put_IEventSubscription2_FilterCriteria_Request,
        put_IEventSubscription2_FilterCriteria_Response,
    ),
    43: DceRpcOp(
        get_IEventSubscription2_SubscriberMoniker_Request,
        get_IEventSubscription2_SubscriberMoniker_Response,
    ),
    44: DceRpcOp(
        put_IEventSubscription2_SubscriberMoniker_Request,
        put_IEventSubscription2_SubscriberMoniker_Response,
    ),
    45: DceRpcOp(
        get_IEventSubscription3_EventClassPartitionID_Request,
        get_IEventSubscription3_EventClassPartitionID_Response,
    ),
    46: DceRpcOp(
        put_IEventSubscription3_EventClassPartitionID_Request,
        put_IEventSubscription3_EventClassPartitionID_Response,
    ),
    47: DceRpcOp(
        get_IEventSubscription3_EventClassApplicationID_Request,
        get_IEventSubscription3_EventClassApplicationID_Response,
    ),
    48: DceRpcOp(
        put_IEventSubscription3_EventClassApplicationID_Request,
        put_IEventSubscription3_EventClassApplicationID_Response,
    ),
    49: DceRpcOp(
        get_IEventSubscription3_SubscriberPartitionID_Request,
        get_IEventSubscription3_SubscriberPartitionID_Response,
    ),
    50: DceRpcOp(
        put_IEventSubscription3_SubscriberPartitionID_Request,
        put_IEventSubscription3_SubscriberPartitionID_Response,
    ),
    51: DceRpcOp(
        get_IEventSubscription3_SubscriberApplicationID_Request,
        get_IEventSubscription3_SubscriberApplicationID_Response,
    ),
    52: DceRpcOp(
        put_IEventSubscription3_SubscriberApplicationID_Request,
        put_IEventSubscription3_SubscriberApplicationID_Response,
    ),
}
register_com_interface(
    name="IEventSubscription3",
    uuid=uuid.UUID("FBC1D17D-C498-43a0-81AF-423DDD530AF6"),
    opnums=IEVENTSUBSCRIPTION3_OPNUMS,
)


class GetVersion_Request(NDRPacket):
    fields_desc = []


class GetVersion_Response(NDRPacket):
    fields_desc = [NDRSignedIntField("pnVersion", 0), NDRIntField("status", 0)]


class VerifyTransientSubscribers_Request(NDRPacket):
    fields_desc = []


class VerifyTransientSubscribers_Response(NDRPacket):
    fields_desc = [NDRIntField("status", 0)]


IEVENTSYSTEM2_OPNUMS = {  # 0: Opnum0NotUsedOnWire,
    # 1: Opnum1NotUsedOnWire,
    # 2: Opnum2NotUsedOnWire,
    3: DceRpcOp(GetTypeInfoCount_Request, GetTypeInfoCount_Response),
    4: DceRpcOp(GetTypeInfo_Request, GetTypeInfo_Response),
    5: DceRpcOp(GetIDsOfNames_Request, GetIDsOfNames_Response),
    6: DceRpcOp(Invoke_Request, Invoke_Response),
    7: DceRpcOp(Query_Request, Query_Response),
    8: DceRpcOp(Store_Request, Store_Response),
    9: DceRpcOp(Remove_Request, Remove_Response),
    10: DceRpcOp(
        get_IEventSystem_EventObjectChangeEventClassID_Request,
        get_IEventSystem_EventObjectChangeEventClassID_Response,
    ),
    11: DceRpcOp(QueryS_Request, QueryS_Response),
    12: DceRpcOp(RemoveS_Request, RemoveS_Response),
    13: DceRpcOp(GetVersion_Request, GetVersion_Response),
    14: DceRpcOp(
        VerifyTransientSubscribers_Request, VerifyTransientSubscribers_Response
    ),
}
register_com_interface(
    name="IEventSystem2",
    uuid=uuid.UUID("99CC098F-A48A-4e9c-8E58-965C0AFC19D5"),
    opnums=IEVENTSYSTEM2_OPNUMS,
)


class SetCOMCatalogBehaviour_Request(NDRPacket):
    fields_desc = [NDRSignedIntField("bRetainSubKeys", 0)]


class SetCOMCatalogBehaviour_Response(NDRPacket):
    fields_desc = [NDRIntField("status", 0)]


IEVENTSYSTEMINITIALIZE_OPNUMS = {  # 0: Opnum0NotUsedOnWire,
    # 1: Opnum1NotUsedOnWire,
    # 2: Opnum2NotUsedOnWire,
    3: DceRpcOp(SetCOMCatalogBehaviour_Request, SetCOMCatalogBehaviour_Response)
}
register_dcerpc_interface(
    name="IEventSystemInitialize",
    uuid=uuid.UUID("a0e8f27a-888c-11d1-b763-00c04fb926af"),
    version="0.0",
    opnums=IEVENTSYSTEMINITIALIZE_OPNUMS,
)
