### ms-srvs.idl
"""
RPC definitions for the following interfaces:
- srvsvc (v3.0): 4B324FC8-1670-01D3-1278-5A47BF6EE188
This file is auto-generated by midl-to-scapy, do not modify.
"""

import uuid

from scapy.fields import PacketListField, StrFixedLenField
from scapy.layers.dcerpc import (
    NDRPacket,
    DceRpcOp,
    NDRByteField,
    NDRConfPacketListField,
    NDRConfStrLenField,
    NDRConfStrLenFieldUtf16,
    NDRConfVarPacketListField,
    NDRConfVarStrNullField,
    NDRConfVarStrNullFieldUtf16,
    NDRContextHandle,
    NDRFullPointerField,
    NDRIntField,
    NDRPacketField,
    NDRShortField,
    NDRSignedIntField,
    NDRUnionField,
    NDRVarStrLenField,
    NDRVarStrLenFieldUtf16,
    register_dcerpc_interface,
)


class LPCONNECTION_INFO_0(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [NDRIntField("coni0_id", 0)]


class CONNECT_INFO_0_CONTAINER(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("EntriesRead", None, size_of="Buffer"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "Buffer",
                [LPCONNECTION_INFO_0()],
                LPCONNECTION_INFO_0,
                size_is=lambda pkt: pkt.EntriesRead,
            ),
            deferred=True,
        ),
    ]


class LPCONNECTION_INFO_1(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("coni1_id", 0),
        NDRIntField("coni1_type", 0),
        NDRIntField("coni1_num_opens", 0),
        NDRIntField("coni1_num_users", 0),
        NDRIntField("coni1_time", 0),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("coni1_username", ""), deferred=True
        ),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("coni1_netname", ""), deferred=True
        ),
    ]


class CONNECT_INFO_1_CONTAINER(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("EntriesRead", None, size_of="Buffer"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "Buffer",
                [LPCONNECTION_INFO_1()],
                LPCONNECTION_INFO_1,
                size_is=lambda pkt: pkt.EntriesRead,
            ),
            deferred=True,
        ),
    ]


class LPCONNECT_ENUM_STRUCT(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("Level", 0),
        NDRUnionField(
            [
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ConnectInfo",
                            CONNECT_INFO_0_CONTAINER(),
                            CONNECT_INFO_0_CONTAINER,
                        ),
                        deferred=True,
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 0),
                        (lambda _, val: val.tag == 0),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ConnectInfo",
                            CONNECT_INFO_1_CONTAINER(),
                            CONNECT_INFO_1_CONTAINER,
                        ),
                        deferred=True,
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1),
                        (lambda _, val: val.tag == 1),
                    ),
                ),
            ],
            StrFixedLenField("ConnectInfo", "", length=0),
            align=(4, 8),
            switch_fmt=("L", "L"),
        ),
    ]


class NetrConnectionEnum_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerName", "")),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("Qualifier", "")),
        NDRPacketField("InfoStruct", LPCONNECT_ENUM_STRUCT(), LPCONNECT_ENUM_STRUCT),
        NDRIntField("PreferedMaximumLength", 0),
        NDRFullPointerField(NDRIntField("ResumeHandle", 0)),
    ]


class NetrConnectionEnum_Response(NDRPacket):
    fields_desc = [
        NDRPacketField("InfoStruct", LPCONNECT_ENUM_STRUCT(), LPCONNECT_ENUM_STRUCT),
        NDRIntField("TotalEntries", 0),
        NDRFullPointerField(NDRIntField("ResumeHandle", 0)),
        NDRIntField("status", 0),
    ]


class LPFILE_INFO_2(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [NDRIntField("fi2_id", 0)]


class FILE_INFO_2_CONTAINER(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("EntriesRead", None, size_of="Buffer"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "Buffer",
                [LPFILE_INFO_2()],
                LPFILE_INFO_2,
                size_is=lambda pkt: pkt.EntriesRead,
            ),
            deferred=True,
        ),
    ]


class LPFILE_INFO_3(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("fi3_id", 0),
        NDRIntField("fi3_permissions", 0),
        NDRIntField("fi3_num_locks", 0),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("fi3_pathname", ""), deferred=True
        ),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("fi3_username", ""), deferred=True
        ),
    ]


class FILE_INFO_3_CONTAINER(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("EntriesRead", None, size_of="Buffer"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "Buffer",
                [LPFILE_INFO_3()],
                LPFILE_INFO_3,
                size_is=lambda pkt: pkt.EntriesRead,
            ),
            deferred=True,
        ),
    ]


class PFILE_ENUM_STRUCT(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("Level", 0),
        NDRUnionField(
            [
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "FileInfo", FILE_INFO_2_CONTAINER(), FILE_INFO_2_CONTAINER
                        ),
                        deferred=True,
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 2),
                        (lambda _, val: val.tag == 2),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "FileInfo", FILE_INFO_3_CONTAINER(), FILE_INFO_3_CONTAINER
                        ),
                        deferred=True,
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 3),
                        (lambda _, val: val.tag == 3),
                    ),
                ),
            ],
            StrFixedLenField("FileInfo", "", length=0),
            align=(4, 8),
            switch_fmt=("L", "L"),
        ),
    ]


class NetrFileEnum_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerName", "")),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("BasePath", "")),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("UserName", "")),
        NDRPacketField("InfoStruct", PFILE_ENUM_STRUCT(), PFILE_ENUM_STRUCT),
        NDRIntField("PreferedMaximumLength", 0),
        NDRFullPointerField(NDRIntField("ResumeHandle", 0)),
    ]


class NetrFileEnum_Response(NDRPacket):
    fields_desc = [
        NDRPacketField("InfoStruct", PFILE_ENUM_STRUCT(), PFILE_ENUM_STRUCT),
        NDRIntField("TotalEntries", 0),
        NDRFullPointerField(NDRIntField("ResumeHandle", 0)),
        NDRIntField("status", 0),
    ]


class NetrFileGetInfo_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerName", "")),
        NDRIntField("FileId", 0),
        NDRIntField("Level", 0),
    ]


class NetrFileGetInfo_Response(NDRPacket):
    fields_desc = [
        NDRUnionField(
            [
                (
                    NDRFullPointerField(
                        NDRPacketField("InfoStruct", LPFILE_INFO_2(), LPFILE_INFO_2)
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 2),
                        (lambda _, val: val.tag == 2),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField("InfoStruct", LPFILE_INFO_3(), LPFILE_INFO_3)
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 3),
                        (lambda _, val: val.tag == 3),
                    ),
                ),
            ],
            StrFixedLenField("InfoStruct", "", length=0),
            align=(4, 8),
            switch_fmt=("L", "L"),
        ),
        NDRIntField("status", 0),
    ]


class NetrFileClose_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerName", "")),
        NDRIntField("FileId", 0),
    ]


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


class LPSESSION_INFO_0(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("sesi0_cname", ""), deferred=True
        )
    ]


class SESSION_INFO_0_CONTAINER(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("EntriesRead", None, size_of="Buffer"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "Buffer",
                [LPSESSION_INFO_0()],
                LPSESSION_INFO_0,
                size_is=lambda pkt: pkt.EntriesRead,
            ),
            deferred=True,
        ),
    ]


class LPSESSION_INFO_1(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("sesi1_cname", ""), deferred=True
        ),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("sesi1_username", ""), deferred=True
        ),
        NDRIntField("sesi1_num_opens", 0),
        NDRIntField("sesi1_time", 0),
        NDRIntField("sesi1_idle_time", 0),
        NDRIntField("sesi1_user_flags", 0),
    ]


class SESSION_INFO_1_CONTAINER(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("EntriesRead", None, size_of="Buffer"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "Buffer",
                [LPSESSION_INFO_1()],
                LPSESSION_INFO_1,
                size_is=lambda pkt: pkt.EntriesRead,
            ),
            deferred=True,
        ),
    ]


class LPSESSION_INFO_2(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("sesi2_cname", ""), deferred=True
        ),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("sesi2_username", ""), deferred=True
        ),
        NDRIntField("sesi2_num_opens", 0),
        NDRIntField("sesi2_time", 0),
        NDRIntField("sesi2_idle_time", 0),
        NDRIntField("sesi2_user_flags", 0),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("sesi2_cltype_name", ""), deferred=True
        ),
    ]


class SESSION_INFO_2_CONTAINER(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("EntriesRead", None, size_of="Buffer"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "Buffer",
                [LPSESSION_INFO_2()],
                LPSESSION_INFO_2,
                size_is=lambda pkt: pkt.EntriesRead,
            ),
            deferred=True,
        ),
    ]


class LPSESSION_INFO_10(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("sesi10_cname", ""), deferred=True
        ),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("sesi10_username", ""), deferred=True
        ),
        NDRIntField("sesi10_time", 0),
        NDRIntField("sesi10_idle_time", 0),
    ]


class SESSION_INFO_10_CONTAINER(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("EntriesRead", None, size_of="Buffer"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "Buffer",
                [LPSESSION_INFO_10()],
                LPSESSION_INFO_10,
                size_is=lambda pkt: pkt.EntriesRead,
            ),
            deferred=True,
        ),
    ]


class LPSESSION_INFO_502(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("sesi502_cname", ""), deferred=True
        ),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("sesi502_username", ""), deferred=True
        ),
        NDRIntField("sesi502_num_opens", 0),
        NDRIntField("sesi502_time", 0),
        NDRIntField("sesi502_idle_time", 0),
        NDRIntField("sesi502_user_flags", 0),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("sesi502_cltype_name", ""), deferred=True
        ),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("sesi502_transport", ""), deferred=True
        ),
    ]


class SESSION_INFO_502_CONTAINER(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("EntriesRead", None, size_of="Buffer"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "Buffer",
                [LPSESSION_INFO_502()],
                LPSESSION_INFO_502,
                size_is=lambda pkt: pkt.EntriesRead,
            ),
            deferred=True,
        ),
    ]


class PSESSION_ENUM_STRUCT(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("Level", 0),
        NDRUnionField(
            [
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "SessionInfo",
                            SESSION_INFO_0_CONTAINER(),
                            SESSION_INFO_0_CONTAINER,
                        ),
                        deferred=True,
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 0),
                        (lambda _, val: val.tag == 0),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "SessionInfo",
                            SESSION_INFO_1_CONTAINER(),
                            SESSION_INFO_1_CONTAINER,
                        ),
                        deferred=True,
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1),
                        (lambda _, val: val.tag == 1),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "SessionInfo",
                            SESSION_INFO_2_CONTAINER(),
                            SESSION_INFO_2_CONTAINER,
                        ),
                        deferred=True,
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 2),
                        (lambda _, val: val.tag == 2),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "SessionInfo",
                            SESSION_INFO_10_CONTAINER(),
                            SESSION_INFO_10_CONTAINER,
                        ),
                        deferred=True,
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 10),
                        (lambda _, val: val.tag == 10),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "SessionInfo",
                            SESSION_INFO_502_CONTAINER(),
                            SESSION_INFO_502_CONTAINER,
                        ),
                        deferred=True,
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 502),
                        (lambda _, val: val.tag == 502),
                    ),
                ),
            ],
            StrFixedLenField("SessionInfo", "", length=0),
            align=(4, 8),
            switch_fmt=("L", "L"),
        ),
    ]


class NetrSessionEnum_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerName", "")),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ClientName", "")),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("UserName", "")),
        NDRPacketField("InfoStruct", PSESSION_ENUM_STRUCT(), PSESSION_ENUM_STRUCT),
        NDRIntField("PreferedMaximumLength", 0),
        NDRFullPointerField(NDRIntField("ResumeHandle", 0)),
    ]


class NetrSessionEnum_Response(NDRPacket):
    fields_desc = [
        NDRPacketField("InfoStruct", PSESSION_ENUM_STRUCT(), PSESSION_ENUM_STRUCT),
        NDRIntField("TotalEntries", 0),
        NDRFullPointerField(NDRIntField("ResumeHandle", 0)),
        NDRIntField("status", 0),
    ]


class NetrSessionDel_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerName", "")),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ClientName", "")),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("UserName", "")),
    ]


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


class LPSHARE_INFO_0(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("shi0_netname", ""), deferred=True
        )
    ]


class LPSHARE_INFO_1(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("shi1_netname", ""), deferred=True
        ),
        NDRIntField("shi1_type", 0),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("shi1_remark", ""), deferred=True
        ),
    ]


class LPSHARE_INFO_2(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("shi2_netname", ""), deferred=True
        ),
        NDRIntField("shi2_type", 0),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("shi2_remark", ""), deferred=True
        ),
        NDRIntField("shi2_permissions", 0),
        NDRIntField("shi2_max_uses", 0),
        NDRIntField("shi2_current_uses", 0),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("shi2_path", ""), deferred=True
        ),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("shi2_passwd", ""), deferred=True
        ),
    ]


class LPSHARE_INFO_502_I(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("shi502_netname", ""), deferred=True
        ),
        NDRIntField("shi502_type", 0),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("shi502_remark", ""), deferred=True
        ),
        NDRIntField("shi502_permissions", 0),
        NDRIntField("shi502_max_uses", 0),
        NDRIntField("shi502_current_uses", 0),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("shi502_path", ""), deferred=True
        ),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("shi502_passwd", ""), deferred=True
        ),
        NDRIntField("shi502_reserved", None, size_of="shi502_security_descriptor"),
        NDRFullPointerField(
            NDRConfStrLenField(
                "shi502_security_descriptor",
                "",
                size_is=lambda pkt: pkt.shi502_reserved,
            ),
            deferred=True,
        ),
    ]


class LPSHARE_INFO_1004(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("shi1004_remark", ""), deferred=True
        )
    ]


class LPSHARE_INFO_1006(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [NDRIntField("shi1006_max_uses", 0)]


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


class LPSHARE_INFO_1005(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [NDRIntField("shi1005_flags", 0)]


class LPSHARE_INFO_501(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("shi501_netname", ""), deferred=True
        ),
        NDRIntField("shi501_type", 0),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("shi501_remark", ""), deferred=True
        ),
        NDRIntField("shi501_flags", 0),
    ]


class LPSHARE_INFO_503_I(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("shi503_netname", ""), deferred=True
        ),
        NDRIntField("shi503_type", 0),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("shi503_remark", ""), deferred=True
        ),
        NDRIntField("shi503_permissions", 0),
        NDRIntField("shi503_max_uses", 0),
        NDRIntField("shi503_current_uses", 0),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("shi503_path", ""), deferred=True
        ),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("shi503_passwd", ""), deferred=True
        ),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("shi503_servername", ""), deferred=True
        ),
        NDRIntField("shi503_reserved", None, size_of="shi503_security_descriptor"),
        NDRFullPointerField(
            NDRConfStrLenField(
                "shi503_security_descriptor",
                "",
                size_is=lambda pkt: pkt.shi503_reserved,
            ),
            deferred=True,
        ),
    ]


class NetrShareAdd_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerName", "")),
        NDRIntField("Level", 0),
        NDRUnionField(
            [
                (
                    NDRFullPointerField(
                        NDRPacketField("ShareInfo", LPSHARE_INFO_0(), LPSHARE_INFO_0)
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 0),
                        (lambda _, val: val.tag == 0),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField("ShareInfo", LPSHARE_INFO_1(), LPSHARE_INFO_1)
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1),
                        (lambda _, val: val.tag == 1),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField("ShareInfo", LPSHARE_INFO_2(), LPSHARE_INFO_2)
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 2),
                        (lambda _, val: val.tag == 2),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ShareInfo", LPSHARE_INFO_502_I(), LPSHARE_INFO_502_I
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 502),
                        (lambda _, val: val.tag == 502),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ShareInfo", LPSHARE_INFO_1004(), LPSHARE_INFO_1004
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1004),
                        (lambda _, val: val.tag == 1004),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ShareInfo", LPSHARE_INFO_1006(), LPSHARE_INFO_1006
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1006),
                        (lambda _, val: val.tag == 1006),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ShareInfo", LPSHARE_INFO_1501_I(), LPSHARE_INFO_1501_I
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1501),
                        (lambda _, val: val.tag == 1501),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ShareInfo", LPSHARE_INFO_1005(), LPSHARE_INFO_1005
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1005),
                        (lambda _, val: val.tag == 1005),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ShareInfo", LPSHARE_INFO_501(), LPSHARE_INFO_501
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 501),
                        (lambda _, val: val.tag == 501),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ShareInfo", LPSHARE_INFO_503_I(), LPSHARE_INFO_503_I
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 503),
                        (lambda _, val: val.tag == 503),
                    ),
                ),
            ],
            StrFixedLenField("ShareInfo", "", length=0),
            align=(4, 8),
            switch_fmt=("L", "L"),
        ),
        NDRFullPointerField(NDRIntField("ParmErr", 0)),
    ]


class NetrShareAdd_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRIntField("ParmErr", 0)),
        NDRIntField("status", 0),
    ]


class SHARE_INFO_0_CONTAINER(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("EntriesRead", None, size_of="Buffer"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "Buffer",
                [LPSHARE_INFO_0()],
                LPSHARE_INFO_0,
                size_is=lambda pkt: pkt.EntriesRead,
            ),
            deferred=True,
        ),
    ]


class SHARE_INFO_1_CONTAINER(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("EntriesRead", None, size_of="Buffer"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "Buffer",
                [LPSHARE_INFO_1()],
                LPSHARE_INFO_1,
                size_is=lambda pkt: pkt.EntriesRead,
            ),
            deferred=True,
        ),
    ]


class SHARE_INFO_2_CONTAINER(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("EntriesRead", None, size_of="Buffer"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "Buffer",
                [LPSHARE_INFO_2()],
                LPSHARE_INFO_2,
                size_is=lambda pkt: pkt.EntriesRead,
            ),
            deferred=True,
        ),
    ]


class SHARE_INFO_501_CONTAINER(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("EntriesRead", None, size_of="Buffer"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "Buffer",
                [LPSHARE_INFO_501()],
                LPSHARE_INFO_501,
                size_is=lambda pkt: pkt.EntriesRead,
            ),
            deferred=True,
        ),
    ]


class SHARE_INFO_502_CONTAINER(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("EntriesRead", None, size_of="Buffer"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "Buffer",
                [LPSHARE_INFO_502_I()],
                LPSHARE_INFO_502_I,
                size_is=lambda pkt: pkt.EntriesRead,
            ),
            deferred=True,
        ),
    ]


class SHARE_INFO_503_CONTAINER(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("EntriesRead", None, size_of="Buffer"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "Buffer",
                [LPSHARE_INFO_503_I()],
                LPSHARE_INFO_503_I,
                size_is=lambda pkt: pkt.EntriesRead,
            ),
            deferred=True,
        ),
    ]


class LPSHARE_ENUM_STRUCT(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("Level", 0),
        NDRUnionField(
            [
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ShareInfo",
                            SHARE_INFO_0_CONTAINER(),
                            SHARE_INFO_0_CONTAINER,
                        ),
                        deferred=True,
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 0),
                        (lambda _, val: val.tag == 0),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ShareInfo",
                            SHARE_INFO_1_CONTAINER(),
                            SHARE_INFO_1_CONTAINER,
                        ),
                        deferred=True,
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1),
                        (lambda _, val: val.tag == 1),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ShareInfo",
                            SHARE_INFO_2_CONTAINER(),
                            SHARE_INFO_2_CONTAINER,
                        ),
                        deferred=True,
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 2),
                        (lambda _, val: val.tag == 2),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ShareInfo",
                            SHARE_INFO_501_CONTAINER(),
                            SHARE_INFO_501_CONTAINER,
                        ),
                        deferred=True,
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 501),
                        (lambda _, val: val.tag == 501),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ShareInfo",
                            SHARE_INFO_502_CONTAINER(),
                            SHARE_INFO_502_CONTAINER,
                        ),
                        deferred=True,
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 502),
                        (lambda _, val: val.tag == 502),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ShareInfo",
                            SHARE_INFO_503_CONTAINER(),
                            SHARE_INFO_503_CONTAINER,
                        ),
                        deferred=True,
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 503),
                        (lambda _, val: val.tag == 503),
                    ),
                ),
            ],
            StrFixedLenField("ShareInfo", "", length=0),
            align=(4, 8),
            switch_fmt=("L", "L"),
        ),
    ]


class NetrShareEnum_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerName", "")),
        NDRPacketField("InfoStruct", LPSHARE_ENUM_STRUCT(), LPSHARE_ENUM_STRUCT),
        NDRIntField("PreferedMaximumLength", 0),
        NDRFullPointerField(NDRIntField("ResumeHandle", 0)),
    ]


class NetrShareEnum_Response(NDRPacket):
    fields_desc = [
        NDRPacketField("InfoStruct", LPSHARE_ENUM_STRUCT(), LPSHARE_ENUM_STRUCT),
        NDRIntField("TotalEntries", 0),
        NDRFullPointerField(NDRIntField("ResumeHandle", 0)),
        NDRIntField("status", 0),
    ]


class NetrShareGetInfo_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerName", "")),
        NDRConfVarStrNullFieldUtf16("NetName", ""),
        NDRIntField("Level", 0),
    ]


class NetrShareGetInfo_Response(NDRPacket):
    fields_desc = [
        NDRUnionField(
            [
                (
                    NDRFullPointerField(
                        NDRPacketField("ShareInfo", LPSHARE_INFO_0(), LPSHARE_INFO_0)
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 0),
                        (lambda _, val: val.tag == 0),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField("ShareInfo", LPSHARE_INFO_1(), LPSHARE_INFO_1)
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1),
                        (lambda _, val: val.tag == 1),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField("ShareInfo", LPSHARE_INFO_2(), LPSHARE_INFO_2)
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 2),
                        (lambda _, val: val.tag == 2),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ShareInfo", LPSHARE_INFO_502_I(), LPSHARE_INFO_502_I
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 502),
                        (lambda _, val: val.tag == 502),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ShareInfo", LPSHARE_INFO_1004(), LPSHARE_INFO_1004
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1004),
                        (lambda _, val: val.tag == 1004),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ShareInfo", LPSHARE_INFO_1006(), LPSHARE_INFO_1006
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1006),
                        (lambda _, val: val.tag == 1006),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ShareInfo", LPSHARE_INFO_1501_I(), LPSHARE_INFO_1501_I
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1501),
                        (lambda _, val: val.tag == 1501),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ShareInfo", LPSHARE_INFO_1005(), LPSHARE_INFO_1005
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1005),
                        (lambda _, val: val.tag == 1005),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ShareInfo", LPSHARE_INFO_501(), LPSHARE_INFO_501
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 501),
                        (lambda _, val: val.tag == 501),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ShareInfo", LPSHARE_INFO_503_I(), LPSHARE_INFO_503_I
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 503),
                        (lambda _, val: val.tag == 503),
                    ),
                ),
            ],
            StrFixedLenField("ShareInfo", "", length=0),
            align=(4, 8),
            switch_fmt=("L", "L"),
        ),
        NDRIntField("status", 0),
    ]


class NetrShareSetInfo_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerName", "")),
        NDRConfVarStrNullFieldUtf16("NetName", ""),
        NDRIntField("Level", 0),
        NDRUnionField(
            [
                (
                    NDRFullPointerField(
                        NDRPacketField("ShareInfo", LPSHARE_INFO_0(), LPSHARE_INFO_0)
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 0),
                        (lambda _, val: val.tag == 0),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField("ShareInfo", LPSHARE_INFO_1(), LPSHARE_INFO_1)
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1),
                        (lambda _, val: val.tag == 1),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField("ShareInfo", LPSHARE_INFO_2(), LPSHARE_INFO_2)
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 2),
                        (lambda _, val: val.tag == 2),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ShareInfo", LPSHARE_INFO_502_I(), LPSHARE_INFO_502_I
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 502),
                        (lambda _, val: val.tag == 502),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ShareInfo", LPSHARE_INFO_1004(), LPSHARE_INFO_1004
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1004),
                        (lambda _, val: val.tag == 1004),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ShareInfo", LPSHARE_INFO_1006(), LPSHARE_INFO_1006
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1006),
                        (lambda _, val: val.tag == 1006),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ShareInfo", LPSHARE_INFO_1501_I(), LPSHARE_INFO_1501_I
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1501),
                        (lambda _, val: val.tag == 1501),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ShareInfo", LPSHARE_INFO_1005(), LPSHARE_INFO_1005
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1005),
                        (lambda _, val: val.tag == 1005),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ShareInfo", LPSHARE_INFO_501(), LPSHARE_INFO_501
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 501),
                        (lambda _, val: val.tag == 501),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ShareInfo", LPSHARE_INFO_503_I(), LPSHARE_INFO_503_I
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 503),
                        (lambda _, val: val.tag == 503),
                    ),
                ),
            ],
            StrFixedLenField("ShareInfo", "", length=0),
            align=(4, 8),
            switch_fmt=("L", "L"),
        ),
        NDRFullPointerField(NDRIntField("ParmErr", 0)),
    ]


class NetrShareSetInfo_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRIntField("ParmErr", 0)),
        NDRIntField("status", 0),
    ]


class NetrShareDel_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerName", "")),
        NDRConfVarStrNullFieldUtf16("NetName", ""),
        NDRIntField("Reserved", 0),
    ]


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


class NetrShareDelSticky_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerName", "")),
        NDRConfVarStrNullFieldUtf16("NetName", ""),
        NDRIntField("Reserved", 0),
    ]


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


class NetrShareCheck_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerName", "")),
        NDRConfVarStrNullFieldUtf16("Device", ""),
    ]


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


class LPSERVER_INFO_100(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("sv100_platform_id", 0),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("sv100_name", ""), deferred=True
        ),
    ]


class LPSERVER_INFO_101(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("sv101_platform_id", 0),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("sv101_name", ""), deferred=True
        ),
        NDRIntField("sv101_version_major", 0),
        NDRIntField("sv101_version_minor", 0),
        NDRIntField("sv101_type", 0),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("sv101_comment", ""), deferred=True
        ),
    ]


class LPSERVER_INFO_102(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("sv102_platform_id", 0),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("sv102_name", ""), deferred=True
        ),
        NDRIntField("sv102_version_major", 0),
        NDRIntField("sv102_version_minor", 0),
        NDRIntField("sv102_type", 0),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("sv102_comment", ""), deferred=True
        ),
        NDRIntField("sv102_users", 0),
        NDRSignedIntField("sv102_disc", 0),
        NDRSignedIntField("sv102_hidden", 0),
        NDRIntField("sv102_announce", 0),
        NDRIntField("sv102_anndelta", 0),
        NDRIntField("sv102_licenses", 0),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("sv102_userpath", ""), deferred=True
        ),
    ]


class LPSERVER_INFO_103(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("sv103_platform_id", 0),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("sv103_name", ""), deferred=True
        ),
        NDRIntField("sv103_version_major", 0),
        NDRIntField("sv103_version_minor", 0),
        NDRIntField("sv103_type", 0),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("sv103_comment", ""), deferred=True
        ),
        NDRIntField("sv103_users", 0),
        NDRSignedIntField("sv103_disc", 0),
        NDRSignedIntField("sv103_hidden", 0),
        NDRIntField("sv103_announce", 0),
        NDRIntField("sv103_anndelta", 0),
        NDRIntField("sv103_licenses", 0),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("sv103_userpath", ""), deferred=True
        ),
        NDRIntField("sv103_capabilities", 0),
    ]


class LPSERVER_INFO_502(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [
        NDRIntField("sv502_sessopens", 0),
        NDRIntField("sv502_sessvcs", 0),
        NDRIntField("sv502_opensearch", 0),
        NDRIntField("sv502_sizreqbuf", 0),
        NDRIntField("sv502_initworkitems", 0),
        NDRIntField("sv502_maxworkitems", 0),
        NDRIntField("sv502_rawworkitems", 0),
        NDRIntField("sv502_irpstacksize", 0),
        NDRIntField("sv502_maxrawbuflen", 0),
        NDRIntField("sv502_sessusers", 0),
        NDRIntField("sv502_sessconns", 0),
        NDRIntField("sv502_maxpagedmemoryusage", 0),
        NDRIntField("sv502_maxnonpagedmemoryusage", 0),
        NDRSignedIntField("sv502_enablesoftcompat", 0),
        NDRSignedIntField("sv502_enableforcedlogoff", 0),
        NDRSignedIntField("sv502_timesource", 0),
        NDRSignedIntField("sv502_acceptdownlevelapis", 0),
        NDRSignedIntField("sv502_lmannounce", 0),
    ]


class LPSERVER_INFO_503(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("sv503_sessopens", 0),
        NDRIntField("sv503_sessvcs", 0),
        NDRIntField("sv503_opensearch", 0),
        NDRIntField("sv503_sizreqbuf", 0),
        NDRIntField("sv503_initworkitems", 0),
        NDRIntField("sv503_maxworkitems", 0),
        NDRIntField("sv503_rawworkitems", 0),
        NDRIntField("sv503_irpstacksize", 0),
        NDRIntField("sv503_maxrawbuflen", 0),
        NDRIntField("sv503_sessusers", 0),
        NDRIntField("sv503_sessconns", 0),
        NDRIntField("sv503_maxpagedmemoryusage", 0),
        NDRIntField("sv503_maxnonpagedmemoryusage", 0),
        NDRSignedIntField("sv503_enablesoftcompat", 0),
        NDRSignedIntField("sv503_enableforcedlogoff", 0),
        NDRSignedIntField("sv503_timesource", 0),
        NDRSignedIntField("sv503_acceptdownlevelapis", 0),
        NDRSignedIntField("sv503_lmannounce", 0),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("sv503_domain", ""), deferred=True
        ),
        NDRIntField("sv503_maxcopyreadlen", 0),
        NDRIntField("sv503_maxcopywritelen", 0),
        NDRIntField("sv503_minkeepsearch", 0),
        NDRIntField("sv503_maxkeepsearch", 0),
        NDRIntField("sv503_minkeepcomplsearch", 0),
        NDRIntField("sv503_maxkeepcomplsearch", 0),
        NDRIntField("sv503_threadcountadd", 0),
        NDRIntField("sv503_numblockthreads", 0),
        NDRIntField("sv503_scavtimeout", 0),
        NDRIntField("sv503_minrcvqueue", 0),
        NDRIntField("sv503_minfreeworkitems", 0),
        NDRIntField("sv503_xactmemsize", 0),
        NDRIntField("sv503_threadpriority", 0),
        NDRIntField("sv503_maxmpxct", 0),
        NDRIntField("sv503_oplockbreakwait", 0),
        NDRIntField("sv503_oplockbreakresponsewait", 0),
        NDRSignedIntField("sv503_enableoplocks", 0),
        NDRSignedIntField("sv503_enableoplockforceclose", 0),
        NDRSignedIntField("sv503_enablefcbopens", 0),
        NDRSignedIntField("sv503_enableraw", 0),
        NDRSignedIntField("sv503_enablesharednetdrives", 0),
        NDRIntField("sv503_minfreeconnections", 0),
        NDRIntField("sv503_maxfreeconnections", 0),
    ]


class LPSERVER_INFO_599(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("sv599_sessopens", 0),
        NDRIntField("sv599_sessvcs", 0),
        NDRIntField("sv599_opensearch", 0),
        NDRIntField("sv599_sizreqbuf", 0),
        NDRIntField("sv599_initworkitems", 0),
        NDRIntField("sv599_maxworkitems", 0),
        NDRIntField("sv599_rawworkitems", 0),
        NDRIntField("sv599_irpstacksize", 0),
        NDRIntField("sv599_maxrawbuflen", 0),
        NDRIntField("sv599_sessusers", 0),
        NDRIntField("sv599_sessconns", 0),
        NDRIntField("sv599_maxpagedmemoryusage", 0),
        NDRIntField("sv599_maxnonpagedmemoryusage", 0),
        NDRSignedIntField("sv599_enablesoftcompat", 0),
        NDRSignedIntField("sv599_enableforcedlogoff", 0),
        NDRSignedIntField("sv599_timesource", 0),
        NDRSignedIntField("sv599_acceptdownlevelapis", 0),
        NDRSignedIntField("sv599_lmannounce", 0),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("sv599_domain", ""), deferred=True
        ),
        NDRIntField("sv599_maxcopyreadlen", 0),
        NDRIntField("sv599_maxcopywritelen", 0),
        NDRIntField("sv599_minkeepsearch", 0),
        NDRIntField("sv599_maxkeepsearch", 0),
        NDRIntField("sv599_minkeepcomplsearch", 0),
        NDRIntField("sv599_maxkeepcomplsearch", 0),
        NDRIntField("sv599_threadcountadd", 0),
        NDRIntField("sv599_numblockthreads", 0),
        NDRIntField("sv599_scavtimeout", 0),
        NDRIntField("sv599_minrcvqueue", 0),
        NDRIntField("sv599_minfreeworkitems", 0),
        NDRIntField("sv599_xactmemsize", 0),
        NDRIntField("sv599_threadpriority", 0),
        NDRIntField("sv599_maxmpxct", 0),
        NDRIntField("sv599_oplockbreakwait", 0),
        NDRIntField("sv599_oplockbreakresponsewait", 0),
        NDRSignedIntField("sv599_enableoplocks", 0),
        NDRSignedIntField("sv599_enableoplockforceclose", 0),
        NDRSignedIntField("sv599_enablefcbopens", 0),
        NDRSignedIntField("sv599_enableraw", 0),
        NDRSignedIntField("sv599_enablesharednetdrives", 0),
        NDRIntField("sv599_minfreeconnections", 0),
        NDRIntField("sv599_maxfreeconnections", 0),
        NDRIntField("sv599_initsesstable", 0),
        NDRIntField("sv599_initconntable", 0),
        NDRIntField("sv599_initfiletable", 0),
        NDRIntField("sv599_initsearchtable", 0),
        NDRIntField("sv599_alertschedule", 0),
        NDRIntField("sv599_errorthreshold", 0),
        NDRIntField("sv599_networkerrorthreshold", 0),
        NDRIntField("sv599_diskspacethreshold", 0),
        NDRIntField("sv599_reserved", 0),
        NDRIntField("sv599_maxlinkdelay", 0),
        NDRIntField("sv599_minlinkthroughput", 0),
        NDRIntField("sv599_linkinfovalidtime", 0),
        NDRIntField("sv599_scavqosinfoupdatetime", 0),
        NDRIntField("sv599_maxworkitemidletime", 0),
    ]


class LPSERVER_INFO_1005(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("sv1005_comment", ""), deferred=True
        )
    ]


class LPSERVER_INFO_1107(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [NDRIntField("sv1107_users", 0)]


class LPSERVER_INFO_1010(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [NDRSignedIntField("sv1010_disc", 0)]


class LPSERVER_INFO_1016(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [NDRSignedIntField("sv1016_hidden", 0)]


class LPSERVER_INFO_1017(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [NDRIntField("sv1017_announce", 0)]


class LPSERVER_INFO_1018(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [NDRIntField("sv1018_anndelta", 0)]


class LPSERVER_INFO_1501(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [NDRIntField("sv1501_sessopens", 0)]


class LPSERVER_INFO_1502(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [NDRIntField("sv1502_sessvcs", 0)]


class LPSERVER_INFO_1503(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [NDRIntField("sv1503_opensearch", 0)]


class LPSERVER_INFO_1506(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [NDRIntField("sv1506_maxworkitems", 0)]


class LPSERVER_INFO_1510(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [NDRIntField("sv1510_sessusers", 0)]


class LPSERVER_INFO_1511(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [NDRIntField("sv1511_sessconns", 0)]


class LPSERVER_INFO_1512(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [NDRIntField("sv1512_maxnonpagedmemoryusage", 0)]


class LPSERVER_INFO_1513(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [NDRIntField("sv1513_maxpagedmemoryusage", 0)]


class LPSERVER_INFO_1514(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [NDRSignedIntField("sv1514_enablesoftcompat", 0)]


class LPSERVER_INFO_1515(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [NDRSignedIntField("sv1515_enableforcedlogoff", 0)]


class LPSERVER_INFO_1516(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [NDRSignedIntField("sv1516_timesource", 0)]


class LPSERVER_INFO_1518(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [NDRSignedIntField("sv1518_lmannounce", 0)]


class LPSERVER_INFO_1523(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [NDRIntField("sv1523_maxkeepsearch", 0)]


class LPSERVER_INFO_1528(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [NDRIntField("sv1528_scavtimeout", 0)]


class LPSERVER_INFO_1529(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [NDRIntField("sv1529_minrcvqueue", 0)]


class LPSERVER_INFO_1530(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [NDRIntField("sv1530_minfreeworkitems", 0)]


class LPSERVER_INFO_1533(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [NDRIntField("sv1533_maxmpxct", 0)]


class LPSERVER_INFO_1534(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [NDRIntField("sv1534_oplockbreakwait", 0)]


class LPSERVER_INFO_1535(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [NDRIntField("sv1535_oplockbreakresponsewait", 0)]


class LPSERVER_INFO_1536(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [NDRSignedIntField("sv1536_enableoplocks", 0)]


class LPSERVER_INFO_1538(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [NDRSignedIntField("sv1538_enablefcbopens", 0)]


class LPSERVER_INFO_1539(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [NDRSignedIntField("sv1539_enableraw", 0)]


class LPSERVER_INFO_1540(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [NDRSignedIntField("sv1540_enablesharednetdrives", 0)]


class LPSERVER_INFO_1541(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [NDRSignedIntField("sv1541_minfreeconnections", 0)]


class LPSERVER_INFO_1542(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [NDRSignedIntField("sv1542_maxfreeconnections", 0)]


class LPSERVER_INFO_1543(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [NDRIntField("sv1543_initsesstable", 0)]


class LPSERVER_INFO_1544(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [NDRIntField("sv1544_initconntable", 0)]


class LPSERVER_INFO_1545(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [NDRIntField("sv1545_initfiletable", 0)]


class LPSERVER_INFO_1546(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [NDRIntField("sv1546_initsearchtable", 0)]


class LPSERVER_INFO_1547(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [NDRIntField("sv1547_alertschedule", 0)]


class LPSERVER_INFO_1548(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [NDRIntField("sv1548_errorthreshold", 0)]


class LPSERVER_INFO_1549(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [NDRIntField("sv1549_networkerrorthreshold", 0)]


class LPSERVER_INFO_1550(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [NDRIntField("sv1550_diskspacethreshold", 0)]


class LPSERVER_INFO_1552(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [NDRIntField("sv1552_maxlinkdelay", 0)]


class LPSERVER_INFO_1553(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [NDRIntField("sv1553_minlinkthroughput", 0)]


class LPSERVER_INFO_1554(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [NDRIntField("sv1554_linkinfovalidtime", 0)]


class LPSERVER_INFO_1555(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [NDRIntField("sv1555_scavqosinfoupdatetime", 0)]


class LPSERVER_INFO_1556(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [NDRIntField("sv1556_maxworkitemidletime", 0)]


class NetrServerGetInfo_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerName", "")),
        NDRIntField("Level", 0),
    ]


class NetrServerGetInfo_Response(NDRPacket):
    fields_desc = [
        NDRUnionField(
            [
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_100(), LPSERVER_INFO_100
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 100),
                        (lambda _, val: val.tag == 100),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_101(), LPSERVER_INFO_101
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 101),
                        (lambda _, val: val.tag == 101),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_102(), LPSERVER_INFO_102
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 102),
                        (lambda _, val: val.tag == 102),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_103(), LPSERVER_INFO_103
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 103),
                        (lambda _, val: val.tag == 103),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_502(), LPSERVER_INFO_502
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 502),
                        (lambda _, val: val.tag == 502),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_503(), LPSERVER_INFO_503
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 503),
                        (lambda _, val: val.tag == 503),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_599(), LPSERVER_INFO_599
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 599),
                        (lambda _, val: val.tag == 599),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1005(), LPSERVER_INFO_1005
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1005),
                        (lambda _, val: val.tag == 1005),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1107(), LPSERVER_INFO_1107
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1107),
                        (lambda _, val: val.tag == 1107),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1010(), LPSERVER_INFO_1010
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1010),
                        (lambda _, val: val.tag == 1010),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1016(), LPSERVER_INFO_1016
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1016),
                        (lambda _, val: val.tag == 1016),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1017(), LPSERVER_INFO_1017
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1017),
                        (lambda _, val: val.tag == 1017),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1018(), LPSERVER_INFO_1018
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1018),
                        (lambda _, val: val.tag == 1018),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1501(), LPSERVER_INFO_1501
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1501),
                        (lambda _, val: val.tag == 1501),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1502(), LPSERVER_INFO_1502
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1502),
                        (lambda _, val: val.tag == 1502),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1503(), LPSERVER_INFO_1503
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1503),
                        (lambda _, val: val.tag == 1503),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1506(), LPSERVER_INFO_1506
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1506),
                        (lambda _, val: val.tag == 1506),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1510(), LPSERVER_INFO_1510
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1510),
                        (lambda _, val: val.tag == 1510),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1511(), LPSERVER_INFO_1511
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1511),
                        (lambda _, val: val.tag == 1511),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1512(), LPSERVER_INFO_1512
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1512),
                        (lambda _, val: val.tag == 1512),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1513(), LPSERVER_INFO_1513
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1513),
                        (lambda _, val: val.tag == 1513),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1514(), LPSERVER_INFO_1514
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1514),
                        (lambda _, val: val.tag == 1514),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1515(), LPSERVER_INFO_1515
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1515),
                        (lambda _, val: val.tag == 1515),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1516(), LPSERVER_INFO_1516
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1516),
                        (lambda _, val: val.tag == 1516),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1518(), LPSERVER_INFO_1518
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1518),
                        (lambda _, val: val.tag == 1518),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1523(), LPSERVER_INFO_1523
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1523),
                        (lambda _, val: val.tag == 1523),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1528(), LPSERVER_INFO_1528
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1528),
                        (lambda _, val: val.tag == 1528),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1529(), LPSERVER_INFO_1529
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1529),
                        (lambda _, val: val.tag == 1529),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1530(), LPSERVER_INFO_1530
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1530),
                        (lambda _, val: val.tag == 1530),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1533(), LPSERVER_INFO_1533
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1533),
                        (lambda _, val: val.tag == 1533),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1534(), LPSERVER_INFO_1534
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1534),
                        (lambda _, val: val.tag == 1534),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1535(), LPSERVER_INFO_1535
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1535),
                        (lambda _, val: val.tag == 1535),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1536(), LPSERVER_INFO_1536
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1536),
                        (lambda _, val: val.tag == 1536),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1538(), LPSERVER_INFO_1538
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1538),
                        (lambda _, val: val.tag == 1538),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1539(), LPSERVER_INFO_1539
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1539),
                        (lambda _, val: val.tag == 1539),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1540(), LPSERVER_INFO_1540
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1540),
                        (lambda _, val: val.tag == 1540),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1541(), LPSERVER_INFO_1541
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1541),
                        (lambda _, val: val.tag == 1541),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1542(), LPSERVER_INFO_1542
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1542),
                        (lambda _, val: val.tag == 1542),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1543(), LPSERVER_INFO_1543
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1543),
                        (lambda _, val: val.tag == 1543),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1544(), LPSERVER_INFO_1544
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1544),
                        (lambda _, val: val.tag == 1544),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1545(), LPSERVER_INFO_1545
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1545),
                        (lambda _, val: val.tag == 1545),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1546(), LPSERVER_INFO_1546
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1546),
                        (lambda _, val: val.tag == 1546),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1547(), LPSERVER_INFO_1547
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1547),
                        (lambda _, val: val.tag == 1547),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1548(), LPSERVER_INFO_1548
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1548),
                        (lambda _, val: val.tag == 1548),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1549(), LPSERVER_INFO_1549
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1549),
                        (lambda _, val: val.tag == 1549),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1550(), LPSERVER_INFO_1550
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1550),
                        (lambda _, val: val.tag == 1550),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1552(), LPSERVER_INFO_1552
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1552),
                        (lambda _, val: val.tag == 1552),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1553(), LPSERVER_INFO_1553
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1553),
                        (lambda _, val: val.tag == 1553),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1554(), LPSERVER_INFO_1554
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1554),
                        (lambda _, val: val.tag == 1554),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1555(), LPSERVER_INFO_1555
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1555),
                        (lambda _, val: val.tag == 1555),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1556(), LPSERVER_INFO_1556
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1556),
                        (lambda _, val: val.tag == 1556),
                    ),
                ),
            ],
            StrFixedLenField("ServerInfo", "", length=0),
            align=(4, 8),
            switch_fmt=("L", "L"),
        ),
        NDRIntField("status", 0),
    ]


class NetrServerSetInfo_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerName", "")),
        NDRIntField("Level", 0),
        NDRUnionField(
            [
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_100(), LPSERVER_INFO_100
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 100),
                        (lambda _, val: val.tag == 100),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_101(), LPSERVER_INFO_101
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 101),
                        (lambda _, val: val.tag == 101),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_102(), LPSERVER_INFO_102
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 102),
                        (lambda _, val: val.tag == 102),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_103(), LPSERVER_INFO_103
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 103),
                        (lambda _, val: val.tag == 103),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_502(), LPSERVER_INFO_502
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 502),
                        (lambda _, val: val.tag == 502),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_503(), LPSERVER_INFO_503
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 503),
                        (lambda _, val: val.tag == 503),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_599(), LPSERVER_INFO_599
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 599),
                        (lambda _, val: val.tag == 599),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1005(), LPSERVER_INFO_1005
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1005),
                        (lambda _, val: val.tag == 1005),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1107(), LPSERVER_INFO_1107
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1107),
                        (lambda _, val: val.tag == 1107),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1010(), LPSERVER_INFO_1010
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1010),
                        (lambda _, val: val.tag == 1010),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1016(), LPSERVER_INFO_1016
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1016),
                        (lambda _, val: val.tag == 1016),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1017(), LPSERVER_INFO_1017
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1017),
                        (lambda _, val: val.tag == 1017),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1018(), LPSERVER_INFO_1018
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1018),
                        (lambda _, val: val.tag == 1018),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1501(), LPSERVER_INFO_1501
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1501),
                        (lambda _, val: val.tag == 1501),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1502(), LPSERVER_INFO_1502
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1502),
                        (lambda _, val: val.tag == 1502),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1503(), LPSERVER_INFO_1503
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1503),
                        (lambda _, val: val.tag == 1503),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1506(), LPSERVER_INFO_1506
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1506),
                        (lambda _, val: val.tag == 1506),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1510(), LPSERVER_INFO_1510
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1510),
                        (lambda _, val: val.tag == 1510),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1511(), LPSERVER_INFO_1511
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1511),
                        (lambda _, val: val.tag == 1511),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1512(), LPSERVER_INFO_1512
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1512),
                        (lambda _, val: val.tag == 1512),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1513(), LPSERVER_INFO_1513
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1513),
                        (lambda _, val: val.tag == 1513),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1514(), LPSERVER_INFO_1514
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1514),
                        (lambda _, val: val.tag == 1514),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1515(), LPSERVER_INFO_1515
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1515),
                        (lambda _, val: val.tag == 1515),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1516(), LPSERVER_INFO_1516
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1516),
                        (lambda _, val: val.tag == 1516),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1518(), LPSERVER_INFO_1518
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1518),
                        (lambda _, val: val.tag == 1518),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1523(), LPSERVER_INFO_1523
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1523),
                        (lambda _, val: val.tag == 1523),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1528(), LPSERVER_INFO_1528
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1528),
                        (lambda _, val: val.tag == 1528),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1529(), LPSERVER_INFO_1529
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1529),
                        (lambda _, val: val.tag == 1529),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1530(), LPSERVER_INFO_1530
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1530),
                        (lambda _, val: val.tag == 1530),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1533(), LPSERVER_INFO_1533
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1533),
                        (lambda _, val: val.tag == 1533),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1534(), LPSERVER_INFO_1534
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1534),
                        (lambda _, val: val.tag == 1534),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1535(), LPSERVER_INFO_1535
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1535),
                        (lambda _, val: val.tag == 1535),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1536(), LPSERVER_INFO_1536
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1536),
                        (lambda _, val: val.tag == 1536),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1538(), LPSERVER_INFO_1538
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1538),
                        (lambda _, val: val.tag == 1538),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1539(), LPSERVER_INFO_1539
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1539),
                        (lambda _, val: val.tag == 1539),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1540(), LPSERVER_INFO_1540
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1540),
                        (lambda _, val: val.tag == 1540),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1541(), LPSERVER_INFO_1541
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1541),
                        (lambda _, val: val.tag == 1541),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1542(), LPSERVER_INFO_1542
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1542),
                        (lambda _, val: val.tag == 1542),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1543(), LPSERVER_INFO_1543
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1543),
                        (lambda _, val: val.tag == 1543),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1544(), LPSERVER_INFO_1544
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1544),
                        (lambda _, val: val.tag == 1544),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1545(), LPSERVER_INFO_1545
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1545),
                        (lambda _, val: val.tag == 1545),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1546(), LPSERVER_INFO_1546
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1546),
                        (lambda _, val: val.tag == 1546),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1547(), LPSERVER_INFO_1547
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1547),
                        (lambda _, val: val.tag == 1547),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1548(), LPSERVER_INFO_1548
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1548),
                        (lambda _, val: val.tag == 1548),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1549(), LPSERVER_INFO_1549
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1549),
                        (lambda _, val: val.tag == 1549),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1550(), LPSERVER_INFO_1550
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1550),
                        (lambda _, val: val.tag == 1550),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1552(), LPSERVER_INFO_1552
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1552),
                        (lambda _, val: val.tag == 1552),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1553(), LPSERVER_INFO_1553
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1553),
                        (lambda _, val: val.tag == 1553),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1554(), LPSERVER_INFO_1554
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1554),
                        (lambda _, val: val.tag == 1554),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1555(), LPSERVER_INFO_1555
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1555),
                        (lambda _, val: val.tag == 1555),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerInfo", LPSERVER_INFO_1556(), LPSERVER_INFO_1556
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1556),
                        (lambda _, val: val.tag == 1556),
                    ),
                ),
            ],
            StrFixedLenField("ServerInfo", "", length=0),
            align=(4, 8),
            switch_fmt=("L", "L"),
        ),
        NDRFullPointerField(NDRIntField("ParmErr", 0)),
    ]


class NetrServerSetInfo_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRIntField("ParmErr", 0)),
        NDRIntField("status", 0),
    ]


class LPDISK_INFO(NDRPacket):
    ALIGNMENT = (2, 2)
    fields_desc = [NDRVarStrLenFieldUtf16("Disk", "")]


class DISK_ENUM_CONTAINER(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("EntriesRead", None, size_of="Buffer"),
        NDRFullPointerField(
            NDRConfVarPacketListField(
                "Buffer",
                [LPDISK_INFO()],
                LPDISK_INFO,
                size_is=lambda pkt: pkt.EntriesRead,
                length_is=lambda pkt: pkt.EntriesRead,
            ),
            deferred=True,
        ),
    ]


class NetrServerDiskEnum_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerName", "")),
        NDRIntField("Level", 0),
        NDRPacketField("DiskInfoStruct", DISK_ENUM_CONTAINER(), DISK_ENUM_CONTAINER),
        NDRIntField("PreferedMaximumLength", 0),
        NDRFullPointerField(NDRIntField("ResumeHandle", 0)),
    ]


class NetrServerDiskEnum_Response(NDRPacket):
    fields_desc = [
        NDRPacketField("DiskInfoStruct", DISK_ENUM_CONTAINER(), DISK_ENUM_CONTAINER),
        NDRIntField("TotalEntries", 0),
        NDRFullPointerField(NDRIntField("ResumeHandle", 0)),
        NDRIntField("status", 0),
    ]


class LPSTAT_SERVER_0(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [
        NDRIntField("sts0_start", 0),
        NDRIntField("sts0_fopens", 0),
        NDRIntField("sts0_devopens", 0),
        NDRIntField("sts0_jobsqueued", 0),
        NDRIntField("sts0_sopens", 0),
        NDRIntField("sts0_stimedout", 0),
        NDRIntField("sts0_serrorout", 0),
        NDRIntField("sts0_pwerrors", 0),
        NDRIntField("sts0_permerrors", 0),
        NDRIntField("sts0_syserrors", 0),
        NDRIntField("sts0_bytessent_low", 0),
        NDRIntField("sts0_bytessent_high", 0),
        NDRIntField("sts0_bytesrcvd_low", 0),
        NDRIntField("sts0_bytesrcvd_high", 0),
        NDRIntField("sts0_avresponse", 0),
        NDRIntField("sts0_reqbufneed", 0),
        NDRIntField("sts0_bigbufneed", 0),
    ]


class NetrServerStatisticsGet_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerName", "")),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("Service", "")),
        NDRIntField("Level", 0),
        NDRIntField("Options", 0),
    ]


class NetrServerStatisticsGet_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("InfoStruct", LPSTAT_SERVER_0(), LPSTAT_SERVER_0)
        ),
        NDRIntField("status", 0),
    ]


class LPSERVER_TRANSPORT_INFO_0(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("svti0_numberofvcs", 0),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("svti0_transportname", ""), deferred=True
        ),
        NDRFullPointerField(
            NDRConfStrLenField(
                "svti0_transportaddress",
                "",
                size_is=lambda pkt: pkt.svti0_transportaddresslength,
            ),
            deferred=True,
        ),
        NDRIntField(
            "svti0_transportaddresslength", None, size_of="svti0_transportaddress"
        ),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("svti0_networkaddress", ""), deferred=True
        ),
    ]


class NetrServerTransportAdd_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerName", "")),
        NDRIntField("Level", 0),
        NDRPacketField(
            "Buffer", LPSERVER_TRANSPORT_INFO_0(), LPSERVER_TRANSPORT_INFO_0
        ),
    ]


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


class PSERVER_XPORT_INFO_0_CONTAINER(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("EntriesRead", None, size_of="Buffer"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "Buffer",
                [LPSERVER_TRANSPORT_INFO_0()],
                LPSERVER_TRANSPORT_INFO_0,
                size_is=lambda pkt: pkt.EntriesRead,
            ),
            deferred=True,
        ),
    ]


class LPSERVER_TRANSPORT_INFO_1(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("svti1_numberofvcs", 0),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("svti1_transportname", ""), deferred=True
        ),
        NDRFullPointerField(
            NDRConfStrLenField(
                "svti1_transportaddress",
                "",
                size_is=lambda pkt: pkt.svti1_transportaddresslength,
            ),
            deferred=True,
        ),
        NDRIntField(
            "svti1_transportaddresslength", None, size_of="svti1_transportaddress"
        ),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("svti1_networkaddress", ""), deferred=True
        ),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("svti1_domain", ""), deferred=True
        ),
    ]


class PSERVER_XPORT_INFO_1_CONTAINER(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("EntriesRead", None, size_of="Buffer"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "Buffer",
                [LPSERVER_TRANSPORT_INFO_1()],
                LPSERVER_TRANSPORT_INFO_1,
                size_is=lambda pkt: pkt.EntriesRead,
            ),
            deferred=True,
        ),
    ]


class LPSERVER_TRANSPORT_INFO_2(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("svti2_numberofvcs", 0),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("svti2_transportname", ""), deferred=True
        ),
        NDRFullPointerField(
            NDRConfStrLenField(
                "svti2_transportaddress",
                "",
                size_is=lambda pkt: pkt.svti2_transportaddresslength,
            ),
            deferred=True,
        ),
        NDRIntField(
            "svti2_transportaddresslength", None, size_of="svti2_transportaddress"
        ),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("svti2_networkaddress", ""), deferred=True
        ),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("svti2_domain", ""), deferred=True
        ),
        NDRIntField("svti2_flags", 0),
    ]


class PSERVER_XPORT_INFO_2_CONTAINER(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("EntriesRead", None, size_of="Buffer"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "Buffer",
                [LPSERVER_TRANSPORT_INFO_2()],
                LPSERVER_TRANSPORT_INFO_2,
                size_is=lambda pkt: pkt.EntriesRead,
            ),
            deferred=True,
        ),
    ]


class LPSERVER_TRANSPORT_INFO_3(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("svti3_numberofvcs", 0),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("svti3_transportname", ""), deferred=True
        ),
        NDRFullPointerField(
            NDRConfStrLenField(
                "svti3_transportaddress",
                "",
                size_is=lambda pkt: pkt.svti3_transportaddresslength,
            ),
            deferred=True,
        ),
        NDRIntField(
            "svti3_transportaddresslength", None, size_of="svti3_transportaddress"
        ),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("svti3_networkaddress", ""), deferred=True
        ),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("svti3_domain", ""), deferred=True
        ),
        NDRIntField("svti3_flags", 0),
        NDRIntField("svti3_passwordlength", 0),
        StrFixedLenField("svti3_password", "", length=256),
    ]


class PSERVER_XPORT_INFO_3_CONTAINER(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("EntriesRead", None, size_of="Buffer"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "Buffer",
                [LPSERVER_TRANSPORT_INFO_3()],
                LPSERVER_TRANSPORT_INFO_3,
                size_is=lambda pkt: pkt.EntriesRead,
            ),
            deferred=True,
        ),
    ]


class LPSERVER_XPORT_ENUM_STRUCT(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("Level", 0),
        NDRUnionField(
            [
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "XportInfo",
                            PSERVER_XPORT_INFO_0_CONTAINER(),
                            PSERVER_XPORT_INFO_0_CONTAINER,
                        ),
                        deferred=True,
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 0),
                        (lambda _, val: val.tag == 0),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "XportInfo",
                            PSERVER_XPORT_INFO_1_CONTAINER(),
                            PSERVER_XPORT_INFO_1_CONTAINER,
                        ),
                        deferred=True,
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1),
                        (lambda _, val: val.tag == 1),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "XportInfo",
                            PSERVER_XPORT_INFO_2_CONTAINER(),
                            PSERVER_XPORT_INFO_2_CONTAINER,
                        ),
                        deferred=True,
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 2),
                        (lambda _, val: val.tag == 2),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "XportInfo",
                            PSERVER_XPORT_INFO_3_CONTAINER(),
                            PSERVER_XPORT_INFO_3_CONTAINER,
                        ),
                        deferred=True,
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 3),
                        (lambda _, val: val.tag == 3),
                    ),
                ),
            ],
            StrFixedLenField("XportInfo", "", length=0),
            align=(4, 8),
            switch_fmt=("L", "L"),
        ),
    ]


class NetrServerTransportEnum_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerName", "")),
        NDRPacketField(
            "InfoStruct", LPSERVER_XPORT_ENUM_STRUCT(), LPSERVER_XPORT_ENUM_STRUCT
        ),
        NDRIntField("PreferedMaximumLength", 0),
        NDRFullPointerField(NDRIntField("ResumeHandle", 0)),
    ]


class NetrServerTransportEnum_Response(NDRPacket):
    fields_desc = [
        NDRPacketField(
            "InfoStruct", LPSERVER_XPORT_ENUM_STRUCT(), LPSERVER_XPORT_ENUM_STRUCT
        ),
        NDRIntField("TotalEntries", 0),
        NDRFullPointerField(NDRIntField("ResumeHandle", 0)),
        NDRIntField("status", 0),
    ]


class NetrServerTransportDel_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerName", "")),
        NDRIntField("Level", 0),
        NDRPacketField(
            "Buffer", LPSERVER_TRANSPORT_INFO_0(), LPSERVER_TRANSPORT_INFO_0
        ),
    ]


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


class LPTIME_OF_DAY_INFO(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [
        NDRIntField("tod_elapsedt", 0),
        NDRIntField("tod_msecs", 0),
        NDRIntField("tod_hours", 0),
        NDRIntField("tod_mins", 0),
        NDRIntField("tod_secs", 0),
        NDRIntField("tod_hunds", 0),
        NDRSignedIntField("tod_timezone", 0),
        NDRIntField("tod_tinterval", 0),
        NDRIntField("tod_day", 0),
        NDRIntField("tod_month", 0),
        NDRIntField("tod_year", 0),
        NDRIntField("tod_weekday", 0),
    ]


class NetrRemoteTOD_Request(NDRPacket):
    fields_desc = [NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerName", ""))]


class NetrRemoteTOD_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("BufferPtr", LPTIME_OF_DAY_INFO(), LPTIME_OF_DAY_INFO)
        ),
        NDRIntField("status", 0),
    ]


class NetprPathType_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerName", "")),
        NDRConfVarStrNullFieldUtf16("PathName", ""),
        NDRIntField("Flags", 0),
    ]


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


class NetprPathCanonicalize_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerName", "")),
        NDRConfVarStrNullFieldUtf16("PathName", ""),
        NDRIntField("OutbufLen", 0),
        NDRConfVarStrNullFieldUtf16("Prefix", ""),
        NDRIntField("PathType", 0),
        NDRIntField("Flags", 0),
    ]


class NetprPathCanonicalize_Response(NDRPacket):
    fields_desc = [
        NDRConfStrLenField("Outbuf", "", size_is=lambda pkt: pkt.OutbufLen),
        NDRIntField("PathType", 0),
        NDRIntField("status", 0),
    ]


class NetprPathCompare_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerName", "")),
        NDRConfVarStrNullFieldUtf16("PathName1", ""),
        NDRConfVarStrNullFieldUtf16("PathName2", ""),
        NDRIntField("PathType", 0),
        NDRIntField("Flags", 0),
    ]


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


class NetprNameValidate_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerName", "")),
        NDRConfVarStrNullFieldUtf16("Name", ""),
        NDRIntField("NameType", 0),
        NDRIntField("Flags", 0),
    ]


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


class NetprNameCanonicalize_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerName", "")),
        NDRConfVarStrNullFieldUtf16("Name", ""),
        NDRIntField("OutbufLen", 0),
        NDRIntField("NameType", 0),
        NDRIntField("Flags", 0),
    ]


class NetprNameCanonicalize_Response(NDRPacket):
    fields_desc = [
        NDRConfStrLenFieldUtf16("Outbuf", "", size_is=lambda pkt: pkt.OutbufLen),
        NDRIntField("status", 0),
    ]


class NetprNameCompare_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerName", "")),
        NDRConfVarStrNullFieldUtf16("Name1", ""),
        NDRConfVarStrNullFieldUtf16("Name2", ""),
        NDRIntField("NameType", 0),
        NDRIntField("Flags", 0),
    ]


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


class NetrShareEnumSticky_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerName", "")),
        NDRPacketField("InfoStruct", LPSHARE_ENUM_STRUCT(), LPSHARE_ENUM_STRUCT),
        NDRIntField("PreferedMaximumLength", 0),
        NDRFullPointerField(NDRIntField("ResumeHandle", 0)),
    ]


class NetrShareEnumSticky_Response(NDRPacket):
    fields_desc = [
        NDRPacketField("InfoStruct", LPSHARE_ENUM_STRUCT(), LPSHARE_ENUM_STRUCT),
        NDRIntField("TotalEntries", 0),
        NDRFullPointerField(NDRIntField("ResumeHandle", 0)),
        NDRIntField("status", 0),
    ]


class NetrShareDelStart_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerName", "")),
        NDRConfVarStrNullFieldUtf16("NetName", ""),
        NDRIntField("Reserved", 0),
    ]


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


class NetrShareDelCommit_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("ContextHandle", NDRContextHandle(), NDRContextHandle)
    ]


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


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


class NetrpGetFileSecurity_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerName", "")),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ShareName", "")),
        NDRConfVarStrNullFieldUtf16("lpFileName", ""),
        NDRIntField("RequestedInformation", 0),
    ]


class NetrpGetFileSecurity_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField(
                "SecurityDescriptor",
                PADT_SECURITY_DESCRIPTOR(),
                PADT_SECURITY_DESCRIPTOR,
            )
        ),
        NDRIntField("status", 0),
    ]


class NetrpSetFileSecurity_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerName", "")),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ShareName", "")),
        NDRConfVarStrNullFieldUtf16("lpFileName", ""),
        NDRIntField("SecurityInformation", 0),
        NDRPacketField(
            "SecurityDescriptor", PADT_SECURITY_DESCRIPTOR(), PADT_SECURITY_DESCRIPTOR
        ),
    ]


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


class SERVER_TRANSPORT_INFO_0(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("svti0_numberofvcs", 0),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("svti0_transportname", ""), deferred=True
        ),
        NDRFullPointerField(
            NDRConfStrLenField(
                "svti0_transportaddress",
                "",
                size_is=lambda pkt: pkt.svti0_transportaddresslength,
            ),
            deferred=True,
        ),
        NDRIntField(
            "svti0_transportaddresslength", None, size_of="svti0_transportaddress"
        ),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("svti0_networkaddress", ""), deferred=True
        ),
    ]


class SERVER_TRANSPORT_INFO_1(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("svti1_numberofvcs", 0),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("svti1_transportname", ""), deferred=True
        ),
        NDRFullPointerField(
            NDRConfStrLenField(
                "svti1_transportaddress",
                "",
                size_is=lambda pkt: pkt.svti1_transportaddresslength,
            ),
            deferred=True,
        ),
        NDRIntField(
            "svti1_transportaddresslength", None, size_of="svti1_transportaddress"
        ),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("svti1_networkaddress", ""), deferred=True
        ),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("svti1_domain", ""), deferred=True
        ),
    ]


class SERVER_TRANSPORT_INFO_2(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("svti2_numberofvcs", 0),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("svti2_transportname", ""), deferred=True
        ),
        NDRFullPointerField(
            NDRConfStrLenField(
                "svti2_transportaddress",
                "",
                size_is=lambda pkt: pkt.svti2_transportaddresslength,
            ),
            deferred=True,
        ),
        NDRIntField(
            "svti2_transportaddresslength", None, size_of="svti2_transportaddress"
        ),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("svti2_networkaddress", ""), deferred=True
        ),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("svti2_domain", ""), deferred=True
        ),
        NDRIntField("svti2_flags", 0),
    ]


class SERVER_TRANSPORT_INFO_3(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("svti3_numberofvcs", 0),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("svti3_transportname", ""), deferred=True
        ),
        NDRFullPointerField(
            NDRConfStrLenField(
                "svti3_transportaddress",
                "",
                size_is=lambda pkt: pkt.svti3_transportaddresslength,
            ),
            deferred=True,
        ),
        NDRIntField(
            "svti3_transportaddresslength", None, size_of="svti3_transportaddress"
        ),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("svti3_networkaddress", ""), deferred=True
        ),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("svti3_domain", ""), deferred=True
        ),
        NDRIntField("svti3_flags", 0),
        NDRIntField("svti3_passwordlength", 0),
        StrFixedLenField("svti3_password", "", length=256),
    ]


class NetrServerTransportAddEx_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerName", "")),
        NDRIntField("Level", 0),
        NDRUnionField(
            [
                (
                    NDRPacketField(
                        "Buffer", SERVER_TRANSPORT_INFO_0(), SERVER_TRANSPORT_INFO_0
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 0),
                        (lambda _, val: val.tag == 0),
                    ),
                ),
                (
                    NDRPacketField(
                        "Buffer", SERVER_TRANSPORT_INFO_1(), SERVER_TRANSPORT_INFO_1
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1),
                        (lambda _, val: val.tag == 1),
                    ),
                ),
                (
                    NDRPacketField(
                        "Buffer", SERVER_TRANSPORT_INFO_2(), SERVER_TRANSPORT_INFO_2
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 2),
                        (lambda _, val: val.tag == 2),
                    ),
                ),
                (
                    NDRPacketField(
                        "Buffer", SERVER_TRANSPORT_INFO_3(), SERVER_TRANSPORT_INFO_3
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 3),
                        (lambda _, val: val.tag == 3),
                    ),
                ),
            ],
            StrFixedLenField("Buffer", "", length=0),
            align=(4, 8),
            switch_fmt=("L", "L"),
        ),
    ]


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


class NetrDfsGetVersion_Request(NDRPacket):
    fields_desc = [NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerName", ""))]


class NetrDfsGetVersion_Response(NDRPacket):
    fields_desc = [NDRIntField("Version", 0), 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 LPNET_DFS_ENTRY_ID(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRPacketField("Uid", GUID(), GUID),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("Prefix", ""), deferred=True),
    ]


class LPNET_DFS_ENTRY_ID_CONTAINER(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("Count", None, size_of="Buffer"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "Buffer",
                [LPNET_DFS_ENTRY_ID()],
                LPNET_DFS_ENTRY_ID,
                size_is=lambda pkt: pkt.Count,
            ),
            deferred=True,
        ),
    ]


class NetrDfsCreateLocalPartition_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerName", "")),
        NDRConfVarStrNullFieldUtf16("ShareName", ""),
        NDRPacketField("EntryUid", GUID(), GUID),
        NDRConfVarStrNullFieldUtf16("EntryPrefix", ""),
        NDRConfVarStrNullFieldUtf16("ShortName", ""),
        NDRPacketField(
            "RelationInfo", LPNET_DFS_ENTRY_ID_CONTAINER(), LPNET_DFS_ENTRY_ID_CONTAINER
        ),
        NDRSignedIntField("Force", 0),
    ]


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


class NetrDfsDeleteLocalPartition_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerName", "")),
        NDRPacketField("Uid", GUID(), GUID),
        NDRConfVarStrNullFieldUtf16("Prefix", ""),
    ]


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


class NetrDfsSetLocalVolumeState_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerName", "")),
        NDRPacketField("Uid", GUID(), GUID),
        NDRConfVarStrNullFieldUtf16("Prefix", ""),
        NDRIntField("State", 0),
    ]


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


class NetrDfsCreateExitPoint_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerName", "")),
        NDRPacketField("Uid", GUID(), GUID),
        NDRConfVarStrNullFieldUtf16("Prefix", ""),
        NDRIntField("Type", 0),
        NDRIntField("ShortPrefixLen", 0),
    ]


class NetrDfsCreateExitPoint_Response(NDRPacket):
    fields_desc = [
        NDRConfStrLenFieldUtf16(
            "ShortPrefix", "", size_is=lambda pkt: pkt.ShortPrefixLen
        ),
        NDRIntField("status", 0),
    ]


class NetrDfsDeleteExitPoint_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerName", "")),
        NDRPacketField("Uid", GUID(), GUID),
        NDRConfVarStrNullFieldUtf16("Prefix", ""),
        NDRIntField("Type", 0),
    ]


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


class NetrDfsModifyPrefix_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerName", "")),
        NDRPacketField("Uid", GUID(), GUID),
        NDRConfVarStrNullFieldUtf16("Prefix", ""),
    ]


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


class NetrDfsFixLocalVolume_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerName", "")),
        NDRConfVarStrNullFieldUtf16("VolumeName", ""),
        NDRIntField("EntryType", 0),
        NDRIntField("ServiceType", 0),
        NDRConfVarStrNullFieldUtf16("StgId", ""),
        NDRPacketField("EntryUid", GUID(), GUID),
        NDRConfVarStrNullFieldUtf16("EntryPrefix", ""),
        NDRPacketField(
            "RelationInfo", LPNET_DFS_ENTRY_ID_CONTAINER(), LPNET_DFS_ENTRY_ID_CONTAINER
        ),
        NDRIntField("CreateDisposition", 0),
    ]


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


class DFS_SITENAME_INFO(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("SiteFlags", 0),
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("SiteName", ""), deferred=True),
    ]


class LPDFS_SITELIST_INFO(NDRPacket):
    ALIGNMENT = (4, 8)
    DEPORTED_CONFORMANTS = ["Site"]
    fields_desc = [
        NDRIntField("cSites", None, size_of="Site"),
        NDRConfPacketListField(
            "Site",
            [],
            DFS_SITENAME_INFO,
            size_is=lambda pkt: pkt.cSites,
            conformant_in_struct=True,
        ),
    ]


class NetrDfsManagerReportSiteInfo_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerName", "")),
        NDRFullPointerField(
            NDRFullPointerField(
                NDRPacketField("ppSiteInfo", LPDFS_SITELIST_INFO(), LPDFS_SITELIST_INFO)
            )
        ),
    ]


class NetrDfsManagerReportSiteInfo_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRFullPointerField(
                NDRPacketField("ppSiteInfo", LPDFS_SITELIST_INFO(), LPDFS_SITELIST_INFO)
            )
        ),
        NDRIntField("status", 0),
    ]


class NetrServerTransportDelEx_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerName", "")),
        NDRIntField("Level", 0),
        NDRUnionField(
            [
                (
                    NDRPacketField(
                        "Buffer", SERVER_TRANSPORT_INFO_0(), SERVER_TRANSPORT_INFO_0
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 0),
                        (lambda _, val: val.tag == 0),
                    ),
                ),
                (
                    NDRPacketField(
                        "Buffer", SERVER_TRANSPORT_INFO_1(), SERVER_TRANSPORT_INFO_1
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1),
                        (lambda _, val: val.tag == 1),
                    ),
                ),
                (
                    NDRPacketField(
                        "Buffer", SERVER_TRANSPORT_INFO_2(), SERVER_TRANSPORT_INFO_2
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 2),
                        (lambda _, val: val.tag == 2),
                    ),
                ),
                (
                    NDRPacketField(
                        "Buffer", SERVER_TRANSPORT_INFO_3(), SERVER_TRANSPORT_INFO_3
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 3),
                        (lambda _, val: val.tag == 3),
                    ),
                ),
            ],
            StrFixedLenField("Buffer", "", length=0),
            align=(4, 8),
            switch_fmt=("L", "L"),
        ),
    ]


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


class LPSERVER_ALIAS_INFO_0(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("srvai0_alias", ""), deferred=True
        ),
        NDRFullPointerField(
            NDRConfVarStrNullFieldUtf16("srvai0_target", ""), deferred=True
        ),
        NDRByteField("srvai0_default", 0),
        NDRIntField("srvai0_reserved", 0),
    ]


class NetrServerAliasAdd_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerName", "")),
        NDRIntField("Level", 0),
        NDRUnionField(
            [
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "InfoStruct", LPSERVER_ALIAS_INFO_0(), LPSERVER_ALIAS_INFO_0
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 0),
                        (lambda _, val: val.tag == 0),
                    ),
                )
            ],
            StrFixedLenField("InfoStruct", "", length=0),
            align=(4, 8),
            switch_fmt=("L", "L"),
        ),
    ]


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


class SERVER_ALIAS_INFO_0_CONTAINER(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("EntriesRead", None, size_of="Buffer"),
        NDRFullPointerField(
            NDRConfPacketListField(
                "Buffer",
                [LPSERVER_ALIAS_INFO_0()],
                LPSERVER_ALIAS_INFO_0,
                size_is=lambda pkt: pkt.EntriesRead,
            ),
            deferred=True,
        ),
    ]


class LPSERVER_ALIAS_ENUM_STRUCT(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("Level", 0),
        NDRUnionField(
            [
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ServerAliasInfo",
                            SERVER_ALIAS_INFO_0_CONTAINER(),
                            SERVER_ALIAS_INFO_0_CONTAINER,
                        ),
                        deferred=True,
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 0),
                        (lambda _, val: val.tag == 0),
                    ),
                )
            ],
            StrFixedLenField("ServerAliasInfo", "", length=0),
            align=(4, 8),
            switch_fmt=("L", "L"),
        ),
    ]


class NetrServerAliasEnum_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerName", "")),
        NDRPacketField(
            "InfoStruct", LPSERVER_ALIAS_ENUM_STRUCT(), LPSERVER_ALIAS_ENUM_STRUCT
        ),
        NDRIntField("PreferedMaximumLength", 0),
        NDRFullPointerField(NDRIntField("ResumeHandle", 0)),
    ]


class NetrServerAliasEnum_Response(NDRPacket):
    fields_desc = [
        NDRPacketField(
            "InfoStruct", LPSERVER_ALIAS_ENUM_STRUCT(), LPSERVER_ALIAS_ENUM_STRUCT
        ),
        NDRIntField("TotalEntries", 0),
        NDRFullPointerField(NDRIntField("ResumeHandle", 0)),
        NDRIntField("status", 0),
    ]


class NetrServerAliasDel_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerName", "")),
        NDRIntField("Level", 0),
        NDRUnionField(
            [
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "InfoStruct", LPSERVER_ALIAS_INFO_0(), LPSERVER_ALIAS_INFO_0
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 0),
                        (lambda _, val: val.tag == 0),
                    ),
                )
            ],
            StrFixedLenField("InfoStruct", "", length=0),
            align=(4, 8),
            switch_fmt=("L", "L"),
        ),
    ]


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


class NetrShareDelEx_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRConfVarStrNullFieldUtf16("ServerName", "")),
        NDRIntField("Level", 0),
        NDRUnionField(
            [
                (
                    NDRFullPointerField(
                        NDRPacketField("ShareInfo", LPSHARE_INFO_0(), LPSHARE_INFO_0)
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 0),
                        (lambda _, val: val.tag == 0),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField("ShareInfo", LPSHARE_INFO_1(), LPSHARE_INFO_1)
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1),
                        (lambda _, val: val.tag == 1),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField("ShareInfo", LPSHARE_INFO_2(), LPSHARE_INFO_2)
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 2),
                        (lambda _, val: val.tag == 2),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ShareInfo", LPSHARE_INFO_502_I(), LPSHARE_INFO_502_I
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 502),
                        (lambda _, val: val.tag == 502),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ShareInfo", LPSHARE_INFO_1004(), LPSHARE_INFO_1004
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1004),
                        (lambda _, val: val.tag == 1004),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ShareInfo", LPSHARE_INFO_1006(), LPSHARE_INFO_1006
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1006),
                        (lambda _, val: val.tag == 1006),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ShareInfo", LPSHARE_INFO_1501_I(), LPSHARE_INFO_1501_I
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1501),
                        (lambda _, val: val.tag == 1501),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ShareInfo", LPSHARE_INFO_1005(), LPSHARE_INFO_1005
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 1005),
                        (lambda _, val: val.tag == 1005),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ShareInfo", LPSHARE_INFO_501(), LPSHARE_INFO_501
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 501),
                        (lambda _, val: val.tag == 501),
                    ),
                ),
                (
                    NDRFullPointerField(
                        NDRPacketField(
                            "ShareInfo", LPSHARE_INFO_503_I(), LPSHARE_INFO_503_I
                        )
                    ),
                    (
                        (lambda pkt: getattr(pkt, "Level", None) == 503),
                        (lambda _, val: val.tag == 503),
                    ),
                ),
            ],
            StrFixedLenField("ShareInfo", "", length=0),
            align=(4, 8),
            switch_fmt=("L", "L"),
        ),
    ]


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


SRVSVC_OPNUMS = {  # 0: Opnum0NotUsedOnWire,
    # 1: Opnum1NotUsedOnWire,
    # 2: Opnum2NotUsedOnWire,
    # 3: Opnum3NotUsedOnWire,
    # 4: Opnum4NotUsedOnWire,
    # 5: Opnum5NotUsedOnWire,
    # 6: Opnum6NotUsedOnWire,
    # 7: Opnum7NotUsedOnWire,
    8: DceRpcOp(NetrConnectionEnum_Request, NetrConnectionEnum_Response),
    9: DceRpcOp(NetrFileEnum_Request, NetrFileEnum_Response),
    10: DceRpcOp(NetrFileGetInfo_Request, NetrFileGetInfo_Response),
    11: DceRpcOp(NetrFileClose_Request, NetrFileClose_Response),
    12: DceRpcOp(NetrSessionEnum_Request, NetrSessionEnum_Response),
    13: DceRpcOp(NetrSessionDel_Request, NetrSessionDel_Response),
    14: DceRpcOp(NetrShareAdd_Request, NetrShareAdd_Response),
    15: DceRpcOp(NetrShareEnum_Request, NetrShareEnum_Response),
    16: DceRpcOp(NetrShareGetInfo_Request, NetrShareGetInfo_Response),
    17: DceRpcOp(NetrShareSetInfo_Request, NetrShareSetInfo_Response),
    18: DceRpcOp(NetrShareDel_Request, NetrShareDel_Response),
    19: DceRpcOp(NetrShareDelSticky_Request, NetrShareDelSticky_Response),
    20: DceRpcOp(NetrShareCheck_Request, NetrShareCheck_Response),
    21: DceRpcOp(NetrServerGetInfo_Request, NetrServerGetInfo_Response),
    22: DceRpcOp(NetrServerSetInfo_Request, NetrServerSetInfo_Response),
    23: DceRpcOp(NetrServerDiskEnum_Request, NetrServerDiskEnum_Response),
    24: DceRpcOp(NetrServerStatisticsGet_Request, NetrServerStatisticsGet_Response),
    25: DceRpcOp(NetrServerTransportAdd_Request, NetrServerTransportAdd_Response),
    26: DceRpcOp(NetrServerTransportEnum_Request, NetrServerTransportEnum_Response),
    27: DceRpcOp(NetrServerTransportDel_Request, NetrServerTransportDel_Response),
    28: DceRpcOp(NetrRemoteTOD_Request, NetrRemoteTOD_Response),
    # 29: Opnum29NotUsedOnWire,
    30: DceRpcOp(NetprPathType_Request, NetprPathType_Response),
    31: DceRpcOp(NetprPathCanonicalize_Request, NetprPathCanonicalize_Response),
    32: DceRpcOp(NetprPathCompare_Request, NetprPathCompare_Response),
    33: DceRpcOp(NetprNameValidate_Request, NetprNameValidate_Response),
    34: DceRpcOp(NetprNameCanonicalize_Request, NetprNameCanonicalize_Response),
    35: DceRpcOp(NetprNameCompare_Request, NetprNameCompare_Response),
    36: DceRpcOp(NetrShareEnumSticky_Request, NetrShareEnumSticky_Response),
    37: DceRpcOp(NetrShareDelStart_Request, NetrShareDelStart_Response),
    38: DceRpcOp(NetrShareDelCommit_Request, NetrShareDelCommit_Response),
    39: DceRpcOp(NetrpGetFileSecurity_Request, NetrpGetFileSecurity_Response),
    40: DceRpcOp(NetrpSetFileSecurity_Request, NetrpSetFileSecurity_Response),
    41: DceRpcOp(NetrServerTransportAddEx_Request, NetrServerTransportAddEx_Response),
    # 42: Opnum42NotUsedOnWire,
    43: DceRpcOp(NetrDfsGetVersion_Request, NetrDfsGetVersion_Response),
    44: DceRpcOp(
        NetrDfsCreateLocalPartition_Request, NetrDfsCreateLocalPartition_Response
    ),
    45: DceRpcOp(
        NetrDfsDeleteLocalPartition_Request, NetrDfsDeleteLocalPartition_Response
    ),
    46: DceRpcOp(
        NetrDfsSetLocalVolumeState_Request, NetrDfsSetLocalVolumeState_Response
    ),
    # 47: Opnum47NotUsedOnWire,
    48: DceRpcOp(NetrDfsCreateExitPoint_Request, NetrDfsCreateExitPoint_Response),
    49: DceRpcOp(NetrDfsDeleteExitPoint_Request, NetrDfsDeleteExitPoint_Response),
    50: DceRpcOp(NetrDfsModifyPrefix_Request, NetrDfsModifyPrefix_Response),
    51: DceRpcOp(NetrDfsFixLocalVolume_Request, NetrDfsFixLocalVolume_Response),
    52: DceRpcOp(
        NetrDfsManagerReportSiteInfo_Request, NetrDfsManagerReportSiteInfo_Response
    ),
    53: DceRpcOp(NetrServerTransportDelEx_Request, NetrServerTransportDelEx_Response),
    54: DceRpcOp(NetrServerAliasAdd_Request, NetrServerAliasAdd_Response),
    55: DceRpcOp(NetrServerAliasEnum_Request, NetrServerAliasEnum_Response),
    56: DceRpcOp(NetrServerAliasDel_Request, NetrServerAliasDel_Response),
    57: DceRpcOp(NetrShareDelEx_Request, NetrShareDelEx_Response),
}
register_dcerpc_interface(
    name="srvsvc",
    uuid=uuid.UUID("4B324FC8-1670-01D3-1278-5A47BF6EE188"),
    version="3.0",
    opnums=SRVSVC_OPNUMS,
)
