1 #pragma once 2 3 #ifndef _SWENUM_ 4 #define _SWENUM_ 5 6 #define IOCTL_SWENUM_INSTALL_INTERFACE \ 7 CTL_CODE(FILE_DEVICE_BUS_EXTENDER, 0x000, METHOD_BUFFERED, FILE_ANY_ACCESS) 8 9 #define IOCTL_SWENUM_REMOVE_INTERFACE \ 10 CTL_CODE(FILE_DEVICE_BUS_EXTENDER, 0x001, METHOD_BUFFERED, FILE_ANY_ACCESS) 11 12 #define IOCTL_SWENUM_GET_BUS_ID \ 13 CTL_CODE(FILE_DEVICE_BUS_EXTENDER, 0x002, METHOD_NEITHER, FILE_READ_ACCESS) 14 15 typedef struct _SWENUM_INSTALL_INTERFACE { 16 GUID DeviceId; 17 GUID InterfaceId; 18 WCHAR ReferenceString[1]; 19 } SWENUM_INSTALL_INTERFACE, *PSWENUM_INSTALL_INTERFACE; 20 21 #ifdef _KS_ 22 #define STATIC_BUSID_SoftwareDeviceEnumerator STATIC_KSMEDIUMSETID_Standard 23 #define BUSID_SoftwareDeviceEnumerator KSMEDIUMSETID_Standard 24 #else 25 #define STATIC_BUSID_SoftwareDeviceEnumerator \ 26 0x4747B320L, 0x62CE, 0x11CF, {0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00} 27 #endif /* _KS_ */ 28 29 #ifdef _NTDDK_ 30 31 #ifndef _KS_ 32 33 typedef VOID 34 (NTAPI *PFNREFERENCEDEVICEOBJECT)( 35 _In_ PVOID Context); 36 37 typedef VOID 38 (NTAPI *PFNDEREFERENCEDEVICEOBJECT)( 39 _In_ PVOID Context); 40 41 typedef NTSTATUS 42 (NTAPI *PFNQUERYREFERENCESTRING)( 43 _In_ PVOID Context, 44 _Inout_ PWCHAR *String); 45 46 #endif /* !_KS_ */ 47 48 #define BUS_INTERFACE_SWENUM_VERSION 0x100 49 50 typedef struct _BUS_INTERFACE_SWENUM { 51 INTERFACE Interface; 52 PFNREFERENCEDEVICEOBJECT ReferenceDeviceObject; 53 PFNDEREFERENCEDEVICEOBJECT DereferenceDeviceObject; 54 PFNQUERYREFERENCESTRING QueryReferenceString; 55 } BUS_INTERFACE_SWENUM, *PBUS_INTERFACE_SWENUM; 56 57 #if defined(__cplusplus) 58 extern "C" { 59 #endif 60 61 #ifdef _KS_ 62 63 KSDDKAPI 64 NTSTATUS 65 NTAPI 66 KsQuerySoftwareBusInterface( 67 _In_ PDEVICE_OBJECT PnpDeviceObject, 68 _Out_ PBUS_INTERFACE_SWENUM BusInterface); 69 70 KSDDKAPI 71 NTSTATUS 72 NTAPI 73 KsReferenceSoftwareBusObject( 74 _In_ KSDEVICE_HEADER Header); 75 76 KSDDKAPI 77 VOID 78 NTAPI 79 KsDereferenceSoftwareBusObject( 80 _In_ KSDEVICE_HEADER Header); 81 82 _IRQL_requires_max_(PASSIVE_LEVEL) 83 KSDDKAPI 84 NTSTATUS 85 NTAPI 86 KsCreateBusEnumObject( 87 _In_ PWSTR BusIdentifier, 88 _In_ PDEVICE_OBJECT BusDeviceObject, 89 _In_ PDEVICE_OBJECT PhysicalDeviceObject, 90 _In_opt_ PDEVICE_OBJECT PnpDeviceObject, 91 _In_opt_ REFGUID InterfaceGuid, 92 _In_opt_ PWSTR ServiceRelativePath); 93 94 KSDDKAPI 95 NTSTATUS 96 NTAPI 97 KsGetBusEnumIdentifier( 98 _Inout_ PIRP Irp); 99 100 _IRQL_requires_max_(PASSIVE_LEVEL) 101 KSDDKAPI 102 NTSTATUS 103 NTAPI 104 KsGetBusEnumPnpDeviceObject( 105 _In_ PDEVICE_OBJECT DeviceObject, 106 _Out_ PDEVICE_OBJECT *PnpDeviceObject); 107 108 _IRQL_requires_max_(PASSIVE_LEVEL) 109 KSDDKAPI 110 NTSTATUS 111 NTAPI 112 KsInstallBusEnumInterface( 113 _In_ PIRP Irp); 114 115 _IRQL_requires_max_(PASSIVE_LEVEL) 116 KSDDKAPI 117 NTSTATUS 118 NTAPI 119 KsIsBusEnumChildDevice( 120 _In_ PDEVICE_OBJECT DeviceObject, 121 _Out_ PBOOLEAN ChildDevice); 122 123 _IRQL_requires_max_(PASSIVE_LEVEL) 124 KSDDKAPI 125 NTSTATUS 126 NTAPI 127 KsRemoveBusEnumInterface( 128 _In_ PIRP Irp); 129 130 _IRQL_requires_max_(PASSIVE_LEVEL) 131 KSDDKAPI 132 NTSTATUS 133 NTAPI 134 KsServiceBusEnumPnpRequest( 135 _In_ PDEVICE_OBJECT DeviceObject, 136 _Inout_ PIRP Irp); 137 138 _IRQL_requires_max_(PASSIVE_LEVEL) 139 KSDDKAPI 140 NTSTATUS 141 NTAPI 142 KsServiceBusEnumCreateRequest( 143 _In_ PDEVICE_OBJECT DeviceObject, 144 _Inout_ PIRP Irp); 145 146 _IRQL_requires_max_(PASSIVE_LEVEL) 147 KSDDKAPI 148 NTSTATUS 149 NTAPI 150 KsGetBusEnumParentFDOFromChildPDO( 151 _In_ PDEVICE_OBJECT DeviceObject, 152 _Out_ PDEVICE_OBJECT *FunctionalDeviceObject); 153 154 #endif /* _KS_ */ 155 156 #if defined(__cplusplus) 157 } 158 #endif 159 160 #endif /* _NTDDK_ */ 161 162 #endif /* _SWENUM_ */ 163