### ms-wsrm.idl
"""
RPC definitions for the following interfaces:
- IResourceManager (v0.0): C5CEBEE2-9DF5-4CDD-A08C-C2471BC144B4
- IWRMCalendar (v0.0): 481E06CF-AB04-4498-8FFE-124A0A34296D
- IWRMPolicy (v0.0): 59602EB6-57B0-4FD8-AA4B-EBF06971FE15
- IWRMResourceGroup (v0.0): BC681469-9DD9-4BF4-9B3D-709F69EFE431
- IWRMAccounting (v0.0): 4F7CA01C-A9E5-45B6-B142-2332A1339C1D
- IWRMConfig (v0.0): 21546AE8-4DA5-445E-987F-627FEA39C5E8
- IWRMProtocol (v0.0): F31931A9-832D-481C-9503-887A0E6A79F0
- IWRMMachineGroup (v0.0): 943991a5-b3fe-41fa-9696-7f7b656ee34b
- IResourceManager2 (v0.0): 2A3EB639-D134-422d-90D8-AAA1B5216202
- IWRMRemoteSessionMgmt (v0.0): FC910418-55CA-45ef-B264-83D4CE7D30E0
This file is auto-generated by midl-to-scapy, do not modify.
"""

from enum import IntEnum
import uuid


from scapy.layers.dcerpc import (
    NDRPacket,
    DceRpcOp,
    NDRConfStrLenField,
    NDRConfStrLenFieldUtf16,
    NDRFullPointerField,
    NDRIntEnumField,
    NDRIntField,
    NDRLongField,
    NDRPacketField,
    NDRSignedIntField,
    register_com_interface,
)


class FLAGGED_WORD_BLOB(NDRPacket):
    ALIGNMENT = (4, 8)
    DEPORTED_CONFORMANTS = ["asData"]
    fields_desc = [
        NDRIntField("cBytes", 0),
        NDRIntField("clSize", None, size_of="asData"),
        NDRConfStrLenFieldUtf16(
            "asData", "", size_is=lambda pkt: pkt.clSize, conformant_in_struct=True
        ),
    ]


class RetrieveEventList_Request(NDRPacket):
    fields_desc = []


class RetrieveEventList_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("pbstrEventList", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
        ),
        NDRIntField("status", 0),
    ]


class GetSystemAffinity_Request(NDRPacket):
    fields_desc = []


class GetSystemAffinity_Response(NDRPacket):
    fields_desc = [NDRLongField("pdwSysAffinity", 0), NDRIntField("status", 0)]


class ImportXMLFiles_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("bstrPMCXml", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB),
        NDRPacketField("bstrPolicyXml", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB),
        NDRPacketField("bstrCalendarXml", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB),
        NDRPacketField("bstrConditionalXml", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB),
    ]


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


class ExportXMLFiles_Request(NDRPacket):
    fields_desc = []


class ExportXMLFiles_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("pbstrPMCXml", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
        ),
        NDRFullPointerField(
            NDRPacketField("pbstrPolicyXml", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
        ),
        NDRFullPointerField(
            NDRPacketField("pbstrCalendarXml", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
        ),
        NDRFullPointerField(
            NDRPacketField(
                "pbstrConditionalXml", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB
            )
        ),
        NDRIntField("status", 0),
    ]


class RESTORE_MODE(IntEnum):
    RESTORE_LAST_GOOD_STATE = 1
    RESTORE_EMPTY_FILES = 2


class RestoreXMLFiles_Request(NDRPacket):
    fields_desc = [NDRIntEnumField("enumRestore", 0, RESTORE_MODE)]


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


class OBJECT_TYPE(IntEnum):
    OBJECT_SELECTION_CRITERIA = 1
    OBJECT_POLICY = 2
    OBJECT_SCHEDULE = 3


class GetDependencies_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("bstrObjectName", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB),
        NDRIntEnumField("enumObject", 0, OBJECT_TYPE),
    ]


class GetDependencies_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField(
                "pbstrDependencyList", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB
            )
        ),
        NDRIntField("status", 0),
    ]


class GetServiceList_Request(NDRPacket):
    fields_desc = []


class GetServiceList_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("pbstrServiceList", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
        ),
        NDRIntField("status", 0),
    ]


class GetIISAppPoolNames_Request(NDRPacket):
    fields_desc = []


class GetIISAppPoolNames_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField(
                "pbstrIISAppPoolList", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB
            )
        ),
        NDRFullPointerField(
            NDRPacketField(
                "pbstrSystemDirectory", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB
            )
        ),
        NDRIntField("status", 0),
    ]


class GetServerName_Request(NDRPacket):
    fields_desc = []


class GetServerName_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("pbstrServerName", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
        ),
        NDRIntField("status", 0),
    ]


class GetCurrentMemory_Request(NDRPacket):
    fields_desc = []


class GetCurrentMemory_Response(NDRPacket):
    fields_desc = [NDRLongField("pdwCurrMemory", 0), NDRIntField("status", 0)]


IRESOURCEMANAGER_OPNUMS = {
    0: DceRpcOp(RetrieveEventList_Request, RetrieveEventList_Response),
    1: DceRpcOp(GetSystemAffinity_Request, GetSystemAffinity_Response),
    2: DceRpcOp(ImportXMLFiles_Request, ImportXMLFiles_Response),
    3: DceRpcOp(ExportXMLFiles_Request, ExportXMLFiles_Response),
    4: DceRpcOp(RestoreXMLFiles_Request, RestoreXMLFiles_Response),
    5: DceRpcOp(GetDependencies_Request, GetDependencies_Response),
    6: DceRpcOp(GetServiceList_Request, GetServiceList_Response),
    7: DceRpcOp(GetIISAppPoolNames_Request, GetIISAppPoolNames_Response),
    8: DceRpcOp(GetServerName_Request, GetServerName_Response),
    9: DceRpcOp(GetCurrentMemory_Request, GetCurrentMemory_Response),
}
register_com_interface(
    name="IResourceManager",
    uuid=uuid.UUID("C5CEBEE2-9DF5-4CDD-A08C-C2471BC144B4"),
    opnums=IRESOURCEMANAGER_OPNUMS,
)


class GetCalendarInfo_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("bstrCalendarName", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
    ]


class GetCalendarInfo_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("pbstrCalendarXML", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
        ),
        NDRIntField("status", 0),
    ]


class CreateCalendar_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("bstrCalendarXML", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB),
        NDRSignedIntField("bChangeActivePolicy", 0),
    ]


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


class ModifyCalendar_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("bstrCalendarXML", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB),
        NDRSignedIntField("bOverwrite", 0),
        NDRSignedIntField("bChangeActivePolicy", 0),
    ]


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


class DeleteCalendar_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("bstrCalendarName", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB),
        NDRSignedIntField("bChangeActivePolicy", 0),
    ]


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


class RenameCalendar_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("bstrOldCalendarName", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB),
        NDRPacketField("bstrNewCalendarName", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB),
    ]


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


class ComputeEvents_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("szStartTime", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB),
        NDRPacketField("szEndTime", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB),
        NDRSignedIntField("fMergeEvents", 0),
    ]


class ComputeEvents_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("pbstrEvents", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
        ),
        NDRFullPointerField(
            NDRPacketField("pbstrConflicts", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
        ),
        NDRIntField("status", 0),
    ]


class GetScheduleInfo_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("bstrScheduleName", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
    ]


class GetScheduleInfo_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("pbstrScheduleXML", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
        ),
        NDRIntField("status", 0),
    ]


class CreateSchedule_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("bstrScheduleXML", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
    ]


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


class ModifySchedule_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("bstrScheduleXML", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB),
        NDRSignedIntField("bOverwrite", 0),
        NDRSignedIntField("bChangeActivePolicy", 0),
    ]


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


class DeleteSchedule_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("bstrScheduleName", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
    ]


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


class RenameSchedule_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("bstrOldScheduleName", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB),
        NDRPacketField("bstrNewScheduleName", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB),
    ]


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


class MoveBeforeCalendar_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("bstrCalendarName", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB),
        NDRPacketField("bstrRefCalendarName", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB),
        NDRSignedIntField("bChangeActivePolicy", 0),
    ]


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


class MoveAfterCalendar_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("bstrCalendarName", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB),
        NDRPacketField("bstrRefCalendarName", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB),
        NDRSignedIntField("bChangeActivePolicy", 0),
    ]


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


class GetServerTimeZone_Request(NDRPacket):
    fields_desc = []


class GetServerTimeZone_Response(NDRPacket):
    fields_desc = [NDRSignedIntField("pnServerTimeZone", 0), NDRIntField("status", 0)]


IWRMCALENDAR_OPNUMS = {
    0: DceRpcOp(GetCalendarInfo_Request, GetCalendarInfo_Response),
    1: DceRpcOp(CreateCalendar_Request, CreateCalendar_Response),
    2: DceRpcOp(ModifyCalendar_Request, ModifyCalendar_Response),
    3: DceRpcOp(DeleteCalendar_Request, DeleteCalendar_Response),
    4: DceRpcOp(RenameCalendar_Request, RenameCalendar_Response),
    5: DceRpcOp(ComputeEvents_Request, ComputeEvents_Response),
    6: DceRpcOp(GetScheduleInfo_Request, GetScheduleInfo_Response),
    7: DceRpcOp(CreateSchedule_Request, CreateSchedule_Response),
    8: DceRpcOp(ModifySchedule_Request, ModifySchedule_Response),
    9: DceRpcOp(DeleteSchedule_Request, DeleteSchedule_Response),
    10: DceRpcOp(RenameSchedule_Request, RenameSchedule_Response),
    11: DceRpcOp(MoveBeforeCalendar_Request, MoveBeforeCalendar_Response),
    12: DceRpcOp(MoveAfterCalendar_Request, MoveAfterCalendar_Response),
    13: DceRpcOp(GetServerTimeZone_Request, GetServerTimeZone_Response),
}
register_com_interface(
    name="IWRMCalendar",
    uuid=uuid.UUID("481E06CF-AB04-4498-8FFE-124A0A34296D"),
    opnums=IWRMCALENDAR_OPNUMS,
)


class GetPolicyInfo_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("bstrPolicyName", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
    ]


class GetPolicyInfo_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("pbstrPolicyInfo", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
        ),
        NDRIntField("status", 0),
    ]


class CreatePolicy_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("bstrPolicyInfo", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
    ]


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


class ModifyPolicy_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("bstrPolicyInfo", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB),
        NDRSignedIntField("bOverwrite", 0),
    ]


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


class DeletePolicy_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("bstrPolicyName", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
    ]


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


class RenameAllocationPolicy_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("bstrNewPolicyName", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB),
        NDRPacketField("bstrOldPolicyName", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB),
    ]


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


class MoveBefore_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("bstrPolicyName", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB),
        NDRPacketField("bstrResourceGroupName", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB),
        NDRPacketField(
            "bstrRefResourceGroupName", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB
        ),
    ]


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


class MoveAfter_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("bstrPolicyName", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB),
        NDRPacketField("bstrResourceGroupName", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB),
        NDRPacketField(
            "bstrRefResourceGroupName", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB
        ),
    ]


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


class SetCalDefaultPolicyName_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("bstrDefaultPolicyName", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
    ]


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


class GetCalDefaultPolicyName_Request(NDRPacket):
    fields_desc = []


class GetCalDefaultPolicyName_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField(
                "pbstrDefaultPolicyName", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB
            )
        ),
        NDRIntField("status", 0),
    ]


class GetProcessList_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("bstrPolicyName", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
    ]


class GetProcessList_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("pbstrProcessList", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
        ),
        NDRIntField("status", 0),
    ]


class MANAGEMENT_TYPE(IntEnum):
    MANUAL_ACTIVE_POLICY = 1
    CALENDAR_POLICY = 2
    PROFILING = 3


class GetCurrentPolicy_Request(NDRPacket):
    fields_desc = []


class GetCurrentPolicy_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField(
                "pbstrCurrentPolicyInfo", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB
            )
        ),
        NDRIntEnumField("enumManage", 0, MANAGEMENT_TYPE),
        NDRIntField("status", 0),
    ]


class SetCurrentPolicy_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("bstrPolicyName", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB),
        NDRIntEnumField("enumManage", 0, MANAGEMENT_TYPE),
    ]


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


class GetCurrentStateAndActivePolicyName_Request(NDRPacket):
    fields_desc = []


class GetCurrentStateAndActivePolicyName_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField(
                "pbstrCurrentPolicyName", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB
            )
        ),
        NDRIntEnumField("enumManage", 0, MANAGEMENT_TYPE),
        NDRIntField("status", 0),
    ]


class GetConditionalPolicy_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("bstrPolicyName", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
    ]


class GetConditionalPolicy_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("pbstrPolicyInfo", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
        ),
        NDRIntField("status", 0),
    ]


class SetConditionalPolicy_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("bstrPolicyInfo", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
    ]


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


IWRMPOLICY_OPNUMS = {
    0: DceRpcOp(GetPolicyInfo_Request, GetPolicyInfo_Response),
    1: DceRpcOp(CreatePolicy_Request, CreatePolicy_Response),
    2: DceRpcOp(ModifyPolicy_Request, ModifyPolicy_Response),
    3: DceRpcOp(DeletePolicy_Request, DeletePolicy_Response),
    4: DceRpcOp(RenameAllocationPolicy_Request, RenameAllocationPolicy_Response),
    5: DceRpcOp(MoveBefore_Request, MoveBefore_Response),
    6: DceRpcOp(MoveAfter_Request, MoveAfter_Response),
    7: DceRpcOp(SetCalDefaultPolicyName_Request, SetCalDefaultPolicyName_Response),
    8: DceRpcOp(GetCalDefaultPolicyName_Request, GetCalDefaultPolicyName_Response),
    9: DceRpcOp(GetProcessList_Request, GetProcessList_Response),
    10: DceRpcOp(GetCurrentPolicy_Request, GetCurrentPolicy_Response),
    11: DceRpcOp(SetCurrentPolicy_Request, SetCurrentPolicy_Response),
    12: DceRpcOp(
        GetCurrentStateAndActivePolicyName_Request,
        GetCurrentStateAndActivePolicyName_Response,
    ),
    13: DceRpcOp(GetConditionalPolicy_Request, GetConditionalPolicy_Response),
    14: DceRpcOp(SetConditionalPolicy_Request, SetConditionalPolicy_Response),
}
register_com_interface(
    name="IWRMPolicy",
    uuid=uuid.UUID("59602EB6-57B0-4FD8-AA4B-EBF06971FE15"),
    opnums=IWRMPOLICY_OPNUMS,
)


class GetResourceGroupInfo_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("bstrResourceGroupName", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
    ]


class GetResourceGroupInfo_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField(
                "pbstrResourceGroupInfo", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB
            )
        ),
        NDRIntField("status", 0),
    ]


class ModifyResourceGroup_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("bstrResourceGroupInfo", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB),
        NDRSignedIntField("bOverwrite", 0),
    ]


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


class CreateResourceGroup_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("bstrResourceGroupInfo", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
    ]


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


class DeleteResourceGroup_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("bstrResourceGroupName", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
    ]


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


class RenameResourceGroup_Request(NDRPacket):
    fields_desc = [
        NDRPacketField(
            "bstrNewResourceGroupName", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB
        ),
        NDRPacketField(
            "bstrOldResourceGroupName", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB
        ),
    ]


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


IWRMRESOURCEGROUP_OPNUMS = {
    0: DceRpcOp(GetResourceGroupInfo_Request, GetResourceGroupInfo_Response),
    1: DceRpcOp(ModifyResourceGroup_Request, ModifyResourceGroup_Response),
    2: DceRpcOp(CreateResourceGroup_Request, CreateResourceGroup_Response),
    3: DceRpcOp(DeleteResourceGroup_Request, DeleteResourceGroup_Response),
    4: DceRpcOp(RenameResourceGroup_Request, RenameResourceGroup_Response),
}
register_com_interface(
    name="IWRMResourceGroup",
    uuid=uuid.UUID("BC681469-9DD9-4BF4-9B3D-709F69EFE431"),
    opnums=IWRMRESOURCEGROUP_OPNUMS,
)


class CreateAccountingDb_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("bstrServerName", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB),
        NDRSignedIntField("bWindowsAuth", 0),
        NDRPacketField("bstrUserName", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB),
        NDRPacketField("bstrPasswd", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB),
    ]


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


class GetAccountingMetadata_Request(NDRPacket):
    fields_desc = []


class GetAccountingMetadata_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("pbstrMetaData", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
        ),
        NDRIntField("status", 0),
    ]


class ExecuteAccountingQuery_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("bstrAccountingQuery", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB),
        NDRPacketField("bstrStartingDate", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB),
        NDRPacketField("bstrEndingDate", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB),
    ]


class ExecuteAccountingQuery_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("pbstrResult", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
        ),
        NDRSignedIntField("pbIsThereMoreData", 0),
        NDRIntField("status", 0),
    ]


class GetRawAccountingData_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("bstrStartingDate", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB),
        NDRPacketField("bstrEndingDate", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB),
        NDRPacketField("bstrMachineName", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB),
    ]


class GetRawAccountingData_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("pbstrResult", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
        ),
        NDRSignedIntField("pbIsThereMoreData", 0),
        NDRIntField("status", 0),
    ]


class GetNextAccountingDataBatch_Request(NDRPacket):
    fields_desc = []


class GetNextAccountingDataBatch_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("pbstrResult", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
        ),
        NDRSignedIntField("pbIsThereMoreData", 0),
        NDRIntField("status", 0),
    ]


class DeleteAccountingData_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("bstrStartingDate", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB),
        NDRPacketField("bstrEndingDate", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB),
        NDRPacketField("bstrMachineName", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB),
    ]


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


class DefragmentDB_Request(NDRPacket):
    fields_desc = []


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


class CancelAccountingQuery_Request(NDRPacket):
    fields_desc = [NDRSignedIntField("flag", 0)]


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


class RegisterAccountingClient_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("bstrClientId", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
    ]


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


class DumpAccountingData_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("bstrAccountingData", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
    ]


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


class GetAccountingClients_Request(NDRPacket):
    fields_desc = []


class GetAccountingClients_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("pbstrClientIds", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
        ),
        NDRIntField("status", 0),
    ]


class SetAccountingClientStatus_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("bstrClientIds", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
    ]


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


class CheckAccountingConnection_Request(NDRPacket):
    fields_desc = []


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


class SetClientPermissions_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("bstrClientId", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB),
        NDRSignedIntField("fAddPermissions", 0),
    ]


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


IWRMACCOUNTING_OPNUMS = {
    0: DceRpcOp(CreateAccountingDb_Request, CreateAccountingDb_Response),
    1: DceRpcOp(GetAccountingMetadata_Request, GetAccountingMetadata_Response),
    2: DceRpcOp(ExecuteAccountingQuery_Request, ExecuteAccountingQuery_Response),
    3: DceRpcOp(GetRawAccountingData_Request, GetRawAccountingData_Response),
    4: DceRpcOp(
        GetNextAccountingDataBatch_Request, GetNextAccountingDataBatch_Response
    ),
    5: DceRpcOp(DeleteAccountingData_Request, DeleteAccountingData_Response),
    6: DceRpcOp(DefragmentDB_Request, DefragmentDB_Response),
    7: DceRpcOp(CancelAccountingQuery_Request, CancelAccountingQuery_Response),
    8: DceRpcOp(RegisterAccountingClient_Request, RegisterAccountingClient_Response),
    9: DceRpcOp(DumpAccountingData_Request, DumpAccountingData_Response),
    10: DceRpcOp(GetAccountingClients_Request, GetAccountingClients_Response),
    11: DceRpcOp(SetAccountingClientStatus_Request, SetAccountingClientStatus_Response),
    12: DceRpcOp(CheckAccountingConnection_Request, CheckAccountingConnection_Response),
    13: DceRpcOp(SetClientPermissions_Request, SetClientPermissions_Response),
}
register_com_interface(
    name="IWRMAccounting",
    uuid=uuid.UUID("4F7CA01C-A9E5-45B6-B142-2332A1339C1D"),
    opnums=IWRMACCOUNTING_OPNUMS,
)


class CONFIGTYPE(IntEnum):
    CONFIGTYPE_ACCOUNTING = 1
    CONFIGTYPE_NOTIFICATION = 2
    CONFIGTYPE_CALENDARING = 3


class GetConfig_Request(NDRPacket):
    fields_desc = [NDRIntEnumField("enumConfigType", 0, CONFIGTYPE)]


class GetConfig_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("pbstrConfigInfo", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
        ),
        NDRIntField("status", 0),
    ]


class SetConfig_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("bstrConfigInfo", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB),
        NDRIntEnumField("enumConfigType", 0, CONFIGTYPE),
    ]


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


class IsEnabled_Request(NDRPacket):
    fields_desc = [NDRIntEnumField("enumConfigType", 0, CONFIGTYPE)]


class IsEnabled_Response(NDRPacket):
    fields_desc = [NDRSignedIntField("pbEnable", 0), NDRIntField("status", 0)]


class EnableDisable_Request(NDRPacket):
    fields_desc = [
        NDRSignedIntField("bEnableDisable", 0),
        NDRIntEnumField("enumConfigType", 0, CONFIGTYPE),
    ]


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


class EXCLUSIONLIST_TYPE(IntEnum):
    SYSTEM_EXCLUSION_LIST = 1
    USER_EXCLUSION_LIST = 2
    DEFAULT_USER_EXCLUSION_LIST = 4


class GetExclusionList_Request(NDRPacket):
    fields_desc = [NDRIntEnumField("enumListType", 0, EXCLUSIONLIST_TYPE)]


class GetExclusionList_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("pbstrExclusionList", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
        ),
        NDRIntField("status", 0),
    ]


class SetExclusionList_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("bstrExclusionList", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
    ]


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


class WSRMActivate_Request(NDRPacket):
    fields_desc = [NDRSignedIntField("bActivate", 0)]


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


class IsWSRMActivated_Request(NDRPacket):
    fields_desc = []


class IsWSRMActivated_Response(NDRPacket):
    fields_desc = [NDRSignedIntField("pbActivated", 0), NDRIntField("status", 0)]


class RestoreExclusionList_Request(NDRPacket):
    fields_desc = []


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


IWRMCONFIG_OPNUMS = {
    0: DceRpcOp(GetConfig_Request, GetConfig_Response),
    1: DceRpcOp(SetConfig_Request, SetConfig_Response),
    2: DceRpcOp(IsEnabled_Request, IsEnabled_Response),
    3: DceRpcOp(EnableDisable_Request, EnableDisable_Response),
    4: DceRpcOp(GetExclusionList_Request, GetExclusionList_Response),
    5: DceRpcOp(SetExclusionList_Request, SetExclusionList_Response),
    6: DceRpcOp(WSRMActivate_Request, WSRMActivate_Response),
    7: DceRpcOp(IsWSRMActivated_Request, IsWSRMActivated_Response),
    8: DceRpcOp(RestoreExclusionList_Request, RestoreExclusionList_Response),
}
register_com_interface(
    name="IWRMConfig",
    uuid=uuid.UUID("21546AE8-4DA5-445E-987F-627FEA39C5E8"),
    opnums=IWRMCONFIG_OPNUMS,
)


class GetSupportedClient_Request(NDRPacket):
    fields_desc = []


class GetSupportedClient_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField(
                "pbstrSupportedClients", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB
            )
        ),
        NDRIntField("status", 0),
    ]


IWRMPROTOCOL_OPNUMS = {
    0: DceRpcOp(GetSupportedClient_Request, GetSupportedClient_Response)
}
register_com_interface(
    name="IWRMProtocol",
    uuid=uuid.UUID("F31931A9-832D-481C-9503-887A0E6A79F0"),
    opnums=IWRMPROTOCOL_OPNUMS,
)


class CreateMachineGroup_Request(NDRPacket):
    fields_desc = [
        NDRPacketField(
            "bstrParentMachineGroupId", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB
        ),
        NDRPacketField("bstrMachineGroupInfo", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB),
    ]


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


class GetMachineGroupInfo_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("bstrMachineGroupId", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
    ]


class GetMachineGroupInfo_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField(
                "pbstrMachineGroupInfo", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB
            )
        ),
        NDRIntField("status", 0),
    ]


class MACHINE_GROUP_MERGE_OPTIONS(IntEnum):
    OVERWRITE_MG_MERGE_OPTION = 1
    OVERRIDE_MG_MERGE_OPTION = 2
    APPEND_MG_MERGE_OPTION = 3
    SMART_MG_MERGE_OPTION = 4


class ModifyMachineGroup_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("bstrMachineGroupId", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB),
        NDRPacketField("bstrMachineGroupInfo", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB),
        NDRIntEnumField("enumMGMergeOptions", 0, MACHINE_GROUP_MERGE_OPTIONS),
    ]


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


class DeleteMachineGroup_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("bstrMachineGroupId", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
    ]


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


class RenameMachineGroup_Request(NDRPacket):
    fields_desc = [
        NDRPacketField(
            "bstrOldMachineGroupName", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB
        ),
        NDRPacketField(
            "bstrNewMachineGroupName", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB
        ),
    ]


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


class AddMachine_Request(NDRPacket):
    fields_desc = [
        NDRPacketField(
            "bstrParentMachineGroupId", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB
        ),
        NDRPacketField("bstrMachineInfo", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB),
    ]


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


class GetMachineInfo_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("bstrMachineId", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
    ]


class GetMachineInfo_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("pbstrMachineInfo", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
        ),
        NDRIntField("status", 0),
    ]


class ModifyMachineInfo_Request(NDRPacket):
    fields_desc = [
        NDRPacketField(
            "bstrParentMachineGroupId", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB
        ),
        NDRPacketField("bstrMachineId", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB),
        NDRPacketField("bstrMachineInfo", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB),
    ]


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


class DeleteMachine_Request(NDRPacket):
    fields_desc = [
        NDRPacketField(
            "bstrParentMachineGroupId", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB
        ),
        NDRPacketField("bstrMachineId", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB),
    ]


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


IWRMMACHINEGROUP_OPNUMS = {
    0: DceRpcOp(CreateMachineGroup_Request, CreateMachineGroup_Response),
    1: DceRpcOp(GetMachineGroupInfo_Request, GetMachineGroupInfo_Response),
    2: DceRpcOp(ModifyMachineGroup_Request, ModifyMachineGroup_Response),
    3: DceRpcOp(DeleteMachineGroup_Request, DeleteMachineGroup_Response),
    4: DceRpcOp(RenameMachineGroup_Request, RenameMachineGroup_Response),
    5: DceRpcOp(AddMachine_Request, AddMachine_Response),
    6: DceRpcOp(GetMachineInfo_Request, GetMachineInfo_Response),
    7: DceRpcOp(ModifyMachineInfo_Request, ModifyMachineInfo_Response),
    8: DceRpcOp(DeleteMachine_Request, DeleteMachine_Response),
}
register_com_interface(
    name="IWRMMachineGroup",
    uuid=uuid.UUID("943991a5-b3fe-41fa-9696-7f7b656ee34b"),
    opnums=IWRMMACHINEGROUP_OPNUMS,
)


class ExportObjects_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("bstrObjectIds", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB),
        NDRIntEnumField("enumObjectType", 0, OBJECT_TYPE),
    ]


class ExportObjects_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("pbstrObjectXml", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
        ),
        NDRIntField("status", 0),
    ]


class GetImportConflicts_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("bstrPMCXml", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB),
        NDRPacketField("bstrPolicyXml", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB),
        NDRPacketField("bstrCalendarXml", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB),
        NDRPacketField("bstrConditionalXml", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB),
        NDRPacketField("bstrMachineGroupXml", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB),
        NDRPacketField("bstrConfigurationXmls", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB),
    ]


class GetImportConflicts_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField(
                "pbstrConflictingObjects", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB
            )
        ),
        NDRIntField("status", 0),
    ]


class IMPORT_TYPE(IntEnum):
    OVERWRITE_IMPORT = 1
    IGNORE_EXISTING_IMPORT = 2
    OVERRIDE_EXISTING_IMPORT = 3
    SMART_MERGE_RENAME_EXISTING_IMPORT = 4
    SMART_MERGE_RENAME_IMPORTED_IMPORT = 5


class ImportXml_Request(NDRPacket):
    fields_desc = [
        NDRPacketField("bstrPMCXml", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB),
        NDRPacketField("bstrPolicyXml", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB),
        NDRPacketField("bstrCalendarXml", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB),
        NDRPacketField("bstrConditionalXml", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB),
        NDRPacketField("bstrMachineGroupXml", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB),
        NDRPacketField("bstrConfigurationXmls", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB),
        NDRIntEnumField("enumImportType", 0, IMPORT_TYPE),
    ]


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


class ExportXml_Request(NDRPacket):
    fields_desc = []


class ExportXml_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField("pbstrPMCXml", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
        ),
        NDRFullPointerField(
            NDRPacketField("pbstrPolicyXml", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
        ),
        NDRFullPointerField(
            NDRPacketField("pbstrCalendarXml", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB)
        ),
        NDRFullPointerField(
            NDRPacketField(
                "pbstrConditionalXml", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB
            )
        ),
        NDRFullPointerField(
            NDRPacketField(
                "pbstrMachineGroupXml", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB
            )
        ),
        NDRFullPointerField(
            NDRPacketField(
                "pbstrConfigurationXmls", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB
            )
        ),
        NDRIntField("status", 0),
    ]


IRESOURCEMANAGER2_OPNUMS = {
    0: DceRpcOp(ExportObjects_Request, ExportObjects_Response),
    1: DceRpcOp(GetImportConflicts_Request, GetImportConflicts_Response),
    2: DceRpcOp(ImportXml_Request, ImportXml_Response),
    3: DceRpcOp(ExportXml_Request, ExportXml_Response),
}
register_com_interface(
    name="IResourceManager2",
    uuid=uuid.UUID("2A3EB639-D134-422d-90D8-AAA1B5216202"),
    opnums=IRESOURCEMANAGER2_OPNUMS,
)


class GetRemoteUserCategories_Request(NDRPacket):
    fields_desc = []


class GetRemoteUserCategories_Response(NDRPacket):
    fields_desc = [
        NDRFullPointerField(
            NDRPacketField(
                "pbstrRemoteUserCategoriesInfo", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB
            )
        ),
        NDRIntField("status", 0),
    ]


class SetRemoteUserCategories_Request(NDRPacket):
    fields_desc = [
        NDRPacketField(
            "bstrRemoteUserCategoriesInfo", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB
        )
    ]


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


class RefreshRemoteSessionWeights_Request(NDRPacket):
    fields_desc = [
        NDRPacketField(
            "bstrTaregetUserSessions", FLAGGED_WORD_BLOB(), FLAGGED_WORD_BLOB
        ),
        NDRSignedIntField("bUpdateAll", 0),
    ]


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


IWRMREMOTESESSIONMGMT_OPNUMS = {
    0: DceRpcOp(GetRemoteUserCategories_Request, GetRemoteUserCategories_Response),
    1: DceRpcOp(SetRemoteUserCategories_Request, SetRemoteUserCategories_Response),
    2: DceRpcOp(
        RefreshRemoteSessionWeights_Request, RefreshRemoteSessionWeights_Response
    ),
}
register_com_interface(
    name="IWRMRemoteSessionMgmt",
    uuid=uuid.UUID("FC910418-55CA-45ef-B264-83D4CE7D30E0"),
    opnums=IWRMREMOTESESSIONMGMT_OPNUMS,
)
