/*
 * Plug and Play Manager RPC interface definition
 */

#include <ms-dtyp.idl>

const unsigned long PNP_MAX_STRING_LEN = 32767;
const unsigned long PNP_MAX_DEVICE_ID_LEN = 200;
const unsigned long PNP_MAX_GUID_STRING_LEN = 39;
const unsigned long PNP_MAX_DEVINTERFACE_LEN = PNP_MAX_STRING_LEN;
const unsigned long PNP_MAX_CULTURE_NAME_LEN = 85;
const unsigned long PNP_MAX_CM_PATH = 360;
const unsigned long PNP_MAX_PROP_SIZE = 65534;
const unsigned long PNP_MAX_PROP_COUNT = 32767;
const unsigned long PNP_MAX_BUFFER_SIZE = 16000000;

cpp_quote("#ifndef _CFGMGR32_H_")
typedef unsigned long RESOURCEID;

typedef struct _HWPROFILEINFO {
    DWORD HWPI_ulHWProfile;
    WCHAR HWPI_szFriendlyName[80];
    DWORD HWPI_dwFlags;
} HWPROFILEINFO;

cpp_quote("#endif")
typedef unsigned long DEVPROPTYPE;
typedef [range(0, PNP_MAX_PROP_SIZE)] unsigned long PNP_PROP_SIZE;
typedef [range(0, PNP_MAX_PROP_COUNT)] unsigned long PNP_PROP_COUNT;
typedef [range(0, PNP_MAX_STRING_LEN)] unsigned long PNP_RPC_STRING_LEN;
typedef [range(0, PNP_MAX_BUFFER_SIZE)] unsigned long PNP_RPC_BUFFER_SIZE;
typedef PNP_PROP_SIZE *PPNP_PROP_SIZE;
typedef PNP_PROP_COUNT *PPNP_PROP_COUNT;
typedef PNP_RPC_STRING_LEN *PPNP_RPC_STRING_LEN;
typedef PNP_RPC_BUFFER_SIZE *PPNP_RPC_BUFFER_SIZE;

cpp_quote("#ifndef _CFG_INCLUDED_")

typedef enum _PNP_VETO_TYPE {
    PNP_VetoTypeUnknown = 0,
    PNP_VetoLegacyDevice = 1,
    PNP_VetoPendingClose = 2,
    PNP_VetoWindowsApp = 3,
    PNP_VetoWindowsService = 4,
    PNP_VetoOutstandingOpen = 5,
    PNP_VetoDevice = 6,
    PNP_VetoDriver = 7,
    PNP_VetoIllegalDeviceRequest = 8,
    PNP_VetoInsufficientPower = 9,
    PNP_VetoNonDisableable = 10,
    PNP_VetoLegacyDriver = 11,
    PNP_VetoInsufficientRights = 12,
} *PPNP_VETO_TYPE;

cpp_quote("#endif")

cpp_quote("#if 0")

typedef struct _BUSNUMBER_DES {
    DWORD BUSD_Count;
    DWORD BUSD_Type;
    DWORD BUSD_Flags;
    DWORD BUSD_Alloc_Base;
    DWORD BUSD_Alloc_End;
} BUSNUMBER_DES, *PBUSNUMBER_DES;

typedef struct _BUSNUMBER_RANGE {
    DWORD BUSR_Min;
    DWORD BUSR_Max;
    DWORD BUSR_nBusNumbers;
    DWORD BUSR_Flags;
} BUSNUMBER_RANGE, *PBUSNUMBER_RANGE;

typedef struct _BUSNUMBER_RESOURCE {
    BUSNUMBER_DES BusNumber_Header;
    BUSNUMBER_RANGE BusNumber_Data[1];
} BUSNUMBER_RESOURCE, *PBUSNUMBER_RESOURCE;

typedef struct _CS_DES {
    DWORD CSD_SignatureLength;
    DWORD CSD_LegacyDataOffset;
    DWORD CSD_LegacyDataSize;
    DWORD CSD_Flags;
    GUID CSD_ClassGuid;
    BYTE CSD_Signature[1];
} CS_DES, *PCS_DES;

typedef struct _CS_RESOURCE {
    CS_DES CS_Header;
} CS_RESOURCE, *PCS_RESOURCE;

typedef struct _DEVPRIVATE_DES {
    DWORD PD_Count;
    DWORD PD_Type;
    DWORD PD_Data1;
    DWORD PD_Data2;
    DWORD PD_Data3;
    DWORD PD_Flags;
} DEVPRIVATE_DES, *PDEVPRIVATE_DES;

typedef struct _DEVPRIVATE_RANGE {
    DWORD PR_Data1;
    DWORD PR_Data2;
    DWORD PR_Data3;
} DEVPRIVATE_RANGE, *PDEVPRIVATE_RANGE;

typedef struct _DEVPRIVATE_RESOURCE {
    DEVPRIVATE_DES PRV_Header;
    DEVPRIVATE_RANGE PRV_Data[1];
} DEVPRIVATE_RESOURCE, *PDEVPRIVATE_RESOURCE;

typedef struct _DMA_DES {
    DWORD DD_Count;
    DWORD DD_Type;
    DWORD DD_Flags;
    unsigned long DD_Alloc_Chan;
} DMA_DES, *PDMA_DES;

typedef struct _DMA_RANGE {
    DWORD DR_Min;
    DWORD DR_Max;
    DWORD DR_Flags;
} DMA_RANGE, *PDMA_RANGE;

typedef struct _DMA_RESOURCE {
    DMA_DES DMA_Header;
    DMA_RANGE DMA_Data[1];
} DMA_RESOURCE, *PDMA_RESOURCE;

typedef struct _IO_DES {
    DWORD IOD_Count;
    DWORD IOD_Type;
    unsigned __int64 IOD_AllocBase;
    unsigned __int64 IOD_AllocEnd;
    DWORD IOD_DesFlags;
} IO_DES, *PIO_DES;

typedef struct _IO_RANGE {
    unsigned __int64 IOR_Align;
    DWORD IOR_nPorts;
    unsigned __int64 IOR_Min;
    unsigned __int64 IOR_Max;
    DWORD IOR_RangeFlags;
    unsigned __int64 IOR_Alias;
} IO_RANGE, *PIO_RANGE;

typedef struct _IO_RESOURCE {
    IO_DES IO_Header;
    IO_RANGE IO_Data[1];
} IO_RESOURCE, *PIO_RESOURCE;

typedef struct _IRQ_DES {
    DWORD IRQD_Count;
    DWORD IRQD_Type;
    DWORD IRQD_Flags;
    DWORD IRQD_Alloc_Num;
    DWORD IRQD_Affinity;
} IRQ_DES, *PIRQ_DES;

typedef struct _IRQ_RANGE {
    DWORD IRQR_Min;
    DWORD IRQR_Max;
    DWORD IRQR_Flags;
} IRQ_RANGE, *PIRQ_RANGE;

typedef struct _IRQ_RESOURCE {
    IRQ_DES IO_Header;
    IRQ_RANGE IO_Data[1];
} IRQ_RESOURCE, *PIRQ_RESOURCE;

typedef struct _MEM_DES {
    DWORD MD_Count;
    DWORD MD_Type;
    unsigned __int64 MD_Alloc_Base;
    unsigned __int64 MD_Alloc_End;
    DWORD MD_Flags;
    DWORD Reserved;
} MEM_DES, *PMEM_DES;

typedef struct _MEM_RANGE {
    __int64 MR_Align;
    DWORD MR_nBytes;
    __int64 MR_Min;
    __int64 MR_Max;
    DWORD MR_Flags;
    DWORD MR_Reserved;
} MEM_RANGE, *PMEM_RANGE;

typedef struct _MEM_RESOURCE {
    MEM_DES MEM_Header;
    MEM_RANGE MEM_Data[1];
} MEM_RESOURCE, *PMEM_RESOURCE;

typedef struct _MFCARD_DES {
    DWORD PMF_Count;
    DWORD PMF_Type;
    DWORD PMF_Flags;
    BYTE PMF_ConfigOptions;
    BYTE PMF_IoResourceIndex;
    BYTE PMF_Reserved[2];
    DWORD PMF_ConfigRegisterBase;
} MFCARD_DES, *PMFCARD_DES;

typedef struct _MFCARD_RESOURCE {
    MFCARD_DES MfCard_Header;
} MFCARD_RESOURCE, *PMFCARD_RESOURCE;

typedef struct _PCCARD_DES {
    DWORD PCD_Count;
    DWORD PCD_Type;
    DWORD PCD_Flags;
    BYTE PCD_ConfigIndex;
    BYTE PCD_Reserved[3];
    DWORD PCD_MemoryCardBase1;
    DWORD PCD_MemoryCardBase2;
} PCCARD_DES, *PPCCARD_DES;

typedef struct _PCCARD_RESOURCE {
    PCCARD_DES PcCard_Header;
} PCCARD_RESOURCE, *PPCARD_RESOURCE;

cpp_quote("#endif")

typedef struct _PNP_CONFLICT_ENTRY {
    DWORD DeviceInstance;
    DWORD DeviceFlags;
    DWORD ResourceType;
    __int64 ResourceStart;
    __int64 ResourceEnd;
    DWORD ResourceFlags;
} PNP_CONFLICT_ENTRY, *PPNP_CONFLICT_ENTRY;

typedef struct _PNP_CONFLICT_LIST {
    DWORD Reserved1;
    DWORD Reserved2;
    DWORD ConflictsCounted;
    DWORD ConflictsListed;
    DWORD RequiredBufferSize;
    PNP_CONFLICT_ENTRY ConflictEntry[1];
} PNP_CONFLICT_LIST, *PPNP_CONFLICT_LIST;

typedef struct _PNP_CONFLICT_STRINGS {
    DWORD NullDeviceInstance;
    WCHAR DeviceInstanceStrings[1];
} PNP_CONFLICT_STRINGS, *PPNP_CONFLICT_STRINGS;

typedef struct _DEVPROPKEY {
    GUID fmtid;
    DWORD pid;
} DEVPROPKEY;

[
  uuid (8D9F4E40-A03D-11CE-8F69-08003E30051B),
  version(1.0),
  pointer_default(unique),
  endpoint("ncacn_np:[\\pipe\\plugplay]")
  #ifndef __midl
  ,explicit_handle
  #endif
]
interface pnp
{
    /* Function 0 */
    DWORD PNP_Disconnect(
        [in] handle_t hBinding); /* FIXME */

    /* Function 1 */
    DWORD PNP_Connect(
        [in] handle_t hBinding); /* FIXME */

    /* Function 2 */
    DWORD PNP_GetVersion(
        [in] handle_t hBinding,
        [out] WORD *pVersion);

    /* Function 3 */
    DWORD PNP_GetGlobalState(
        [in] handle_t hBinding,
        [out] DWORD *pulState,
        [in] DWORD ulFlags);

    /* Function 4 */
    DWORD PNP_InitDetection(
        [in] handle_t hBinding);

    /* Function 5 */
    DWORD PNP_ReportLogOn(
        [in] handle_t hBinding,
        [in] BOOL Admin,
        [in] DWORD ProcessId);

    /* Function 6 */
    DWORD PNP_ValidateDeviceInstance(
        [in] handle_t hBinding,
        [in, string, ref] LPWSTR pDeviceID,
        [in] DWORD ulFlags);

    /* Function 7 */
    DWORD PNP_GetRootDeviceInstance(
        [in] handle_t hBinding,
        [out, string, size_is(ulLength)] LPWSTR pDeviceID,
        [in] PNP_RPC_STRING_LEN ulLength);

    /* Function 8 */
    cpp_quote("#define PNP_GET_PARENT_DEVICE_INSTANCE  0x1")
    cpp_quote("#define PNP_GET_CHILD_DEVICE_INSTANCE   0x2")
    cpp_quote("#define PNP_GET_SIBLING_DEVICE_INSTANCE 0x3")
    DWORD PNP_GetRelatedDeviceInstance(
        [in] handle_t hBinding,
        [in] DWORD ulRelationship,
        [in, string, ref] LPWSTR pDeviceID,
        [out, string, size_is(*pulLength)] LPWSTR pRelatedDeviceId,
        [in, out] PNP_RPC_STRING_LEN *pulLength,
        [in] DWORD ulFlags);

    /* Function 9 */
    cpp_quote("#define PNP_ENUMERATOR_SUBKEYS 0x1")
    cpp_quote("#define PNP_CLASS_SUBKEYS      0x2")
    DWORD PNP_EnumerateSubKeys(
        [in] handle_t hBinding,
        [in] DWORD ulBranch,
        [in] DWORD ulIndex,
        [out, string, size_is(ulLength)] LPWSTR Buffer,
        [in] PNP_RPC_STRING_LEN ulLength,
        [out] PNP_RPC_STRING_LEN *pulRequiredLen,
        [in] DWORD ulFlags);

    /* Function 10 */
    DWORD PNP_GetDeviceList(
        [in] handle_t hBinding,
        [in, string, unique] LPWSTR pszFilter,
        [out, size_is(*pulLength), length_is(*pulLength)] LPWSTR Buffer,
        [in, out] PNP_RPC_STRING_LEN *pulLength,
        [in] DWORD ulFlags);

    /* Function 11 */
    DWORD PNP_GetDeviceListSize(
        [in] handle_t hBinding,
        [in, string, unique] LPWSTR pszFilter,
        [out] PNP_RPC_BUFFER_SIZE *pulLen,
        [in] DWORD ulFlags);

    /* Function 12 */
    DWORD PNP_GetDepth(
        [in] handle_t hBinding,
        [in, string, ref] LPWSTR pszDeviceID,
        [out] DWORD *pulDepth,
        [in] DWORD ulFlags);

    /* Function 13 */
    DWORD PNP_GetDeviceRegProp(
        [in] handle_t hBinding,
        [in, string, ref] LPWSTR pDeviceID,
        [in] DWORD ulProperty,
        [in, out] DWORD *pulRegDataType,
        [out, size_is(*pulTransferLen), length_is(*pulTransferLen)] BYTE *Buffer,
        [in, out] PNP_PROP_SIZE *pulTransferLen,
        [in, out] PNP_PROP_SIZE *pulLength,
        [in] DWORD ulFlags);

    /* Function 14 */
    DWORD PNP_SetDeviceRegProp(
        [in] handle_t hBinding,
        [in, string, ref] LPWSTR pDeviceId,
        [in] DWORD ulProperty,
        [in] DWORD ulDataType,
        [in, size_is(ulLength)] BYTE *Buffer,
        [in] PNP_PROP_SIZE ulLength,
        [in] DWORD ulFlags);

    /* Function 15 */
    DWORD PNP_GetClassInstance(
        [in] handle_t hBinding,
        [in, string, ref] LPWSTR pDeviceId,
        [out, string, size_is(ulLength)] LPWSTR pszClassInstance,
        [in] PNP_RPC_STRING_LEN ulLength);

    /* Function 16 */
    DWORD PNP_CreateKey(
        [in] handle_t hBinding,
        [in, string, ref] LPWSTR pszSubKey,
        [in] DWORD samDesired,
        [in] DWORD ulFlags);

    /* Function 17 */
    DWORD PNP_DeleteRegistryKey(
        [in] handle_t hBinding,
        [in, string, ref] LPWSTR pszDeviceID,
        [in, string, ref] LPWSTR pszParentKey,
        [in, string, ref] LPWSTR pszChildKey,
        [in] DWORD ulFlags);

    /* Function 18 */
    DWORD PNP_GetClassCount(
        [in] handle_t hBinding,
        [out] DWORD *pulClassCount,
        [in] DWORD ulFlags);

    /* Function 19 */
    DWORD PNP_GetClassName(
        [in] handle_t hBinding,
        [in, string, ref] LPWSTR pszClassGuid,
        [out, string, size_is(*pulLength)] LPWSTR Buffer,
        [in, out] PNP_RPC_STRING_LEN *pulLength,
        [in] DWORD ulFlags);

    /* Function 20 */
    DWORD PNP_DeleteClassKey(
        [in] handle_t hBinding,
        [in, string, ref] LPWSTR pszClassGuid,
        [in] DWORD ulFlags);

    /* Function 21 */
    DWORD PNP_GetInterfaceDeviceAlias(
        [in] handle_t hBinding,
        [in, string, ref] LPWSTR pszInterfaceDevice,
        [in] GUID *AliasInterfaceGuid,
        [out, string, size_is(*pulTransferLen)] LPWSTR pszAliasInterfaceDevice,
        [in, out] PNP_RPC_STRING_LEN *pulLength,
        [in, out] PNP_RPC_STRING_LEN *pulTransferLen,
        [in] DWORD ulFlags);

    /* Function 22 */
    DWORD PNP_GetInterfaceDeviceList(
        [in] handle_t hBinding,
        [in] GUID *InterfaceGuid,
        [in, string, unique] LPWSTR pszDeviceID,
        [out, size_is(*pulLength), length_is(*pulLength)] BYTE *Buffer,
        [in, out] PNP_RPC_BUFFER_SIZE *pulLength,
        [in] DWORD ulFlags);

    /* Function 23 */
    DWORD PNP_GetInterfaceDeviceListSize(
        [in] handle_t hBinding,
        [out] PNP_RPC_BUFFER_SIZE *pulLen,
        [in] GUID *InterfaceGuid,
        [in, string, unique] LPWSTR pszDeviceID,
        [in] DWORD ulFlags);

    /* Function 24 */
    DWORD PNP_RegisterDeviceClassAssociation(
        [in] handle_t hBinding,
        [in, string, unique] LPWSTR pszDeviceID,
        [in] GUID *InterfaceGuid,
        [in, string, unique] LPWSTR pszReference,
        [out, string, size_is(*pulTransferLen)] LPWSTR pszSymLink,
        [in, out] PNP_RPC_STRING_LEN *pulLength,
        [in, out] PNP_RPC_STRING_LEN *pulTransferLen,
        [in] DWORD ulFlags);

    /* Function 25 */
    DWORD PNP_UnregisterDeviceClassAssociation(
        [in] handle_t hBinding,
        [in, string, unique] LPWSTR pszInterfaceDevice,
        [in] DWORD ulFlags);

    /* Function 26 */
    DWORD PNP_GetClassRegProp(
        [in] handle_t hBinding,
        [in, string, ref] LPWSTR pszClassGuid,
        [in] DWORD ulProperty,
        [in, out] DWORD *pulRegDataType,
        [out, size_is(*pulTransferLen), length_is(*pulTransferLen)] BYTE *Buffer,
        [in, out] PNP_RPC_STRING_LEN *pulTransferLen,
        [in, out] PNP_RPC_STRING_LEN *pulLength,
        [in] DWORD ulFlags);

    /* Function 27 */
    DWORD PNP_SetClassRegProp(
        [in] handle_t hBinding,
        [in, string, ref] LPWSTR pszClassGuid,
        [in] DWORD ulProperty,
        [in] DWORD ulDataType,
        [in, size_is(ulLength)] BYTE *Buffer,
        [in] PNP_PROP_SIZE ulLength,
        [in] DWORD ulFlags);

    /* Function 28 */
    DWORD PNP_CreateDevInst(
        [in] handle_t hBinding,
        [in, out, string, size_is(ulLength)] LPWSTR pszDeviceID,
        [in, string, ref] LPWSTR pszParentDeviceID,
        [in] PNP_RPC_STRING_LEN ulLength,
        [in] DWORD ulFlags);

    /* Function 29 */
    cpp_quote("#define PNP_DEVINST_MOVE        0x2")
    cpp_quote("#define PNP_DEVINST_SETUP       0x3")
    cpp_quote("#define PNP_DEVINST_ENABLE      0x4")
    cpp_quote("#define PNP_DEVINST_DISABLE     0x5")
    cpp_quote("#define PNP_DEVINST_REENUMERATE 0x7")
    DWORD PNP_DeviceInstanceAction(
        [in] handle_t hBinding,
        [in] DWORD ulAction,
        [in] DWORD ulFlags,
        [in, string, unique] LPWSTR pszDeviceInstance1,
        [in, string, unique] LPWSTR pszDeviceInstance2);

    /* Function 30 */
    DWORD PNP_GetDeviceStatus(
        [in] handle_t hBinding,
        [in, string, unique] LPWSTR pDeviceID,
        [out] DWORD *pulStatus,
        [out] DWORD *pulProblem,
        [in] DWORD ulFlags);

    /* Function 31 */
    DWORD PNP_SetDeviceProblem(
        [in] handle_t hBinding,
        [in, string, unique] LPWSTR pDeviceID,
        [in] DWORD ulProblem,
        [in] DWORD ulFlags);

    /* Function 32 */
    DWORD PNP_DisableDevInst(
        [in] handle_t hBinding,
        [in, string, unique] LPWSTR pDeviceID,
        [in, out, unique] PPNP_VETO_TYPE pVetoType,
        [in, out, string, unique, size_is(ulNameLength)] LPWSTR pszVetoName,
        [in] DWORD ulNameLength,
        [in] DWORD ulFlags);

    /* Function 33 */
    DWORD PNP_UninstallDevInst(
        [in] handle_t hBinding,
        [in, string, unique] LPWSTR pDeviceID,
        [in] DWORD ulFlags);

    /* Function 34 */
    DWORD PNP_AddID(
        [in] handle_t hBinding,
        [in, string, unique] LPWSTR pszDeviceID,
        [in, string, ref] LPWSTR pszID,
        [in] DWORD ulFlags);

    /* Function 35 */
    DWORD PNP_RegisterDriver(
        [in] handle_t hBinding,
        [in, string, ref] LPWSTR pszDeviceID,
        [in] DWORD ulFlags);

    /* Function 36 */
    DWORD PNP_QueryRemove(
        [in] handle_t hBinding,
        [in, string, ref] LPWSTR pszDeviceID,
        [in, out, unique] PPNP_VETO_TYPE pVetoType,
        [in, out, string, unique, size_is(ulNameLength)] LPWSTR pszVetoName,
        [in] DWORD ulNameLength,
        [in] DWORD ulFlags);

    /* Function 37 */
    DWORD PNP_RequestDeviceEject(
        [in] handle_t hBinding,
        [in, string, ref] LPWSTR pszDeviceID,
        [in, out, unique] PPNP_VETO_TYPE pVetoType,
        [in, out, string, unique, size_is(ulNameLength)] LPWSTR pszVetoName,
        [in] DWORD ulNameLength,
        [in] DWORD ulFlags);

    /* Function 38 */
    DWORD PNP_IsDockStationPresent(
        [in] handle_t hBinding,
        [in, out, unique] BOOL *Present);

    /* Function 39 */
    DWORD PNP_RequestEjectPC(
        [in] handle_t hBinding);

    /* Function 40 */
    cpp_quote("#define PNP_GET_HWPROFFLAGS 0x1")
    cpp_quote("#define PNP_SET_HWPROFFLAGS 0x2")
    DWORD PNP_HwProfFlags(
        [in] handle_t hBinding,
        [in] DWORD ulAction,
        [in, string, ref] LPWSTR pDeviceID,
        [in] DWORD ulConfig,
        [in, out] DWORD *pulValue,
        [in, out, unique] PPNP_VETO_TYPE pVetoType,
        [in, out, string, unique, size_is(ulNameLength)] LPWSTR pszVetoName,
        [in] DWORD ulNameLength,
        [in] DWORD ulFlags);

    /* Function 41 */
    DWORD PNP_GetHwProfInfo(
        [in] handle_t hBinding,
        [in] DWORD ulIndex,
        [in, out, ref] HWPROFILEINFO *pHWProfileInfo,
        [in, range(0, 168)] DWORD ulProfileInfoSize,
        /* FIXME: should be [in, range(0, sizeof(HWPROFILEINFO))] DWORD ulProfileInfoSize, */
        [in] DWORD ulFlags);

    /* Function 42 */
    DWORD PNP_AddEmptyLogConf(
        [in] handle_t hBinding,
        [in, string, ref] LPWSTR pDeviceID,
        [in] DWORD ulPriority,
        [out] DWORD *pulLogConfTag,
        [in] DWORD ulFlags);

    /* Function 43 */
    DWORD PNP_FreeLogConf(
        [in] handle_t hBinding,
        [in, string, ref] LPWSTR pDeviceID,
        [in] DWORD ulLogConfType,
        [in] DWORD ulLogConfTag,
        [in] DWORD ulFlags);

    /* Function 44 */
    DWORD PNP_GetFirstLogConf(
        [in] handle_t hBinding,
        [in, string, ref] LPWSTR pDeviceID,
        [in] DWORD ulLogConfType,
        [out] DWORD *pulLogConfTag,
        [in] DWORD ulFlags);

    /* Function 45 */
    DWORD PNP_GetNextLogConf(
        [in] handle_t hBinding,
        [in, string, ref] LPWSTR pDeviceID,
        [in] DWORD ulLogConfType,
        [in] DWORD ulCurrentTag,
        [out] DWORD *pulNextTag,
        [in] DWORD ulFlags);

    /* Function 46 */
    DWORD PNP_GetLogConfPriority(
        [in] handle_t hBinding,
        [in, string, ref] LPWSTR pDeviceID,
        [in] DWORD ulType,
        [in] DWORD ulTag,
        [out] DWORD *pPriority,
        [in] DWORD ulFlags);

    /* Function 47 */
    DWORD PNP_AddResDes(
        [in] handle_t hBinding,
        [in, string, ref] LPWSTR pDeviceID,
        [in] DWORD ulLogConfTag,
        [in] DWORD ulLogConfType,
        [in] RESOURCEID ResourceID,
        [out] DWORD *pulResourceTag,
        [in, size_is(ResourceLen)] BYTE *ResourceData,
        [in] PNP_RPC_BUFFER_SIZE ResourceLen,
        [in] DWORD ulFlags);

    /* Function 48 */
    DWORD PNP_FreeResDes(
        [in] handle_t hBinding,
        [in, string, ref] LPWSTR pDeviceID,
        [in] DWORD ulLogConfTag,
        [in] DWORD ulLogConfType,
        [in] RESOURCEID ResourceID,
        [in] DWORD ulResourceTag,
        [out] DWORD *pulPreviousResType,
        [out] DWORD *pulPreviousResTag,
        [in] DWORD ulFlags);

    /* Function 49 */
    DWORD PNP_GetNextResDes(
        [in] handle_t hBinding,
        [in, string, ref] LPWSTR pDeviceID,
        [in] DWORD ulLogConfTag,
        [in] DWORD ulLogConfType,
        [in] RESOURCEID ResourceID,
        [in] DWORD ulResourceTag,
        [out] DWORD *pulNextResType,
        [out] DWORD *pulNextResTag,
        [in] DWORD ulFlags);

    /* Function 50 */
    DWORD PNP_GetResDesData(
        [in] handle_t hBinding,
        [in, string, ref] LPWSTR pDeviceID,
        [in] DWORD ulLogConfTag,
        [in] DWORD ulLogConfType,
        [in] RESOURCEID ResourceID,
        [in] DWORD ulResourceTag,
        [out, size_is(BufferLen)] BYTE *Buffer,
        [in] PNP_RPC_BUFFER_SIZE BufferLen,
        [in] DWORD ulFlags);

    /* Function 51 */
    DWORD PNP_GetResDesDataSize(
        [in] handle_t hBinding,
        [in, string, ref] LPWSTR pDeviceID,
        [in] DWORD ulLogConfTag,
        [in] DWORD ulLogConfType,
        [in] RESOURCEID ResourceID,
        [in] DWORD ulResourceTag,
        [out] DWORD *pulSize,
        [in] DWORD ulFlags);

    /* Function 52 */
    DWORD PNP_ModifyResDes(
        [in] handle_t hBinding,
        [in, string, ref] LPWSTR pDeviceID,
        [in] DWORD ulLogConfTag,
        [in] DWORD ulLogConfType,
        [in] RESOURCEID CurrentResourceID,
        [in] RESOURCEID NewResourceID,
        [in] DWORD ulResourceTag,
        [in, size_is(ResourceLen)] BYTE *ResourceData,
        [in] PNP_RPC_BUFFER_SIZE ResourceLen,
        [in] DWORD ulFlags);

    /* Function 53 */
    DWORD PNP_DetectResourceConflict(
        [in] handle_t hBinding,
        [in, string, ref] LPWSTR pDeviceID,
        [in] RESOURCEID ResourceID,
        [in, size_is(ResourceLen)] BYTE *ResourceData,
        [in] PNP_RPC_BUFFER_SIZE ResourceLen,
        [out] BOOL *pbConflictDetected,
        [in] DWORD ulFlags);

    /* Function 54 */
    DWORD PNP_QueryResConfList(
        [in] handle_t hBinding,
        [in, string, ref] LPWSTR pDeviceID,
        [in] RESOURCEID ResourceID,
        [in, size_is(ResourceLen)] BYTE *ResourceData,
        [in] PNP_RPC_BUFFER_SIZE ResourceLen,
        [out, size_is(BufferLen)] BYTE *Buffer,
        [in] PNP_RPC_BUFFER_SIZE BufferLen,
        [in] DWORD ulFlags);

    /* Function 55 */
    DWORD PNP_SetHwProf(
        [in] handle_t hBinding,
        [in] DWORD ulHardwareProfile,
        [in] DWORD ulFlags);

    /* Function 56 */
    DWORD PNP_QueryArbitratorFreeData(
        [in] handle_t hBinding,
        [out,size_is(DataLen)] BYTE *pData,
        [in] DWORD DataLen,
        [in, string, ref] LPWSTR pDeviceID,
        [in] RESOURCEID ResourceID,
        [in] DWORD ulFlags);

    /* Function 57 */
    DWORD PNP_QueryArbitratorFreeSize(
        [in] handle_t hBinding,
        [out] DWORD *pulSize,
        [in, string, ref] LPWSTR pDeviceID,
        [in] RESOURCEID ResourceID,
        [in] DWORD ulFlags);

    /* Function 58 */
    DWORD PNP_RunDetection(
        [in] handle_t hBinding,
        [in] DWORD ulFlags);

    /* Function 59 */
    DWORD PNP_RegisterNotification(
        [in] handle_t hBinding);

    /* Function 60 */
    DWORD PNP_UnregisterNotification(
        [in] handle_t hBinding);

cpp_quote("#if _WIN32_WINNT >= 0x0501")

    /* Function 61 */
    DWORD PNP_GetCustomDevProp(
        [in] handle_t hBinding,
        [in, string, ref] LPWSTR pDeviceID,
        [in, string, ref] LPWSTR CustomPropName,
        [out] DWORD *pulRegDataType,
        [out, size_is(*pulLength), length_is(*pulTransferLen)] BYTE *Buffer,
        [out] PNP_RPC_STRING_LEN *pulTransferLen,
        [in, out] PNP_RPC_STRING_LEN *pulLength,
        [in] DWORD ulFlags);

    /* Function 62 */
    DWORD PNP_GetVersionInternal(
        [in] handle_t hBinding,
        [in, out] WORD *pwVersion);

    /* Function 63 */
    DWORD PNP_GetBlockedDriverInfo(
        [in] handle_t hBinding,
        [out, size_is(*pulLength), length_is(*pulTransferLen)] BYTE *Buffer,
        [out] PNP_RPC_BUFFER_SIZE *pulTransferLen,
        [in, out] PNP_RPC_BUFFER_SIZE *pulLength,
        [in] DWORD ulFlags);

    /* Function 64 */
    DWORD PNP_GetServerSideDeviceInstallFlags(
        [in] handle_t hBinding,
        [out] DWORD *pulSSDIFlags,
        [in] DWORD ulFlags);

cpp_quote("#if _WIN32_WINNT >= 0x0600")

    /* Function 65 */
    DWORD PNP_GetObjectPropKeys(
        [in] handle_t hBinding,
        [in, string, ref] LPWSTR ObjectName,
        [in] DWORD ObjectType,
        [in, string, unique] LPWSTR PropertyCultureName,
        [in, out] PNP_PROP_COUNT *PropertyCount,
        [out] PNP_PROP_COUNT *TransferLen,
        [out, size_is(*PropertyCount), length_is(*TransferLen)] DEVPROPKEY *PropertyKeys,
        [in] DWORD Flags);

    /* Function 66 */
    DWORD PNP_GetObjectProp(
        [in] handle_t hBinding,
        [in, string, ref] LPWSTR ObjectName,
        [in] DWORD ObjectType,
        [in, string, unique] LPWSTR PropertyCultureName,
        [in] const DEVPROPKEY *PropertyKey,
        [out] DEVPROPTYPE *PropertyType,
        [in, out] PNP_PROP_SIZE *PropertySize,
        [out] PNP_PROP_SIZE *TransferLen,
        [out, size_is(*PropertySize), length_is(*TransferLen)] BYTE *PropertyBuffer,
        [in] DWORD Flags);

    /* Function 67 */
    DWORD PNP_SetObjectProp(
        [in] handle_t hBinding,
        [in, string, ref] LPWSTR ObjectName,
        [in] DWORD ObjectType,
        [in, string, unique] LPWSTR PropertyCultureName,
        [in] const DEVPROPKEY *PropertyKey,
        [in] DEVPROPTYPE PropertyType,
        [in] PNP_PROP_SIZE PropertySize,
        [in, unique, size_is(PropertySize)] BYTE *PropertyBuffer,
        [in] DWORD Flags);

    /* Function 68 */
    DWORD PNP_InstallDevInst(
        [in] handle_t hBinding); /* FIXME */

    /* Function 69 */
    DWORD PNP_ApplyPowerSettings(
        [in] handle_t hBinding); /* FIXME */

    /* Function 70 */
    DWORD PNP_DriverStoreAddDriverPackage(
        [in] handle_t hBinding); /* FIXME */

    /* Function 71 */
    DWORD PNP_DriverStoreDeleteDriverPackage(
        [in] handle_t hBinding); /* FIXME */

    /* Function 72 */
    DWORD PNP_RegisterServiceNotification(
        [in] handle_t hBinding); /* FIXME */

    /* Function 73 */
    DWORD PNP_SetActiveService(
        [in] handle_t hBinding); /* FIXME */

    /* Function 74 */
    DWORD PNP_DeleteServiceDevices(
        [in] handle_t hBinding); /* FIXME */

cpp_quote("#endif /* WIN32_WINNT >= 0x0600 */")
cpp_quote("#endif /* WIN32_WINNT >= 0x0501 */")

}
