### ms-dmrp_dmintf3.idl
"""
RPC definitions for the following interfaces:
- IVolumeClient3 (v0.0): 135698D2-3A37-4d26-99DF-E2BB6AE3AC61
- IVolumeClient4 (v0.0): DEB01010-3A37-4d26-99DF-E2BB6AE3AC61
This file is auto-generated by midl-to-scapy, do not modify.
"""

from enum import IntEnum
import uuid

from scapy.fields import StrFixedLenField, StrFixedLenFieldUtf16
from scapy.layers.dcerpc import (
    NDRPacket,
    DceRpcOp,
    NDRConfFieldListField,
    NDRConfPacketListField,
    NDRConfStrLenField,
    NDRConfStrLenFieldUtf16,
    NDRConfVarStrLenField,
    NDRConfVarStrLenFieldUtf16,
    NDRFullPointerField,
    NDRInt3264EnumField,
    NDRIntField,
    NDRLongField,
    NDRPacketField,
    NDRShortField,
    NDRSignedIntField,
    NDRSignedLongField,
    NDRUnionField,
    register_com_interface,
)


class PARTITIONSTYLE(IntEnum):
    PARTITIONSTYLE_UNKNOWN = 0
    PARTITIONSTYLE_MBR = 1
    PARTITIONSTYLE_GPT = 2


class mbr_sub0(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [NDRIntField("signature", 0)]


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


class gpt_sub1(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [NDRPacketField("diskId", GUID(), GUID)]


class diskinfoex(NDRPacket):
    ALIGNMENT = (8, 8)
    fields_desc = [
        NDRSignedLongField("id", 0),
        NDRSignedLongField("length", 0),
        NDRSignedLongField("freeBytes", 0),
        NDRIntField("bytesPerTrack", 0),
        NDRIntField("bytesPerCylinder", 0),
        NDRIntField("bytesPerSector", 0),
        NDRIntField("regionCount", 0),
        NDRIntField("dflags", 0),
        NDRIntField("deviceType", 0),
        NDRIntField("deviceState", 0),
        NDRIntField("busType", 0),
        NDRIntField("attributes", 0),
        NDRIntField("maxPartitionCount", 0),
        NDRIntField("isUpgradeable", 0),
        NDRIntField("maySwitchStyle", 0),
        NDRInt3264EnumField("partitionStyle", 0, PARTITIONSTYLE),
        NDRUnionField(
            [
                (
                    NDRPacketField("value", mbr_sub0(), mbr_sub0),
                    (
                        (
                            lambda pkt: getattr(pkt, "partitionStyle", None)
                            == PARTITIONSTYLE.PARTITIONSTYLE_MBR
                        ),
                        (lambda _, val: val.tag == PARTITIONSTYLE.PARTITIONSTYLE_MBR),
                    ),
                ),
                (
                    NDRPacketField("value", gpt_sub1(), gpt_sub1),
                    (
                        (
                            lambda pkt: getattr(pkt, "partitionStyle", None)
                            == PARTITIONSTYLE.PARTITIONSTYLE_GPT
                        ),
                        (lambda _, val: val.tag == PARTITIONSTYLE.PARTITIONSTYLE_GPT),
                    ),
                ),
            ],
            StrFixedLenField("value", "", length=0),
            align=(2, 4),
            switch_fmt=("H", "I"),
        ),
        NDRSignedIntField("portNumber", 0),
        NDRSignedIntField("targetNumber", 0),
        NDRSignedIntField("lunNumber", 0),
        NDRSignedLongField("lastKnownState", 0),
        NDRSignedLongField("taskId", 0),
        NDRSignedIntField("cchName", None, size_of="name"),
        NDRSignedIntField("cchVendor", None, size_of="vendor"),
        NDRSignedIntField("cchDgid", None, size_of="dgid"),
        NDRSignedIntField("cchAdapterName", None, size_of="adapterName"),
        NDRSignedIntField("cchDgName", None, size_of="dgName"),
        NDRSignedIntField("cchDevInstId", None, size_of="devInstId"),
        NDRFullPointerField(
            NDRConfStrLenFieldUtf16("name", "", size_is=lambda pkt: pkt.cchName),
            deferred=True,
        ),
        NDRFullPointerField(
            NDRConfStrLenFieldUtf16("vendor", "", size_is=lambda pkt: pkt.cchVendor),
            deferred=True,
        ),
        NDRFullPointerField(
            NDRConfStrLenField("dgid", "", size_is=lambda pkt: pkt.cchDgid),
            deferred=True,
        ),
        NDRFullPointerField(
            NDRConfStrLenFieldUtf16(
                "adapterName", "", size_is=lambda pkt: pkt.cchAdapterName
            ),
            deferred=True,
        ),
        NDRFullPointerField(
            NDRConfStrLenFieldUtf16("dgName", "", size_is=lambda pkt: pkt.cchDgName),
            deferred=True,
        ),
        NDRFullPointerField(
            NDRConfStrLenFieldUtf16(
                "devInstId", "", size_is=lambda pkt: pkt.cchDevInstId
            ),
            deferred=True,
        ),
    ]


class EnumDisksEx_Request(NDRPacket):
    fields_desc = []


class EnumDisksEx_Response(NDRPacket):
    fields_desc = [
        NDRIntField("diskCount", None, size_of="diskList"),
        NDRConfPacketListField(
            "diskList", [], diskinfoex, size_is=lambda pkt: pkt.diskCount, ptr_pack=True
        ),
        NDRIntField("status", 0),
    ]


class REGIONTYPE(IntEnum):
    REGION_UNKNOWN = 1
    REGION_FREE = 2
    REGION_EXTENDED_FREE = 3
    REGION_PRIMARY = 4
    REGION_LOGICAL = 5
    REGION_EXTENDED = 6
    REGION_SUBDISK = 7
    REGION_CDROM = 8
    REGION_REMOVABLE = 9


class mbr_sub0(NDRPacket):
    ALIGNMENT = (4, 4)
    fields_desc = [NDRIntField("partitionType", 0), NDRIntField("isActive", 0)]


class gpt_sub1(NDRPacket):
    ALIGNMENT = (8, 8)
    fields_desc = [
        NDRPacketField("partitionType", GUID(), GUID),
        NDRPacketField("partitionId", GUID(), GUID),
        NDRLongField("attributes", 0),
    ]


class REGIONSTATUS(IntEnum):
    REGIONSTATUS_UNKNOWN = 1
    REGIONSTATUS_OK = 2
    REGIONSTATUS_FAILED = 3
    REGIONSTATUS_FAILING = 4
    REGIONSTATUS_REGENERATING = 5
    REGIONSTATUS_NEEDSRESYNC = 6


class regioninfoex(NDRPacket):
    ALIGNMENT = (8, 8)
    fields_desc = [
        NDRSignedLongField("id", 0),
        NDRSignedLongField("diskId", 0),
        NDRSignedLongField("volId", 0),
        NDRSignedLongField("fsId", 0),
        NDRSignedLongField("start", 0),
        NDRSignedLongField("length", 0),
        NDRInt3264EnumField("regionType", 0, REGIONTYPE),
        NDRInt3264EnumField("partitionStyle", 0, PARTITIONSTYLE),
        NDRUnionField(
            [
                (
                    NDRPacketField("value", mbr_sub0(), mbr_sub0),
                    (
                        (
                            lambda pkt: getattr(pkt, "partitionStyle", None)
                            == PARTITIONSTYLE.PARTITIONSTYLE_MBR
                        ),
                        (lambda _, val: val.tag == PARTITIONSTYLE.PARTITIONSTYLE_MBR),
                    ),
                ),
                (
                    NDRPacketField("value", gpt_sub1(), gpt_sub1),
                    (
                        (
                            lambda pkt: getattr(pkt, "partitionStyle", None)
                            == PARTITIONSTYLE.PARTITIONSTYLE_GPT
                        ),
                        (lambda _, val: val.tag == PARTITIONSTYLE.PARTITIONSTYLE_GPT),
                    ),
                ),
            ],
            StrFixedLenField("value", "", length=0),
            align=(2, 8),
            switch_fmt=("H", "I"),
        ),
        NDRInt3264EnumField("status", 0, REGIONSTATUS),
        NDRSignedLongField("lastKnownState", 0),
        NDRSignedLongField("taskId", 0),
        NDRIntField("rflags", 0),
        NDRIntField("currentPartitionNumber", 0),
        NDRSignedIntField("cchName", None, size_of="name"),
        NDRFullPointerField(
            NDRConfStrLenFieldUtf16("name", "", size_is=lambda pkt: pkt.cchName),
            deferred=True,
        ),
    ]


class EnumDiskRegionsEx_Request(NDRPacket):
    fields_desc = [NDRSignedLongField("diskId", 0), NDRIntField("numRegions", 0)]


class EnumDiskRegionsEx_Response(NDRPacket):
    fields_desc = [
        NDRIntField("numRegions", None, size_of="regionList"),
        NDRConfPacketListField(
            "regionList",
            [],
            regioninfoex,
            size_is=lambda pkt: pkt.numRegions,
            ptr_pack=True,
        ),
        NDRIntField("status", 0),
    ]


class regionspec(NDRPacket):
    ALIGNMENT = (8, 8)
    fields_desc = [
        NDRSignedLongField("regionId", 0),
        NDRInt3264EnumField("regionType", 0, REGIONTYPE),
        NDRSignedLongField("diskId", 0),
        NDRSignedLongField("start", 0),
        NDRSignedLongField("length", 0),
        NDRSignedLongField("lastKnownState", 0),
    ]


class REQSTATUS(IntEnum):
    REQ_UNKNOWN = 1
    REQ_STARTED = 2
    REQ_IN_PROGRESS = 3
    REQ_COMPLETED = 4
    REQ_ABORTED = 5
    REQ_FAILED = 6


class DMPROGRESS_TYPE(IntEnum):
    PROGRESS_UNKNOWN = 1
    PROGRESS_FORMAT = 2
    PROGRESS_SYNCHING = 3


class taskinfo(NDRPacket):
    ALIGNMENT = (8, 8)
    fields_desc = [
        NDRSignedLongField("id", 0),
        NDRSignedLongField("storageId", 0),
        NDRSignedLongField("createTime", 0),
        NDRSignedLongField("clientID", 0),
        NDRIntField("percentComplete", 0),
        NDRInt3264EnumField("status", 0, REQSTATUS),
        NDRInt3264EnumField("type", 0, DMPROGRESS_TYPE),
        NDRSignedIntField("error", 0),
        NDRIntField("tflag", 0),
    ]


class CreatePartition_Request(NDRPacket):
    fields_desc = [NDRPacketField("partitionSpec", regionspec(), regionspec)]


class CreatePartition_Response(NDRPacket):
    fields_desc = [
        NDRPacketField("tinfo", taskinfo(), taskinfo),
        NDRIntField("status", 0),
    ]


class filesysteminfo(NDRPacket):
    ALIGNMENT = (8, 8)
    fields_desc = [
        NDRSignedLongField("id", 0),
        NDRSignedLongField("storageId", 0),
        NDRSignedLongField("totalAllocationUnits", 0),
        NDRSignedLongField("availableAllocationUnits", 0),
        NDRIntField("allocationUnitSize", 0),
        NDRIntField("fsflags", 0),
        NDRSignedLongField("lastKnownState", 0),
        NDRSignedLongField("taskId", 0),
        NDRSignedIntField("fsType", 0),
        NDRSignedIntField("cchLabel", None, size_of="label"),
        NDRFullPointerField(
            NDRConfStrLenFieldUtf16("label", "", size_is=lambda pkt: pkt.cchLabel),
            deferred=True,
        ),
    ]


class CreatePartitionAssignAndFormat_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("partitionSpec", regionspec(), regionspec),
        NDRShortField("letter", 0),
        NDRSignedLongField("letterLastKnownState", 0),
        NDRPacketField("fsSpec", filesysteminfo(), filesysteminfo),
        NDRIntField("quickFormat", 0),
    ]


class CreatePartitionAssignAndFormat_Response(NDRPacket):
    fields_desc = [
        NDRPacketField("tinfo", taskinfo(), taskinfo),
        NDRIntField("status", 0),
    ]


class CreatePartitionAssignAndFormatEx_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("partitionSpec", regionspec(), regionspec),
        NDRShortField("letter", 0),
        NDRSignedLongField("letterLastKnownState", 0),
        NDRSignedIntField("cchAccessPath", None, size_of="AccessPath"),
        NDRConfStrLenFieldUtf16(
            "AccessPath", "", size_is=lambda pkt: pkt.cchAccessPath
        ),
        NDRPacketField("fsSpec", filesysteminfo(), filesysteminfo),
        NDRIntField("quickFormat", 0),
        NDRIntField("dwFlags", 0),
    ]


class CreatePartitionAssignAndFormatEx_Response(NDRPacket):
    fields_desc = [
        NDRPacketField("tinfo", taskinfo(), taskinfo),
        NDRIntField("status", 0),
    ]


class DeletePartition_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("partitionSpec", regionspec(), regionspec),
        NDRIntField("force", 0),
    ]


class DeletePartition_Response(NDRPacket):
    fields_desc = [
        NDRPacketField("tinfo", taskinfo(), taskinfo),
        NDRIntField("status", 0),
    ]


class InitializeDiskStyle_Request(NDRPacket):
    fields_desc = [
        NDRSignedLongField("diskId", 0),
        NDRInt3264EnumField("style", 0, PARTITIONSTYLE),
        NDRSignedLongField("diskLastKnownState", 0),
    ]


class InitializeDiskStyle_Response(NDRPacket):
    fields_desc = [
        NDRPacketField("tinfo", taskinfo(), taskinfo),
        NDRIntField("status", 0),
    ]


class MarkActivePartition_Request(NDRPacket):
    fields_desc = [
        NDRSignedLongField("regionId", 0),
        NDRSignedLongField("regionLastKnownState", 0),
    ]


class MarkActivePartition_Response(NDRPacket):
    fields_desc = [
        NDRPacketField("tinfo", taskinfo(), taskinfo),
        NDRIntField("status", 0),
    ]


class Eject_Request(NDRPacket):
    fields_desc = [
        NDRSignedLongField("diskId", 0),
        NDRSignedLongField("diskLastKnownState", 0),
    ]


class Eject_Response(NDRPacket):
    fields_desc = [
        NDRPacketField("tinfo", taskinfo(), taskinfo),
        NDRIntField("status", 0),
    ]


class Reserved_Opnum12_Request(NDRPacket):
    fields_desc = []


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


class VOLUMETYPE(IntEnum):
    VOLUMETYPE_UNKNOWN = 1
    VOLUMETYPE_PRIMARY_PARTITION = 2
    VOLUMETYPE_LOGICAL_DRIVE = 3
    VOLUMETYPE_FT = 4
    VOLUMETYPE_VM = 5
    VOLUMETYPE_CDROM = 6
    VOLUMETYPE_REMOVABLE = 7


class VOLUMELAYOUT(IntEnum):
    VOLUMELAYOUT_UNKNOWN = 1
    VOLUMELAYOUT_PARTITION = 2
    VOLUMELAYOUT_SIMPLE = 3
    VOLUMELAYOUT_SPANNED = 4
    VOLUMELAYOUT_MIRROR = 5
    VOLUMELAYOUT_STRIPE = 6
    VOLUMELAYOUT_RAID5 = 7


class VOLUMESTATUS(IntEnum):
    VOLUME_STATUS_UNKNOWN = 1
    VOLUME_STATUS_HEALTHY = 2
    VOLUME_STATUS_FAILED = 3
    VOLUME_STATUS_FAILED_REDUNDANCY = 4
    VOLUME_STATUS_FAILING = 5
    VOLUME_STATUS_FAILING_REDUNDANCY = 6
    VOLUME_STATUS_FAILED_REDUNDANCY_FAILING = 7
    VOLUME_STATUS_SYNCHING = 8
    VOLUME_STATUS_REGENERATING = 9
    VOLUME_STATUS_INITIALIZING = 10
    VOLUME_STATUS_FORMATTING = 11


class VOLUME_INFO(NDRPacket):
    ALIGNMENT = (8, 8)
    fields_desc = [
        NDRSignedLongField("id", 0),
        NDRInt3264EnumField("type", 0, VOLUMETYPE),
        NDRInt3264EnumField("layout", 0, VOLUMELAYOUT),
        NDRSignedLongField("length", 0),
        NDRSignedLongField("fsId", 0),
        NDRIntField("memberCount", 0),
        NDRInt3264EnumField("status", 0, VOLUMESTATUS),
        NDRSignedLongField("lastKnownState", 0),
        NDRSignedLongField("taskId", 0),
        NDRIntField("vflags", 0),
    ]


class FTEnumVolumes_Request(NDRPacket):
    fields_desc = [NDRIntField("volumeCount", 0)]


class FTEnumVolumes_Response(NDRPacket):
    fields_desc = [
        NDRIntField("volumeCount", None, size_of="ftVolumeList"),
        NDRConfPacketListField(
            "ftVolumeList",
            [],
            VOLUME_INFO,
            size_is=lambda pkt: pkt.volumeCount,
            ptr_pack=True,
        ),
        NDRIntField("status", 0),
    ]


class FTEnumLogicalDiskMembers_Request(NDRPacket):
    fields_desc = [NDRSignedLongField("volumeId", 0), NDRIntField("memberCount", 0)]


class FTEnumLogicalDiskMembers_Response(NDRPacket):
    fields_desc = [
        NDRIntField("memberCount", None, size_of="memberList"),
        NDRConfFieldListField(
            "memberList",
            [],
            NDRSignedLongField("", 0),
            size_is=lambda pkt: pkt.memberCount,
            ptr_pack=True,
        ),
        NDRIntField("status", 0),
    ]


class FTDeleteVolume_Request(NDRPacket):
    fields_desc = [
        NDRSignedLongField("volumeId", 0),
        NDRIntField("force", 0),
        NDRSignedLongField("volumeLastKnownState", 0),
    ]


class FTDeleteVolume_Response(NDRPacket):
    fields_desc = [
        NDRPacketField("tinfo", taskinfo(), taskinfo),
        NDRIntField("status", 0),
    ]


class FTBreakMirror_Request(NDRPacket):
    fields_desc = [
        NDRSignedLongField("volumeId", 0),
        NDRSignedLongField("volumeLastKnownState", 0),
        NDRIntField("bForce", 0),
    ]


class FTBreakMirror_Response(NDRPacket):
    fields_desc = [
        NDRPacketField("tinfo", taskinfo(), taskinfo),
        NDRIntField("status", 0),
    ]


class FTResyncMirror_Request(NDRPacket):
    fields_desc = [
        NDRSignedLongField("volumeId", 0),
        NDRSignedLongField("volumeLastKnownState", 0),
    ]


class FTResyncMirror_Response(NDRPacket):
    fields_desc = [
        NDRPacketField("tinfo", taskinfo(), taskinfo),
        NDRIntField("status", 0),
    ]


class FTRegenerateParityStripe_Request(NDRPacket):
    fields_desc = [
        NDRSignedLongField("volumeId", 0),
        NDRSignedLongField("volumeLastKnownState", 0),
    ]


class FTRegenerateParityStripe_Response(NDRPacket):
    fields_desc = [
        NDRPacketField("tinfo", taskinfo(), taskinfo),
        NDRIntField("status", 0),
    ]


class FTReplaceMirrorPartition_Request(NDRPacket):
    fields_desc = [
        NDRSignedLongField("volumeId", 0),
        NDRSignedLongField("volumeLastKnownState", 0),
        NDRSignedLongField("oldMemberId", 0),
        NDRSignedLongField("oldMemberLastKnownState", 0),
        NDRSignedLongField("newRegionId", 0),
        NDRSignedLongField("newRegionLastKnownState", 0),
        NDRIntField("flags", 0),
    ]


class FTReplaceMirrorPartition_Response(NDRPacket):
    fields_desc = [
        NDRPacketField("tinfo", taskinfo(), taskinfo),
        NDRIntField("status", 0),
    ]


class FTReplaceParityStripePartition_Request(NDRPacket):
    fields_desc = [
        NDRSignedLongField("volumeId", 0),
        NDRSignedLongField("volumeLastKnownState", 0),
        NDRSignedLongField("oldMemberId", 0),
        NDRSignedLongField("oldMemberLastKnownState", 0),
        NDRSignedLongField("newRegionId", 0),
        NDRSignedLongField("newRegionLastKnownState", 0),
        NDRIntField("flags", 0),
    ]


class FTReplaceParityStripePartition_Response(NDRPacket):
    fields_desc = [
        NDRPacketField("tinfo", taskinfo(), taskinfo),
        NDRIntField("status", 0),
    ]


class driveletterinfo(NDRPacket):
    ALIGNMENT = (8, 8)
    fields_desc = [
        NDRShortField("letter", 0),
        NDRSignedLongField("storageId", 0),
        NDRIntField("isUsed", 0),
        NDRSignedLongField("lastKnownState", 0),
        NDRSignedLongField("taskId", 0),
        NDRIntField("dlflags", 0),
    ]


class EnumDriveLetters_Request(NDRPacket):
    fields_desc = [NDRIntField("driveLetterCount", 0)]


class EnumDriveLetters_Response(NDRPacket):
    fields_desc = [
        NDRIntField("driveLetterCount", None, size_of="driveLetterList"),
        NDRConfPacketListField(
            "driveLetterList",
            [],
            driveletterinfo,
            size_is=lambda pkt: pkt.driveLetterCount,
            ptr_pack=True,
        ),
        NDRIntField("status", 0),
    ]


class AssignDriveLetter_Request(NDRPacket):
    fields_desc = [
        NDRShortField("letter", 0),
        NDRIntField("forceOption", 0),
        NDRSignedLongField("letterLastKnownState", 0),
        NDRSignedLongField("storageId", 0),
        NDRSignedLongField("storageLastKnownState", 0),
    ]


class AssignDriveLetter_Response(NDRPacket):
    fields_desc = [
        NDRPacketField("tinfo", taskinfo(), taskinfo),
        NDRIntField("status", 0),
    ]


class FreeDriveLetter_Request(NDRPacket):
    fields_desc = [
        NDRShortField("letter", 0),
        NDRIntField("forceOption", 0),
        NDRSignedLongField("letterLastKnownState", 0),
        NDRSignedLongField("storageId", 0),
        NDRSignedLongField("storageLastKnownState", 0),
    ]


class FreeDriveLetter_Response(NDRPacket):
    fields_desc = [
        NDRPacketField("tinfo", taskinfo(), taskinfo),
        NDRIntField("status", 0),
    ]


class EnumLocalFileSystems_Request(NDRPacket):
    fields_desc = []


class EnumLocalFileSystems_Response(NDRPacket):
    fields_desc = [
        NDRIntField("fileSystemCount", None, size_of="fileSystemList"),
        NDRConfPacketListField(
            "fileSystemList",
            [],
            filesysteminfo,
            size_is=lambda pkt: pkt.fileSystemCount,
            ptr_pack=True,
        ),
        NDRIntField("status", 0),
    ]


class ifilesysteminfo(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRSignedIntField("fsType", 0),
        StrFixedLenFieldUtf16("fsName", "", length=8 * 2),
        NDRIntField("fsFlags", 0),
        NDRIntField("fsCompressionFlags", 0),
        NDRSignedIntField("cchLabelLimit", 0),
        NDRSignedIntField("cchLabel", None, size_of="iLabelChSet"),
        NDRFullPointerField(
            NDRConfStrLenFieldUtf16(
                "iLabelChSet", "", size_is=lambda pkt: pkt.cchLabel
            ),
            deferred=True,
        ),
    ]


class GetInstalledFileSystems_Request(NDRPacket):
    fields_desc = []


class GetInstalledFileSystems_Response(NDRPacket):
    fields_desc = [
        NDRIntField("fsCount", None, size_of="fsList"),
        NDRConfPacketListField(
            "fsList",
            [],
            ifilesysteminfo,
            size_is=lambda pkt: pkt.fsCount,
            ptr_pack=True,
        ),
        NDRIntField("status", 0),
    ]


class Format_Request(NDRPacket):
    fields_desc = [
        NDRSignedLongField("storageId", 0),
        NDRPacketField("fsSpec", filesysteminfo(), filesysteminfo),
        NDRIntField("quickFormat", 0),
        NDRIntField("force", 0),
        NDRSignedLongField("storageLastKnownState", 0),
    ]


class Format_Response(NDRPacket):
    fields_desc = [
        NDRPacketField("tinfo", taskinfo(), taskinfo),
        NDRIntField("status", 0),
    ]


class EnumVolumes_Request(NDRPacket):
    fields_desc = [NDRIntField("volumeCount", 0)]


class EnumVolumes_Response(NDRPacket):
    fields_desc = [
        NDRIntField("volumeCount", None, size_of="LdmVolumeList"),
        NDRConfPacketListField(
            "LdmVolumeList",
            [],
            VOLUME_INFO,
            size_is=lambda pkt: pkt.volumeCount,
            ptr_pack=True,
        ),
        NDRIntField("status", 0),
    ]


class EnumVolumeMembers_Request(NDRPacket):
    fields_desc = [NDRSignedLongField("volumeId", 0), NDRIntField("memberCount", 0)]


class EnumVolumeMembers_Response(NDRPacket):
    fields_desc = [
        NDRIntField("memberCount", None, size_of="memberList"),
        NDRConfFieldListField(
            "memberList",
            [],
            NDRSignedLongField("", 0),
            size_is=lambda pkt: pkt.memberCount,
            ptr_pack=True,
        ),
        NDRIntField("status", 0),
    ]


class VOLUME_SPEC(NDRPacket):
    ALIGNMENT = (8, 8)
    fields_desc = [
        NDRInt3264EnumField("type", 0, VOLUMETYPE),
        NDRInt3264EnumField("layout", 0, VOLUMELAYOUT),
        NDRInt3264EnumField("partitionType", 0, REGIONTYPE),
        NDRSignedLongField("length", 0),
        NDRSignedLongField("lastKnownState", 0),
    ]


class diskspec(NDRPacket):
    ALIGNMENT = (8, 8)
    fields_desc = [
        NDRSignedLongField("diskId", 0),
        NDRSignedLongField("length", 0),
        NDRIntField("needContiguous", 0),
        NDRSignedLongField("lastKnownState", 0),
    ]


class CreateVolume_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("volumeSpec", VOLUME_SPEC(), VOLUME_SPEC),
        NDRIntField("diskCount", None, size_of="diskList"),
        NDRConfPacketListField(
            "diskList", [], diskspec, size_is=lambda pkt: pkt.diskCount
        ),
    ]


class CreateVolume_Response(NDRPacket):
    fields_desc = [
        NDRPacketField("tinfo", taskinfo(), taskinfo),
        NDRIntField("status", 0),
    ]


class CreateVolumeAssignAndFormat_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("volumeSpec", VOLUME_SPEC(), VOLUME_SPEC),
        NDRIntField("diskCount", None, size_of="diskList"),
        NDRConfPacketListField(
            "diskList", [], diskspec, size_is=lambda pkt: pkt.diskCount
        ),
        NDRShortField("letter", 0),
        NDRSignedLongField("letterLastKnownState", 0),
        NDRPacketField("fsSpec", filesysteminfo(), filesysteminfo),
        NDRIntField("quickFormat", 0),
    ]


class CreateVolumeAssignAndFormat_Response(NDRPacket):
    fields_desc = [
        NDRPacketField("tinfo", taskinfo(), taskinfo),
        NDRIntField("status", 0),
    ]


class CreateVolumeAssignAndFormatEx_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("volumeSpec", VOLUME_SPEC(), VOLUME_SPEC),
        NDRIntField("diskCount", None, size_of="diskList"),
        NDRConfPacketListField(
            "diskList", [], diskspec, size_is=lambda pkt: pkt.diskCount
        ),
        NDRShortField("letter", 0),
        NDRSignedLongField("letterLastKnownState", 0),
        NDRSignedIntField("cchAccessPath", None, size_of="AccessPath"),
        NDRConfStrLenFieldUtf16(
            "AccessPath", "", size_is=lambda pkt: pkt.cchAccessPath
        ),
        NDRPacketField("fsSpec", filesysteminfo(), filesysteminfo),
        NDRIntField("quickFormat", 0),
        NDRIntField("dwFlags", 0),
    ]


class CreateVolumeAssignAndFormatEx_Response(NDRPacket):
    fields_desc = [
        NDRPacketField("tinfo", taskinfo(), taskinfo),
        NDRIntField("status", 0),
    ]


class GetVolumeMountName_Request(NDRPacket):
    fields_desc = [NDRSignedLongField("volumeId", 0)]


class GetVolumeMountName_Response(NDRPacket):
    fields_desc = [
        NDRIntField("cchMountName", None, size_of="mountName"),
        NDRConfStrLenFieldUtf16("mountName", "", size_is=lambda pkt: pkt.cchMountName),
        NDRIntField("status", 0),
    ]


class GrowVolume_Request(NDRPacket):
    fields_desc = [
        NDRSignedLongField("volumeId", 0),
        NDRPacketField("volumeSpec", VOLUME_SPEC(), VOLUME_SPEC),
        NDRIntField("diskCount", None, size_of="diskList"),
        NDRConfPacketListField(
            "diskList", [], diskspec, size_is=lambda pkt: pkt.diskCount
        ),
        NDRIntField("force", 0),
    ]


class GrowVolume_Response(NDRPacket):
    fields_desc = [
        NDRPacketField("tinfo", taskinfo(), taskinfo),
        NDRIntField("status", 0),
    ]


class DeleteVolume_Request(NDRPacket):
    fields_desc = [
        NDRSignedLongField("volumeId", 0),
        NDRIntField("force", 0),
        NDRSignedLongField("volumeLastKnownState", 0),
    ]


class DeleteVolume_Response(NDRPacket):
    fields_desc = [
        NDRPacketField("tinfo", taskinfo(), taskinfo),
        NDRIntField("status", 0),
    ]


class CreatePartitionsForVolume_Request(NDRPacket):
    fields_desc = [
        NDRSignedLongField("volumeId", 0),
        NDRIntField("active", 0),
        NDRSignedLongField("volumeLastKnownState", 0),
    ]


class CreatePartitionsForVolume_Response(NDRPacket):
    fields_desc = [
        NDRPacketField("tinfo", taskinfo(), taskinfo),
        NDRIntField("status", 0),
    ]


class DeletePartitionsForVolume_Request(NDRPacket):
    fields_desc = [
        NDRSignedLongField("volumeId", 0),
        NDRSignedLongField("volumeLastKnownState", 0),
    ]


class DeletePartitionsForVolume_Response(NDRPacket):
    fields_desc = [
        NDRPacketField("tinfo", taskinfo(), taskinfo),
        NDRIntField("status", 0),
    ]


class GetMaxAdjustedFreeSpace_Request(NDRPacket):
    fields_desc = [NDRSignedLongField("diskId", 0)]


class GetMaxAdjustedFreeSpace_Response(NDRPacket):
    fields_desc = [
        NDRSignedLongField("maxAdjustedFreeSpace", 0),
        NDRIntField("status", 0),
    ]


class AddMirror_Request(NDRPacket):
    fields_desc = [
        NDRSignedLongField("volumeId", 0),
        NDRSignedLongField("volumeLastKnownState", 0),
        NDRPacketField("diskSpec", diskspec(), diskspec),
        NDRSignedIntField("diskNumber", 0),
    ]


class AddMirror_Response(NDRPacket):
    fields_desc = [
        NDRSignedIntField("diskNumber", 0),
        NDRSignedIntField("partitionNumber", 0),
        NDRPacketField("tinfo", taskinfo(), taskinfo),
        NDRIntField("status", 0),
    ]


class RemoveMirror_Request(NDRPacket):
    fields_desc = [
        NDRSignedLongField("volumeId", 0),
        NDRSignedLongField("volumeLastKnownState", 0),
        NDRSignedLongField("diskId", 0),
        NDRSignedLongField("diskLastKnownState", 0),
    ]


class RemoveMirror_Response(NDRPacket):
    fields_desc = [
        NDRPacketField("tinfo", taskinfo(), taskinfo),
        NDRIntField("status", 0),
    ]


class SplitMirror_Request(NDRPacket):
    fields_desc = [
        NDRSignedLongField("volumeId", 0),
        NDRSignedLongField("volumeLastKnownState", 0),
        NDRSignedLongField("diskId", 0),
        NDRSignedLongField("diskLastKnownState", 0),
        NDRShortField("letter", 0),
        NDRSignedLongField("letterLastKnownState", 0),
        NDRPacketField("tinfo", taskinfo(), taskinfo),
    ]


class SplitMirror_Response(NDRPacket):
    fields_desc = [
        NDRPacketField("tinfo", taskinfo(), taskinfo),
        NDRIntField("status", 0),
    ]


class InitializeDiskEx_Request(NDRPacket):
    fields_desc = [
        NDRSignedLongField("diskId", 0),
        NDRInt3264EnumField("style", 0, PARTITIONSTYLE),
        NDRSignedLongField("diskLastKnownState", 0),
    ]


class InitializeDiskEx_Response(NDRPacket):
    fields_desc = [
        NDRPacketField("tinfo", taskinfo(), taskinfo),
        NDRIntField("status", 0),
    ]


class UninitializeDisk_Request(NDRPacket):
    fields_desc = [
        NDRSignedLongField("diskId", 0),
        NDRSignedLongField("diskLastKnownState", 0),
    ]


class UninitializeDisk_Response(NDRPacket):
    fields_desc = [
        NDRPacketField("tinfo", taskinfo(), taskinfo),
        NDRIntField("status", 0),
    ]


class ReConnectDisk_Request(NDRPacket):
    fields_desc = [NDRSignedLongField("diskId", 0)]


class ReConnectDisk_Response(NDRPacket):
    fields_desc = [
        NDRPacketField("tinfo", taskinfo(), taskinfo),
        NDRIntField("status", 0),
    ]


class ImportDiskGroup_Request(NDRPacket):
    fields_desc = [
        NDRSignedIntField("cchDgid", None, size_of="dgid"),
        NDRConfStrLenField("dgid", "", size_is=lambda pkt: pkt.cchDgid),
    ]


class ImportDiskGroup_Response(NDRPacket):
    fields_desc = [
        NDRPacketField("tinfo", taskinfo(), taskinfo),
        NDRIntField("status", 0),
    ]


class mergeobjectinfo(NDRPacket):
    ALIGNMENT = (8, 8)
    fields_desc = [
        NDRIntField("type", 0),
        NDRIntField("flags", 0),
        NDRInt3264EnumField("layout", 0, VOLUMELAYOUT),
        NDRSignedLongField("length", 0),
    ]


class DiskMergeQuery_Request(NDRPacket):
    fields_desc = [
        NDRSignedIntField("cchDgid", None, size_of="dgid"),
        NDRConfStrLenField("dgid", "", size_is=lambda pkt: pkt.cchDgid),
        NDRSignedIntField("numDisks", None, size_of="diskList"),
        NDRConfFieldListField(
            "diskList", [], NDRSignedLongField("", 0), size_is=lambda pkt: pkt.numDisks
        ),
        NDRIntField("flags", 0),
    ]


class DiskMergeQuery_Response(NDRPacket):
    fields_desc = [
        NDRSignedLongField("merge_config_tid", 0),
        NDRSignedIntField("numRids", None, size_of="merge_dm_rids"),
        NDRConfFieldListField(
            "merge_dm_rids",
            [],
            NDRSignedLongField("", 0),
            size_is=lambda pkt: pkt.numRids,
            ptr_pack=True,
        ),
        NDRSignedIntField("numObjects", None, size_of="mergeObjectInfo"),
        NDRConfPacketListField(
            "mergeObjectInfo",
            [],
            mergeobjectinfo,
            size_is=lambda pkt: pkt.numObjects,
            ptr_pack=True,
        ),
        NDRIntField("flags", 0),
        NDRPacketField("tinfo", taskinfo(), taskinfo),
        NDRIntField("status", 0),
    ]


class DiskMerge_Request(NDRPacket):
    fields_desc = [
        NDRSignedIntField("cchDgid", None, size_of="dgid"),
        NDRConfStrLenField("dgid", "", size_is=lambda pkt: pkt.cchDgid),
        NDRSignedIntField("numDisks", None, size_of="diskList"),
        NDRConfFieldListField(
            "diskList", [], NDRSignedLongField("", 0), size_is=lambda pkt: pkt.numDisks
        ),
        NDRSignedLongField("merge_config_tid", 0),
        NDRSignedIntField("numRids", None, size_of="merge_dm_rids"),
        NDRConfFieldListField(
            "merge_dm_rids",
            [],
            NDRSignedLongField("", 0),
            size_is=lambda pkt: pkt.numRids,
        ),
    ]


class DiskMerge_Response(NDRPacket):
    fields_desc = [
        NDRPacketField("tinfo", taskinfo(), taskinfo),
        NDRIntField("status", 0),
    ]


class ReAttachDisk_Request(NDRPacket):
    fields_desc = [
        NDRSignedLongField("diskId", 0),
        NDRSignedLongField("diskLastKnownState", 0),
    ]


class ReAttachDisk_Response(NDRPacket):
    fields_desc = [
        NDRPacketField("tinfo", taskinfo(), taskinfo),
        NDRIntField("status", 0),
    ]


class ReplaceRaid5Column_Request(NDRPacket):
    fields_desc = [
        NDRSignedLongField("volumeId", 0),
        NDRSignedLongField("volumeLastKnownState", 0),
        NDRSignedLongField("newDiskId", 0),
        NDRSignedLongField("diskLastKnownState", 0),
    ]


class ReplaceRaid5Column_Response(NDRPacket):
    fields_desc = [
        NDRPacketField("tinfo", taskinfo(), taskinfo),
        NDRIntField("status", 0),
    ]


class RestartVolume_Request(NDRPacket):
    fields_desc = [
        NDRSignedLongField("volumeId", 0),
        NDRSignedLongField("volumeLastKnownState", 0),
    ]


class RestartVolume_Response(NDRPacket):
    fields_desc = [
        NDRPacketField("tinfo", taskinfo(), taskinfo),
        NDRIntField("status", 0),
    ]


class GetEncapsulateDiskInfoEx_Request(NDRPacket):
    fields_desc = [
        NDRIntField("diskCount", None, size_of="diskSpecList"),
        NDRConfPacketListField(
            "diskSpecList", [], diskspec, size_is=lambda pkt: pkt.diskCount
        ),
    ]


class GetEncapsulateDiskInfoEx_Response(NDRPacket):
    fields_desc = [
        NDRIntField("encapInfoFlags", 0),
        NDRIntField("affectedDiskCount", None, size_of="affectedDiskFlags"),
        NDRConfPacketListField(
            "affectedDiskList",
            [],
            diskinfoex,
            size_is=lambda pkt: pkt.affectedDiskCount,
            ptr_pack=True,
        ),
        NDRConfFieldListField(
            "affectedDiskFlags",
            [],
            NDRIntField("", 0),
            size_is=lambda pkt: pkt.affectedDiskCount,
            ptr_pack=True,
        ),
        NDRIntField("affectedVolumeCount", None, size_of="affectedVolumeList"),
        NDRConfPacketListField(
            "affectedVolumeList",
            [],
            VOLUME_INFO,
            size_is=lambda pkt: pkt.affectedVolumeCount,
            ptr_pack=True,
        ),
        NDRIntField("affectedRegionCount", None, size_of="affectedRegionList"),
        NDRConfPacketListField(
            "affectedRegionList",
            [],
            regioninfoex,
            size_is=lambda pkt: pkt.affectedRegionCount,
            ptr_pack=True,
        ),
        NDRPacketField("tinfo", taskinfo(), taskinfo),
        NDRIntField("status", 0),
    ]


class EncapsulateDiskEx_Request(NDRPacket):
    fields_desc = [
        NDRIntField("affectedDiskCount", None, size_of="affectedDiskList"),
        NDRConfPacketListField(
            "affectedDiskList",
            [],
            diskinfoex,
            size_is=lambda pkt: pkt.affectedDiskCount,
        ),
        NDRIntField("affectedVolumeCount", None, size_of="affectedVolumeList"),
        NDRConfPacketListField(
            "affectedVolumeList",
            [],
            VOLUME_INFO,
            size_is=lambda pkt: pkt.affectedVolumeCount,
        ),
        NDRIntField("affectedRegionCount", None, size_of="affectedRegionList"),
        NDRConfPacketListField(
            "affectedRegionList",
            [],
            regioninfoex,
            size_is=lambda pkt: pkt.affectedRegionCount,
        ),
    ]


class EncapsulateDiskEx_Response(NDRPacket):
    fields_desc = [
        NDRIntField("encapInfoFlags", 0),
        NDRPacketField("tinfo", taskinfo(), taskinfo),
        NDRIntField("status", 0),
    ]


class QueryChangePartitionNumbers_Request(NDRPacket):
    fields_desc = []


class QueryChangePartitionNumbers_Response(NDRPacket):
    fields_desc = [
        NDRSignedIntField("oldPartitionNumber", 0),
        NDRSignedIntField("newPartitionNumber", 0),
        NDRIntField("status", 0),
    ]


class DeletePartitionNumberInfoFromRegistry_Request(NDRPacket):
    fields_desc = []


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


class SetDontShow_Request(NDRPacket):
    fields_desc = [NDRIntField("bSetNoShow", 0)]


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


class GetDontShow_Request(NDRPacket):
    fields_desc = []


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


class Reserved0_Request(NDRPacket):
    fields_desc = []


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


class Reserved1_Request(NDRPacket):
    fields_desc = []


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


class Reserved2_Request(NDRPacket):
    fields_desc = []


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


class Reserved3_Request(NDRPacket):
    fields_desc = []


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


class Reserved4_Request(NDRPacket):
    fields_desc = []


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


class Reserved5_Request(NDRPacket):
    fields_desc = []


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


class Reserved6_Request(NDRPacket):
    fields_desc = []


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


class Reserved7_Request(NDRPacket):
    fields_desc = []


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


class EnumTasks_Request(NDRPacket):
    fields_desc = [NDRIntField("taskCount", 0)]


class EnumTasks_Response(NDRPacket):
    fields_desc = [
        NDRIntField("taskCount", None, size_of="taskList"),
        NDRConfPacketListField(
            "taskList", [], taskinfo, size_is=lambda pkt: pkt.taskCount, ptr_pack=True
        ),
        NDRIntField("status", 0),
    ]


class GetTaskDetail_Request(NDRPacket):
    fields_desc = [
        NDRSignedLongField("id", 0),
        NDRPacketField("tinfo", taskinfo(), taskinfo),
    ]


class GetTaskDetail_Response(NDRPacket):
    fields_desc = [
        NDRPacketField("tinfo", taskinfo(), taskinfo),
        NDRIntField("status", 0),
    ]


class AbortTask_Request(NDRPacket):
    fields_desc = [NDRSignedLongField("id", 0)]


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


class HrGetErrorData_Request(NDRPacket):
    fields_desc = [NDRSignedIntField("hr", 0), NDRIntField("dwFlags", 0)]


class HrGetErrorData_Response(NDRPacket):
    fields_desc = [
        NDRIntField("pdwStoredFlags", 0),
        NDRSignedIntField("pcszw", None, size_of="prgszw"),
        NDRConfVarStrLenFieldUtf16("prgszw", "", size_is=lambda pkt: pkt.pcszw),
        NDRIntField("status", 0),
    ]


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


class Initialize_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("notificationInterface", MInterfacePointer(), MInterfacePointer),
        NDRIntField("cRemote", 0),
    ]


class Initialize_Response(NDRPacket):
    fields_desc = [
        NDRIntField("ulIDLVersion", 0),
        NDRIntField("pdwFlags", 0),
        NDRSignedLongField("clientId", 0),
        NDRIntField("status", 0),
    ]


class Uninitialize_Request(NDRPacket):
    fields_desc = []


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


class Refresh_Request(NDRPacket):
    fields_desc = []


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


class RescanDisks_Request(NDRPacket):
    fields_desc = []


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


class RefreshFileSys_Request(NDRPacket):
    fields_desc = []


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


class SecureSystemPartition_Request(NDRPacket):
    fields_desc = []


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


class ShutDownSystem_Request(NDRPacket):
    fields_desc = []


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


class countedstring(NDRPacket):
    ALIGNMENT = (8, 8)
    fields_desc = [
        NDRSignedLongField("sourceId", 0),
        NDRSignedLongField("targetId", 0),
        NDRSignedIntField("cchString", None, size_of="sstring"),
        NDRFullPointerField(
            NDRConfStrLenFieldUtf16("sstring", "", size_is=lambda pkt: pkt.cchString),
            deferred=True,
        ),
    ]


class EnumAccessPath_Request(NDRPacket):
    fields_desc = [NDRSignedIntField("lCount", 0)]


class EnumAccessPath_Response(NDRPacket):
    fields_desc = [
        NDRSignedIntField("lCount", None, size_of="paths"),
        NDRConfPacketListField(
            "paths", [], countedstring, size_is=lambda pkt: pkt.lCount, ptr_pack=True
        ),
        NDRIntField("status", 0),
    ]


class EnumAccessPathForVolume_Request(NDRPacket):
    fields_desc = [NDRSignedLongField("VolumeId", 0), NDRSignedIntField("lCount", 0)]


class EnumAccessPathForVolume_Response(NDRPacket):
    fields_desc = [
        NDRSignedIntField("lCount", None, size_of="paths"),
        NDRConfPacketListField(
            "paths", [], countedstring, size_is=lambda pkt: pkt.lCount, ptr_pack=True
        ),
        NDRIntField("status", 0),
    ]


class AddAccessPath_Request(NDRPacket):
    fields_desc = [
        NDRSignedIntField("cch_path", None, size_of="path"),
        NDRConfStrLenFieldUtf16("path", "", size_is=lambda pkt: pkt.cch_path),
        NDRSignedLongField("targetId", 0),
    ]


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


class DeleteAccessPath_Request(NDRPacket):
    fields_desc = [
        NDRSignedLongField("volumeId", 0),
        NDRSignedIntField("cch_path", None, size_of="path"),
        NDRConfStrLenFieldUtf16("path", "", size_is=lambda pkt: pkt.cch_path),
    ]


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


IVOLUMECLIENT3_OPNUMS = {
    0: DceRpcOp(EnumDisksEx_Request, EnumDisksEx_Response),
    1: DceRpcOp(EnumDiskRegionsEx_Request, EnumDiskRegionsEx_Response),
    2: DceRpcOp(CreatePartition_Request, CreatePartition_Response),
    3: DceRpcOp(
        CreatePartitionAssignAndFormat_Request, CreatePartitionAssignAndFormat_Response
    ),
    4: DceRpcOp(
        CreatePartitionAssignAndFormatEx_Request,
        CreatePartitionAssignAndFormatEx_Response,
    ),
    5: DceRpcOp(DeletePartition_Request, DeletePartition_Response),
    6: DceRpcOp(InitializeDiskStyle_Request, InitializeDiskStyle_Response),
    7: DceRpcOp(MarkActivePartition_Request, MarkActivePartition_Response),
    8: DceRpcOp(Eject_Request, Eject_Response),
    9: DceRpcOp(Reserved_Opnum12_Request, Reserved_Opnum12_Response),
    10: DceRpcOp(FTEnumVolumes_Request, FTEnumVolumes_Response),
    11: DceRpcOp(FTEnumLogicalDiskMembers_Request, FTEnumLogicalDiskMembers_Response),
    12: DceRpcOp(FTDeleteVolume_Request, FTDeleteVolume_Response),
    13: DceRpcOp(FTBreakMirror_Request, FTBreakMirror_Response),
    14: DceRpcOp(FTResyncMirror_Request, FTResyncMirror_Response),
    15: DceRpcOp(FTRegenerateParityStripe_Request, FTRegenerateParityStripe_Response),
    16: DceRpcOp(FTReplaceMirrorPartition_Request, FTReplaceMirrorPartition_Response),
    17: DceRpcOp(
        FTReplaceParityStripePartition_Request, FTReplaceParityStripePartition_Response
    ),
    18: DceRpcOp(EnumDriveLetters_Request, EnumDriveLetters_Response),
    19: DceRpcOp(AssignDriveLetter_Request, AssignDriveLetter_Response),
    20: DceRpcOp(FreeDriveLetter_Request, FreeDriveLetter_Response),
    21: DceRpcOp(EnumLocalFileSystems_Request, EnumLocalFileSystems_Response),
    22: DceRpcOp(GetInstalledFileSystems_Request, GetInstalledFileSystems_Response),
    23: DceRpcOp(Format_Request, Format_Response),
    24: DceRpcOp(EnumVolumes_Request, EnumVolumes_Response),
    25: DceRpcOp(EnumVolumeMembers_Request, EnumVolumeMembers_Response),
    26: DceRpcOp(CreateVolume_Request, CreateVolume_Response),
    27: DceRpcOp(
        CreateVolumeAssignAndFormat_Request, CreateVolumeAssignAndFormat_Response
    ),
    28: DceRpcOp(
        CreateVolumeAssignAndFormatEx_Request, CreateVolumeAssignAndFormatEx_Response
    ),
    29: DceRpcOp(GetVolumeMountName_Request, GetVolumeMountName_Response),
    30: DceRpcOp(GrowVolume_Request, GrowVolume_Response),
    31: DceRpcOp(DeleteVolume_Request, DeleteVolume_Response),
    32: DceRpcOp(CreatePartitionsForVolume_Request, CreatePartitionsForVolume_Response),
    33: DceRpcOp(DeletePartitionsForVolume_Request, DeletePartitionsForVolume_Response),
    34: DceRpcOp(GetMaxAdjustedFreeSpace_Request, GetMaxAdjustedFreeSpace_Response),
    35: DceRpcOp(AddMirror_Request, AddMirror_Response),
    36: DceRpcOp(RemoveMirror_Request, RemoveMirror_Response),
    37: DceRpcOp(SplitMirror_Request, SplitMirror_Response),
    38: DceRpcOp(InitializeDiskEx_Request, InitializeDiskEx_Response),
    39: DceRpcOp(UninitializeDisk_Request, UninitializeDisk_Response),
    40: DceRpcOp(ReConnectDisk_Request, ReConnectDisk_Response),
    41: DceRpcOp(ImportDiskGroup_Request, ImportDiskGroup_Response),
    42: DceRpcOp(DiskMergeQuery_Request, DiskMergeQuery_Response),
    43: DceRpcOp(DiskMerge_Request, DiskMerge_Response),
    44: DceRpcOp(ReAttachDisk_Request, ReAttachDisk_Response),
    45: DceRpcOp(ReplaceRaid5Column_Request, ReplaceRaid5Column_Response),
    46: DceRpcOp(RestartVolume_Request, RestartVolume_Response),
    47: DceRpcOp(GetEncapsulateDiskInfoEx_Request, GetEncapsulateDiskInfoEx_Response),
    48: DceRpcOp(EncapsulateDiskEx_Request, EncapsulateDiskEx_Response),
    49: DceRpcOp(
        QueryChangePartitionNumbers_Request, QueryChangePartitionNumbers_Response
    ),
    50: DceRpcOp(
        DeletePartitionNumberInfoFromRegistry_Request,
        DeletePartitionNumberInfoFromRegistry_Response,
    ),
    51: DceRpcOp(SetDontShow_Request, SetDontShow_Response),
    52: DceRpcOp(GetDontShow_Request, GetDontShow_Response),
    53: DceRpcOp(Reserved0_Request, Reserved0_Response),
    54: DceRpcOp(Reserved1_Request, Reserved1_Response),
    55: DceRpcOp(Reserved2_Request, Reserved2_Response),
    56: DceRpcOp(Reserved3_Request, Reserved3_Response),
    57: DceRpcOp(Reserved4_Request, Reserved4_Response),
    58: DceRpcOp(Reserved5_Request, Reserved5_Response),
    59: DceRpcOp(Reserved6_Request, Reserved6_Response),
    60: DceRpcOp(Reserved7_Request, Reserved7_Response),
    61: DceRpcOp(EnumTasks_Request, EnumTasks_Response),
    62: DceRpcOp(GetTaskDetail_Request, GetTaskDetail_Response),
    63: DceRpcOp(AbortTask_Request, AbortTask_Response),
    64: DceRpcOp(HrGetErrorData_Request, HrGetErrorData_Response),
    65: DceRpcOp(Initialize_Request, Initialize_Response),
    66: DceRpcOp(Uninitialize_Request, Uninitialize_Response),
    67: DceRpcOp(Refresh_Request, Refresh_Response),
    68: DceRpcOp(RescanDisks_Request, RescanDisks_Response),
    69: DceRpcOp(RefreshFileSys_Request, RefreshFileSys_Response),
    70: DceRpcOp(SecureSystemPartition_Request, SecureSystemPartition_Response),
    71: DceRpcOp(ShutDownSystem_Request, ShutDownSystem_Response),
    72: DceRpcOp(EnumAccessPath_Request, EnumAccessPath_Response),
    73: DceRpcOp(EnumAccessPathForVolume_Request, EnumAccessPathForVolume_Response),
    74: DceRpcOp(AddAccessPath_Request, AddAccessPath_Response),
    75: DceRpcOp(DeleteAccessPath_Request, DeleteAccessPath_Response),
}
register_com_interface(
    name="IVolumeClient3",
    uuid=uuid.UUID("135698D2-3A37-4d26-99DF-E2BB6AE3AC61"),
    opnums=IVOLUMECLIENT3_OPNUMS,
)


class RefreshEx_Request(NDRPacket):
    fields_desc = []


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


class GetVolumeDeviceName_Request(NDRPacket):
    fields_desc = [NDRSignedLongField("_volumeId", 0)]


class GetVolumeDeviceName_Response(NDRPacket):
    fields_desc = [
        NDRIntField("cchVolumeDevice", None, size_of="pwszVolumeDevice"),
        NDRConfStrLenFieldUtf16(
            "pwszVolumeDevice", "", size_is=lambda pkt: pkt.cchVolumeDevice
        ),
        NDRIntField("status", 0),
    ]


IVOLUMECLIENT4_OPNUMS = {
    0: DceRpcOp(RefreshEx_Request, RefreshEx_Response),
    1: DceRpcOp(GetVolumeDeviceName_Request, GetVolumeDeviceName_Response),
}
register_com_interface(
    name="IVolumeClient4",
    uuid=uuid.UUID("DEB01010-3A37-4d26-99DF-E2BB6AE3AC61"),
    opnums=IVOLUMECLIENT4_OPNUMS,
)
