### ms-gkdi.idl
"""
RPC definitions for the following interfaces:
- ISDKey (v1.0): b9785960-524f-11df-8b6d-83dcded72085
This file is auto-generated by midl-to-scapy, do not modify.
"""

import uuid

from scapy.fields import StrFixedLenField
from scapy.layers.dcerpc import (
    NDRPacket,
    DceRpcOp,
    NDRConfStrLenField,
    NDRFullPointerField,
    NDRIntField,
    NDRPacketField,
    NDRShortField,
    NDRSignedIntField,
    register_dcerpc_interface,
)


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


class GetKey_Request(NDRPacket):
    fields_desc = [
        NDRIntField("cbTargetSD", None, size_of="pbTargetSD"),
        NDRConfStrLenField("pbTargetSD", "", size_is=lambda pkt: pkt.cbTargetSD),
        NDRFullPointerField(NDRPacketField("pRootKeyID", GUID(), GUID)),
        NDRSignedIntField("L0KeyID", 0),
        NDRSignedIntField("L1KeyID", 0),
        NDRSignedIntField("L2KeyID", 0),
    ]


class GetKey_Response(NDRPacket):
    fields_desc = [
        NDRIntField("pcbOut", None, size_of="ppbOut"),
        NDRConfStrLenField("ppbOut", "", size_is=lambda pkt: pkt.pcbOut),
        NDRIntField("status", 0),
    ]


ISDKEY_OPNUMS = {0: DceRpcOp(GetKey_Request, GetKey_Response)}
register_dcerpc_interface(
    name="ISDKey",
    uuid=uuid.UUID("b9785960-524f-11df-8b6d-83dcded72085"),
    version="1.0",
    opnums=ISDKEY_OPNUMS,
)
