### ms-oxnspi.idl
"""
RPC definitions for the following interfaces:
- nspi (v56.0): F5CC5A18-4264-101A-8C59-08002B2F8426
This file is auto-generated by midl-to-scapy, do not modify.
"""

import uuid

from scapy.fields import StrFixedLenField
from scapy.layers.dcerpc import (
    NDRPacket,
    DceRpcOp,
    NDRConfFieldListField,
    NDRConfPacketListField,
    NDRConfStrLenField,
    NDRConfStrLenFieldUtf16,
    NDRConfVarFieldListField,
    NDRConfVarStrNullField,
    NDRConfVarStrNullFieldUtf16,
    NDRContextHandle,
    NDRFullPointerField,
    NDRIntField,
    NDRPacketField,
    NDRRecursiveField,
    NDRShortField,
    NDRSignedByteField,
    NDRSignedIntField,
    NDRSignedShortField,
    NDRUnionField,
    register_dcerpc_interface,
)


class STAT(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [
        NDRIntField("SortType", 0),
        NDRIntField("ContainerID", 0),
        NDRIntField("CurrentRec", 0),
        NDRSignedIntField("Delta", 0),
        NDRIntField("NumPos", 0),
        NDRIntField("TotalRecs", 0),
        NDRIntField("CodePage", 0),
        NDRIntField("TemplateLocale", 0),
        NDRIntField("SortLocale", 0),
    ]


class FlatUID_r(NDRPacket):
    fields_desc = [StrFixedLenField("ab", "", length=16)]


class NspiBind_Request(NDRPacket):
    fields_desc = [
        NDRIntField("dwFlags", 0),
        NDRPacketField("pStat", STAT(), STAT),
        NDRFullPointerField(NDRPacketField("pServerGuid", FlatUID_r(), FlatUID_r)),
    ]


class NspiBind_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRPacketField("pServerGuid", FlatUID_r(), FlatUID_r)),
        NDRPacketField("contextHandle", NDRContextHandle(), NDRContextHandle),
        NDRIntField("status", 0),
    ]


class NspiUnbind_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("contextHandle", NDRContextHandle(), NDRContextHandle),
        NDRIntField("Reserved", 0),
    ]


class NspiUnbind_Response(NDRPacket):
    fields_desc = [
        NDRPacketField("contextHandle", NDRContextHandle(), NDRContextHandle),
        NDRIntField("status", 0),
    ]


class NspiUpdateStat_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hRpc", NDRContextHandle(), NDRContextHandle),
        NDRIntField("Reserved", 0),
        NDRPacketField("pStat", STAT(), STAT),
        NDRFullPointerField(NDRSignedIntField("plDelta", 0)),
    ]


class NspiUpdateStat_Response(NDRPacket):
    fields_desc = [
        NDRPacketField("pStat", STAT(), STAT),
        NDRFullPointerField(NDRSignedIntField("plDelta", 0)),
        NDRIntField("status", 0),
    ]


class PropertyTagArray_r(NDRPacket):
    ALIGNMENT = (4, 8)
    DEPORTED_CONFORMANTS = ["aulPropTag"]
    fields_desc = [
        NDRIntField("cValues", None, size_of="aulPropTag"),
        NDRConfVarFieldListField(
            "aulPropTag",
            [],
            NDRIntField("", 0),
            size_is=lambda pkt: (pkt.cValues + 1),
            length_is=lambda pkt: pkt.cValues,
            conformant_in_struct=True,
        ),
    ]


class Binary_r(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("cb", None, size_of="lpb"),
        NDRFullPointerField(
            NDRConfStrLenField("lpb", "", size_is=lambda pkt: pkt.cb), deferred=True
        ),
    ]


class FILETIME(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [NDRIntField("dwLowDateTime", 0), NDRIntField("dwHighDateTime", 0)]


class ShortArray_r(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("cValues", None, size_of="lpi"),
        NDRFullPointerField(
            NDRConfStrLenFieldUtf16("lpi", "", size_is=lambda pkt: pkt.cValues),
            deferred=True,
        ),
    ]


class LongArray_r(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("cValues", None, size_of="lpl"),
        NDRFullPointerField(
            NDRConfFieldListField(
                "lpl", [], NDRSignedIntField("lpl", 0), size_is=lambda pkt: pkt.cValues
            ),
            deferred=True,
        ),
    ]


class StringArray_r(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("cValues", None, size_of="lppszA"),
        NDRFullPointerField(
            NDRConfFieldListField(
                "lppszA",
                [],
                NDRFullPointerField(
                    NDRConfVarStrNullField("lppszA", ""), deferred=True
                ),
                size_is=lambda pkt: pkt.cValues,
            ),
            deferred=True,
        ),
    ]


class BinaryArray_r(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("cValues", None, size_of="lpbin"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "lpbin", [], Binary_r, size_is=lambda pkt: pkt.cValues
            ),
            deferred=True,
        ),
    ]


class FlatUIDArray_r(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("cValues", None, size_of="lpguid"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "lpguid", [], FlatUID_r, size_is=lambda pkt: pkt.cValues, ptr_pack=True
            ),
            deferred=True,
        ),
    ]


class WStringArray_r(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("cValues", None, size_of="lppszW"),
        NDRFullPointerField(
            NDRConfFieldListField(
                "lppszW",
                [],
                NDRFullPointerField(
                    NDRConfVarStrNullFieldUtf16("lppszW", ""), deferred=True
                ),
                size_is=lambda pkt: pkt.cValues,
            ),
            deferred=True,
        ),
    ]


class DateTimeArray_r(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("cValues", None, size_of="lpft"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "lpft", [], FILETIME, size_is=lambda pkt: pkt.cValues
            ),
            deferred=True,
        ),
    ]


class _PropertyValue_r(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("ulPropTag", 0),
        NDRIntField("ulReserved", 0),
        NDRUnionField(
            [
                (
                    NDRSignedShortField("Value", 0),
                    (
                        (
                            lambda pkt: (
                                (getattr(pkt, "ulPropTag", None) & 65535)
                                & 0xFFFFFFFFFFFFFFFF
                            )
                            == 2
                        ),
                        (lambda _, val: val.tag == 2),
                    ),
                ),
                (
                    NDRSignedIntField("Value", 0),
                    (
                        (
                            lambda pkt: (
                                (getattr(pkt, "ulPropTag", None) & 65535)
                                & 0xFFFFFFFFFFFFFFFF
                            )
                            == 3
                        ),
                        (lambda _, val: val.tag == 3),
                    ),
                ),
                (
                    NDRShortField("Value", 0),
                    (
                        (
                            lambda pkt: (
                                (getattr(pkt, "ulPropTag", None) & 65535)
                                & 0xFFFFFFFFFFFFFFFF
                            )
                            == 11
                        ),
                        (lambda _, val: val.tag == 11),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRConfVarStrNullField("Value", ""), deferred=True
                    ),
                    (
                        (
                            lambda pkt: (
                                (getattr(pkt, "ulPropTag", None) & 65535)
                                & 0xFFFFFFFFFFFFFFFF
                            )
                            == 30
                        ),
                        (lambda _, val: val.tag == 30),
                    ),
                ),
                (
                    NDRPacketField("Value", Binary_r(), Binary_r),
                    (
                        (
                            lambda pkt: (
                                (getattr(pkt, "ulPropTag", None) & 65535)
                                & 0xFFFFFFFFFFFFFFFF
                            )
                            == 258
                        ),
                        (lambda _, val: val.tag == 258),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRConfVarStrNullFieldUtf16("Value", ""), deferred=True
                    ),
                    (
                        (
                            lambda pkt: (
                                (getattr(pkt, "ulPropTag", None) & 65535)
                                & 0xFFFFFFFFFFFFFFFF
                            )
                            == 31
                        ),
                        (lambda _, val: val.tag == 31),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField("Value", FlatUID_r(), FlatUID_r), deferred=True
                    ),
                    (
                        (
                            lambda pkt: (
                                (getattr(pkt, "ulPropTag", None) & 65535)
                                & 0xFFFFFFFFFFFFFFFF
                            )
                            == 72
                        ),
                        (lambda _, val: val.tag == 72),
                    ),
                ),
                (
                    NDRPacketField("Value", FILETIME(), FILETIME),
                    (
                        (
                            lambda pkt: (
                                (getattr(pkt, "ulPropTag", None) & 65535)
                                & 0xFFFFFFFFFFFFFFFF
                            )
                            == 64
                        ),
                        (lambda _, val: val.tag == 64),
                    ),
                ),
                (
                    NDRSignedIntField("Value", 0),
                    (
                        (
                            lambda pkt: (
                                (getattr(pkt, "ulPropTag", None) & 65535)
                                & 0xFFFFFFFFFFFFFFFF
                            )
                            == 10
                        ),
                        (lambda _, val: val.tag == 10),
                    ),
                ),
                (
                    NDRPacketField("Value", ShortArray_r(), ShortArray_r),
                    (
                        (
                            lambda pkt: (
                                (getattr(pkt, "ulPropTag", None) & 65535)
                                & 0xFFFFFFFFFFFFFFFF
                            )
                            == 4098
                        ),
                        (lambda _, val: val.tag == 4098),
                    ),
                ),
                (
                    NDRPacketField("Value", LongArray_r(), LongArray_r),
                    (
                        (
                            lambda pkt: (
                                (getattr(pkt, "ulPropTag", None) & 65535)
                                & 0xFFFFFFFFFFFFFFFF
                            )
                            == 4099
                        ),
                        (lambda _, val: val.tag == 4099),
                    ),
                ),
                (
                    NDRPacketField("Value", StringArray_r(), StringArray_r),
                    (
                        (
                            lambda pkt: (
                                (getattr(pkt, "ulPropTag", None) & 65535)
                                & 0xFFFFFFFFFFFFFFFF
                            )
                            == 4126
                        ),
                        (lambda _, val: val.tag == 4126),
                    ),
                ),
                (
                    NDRPacketField("Value", BinaryArray_r(), BinaryArray_r),
                    (
                        (
                            lambda pkt: (
                                (getattr(pkt, "ulPropTag", None) & 65535)
                                & 0xFFFFFFFFFFFFFFFF
                            )
                            == 4354
                        ),
                        (lambda _, val: val.tag == 4354),
                    ),
                ),
                (
                    NDRPacketField("Value", FlatUIDArray_r(), FlatUIDArray_r),
                    (
                        (
                            lambda pkt: (
                                (getattr(pkt, "ulPropTag", None) & 65535)
                                & 0xFFFFFFFFFFFFFFFF
                            )
                            == 4168
                        ),
                        (lambda _, val: val.tag == 4168),
                    ),
                ),
                (
                    NDRPacketField("Value", WStringArray_r(), WStringArray_r),
                    (
                        (
                            lambda pkt: (
                                (getattr(pkt, "ulPropTag", None) & 65535)
                                & 0xFFFFFFFFFFFFFFFF
                            )
                            == 4127
                        ),
                        (lambda _, val: val.tag == 4127),
                    ),
                ),
                (
                    NDRPacketField("Value", DateTimeArray_r(), DateTimeArray_r),
                    (
                        (
                            lambda pkt: (
                                (getattr(pkt, "ulPropTag", None) & 65535)
                                & 0xFFFFFFFFFFFFFFFF
                            )
                            == 4160
                        ),
                        (lambda _, val: val.tag == 4160),
                    ),
                ),
                (
                    NDRSignedIntField("Value", 0),
                    (
                        (
                            lambda pkt: (
                                (getattr(pkt, "ulPropTag", None) & 65535)
                                & 0xFFFFFFFFFFFFFFFF
                            )
                            in [1, 13]
                        ),
                        (lambda _, val: val.tag in [1, 13]),
                    ),
                ),
            ],
            StrFixedLenField("Value", "", length=0),
            align=(4, 8),
            switch_fmt=("L", "L"),
        ),
    ]


class PropertyRow_r(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("Reserved", 0),
        NDRIntField("cValues", None, size_of="lpProps"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "lpProps", [], _PropertyValue_r, size_is=lambda pkt: pkt.cValues
            ),
            deferred=True,
        ),
    ]


class PropertyRowSet_r(NDRPacket):
    ALIGNMENT = (4, 8)
    DEPORTED_CONFORMANTS = ["aRow"]
    fields_desc = [
        NDRIntField("cRows", None, size_of="aRow"),
        NDRConfPacketListField(
            "aRow",
            [],
            PropertyRow_r,
            size_is=lambda pkt: pkt.cRows,
            conformant_in_struct=True,
        ),
    ]


class NspiQueryRows_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hRpc", NDRContextHandle(), NDRContextHandle),
        NDRIntField("dwFlags", 0),
        NDRPacketField("pStat", STAT(), STAT),
        NDRIntField("dwETableCount", None, size_of="lpETable"),
        NDRConfFieldListField(
            "lpETable", [], NDRIntField("", 0), size_is=lambda pkt: pkt.dwETableCount
        ),
        NDRIntField("Count", 0),
        NDRFullPointerField(
            NDRPacketField("pPropTags", PropertyTagArray_r(), PropertyTagArray_r)
        ),
    ]


class NspiQueryRows_Response(NDRPacket):
    fields_desc = [
        NDRPacketField("pStat", STAT(), STAT),
        NDRFullPointerField(
            NDRPacketField("ppRows", PropertyRowSet_r(), PropertyRowSet_r)
        ),
        NDRIntField("status", 0),
    ]


class NspiSeekEntries_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hRpc", NDRContextHandle(), NDRContextHandle),
        NDRIntField("Reserved", 0),
        NDRPacketField("pStat", STAT(), STAT),
        NDRPacketField("pTarget", _PropertyValue_r(), _PropertyValue_r),
        NDRFullPointerField(
            NDRPacketField("lpETable", PropertyTagArray_r(), PropertyTagArray_r)
        ),
        NDRFullPointerField(
            NDRPacketField("pPropTags", PropertyTagArray_r(), PropertyTagArray_r)
        ),
    ]


class NspiSeekEntries_Response(NDRPacket):
    fields_desc = [
        NDRPacketField("pStat", STAT(), STAT),
        NDRFullPointerField(
            NDRPacketField("ppRows", PropertyRowSet_r(), PropertyRowSet_r)
        ),
        NDRIntField("status", 0),
    ]


class _Restriction_r(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [NDRIntField("rt", 0), NDRRecursiveField("res")]


class PropertyName_r(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("lpguid", FlatUID_r(), FlatUID_r), deferred=True
        ),
        NDRIntField("ulReserved", 0),
        NDRSignedIntField("lID", 0),
    ]


class NspiGetMatches_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hRpc", NDRContextHandle(), NDRContextHandle),
        NDRIntField("Reserved1", 0),
        NDRPacketField("pStat", STAT(), STAT),
        NDRFullPointerField(
            NDRPacketField("pReserved", PropertyTagArray_r(), PropertyTagArray_r)
        ),
        NDRIntField("Reserved2", 0),
        NDRFullPointerField(NDRPacketField("Filter", _Restriction_r(), _Restriction_r)),
        NDRFullPointerField(
            NDRPacketField("lpPropName", PropertyName_r(), PropertyName_r)
        ),
        NDRIntField("ulRequested", 0),
        NDRFullPointerField(
            NDRPacketField("pPropTags", PropertyTagArray_r(), PropertyTagArray_r)
        ),
    ]


class NspiGetMatches_Response(NDRPacket):
    fields_desc = [
        NDRPacketField("pStat", STAT(), STAT),
        NDRFullPointerField(
            NDRPacketField("ppOutMIds", PropertyTagArray_r(), PropertyTagArray_r)
        ),
        NDRFullPointerField(
            NDRPacketField("ppRows", PropertyRowSet_r(), PropertyRowSet_r)
        ),
        NDRIntField("status", 0),
    ]


class NspiResortRestriction_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hRpc", NDRContextHandle(), NDRContextHandle),
        NDRIntField("Reserved", 0),
        NDRPacketField("pStat", STAT(), STAT),
        NDRPacketField("pInMIds", PropertyTagArray_r(), PropertyTagArray_r),
        NDRFullPointerField(
            NDRPacketField("ppOutMIds", PropertyTagArray_r(), PropertyTagArray_r)
        ),
    ]


class NspiResortRestriction_Response(NDRPacket):
    fields_desc = [
        NDRPacketField("pStat", STAT(), STAT),
        NDRFullPointerField(
            NDRPacketField("ppOutMIds", PropertyTagArray_r(), PropertyTagArray_r)
        ),
        NDRIntField("status", 0),
    ]


class StringsArray_r(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("Count", None, size_of="Strings"),
        NDRFullPointerField(
            NDRConfFieldListField(
                "Strings",
                [],
                NDRFullPointerField(NDRSignedByteField("Strings", 0), deferred=True),
                size_is=lambda pkt: pkt.Count,
            ),
            deferred=True,
        ),
    ]


class NspiDNToMId_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hRpc", NDRContextHandle(), NDRContextHandle),
        NDRIntField("Reserved", 0),
        NDRPacketField("pNames", StringsArray_r(), StringsArray_r),
    ]


class NspiDNToMId_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("ppOutMIds", PropertyTagArray_r(), PropertyTagArray_r)
        ),
        NDRIntField("status", 0),
    ]


class NspiGetPropList_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hRpc", NDRContextHandle(), NDRContextHandle),
        NDRIntField("dwFlags", 0),
        NDRIntField("dwMId", 0),
        NDRIntField("CodePage", 0),
    ]


class NspiGetPropList_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("ppPropTags", PropertyTagArray_r(), PropertyTagArray_r)
        ),
        NDRIntField("status", 0),
    ]


class NspiGetProps_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hRpc", NDRContextHandle(), NDRContextHandle),
        NDRIntField("dwFlags", 0),
        NDRPacketField("pStat", STAT(), STAT),
        NDRFullPointerField(
            NDRPacketField("pPropTags", PropertyTagArray_r(), PropertyTagArray_r)
        ),
    ]


class NspiGetProps_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRPacketField("ppRows", PropertyRow_r(), PropertyRow_r)),
        NDRIntField("status", 0),
    ]


class NspiCompareMIds_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hRpc", NDRContextHandle(), NDRContextHandle),
        NDRIntField("Reserved", 0),
        NDRPacketField("pStat", STAT(), STAT),
        NDRIntField("MId1", 0),
        NDRIntField("MId2", 0),
    ]


class NspiCompareMIds_Response(NDRPacket):
    fields_desc = [NDRSignedIntField("plResult", 0), NDRIntField("status", 0)]


class NspiModProps_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hRpc", NDRContextHandle(), NDRContextHandle),
        NDRIntField("Reserved", 0),
        NDRPacketField("pStat", STAT(), STAT),
        NDRFullPointerField(
            NDRPacketField("pPropTags", PropertyTagArray_r(), PropertyTagArray_r)
        ),
        NDRPacketField("pRow", PropertyRow_r(), PropertyRow_r),
    ]


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


class NspiGetSpecialTable_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hRpc", NDRContextHandle(), NDRContextHandle),
        NDRIntField("dwFlags", 0),
        NDRPacketField("pStat", STAT(), STAT),
        NDRIntField("lpVersion", 0),
    ]


class NspiGetSpecialTable_Response(NDRPacket):
    fields_desc = [
        NDRIntField("lpVersion", 0),
        NDRFullPointerField(
            NDRPacketField("ppRows", PropertyRowSet_r(), PropertyRowSet_r)
        ),
        NDRIntField("status", 0),
    ]


class NspiGetTemplateInfo_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hRpc", NDRContextHandle(), NDRContextHandle),
        NDRIntField("dwFlags", 0),
        NDRIntField("ulType", 0),
        NDRFullPointerField(NDRConfVarStrNullField("pDN", "")),
        NDRIntField("dwCodePage", 0),
        NDRIntField("dwLocaleID", 0),
    ]


class NspiGetTemplateInfo_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRPacketField("ppData", PropertyRow_r(), PropertyRow_r)),
        NDRIntField("status", 0),
    ]


class NspiModLinkAtt_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hRpc", NDRContextHandle(), NDRContextHandle),
        NDRIntField("dwFlags", 0),
        NDRIntField("ulPropTag", 0),
        NDRIntField("dwMId", 0),
        NDRPacketField("lpEntryIds", BinaryArray_r(), BinaryArray_r),
    ]


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


class NspiQueryColumns_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hRpc", NDRContextHandle(), NDRContextHandle),
        NDRIntField("Reserved", 0),
        NDRIntField("dwFlags", 0),
    ]


class NspiQueryColumns_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("ppColumns", PropertyTagArray_r(), PropertyTagArray_r)
        ),
        NDRIntField("status", 0),
    ]


class NspiResolveNames_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hRpc", NDRContextHandle(), NDRContextHandle),
        NDRIntField("Reserved", 0),
        NDRPacketField("pStat", STAT(), STAT),
        NDRFullPointerField(
            NDRPacketField("pPropTags", PropertyTagArray_r(), PropertyTagArray_r)
        ),
        NDRPacketField("paStr", StringsArray_r(), StringsArray_r),
    ]


class NspiResolveNames_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("ppMIds", PropertyTagArray_r(), PropertyTagArray_r)
        ),
        NDRFullPointerField(
            NDRPacketField("ppRows", PropertyRowSet_r(), PropertyRowSet_r)
        ),
        NDRIntField("status", 0),
    ]


class WStringsArray_r(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("Count", None, size_of="Strings"),
        NDRFullPointerField(
            NDRConfFieldListField(
                "Strings",
                [],
                NDRFullPointerField(NDRShortField("Strings", 0), deferred=True),
                size_is=lambda pkt: pkt.Count,
            ),
            deferred=True,
        ),
    ]


class NspiResolveNamesW_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hRpc", NDRContextHandle(), NDRContextHandle),
        NDRIntField("Reserved", 0),
        NDRPacketField("pStat", STAT(), STAT),
        NDRFullPointerField(
            NDRPacketField("pPropTags", PropertyTagArray_r(), PropertyTagArray_r)
        ),
        NDRPacketField("paWStr", WStringsArray_r(), WStringsArray_r),
    ]


class NspiResolveNamesW_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("ppMIds", PropertyTagArray_r(), PropertyTagArray_r)
        ),
        NDRFullPointerField(
            NDRPacketField("ppRows", PropertyRowSet_r(), PropertyRowSet_r)
        ),
        NDRIntField("status", 0),
    ]


NSPI_OPNUMS = {
    0: DceRpcOp(NspiBind_Request, NspiBind_Response),
    1: DceRpcOp(NspiUnbind_Request, NspiUnbind_Response),
    2: DceRpcOp(NspiUpdateStat_Request, NspiUpdateStat_Response),
    3: DceRpcOp(NspiQueryRows_Request, NspiQueryRows_Response),
    4: DceRpcOp(NspiSeekEntries_Request, NspiSeekEntries_Response),
    5: DceRpcOp(NspiGetMatches_Request, NspiGetMatches_Response),
    6: DceRpcOp(NspiResortRestriction_Request, NspiResortRestriction_Response),
    7: DceRpcOp(NspiDNToMId_Request, NspiDNToMId_Response),
    8: DceRpcOp(NspiGetPropList_Request, NspiGetPropList_Response),
    9: DceRpcOp(NspiGetProps_Request, NspiGetProps_Response),
    10: DceRpcOp(NspiCompareMIds_Request, NspiCompareMIds_Response),
    11: DceRpcOp(NspiModProps_Request, NspiModProps_Response),
    12: DceRpcOp(NspiGetSpecialTable_Request, NspiGetSpecialTable_Response),
    13: DceRpcOp(NspiGetTemplateInfo_Request, NspiGetTemplateInfo_Response),
    14: DceRpcOp(NspiModLinkAtt_Request, NspiModLinkAtt_Response),
    # 15: Opnum15NotUsedOnWire,
    16: DceRpcOp(NspiQueryColumns_Request, NspiQueryColumns_Response),
    # 17: Opnum17NotUsedOnWire,
    # 18: Opnum18NotUsedOnWire,
    19: DceRpcOp(NspiResolveNames_Request, NspiResolveNames_Response),
    20: DceRpcOp(NspiResolveNamesW_Request, NspiResolveNamesW_Response),
}
register_dcerpc_interface(
    name="nspi",
    uuid=uuid.UUID("F5CC5A18-4264-101A-8C59-08002B2F8426"),
    version="56.0",
    opnums=NSPI_OPNUMS,
)
