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

# [ms-rrp] v39.0 (Mon, 21 Oct 2024)

"""
RPC definitions for the following interfaces:
- winreg (v1.0): 338CD001-2244-31F1-AAAA-900038001003
This file is auto-generated by midl-to-scapy, do not modify.
"""

import uuid

from scapy.fields import PacketListField
from scapy.layers.dcerpc import (
    NDRPacket,
    DceRpcOp,
    NDRByteField,
    NDRConfStrLenField,
    NDRConfVarPacketListField,
    NDRConfVarStrLenField,
    NDRConfVarStrLenFieldUtf16,
    NDRContextHandle,
    NDRFullEmbPointerField,
    NDRFullPointerField,
    NDRIntField,
    NDRPacketField,
    NDRShortField,
    register_dcerpc_interface,
)


class OpenClassesRoot_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRShortField("ServerName", 0)),
        NDRIntField("samDesired", 0),
    ]


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


class OpenCurrentUser_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRShortField("ServerName", 0)),
        NDRIntField("samDesired", 0),
    ]


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


class OpenLocalMachine_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRShortField("ServerName", 0)),
        NDRIntField("samDesired", 0),
    ]


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


class OpenPerformanceData_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRShortField("ServerName", 0)),
        NDRIntField("samDesired", 0),
    ]


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


class OpenUsers_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRShortField("ServerName", 0)),
        NDRIntField("samDesired", 0),
    ]


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


class BaseRegCloseKey_Request(NDRPacket):
    fields_desc = [NDRPacketField("hKey", NDRContextHandle(), NDRContextHandle)]


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


class RPC_UNICODE_STRING(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRShortField("Length", None, size_of="Buffer", adjust=lambda _, x: (x * 2)),
        NDRShortField(
            "MaximumLength", None, size_of="Buffer", adjust=lambda _, x: (x * 2)
        ),
        NDRFullEmbPointerField(
            NDRConfVarStrLenFieldUtf16(
                "Buffer",
                "",
                size_is=lambda pkt: (pkt.MaximumLength // 2),
                length_is=lambda pkt: (pkt.Length // 2),
            )
        ),
    ]


class RPC_SECURITY_DESCRIPTOR(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRFullEmbPointerField(
            NDRConfVarStrLenField(
                "lpSecurityDescriptor",
                "",
                size_is=lambda pkt: pkt.cbInSecurityDescriptor,
                length_is=lambda pkt: pkt.cbOutSecurityDescriptor,
            )
        ),
        NDRIntField("cbInSecurityDescriptor", None, size_of="lpSecurityDescriptor"),
        NDRIntField("cbOutSecurityDescriptor", None, size_of="lpSecurityDescriptor"),
    ]


class PRPC_SECURITY_ATTRIBUTES(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRIntField("nLength", 0),
        NDRPacketField(
            "RpcSecurityDescriptor", RPC_SECURITY_DESCRIPTOR(), RPC_SECURITY_DESCRIPTOR
        ),
        NDRByteField("bInheritHandle", 0),
    ]


class BaseRegCreateKey_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hKey", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("lpSubKey", RPC_UNICODE_STRING(), RPC_UNICODE_STRING),
        NDRPacketField("lpClass", RPC_UNICODE_STRING(), RPC_UNICODE_STRING),
        NDRIntField("dwOptions", 0),
        NDRIntField("samDesired", 0),
        NDRFullPointerField(
            NDRPacketField(
                "lpSecurityAttributes",
                PRPC_SECURITY_ATTRIBUTES(),
                PRPC_SECURITY_ATTRIBUTES,
            )
        ),
        NDRFullPointerField(NDRIntField("lpdwDisposition", 0)),
    ]


class BaseRegCreateKey_Response(NDRPacket):
    fields_desc = [
        NDRPacketField("phkResult", NDRContextHandle(), NDRContextHandle),
        NDRFullPointerField(NDRIntField("lpdwDisposition", 0)),
        NDRIntField("status", 0),
    ]


class BaseRegDeleteKey_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hKey", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("lpSubKey", RPC_UNICODE_STRING(), RPC_UNICODE_STRING),
    ]


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


class BaseRegDeleteValue_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hKey", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("lpValueName", RPC_UNICODE_STRING(), RPC_UNICODE_STRING),
    ]


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


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


class PRPC_UNICODE_STRING(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRShortField("Length", None, size_of="Buffer", adjust=lambda _, x: (x * 2)),
        NDRShortField(
            "MaximumLength", None, size_of="Buffer", adjust=lambda _, x: (x * 2)
        ),
        NDRFullEmbPointerField(
            NDRConfVarStrLenFieldUtf16(
                "Buffer",
                "",
                size_is=lambda pkt: (pkt.MaximumLength // 2),
                length_is=lambda pkt: (pkt.Length // 2),
            )
        ),
    ]


class BaseRegEnumKey_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hKey", NDRContextHandle(), NDRContextHandle),
        NDRIntField("dwIndex", 0),
        NDRPacketField("lpNameIn", RPC_UNICODE_STRING(), RPC_UNICODE_STRING),
        NDRFullPointerField(
            NDRPacketField("lpClassIn", RPC_UNICODE_STRING(), RPC_UNICODE_STRING)
        ),
        NDRFullPointerField(
            NDRPacketField("lpftLastWriteTime", PFILETIME(), PFILETIME)
        ),
    ]


class BaseRegEnumKey_Response(NDRPacket):
    fields_desc = [
        NDRPacketField("lpNameOut", RPC_UNICODE_STRING(), RPC_UNICODE_STRING),
        NDRFullPointerField(
            NDRPacketField("lplpClassOut", PRPC_UNICODE_STRING(), PRPC_UNICODE_STRING)
        ),
        NDRFullPointerField(
            NDRPacketField("lpftLastWriteTime", PFILETIME(), PFILETIME)
        ),
        NDRIntField("status", 0),
    ]


class BaseRegEnumValue_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hKey", NDRContextHandle(), NDRContextHandle),
        NDRIntField("dwIndex", 0),
        NDRPacketField("lpValueNameIn", RPC_UNICODE_STRING(), RPC_UNICODE_STRING),
        NDRFullPointerField(NDRIntField("lpType", 0)),
        NDRFullPointerField(
            NDRConfVarStrLenField(
                "lpData",
                "",
                size_is=lambda pkt: (pkt.lpcbData if pkt.lpcbData else 0),
                max_is=lambda pkt: 67108864,
                length_is=lambda pkt: (pkt.lpcbLen if pkt.lpcbLen else 0),
            )
        ),
        NDRFullPointerField(NDRIntField("lpcbData", 0)),
        NDRFullPointerField(NDRIntField("lpcbLen", 0)),
    ]


class BaseRegEnumValue_Response(NDRPacket):
    fields_desc = [
        NDRPacketField("lpValueNameOut", PRPC_UNICODE_STRING(), PRPC_UNICODE_STRING),
        NDRFullPointerField(NDRIntField("lpType", 0)),
        NDRFullPointerField(
            NDRConfVarStrLenField(
                "lpData",
                "",
                size_is=lambda pkt: (pkt.lpcbData if pkt.lpcbData else 0),
                max_is=lambda pkt: 67108864,
                length_is=lambda pkt: (pkt.lpcbLen if pkt.lpcbLen else 0),
            )
        ),
        NDRFullPointerField(NDRIntField("lpcbData", 0)),
        NDRFullPointerField(NDRIntField("lpcbLen", 0)),
        NDRIntField("status", 0),
    ]


class BaseRegFlushKey_Request(NDRPacket):
    fields_desc = [NDRPacketField("hKey", NDRContextHandle(), NDRContextHandle)]


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


class PRPC_SECURITY_DESCRIPTOR(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRFullEmbPointerField(
            NDRConfVarStrLenField(
                "lpSecurityDescriptor",
                "",
                size_is=lambda pkt: pkt.cbInSecurityDescriptor,
                length_is=lambda pkt: pkt.cbOutSecurityDescriptor,
            )
        ),
        NDRIntField("cbInSecurityDescriptor", None, size_of="lpSecurityDescriptor"),
        NDRIntField("cbOutSecurityDescriptor", None, size_of="lpSecurityDescriptor"),
    ]


class BaseRegGetKeySecurity_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hKey", NDRContextHandle(), NDRContextHandle),
        NDRIntField("SecurityInformation", 0),
        NDRPacketField(
            "pRpcSecurityDescriptorIn",
            PRPC_SECURITY_DESCRIPTOR(),
            PRPC_SECURITY_DESCRIPTOR,
        ),
    ]


class BaseRegGetKeySecurity_Response(NDRPacket):
    fields_desc = [
        NDRPacketField(
            "pRpcSecurityDescriptorOut",
            PRPC_SECURITY_DESCRIPTOR(),
            PRPC_SECURITY_DESCRIPTOR,
        ),
        NDRIntField("status", 0),
    ]


class BaseRegLoadKey_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hKey", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("lpSubKey", RPC_UNICODE_STRING(), RPC_UNICODE_STRING),
        NDRPacketField("lpFile", RPC_UNICODE_STRING(), RPC_UNICODE_STRING),
    ]


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


class BaseRegOpenKey_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hKey", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("lpSubKey", RPC_UNICODE_STRING(), RPC_UNICODE_STRING),
        NDRIntField("dwOptions", 0),
        NDRIntField("samDesired", 0),
    ]


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


class BaseRegQueryInfoKey_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hKey", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("lpClassIn", RPC_UNICODE_STRING(), RPC_UNICODE_STRING),
    ]


class BaseRegQueryInfoKey_Response(NDRPacket):
    fields_desc = [
        NDRPacketField("lpClassOut", PRPC_UNICODE_STRING(), PRPC_UNICODE_STRING),
        NDRIntField("lpcSubKeys", 0),
        NDRIntField("lpcbMaxSubKeyLen", 0),
        NDRIntField("lpcbMaxClassLen", 0),
        NDRIntField("lpcValues", 0),
        NDRIntField("lpcbMaxValueNameLen", 0),
        NDRIntField("lpcbMaxValueLen", 0),
        NDRIntField("lpcbSecurityDescriptor", 0),
        NDRPacketField("lpftLastWriteTime", PFILETIME(), PFILETIME),
        NDRIntField("status", 0),
    ]


class BaseRegQueryValue_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hKey", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("lpValueName", RPC_UNICODE_STRING(), RPC_UNICODE_STRING),
        NDRFullPointerField(NDRIntField("lpType", 0)),
        NDRFullPointerField(
            NDRConfVarStrLenField(
                "lpData",
                "",
                size_is=lambda pkt: (pkt.lpcbData if pkt.lpcbData else 0),
                max_is=lambda pkt: 67108864,
                length_is=lambda pkt: (pkt.lpcbLen if pkt.lpcbLen else 0),
            )
        ),
        NDRFullPointerField(NDRIntField("lpcbData", 0)),
        NDRFullPointerField(NDRIntField("lpcbLen", 0)),
    ]


class BaseRegQueryValue_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRIntField("lpType", 0)),
        NDRFullPointerField(
            NDRConfVarStrLenField(
                "lpData",
                "",
                size_is=lambda pkt: (pkt.lpcbData if pkt.lpcbData else 0),
                max_is=lambda pkt: 67108864,
                length_is=lambda pkt: (pkt.lpcbLen if pkt.lpcbLen else 0),
            )
        ),
        NDRFullPointerField(NDRIntField("lpcbData", 0)),
        NDRFullPointerField(NDRIntField("lpcbLen", 0)),
        NDRIntField("status", 0),
    ]


class BaseRegReplaceKey_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hKey", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("lpSubKey", RPC_UNICODE_STRING(), RPC_UNICODE_STRING),
        NDRPacketField("lpNewFile", RPC_UNICODE_STRING(), RPC_UNICODE_STRING),
        NDRPacketField("lpOldFile", RPC_UNICODE_STRING(), RPC_UNICODE_STRING),
    ]


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


class BaseRegRestoreKey_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hKey", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("lpFile", RPC_UNICODE_STRING(), RPC_UNICODE_STRING),
        NDRIntField("Flags", 0),
    ]


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


class BaseRegSaveKey_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hKey", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("lpFile", RPC_UNICODE_STRING(), RPC_UNICODE_STRING),
        NDRFullPointerField(
            NDRPacketField(
                "pSecurityAttributes",
                PRPC_SECURITY_ATTRIBUTES(),
                PRPC_SECURITY_ATTRIBUTES,
            )
        ),
    ]


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


class BaseRegSetKeySecurity_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hKey", NDRContextHandle(), NDRContextHandle),
        NDRIntField("SecurityInformation", 0),
        NDRPacketField(
            "pRpcSecurityDescriptor",
            PRPC_SECURITY_DESCRIPTOR(),
            PRPC_SECURITY_DESCRIPTOR,
        ),
    ]


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


class BaseRegSetValue_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hKey", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("lpValueName", RPC_UNICODE_STRING(), RPC_UNICODE_STRING),
        NDRIntField("dwType", 0),
        NDRConfStrLenField("lpData", "", size_is=lambda pkt: pkt.cbData),
        NDRIntField("cbData", None, size_of="lpData"),
    ]


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


class BaseRegUnLoadKey_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hKey", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("lpSubKey", RPC_UNICODE_STRING(), RPC_UNICODE_STRING),
    ]


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


class BaseRegGetVersion_Request(NDRPacket):
    fields_desc = [NDRPacketField("hKey", NDRContextHandle(), NDRContextHandle)]


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


class OpenCurrentConfig_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRShortField("ServerName", 0)),
        NDRIntField("samDesired", 0),
    ]


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


class PRVALENT(NDRPacket):
    ALIGNMENT = (4, 8)
    fields_desc = [
        NDRFullEmbPointerField(
            NDRPacketField("ve_valuename", PRPC_UNICODE_STRING(), PRPC_UNICODE_STRING)
        ),
        NDRIntField("ve_valuelen", 0),
        NDRFullEmbPointerField(NDRIntField("ve_valueptr", 0)),
        NDRIntField("ve_type", 0),
    ]


class BaseRegQueryMultipleValues_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hKey", NDRContextHandle(), NDRContextHandle),
        NDRConfVarPacketListField(
            "val_listIn",
            [],
            PRVALENT,
            size_is=lambda pkt: pkt.num_vals,
            length_is=lambda pkt: pkt.num_vals,
        ),
        NDRIntField("num_vals", None, size_of="val_listIn"),
        NDRFullPointerField(
            NDRConfVarStrLenField(
                "lpvalueBuf",
                "",
                size_is=lambda pkt: pkt.ldwTotsize,
                length_is=lambda pkt: pkt.ldwTotsize,
            )
        ),
        NDRIntField("ldwTotsize", None, size_of="lpvalueBuf"),
    ]


class BaseRegQueryMultipleValues_Response(NDRPacket):
    fields_desc = [
        NDRConfVarPacketListField(
            "val_listOut",
            [],
            PRVALENT,
            size_is=lambda pkt: pkt.num_vals,
            length_is=lambda pkt: pkt.num_vals,
        ),
        NDRFullPointerField(
            NDRConfVarStrLenField(
                "lpvalueBuf",
                "",
                size_is=lambda pkt: pkt.ldwTotsize,
                length_is=lambda pkt: pkt.ldwTotsize,
            )
        ),
        NDRIntField("ldwTotsize", None, size_of="lpvalueBuf"),
        NDRIntField("status", 0),
    ]


class BaseRegSaveKeyEx_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hKey", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("lpFile", RPC_UNICODE_STRING(), RPC_UNICODE_STRING),
        NDRFullPointerField(
            NDRPacketField(
                "pSecurityAttributes",
                PRPC_SECURITY_ATTRIBUTES(),
                PRPC_SECURITY_ATTRIBUTES,
            )
        ),
        NDRIntField("Flags", 0),
    ]


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


class OpenPerformanceText_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRShortField("ServerName", 0)),
        NDRIntField("samDesired", 0),
    ]


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


class OpenPerformanceNlsText_Request(NDRPacket):
    fields_desc = [
        NDRFullPointerField(NDRShortField("ServerName", 0)),
        NDRIntField("samDesired", 0),
    ]


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


class BaseRegQueryMultipleValues2_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hKey", NDRContextHandle(), NDRContextHandle),
        NDRConfVarPacketListField(
            "val_listIn",
            [],
            PRVALENT,
            size_is=lambda pkt: pkt.num_vals,
            length_is=lambda pkt: pkt.num_vals,
        ),
        NDRIntField("num_vals", None, size_of="val_listIn"),
        NDRFullPointerField(
            NDRConfVarStrLenField(
                "lpvalueBuf",
                "",
                size_is=lambda pkt: pkt.ldwTotsize,
                length_is=lambda pkt: pkt.ldwTotsize,
            )
        ),
        NDRIntField("ldwTotsize", None, size_of="lpvalueBuf"),
    ]


class BaseRegQueryMultipleValues2_Response(NDRPacket):
    fields_desc = [
        NDRConfVarPacketListField(
            "val_listOut",
            [],
            PRVALENT,
            size_is=lambda pkt: pkt.num_vals,
            length_is=lambda pkt: pkt.num_vals,
        ),
        NDRFullPointerField(
            NDRConfVarStrLenField(
                "lpvalueBuf",
                "",
                size_is=lambda pkt: pkt.ldwTotsize,
                length_is=lambda pkt: pkt.ldwTotsize,
            )
        ),
        NDRIntField("ldwRequiredSize", 0),
        NDRIntField("status", 0),
    ]


class BaseRegDeleteKeyEx_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("hKey", NDRContextHandle(), NDRContextHandle),
        NDRPacketField("lpSubKey", RPC_UNICODE_STRING(), RPC_UNICODE_STRING),
        NDRIntField("AccessMask", 0),
        NDRIntField("Reserved", 0),
    ]


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


WINREG_OPNUMS = {
    0: DceRpcOp(OpenClassesRoot_Request, OpenClassesRoot_Response),
    1: DceRpcOp(OpenCurrentUser_Request, OpenCurrentUser_Response),
    2: DceRpcOp(OpenLocalMachine_Request, OpenLocalMachine_Response),
    3: DceRpcOp(OpenPerformanceData_Request, OpenPerformanceData_Response),
    4: DceRpcOp(OpenUsers_Request, OpenUsers_Response),
    5: DceRpcOp(BaseRegCloseKey_Request, BaseRegCloseKey_Response),
    6: DceRpcOp(BaseRegCreateKey_Request, BaseRegCreateKey_Response),
    7: DceRpcOp(BaseRegDeleteKey_Request, BaseRegDeleteKey_Response),
    8: DceRpcOp(BaseRegDeleteValue_Request, BaseRegDeleteValue_Response),
    9: DceRpcOp(BaseRegEnumKey_Request, BaseRegEnumKey_Response),
    10: DceRpcOp(BaseRegEnumValue_Request, BaseRegEnumValue_Response),
    11: DceRpcOp(BaseRegFlushKey_Request, BaseRegFlushKey_Response),
    12: DceRpcOp(BaseRegGetKeySecurity_Request, BaseRegGetKeySecurity_Response),
    13: DceRpcOp(BaseRegLoadKey_Request, BaseRegLoadKey_Response),
    # 14: Opnum14NotImplemented,
    15: DceRpcOp(BaseRegOpenKey_Request, BaseRegOpenKey_Response),
    16: DceRpcOp(BaseRegQueryInfoKey_Request, BaseRegQueryInfoKey_Response),
    17: DceRpcOp(BaseRegQueryValue_Request, BaseRegQueryValue_Response),
    18: DceRpcOp(BaseRegReplaceKey_Request, BaseRegReplaceKey_Response),
    19: DceRpcOp(BaseRegRestoreKey_Request, BaseRegRestoreKey_Response),
    20: DceRpcOp(BaseRegSaveKey_Request, BaseRegSaveKey_Response),
    21: DceRpcOp(BaseRegSetKeySecurity_Request, BaseRegSetKeySecurity_Response),
    22: DceRpcOp(BaseRegSetValue_Request, BaseRegSetValue_Response),
    23: DceRpcOp(BaseRegUnLoadKey_Request, BaseRegUnLoadKey_Response),
    # 24: Opnum24NotImplemented,
    # 25: Opnum25NotImplemented,
    26: DceRpcOp(BaseRegGetVersion_Request, BaseRegGetVersion_Response),
    27: DceRpcOp(OpenCurrentConfig_Request, OpenCurrentConfig_Response),
    # 28: Opnum28NotImplemented,
    29: DceRpcOp(
        BaseRegQueryMultipleValues_Request, BaseRegQueryMultipleValues_Response
    ),
    # 30: Opnum30NotImplemented,
    31: DceRpcOp(BaseRegSaveKeyEx_Request, BaseRegSaveKeyEx_Response),
    32: DceRpcOp(OpenPerformanceText_Request, OpenPerformanceText_Response),
    33: DceRpcOp(OpenPerformanceNlsText_Request, OpenPerformanceNlsText_Response),
    34: DceRpcOp(
        BaseRegQueryMultipleValues2_Request, BaseRegQueryMultipleValues2_Response
    ),
    35: DceRpcOp(BaseRegDeleteKeyEx_Request, BaseRegDeleteKeyEx_Response),
}
register_dcerpc_interface(
    name="winreg",
    uuid=uuid.UUID("338CD001-2244-31F1-AAAA-900038001003"),
    version="1.0",
    opnums=WINREG_OPNUMS,
)
