71 DeviceExtension->IsBus =
FALSE;
73 DeviceExtension->DeviceEntry = DeviceEntry;
74 DeviceExtension->BusDeviceExtension = BusDeviceExtension;
121 FreeItem(BusInstanceEntry->SymbolicLink.Buffer);
125 DPRINT(
"Registered DeviceInterface %wZ\n", &BusInstanceEntry->SymbolicLink);
140 Entry = DeviceEntry->DeviceInterfaceList.Flink;
142 while(
Entry != &DeviceEntry->DeviceInterfaceList)
278 Entry = DeviceEntry->DeviceInterfaceList.Flink;
280 DPRINT(
"KspCreateDeviceAssociation InterfaceString %S\n", InterfaceString);
282 while(
Entry != &DeviceEntry->DeviceInterfaceList)
367 Entry = BusDeviceExtension->Common.
Entry.Flink;
369 while(
Entry != &BusDeviceExtension->Common.
Entry)
411 if (!DeviceEntry->
BusId)
538 ASSERT(BusDeviceExtension);
624 Interface->Interface.Size =
sizeof(BUS_INTERFACE_SWENUM);
625 Interface->Interface.Version = BUS_INTERFACE_SWENUM_VERSION;
626 Interface->Interface.Context = ChildDeviceExtension;
946 ASSERT(BusDeviceExtension);
980 return Irp->IoStatus.Status;
991 HANDLE hKey, hDeviceKey, hInterfaceKey, hReferenceKey;
1004 if (InstallInterface->ReferenceString[
Index] <=
L' ' ||
1005 InstallInterface->ReferenceString[
Index] >
L'~' ||
1006 InstallInterface->ReferenceString[
Index] ==
L',' ||
1007 InstallInterface->ReferenceString[
Index] ==
L'\\' ||
1008 InstallInterface->ReferenceString[
Index] ==
L'/')
1095 ASSERT(InstallInterface);
1136 Entry =
Context->BusDeviceExtension->Common.Entry.Flink;
1137 while(
Entry != &
Context->BusDeviceExtension->Common.Entry)
1143 if (!DeviceEntry->
PDO)
1210 if (DeviceEntry->
PDO)
1222 DPRINT1(
"DeviceID %S Instance %S TimeCreated %I64u Now %I64u Diff %I64u hung\n",
1239 DoInvalidate =
TRUE;
1325 Entry = BusDeviceExtension->Common.
Entry.Flink;
1327 while(
Entry != &BusDeviceExtension->Common.
Entry)
1349 if (!DeviceRelations)
1357 Entry = BusDeviceExtension->Common.
Entry.Flink;
1359 while(
Entry != &BusDeviceExtension->Common.
Entry)
1374 DeviceRelations->
Count++;
1388 Irp->IoStatus.Information = (
ULONG_PTR)DeviceRelations;
1413 DPRINT(
"KsGetBusEnumIdentifier\n");
1429 ASSERT(BusDeviceExtension);
1432 if (!BusDeviceExtension)
1463 Irp->AssociatedIrp.SystemBuffer =
Buffer;
1495 DPRINT(
"KsGetBusEnumParentFDOFromChildPDO\n");
1538 DPRINT1(
"KsCreateBusEnumObject %S BusDeviceObject %p\n", ServiceRelativePath, BusDeviceObject);
1545 if (!BusDeviceExtension)
1553 DeviceExtension = (
PDEV_EXTENSION)BusDeviceObject->DeviceExtension;
1558 DPRINT(
"DeviceExtension %p BusDeviceExtension %p\n", DeviceExtension, DeviceExtension->
Ext);
1569 Length += BusDeviceObject->DriverObject->DriverExtension->ServiceKeyName.MaximumLength;
1571 if (ServiceRelativePath)
1592 if (ServiceRelativePath)
1606 DPRINT1(
"IoRegisterDeviceInterface failed Status %lx\n",
Status);
1617 DPRINT1(
"IoSetDeviceInterfaceState failed Status %lx\n",
Status);
1650 if (!PnpDeviceObject)
1658 DPRINT1(
"IoAttachDeviceToDeviceStack failed with %x\n",
Status);
1716 if (!DeviceEntry->
PDO)
1759 DPRINT(
"KsGetBusEnumPnpDeviceObject\n");
1771 CommonDeviceExtension = DeviceExtension->
Ext;
1773 if (!CommonDeviceExtension)
1779 if (!CommonDeviceExtension->IsBus)
1786 ASSERT(CommonDeviceExtension);
1787 ASSERT(CommonDeviceExtension->IsBus);
1815 DPRINT(
"KsInstallBusEnumInterface\n");
1843 Context.BusDeviceExtension = BusDeviceExtension;
1879 if (!BusDeviceExtension)
1926 DPRINT(
"KsServiceBusEnumCreateRequest PNP Hack\n");
1933 DPRINT1(
"KsServiceBusEnumCreateRequest IRP %p Name %wZ\n",
Irp, &IoStack->
FileObject->FileName);
1963 if (DeviceEntry->
PDO)
2001 DPRINT1(
"KsServiceBusEnumCreateRequest failed to create PDO with %x\n",
Status);
2071 ChildDeviceExtension = DeviceExtension->
Ext;
2074 BusDeviceExtension = ChildDeviceExtension->BusDeviceExtension;
2083 ASSERT(ChildDeviceExtension->DeviceEntry->DeviceState !=
Started || ChildDeviceExtension->DeviceEntry->DeviceState ==
NotStarted);
2087 DeviceEntry = ChildDeviceExtension->DeviceEntry;
2145 ASSERT(BusDeviceExtension);
2174 DeviceRelation->
Count = 1;
2220 DPRINT(
"KsRemoveBusEnumInterface\n");
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
#define STATUS_PRIVILEGE_NOT_HELD
#define InterlockedIncrement
#define InterlockedDecrement
PDEVICE_OBJECT PhysicalDeviceObject
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
#define STATUS_DEVICE_REMOVED
#define STATUS_NOT_IMPLEMENTED
#define NT_SUCCESS(StatCode)
VOID NTAPI KeInitializeDpc(IN PKDPC Dpc, IN PKDEFERRED_ROUTINE DeferredRoutine, IN PVOID DeferredContext)
NTSTATUS NTAPI CompleteRequest(IN PIRP Irp, IN NTSTATUS Status, IN ULONG_PTR Information)
struct _COMMON_DEVICE_EXTENSION * PCOMMON_DEVICE_EXTENSION
#define RemoveEntryList(Entry)
#define InsertTailList(ListHead, Entry)
#define ExAllocatePoolWithTag(hernya, size, tag)
#define IsListEmpty(ListHead)
#define KeWaitForSingleObject(pEvt, foo, a, b, c)
#define KeInitializeEvent(pEvt, foo, foo2)
#define KeReleaseSpinLock(sl, irql)
NTSTATUS RtlAppendUnicodeToString(IN PUNICODE_STRING Str1, IN PWSTR Str2)
#define KeSetEvent(pEvt, foo, foo2)
#define KeAcquireSpinLock(sl, irql)
#define KeGetCurrentIrql()
#define RemoveHeadList(ListHead)
#define InitializeListHead(ListHead)
#define KeInitializeSpinLock(sl)
#define ExGetPreviousMode
_Must_inspect_result_ typedef _Out_ PHIDP_CAPS Capabilities
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define OBJ_KERNEL_HANDLE
#define OBJ_CASE_INSENSITIVE
NTSYSAPI NTSTATUS WINAPI RtlGUIDFromString(PUNICODE_STRING, GUID *)
NTSYSAPI NTSTATUS WINAPI RtlStringFromGUID(REFGUID, PUNICODE_STRING)
KSDDKAPI NTSTATUS NTAPI KsInstallBusEnumInterface(PIRP Irp)
VOID NTAPI KspRemoveBusInterface(PVOID Ctx)
NTSTATUS KspQueryId(IN PCOMMON_DEVICE_EXTENSION ChildDeviceExtension, IN PIRP Irp)
NTSTATUS KspQueryBusDeviceCapabilities(IN PCOMMON_DEVICE_EXTENSION ChildDeviceExtension, IN PIRP Irp)
NTSTATUS NTAPI KspBusQueryReferenceString(IN PVOID Context, IN OUT PWCHAR *String)
KSDDKAPI NTSTATUS NTAPI KsIsBusEnumChildDevice(IN PDEVICE_OBJECT DeviceObject, OUT PBOOLEAN ChildDevice)
NTSTATUS NTAPI KspCreateDeviceAssociation(IN PHANDLE hKey, IN PBUS_ENUM_DEVICE_EXTENSION BusDeviceExtension, IN PBUS_DEVICE_ENTRY DeviceEntry, IN LPWSTR InterfaceString, IN LPWSTR ReferenceString)
VOID KspRemoveDeviceAssociations(IN PBUS_DEVICE_ENTRY DeviceEntry)
VOID NTAPI KspBusDeviceReference(IN PVOID Context)
VOID NTAPI KspBusWorkerRoutine(IN PVOID Parameter)
VOID NTAPI KspBusDereferenceDeviceObject(IN PVOID Context)
VOID NTAPI KspBusReferenceDeviceObject(IN PVOID Context)
NTSTATUS KspQueryBusDeviceInterface(IN PCOMMON_DEVICE_EXTENSION ChildDeviceExtension, IN PIRP Irp)
VOID NTAPI KspInstallBusEnumInterface(IN PVOID Ctx)
VOID NTAPI KspBusDeviceDereference(IN PVOID Context)
NTSTATUS KspEnableBusDeviceInterface(PBUS_DEVICE_ENTRY DeviceEntry, BOOLEAN bEnable)
KSDDKAPI NTSTATUS NTAPI KsGetBusEnumPnpDeviceObject(IN PDEVICE_OBJECT DeviceObject, IN PDEVICE_OBJECT *PnpDeviceObject)
KSDDKAPI NTSTATUS NTAPI KsGetBusEnumIdentifier(IN PIRP Irp)
NTSTATUS KspInstallInterface(IN PBUS_ENUM_DEVICE_EXTENSION BusDeviceExtension, IN PSWENUM_INSTALL_INTERFACE InstallInterface)
NTSTATUS KspStartBusDevice(IN PDEVICE_OBJECT DeviceObject, IN PCOMMON_DEVICE_EXTENSION ChildDeviceExtension, IN PIRP Irp)
NTSTATUS NTAPI KspCreateDeviceReferenceTrampoline(IN PHANDLE hKey, IN PBUS_ENUM_DEVICE_EXTENSION BusDeviceExtension, IN PBUS_DEVICE_ENTRY DummyEntry, IN LPWSTR DeviceCategory, IN LPWSTR ReferenceString)
KSDDKAPI NTSTATUS NTAPI KsServiceBusEnumPnpRequest(IN PDEVICE_OBJECT DeviceObject, IN OUT PIRP Irp)
NTSTATUS KspCreatePDO(IN PBUS_ENUM_DEVICE_EXTENSION BusDeviceExtension, IN PBUS_DEVICE_ENTRY DeviceEntry, OUT PDEVICE_OBJECT *OutDeviceObject)
NTSTATUS KspEnumerateBusRegistryKeys(IN HANDLE hKey, IN LPWSTR ReferenceString, IN PKSP_BUS_ENUM_CALLBACK Callback, IN PBUS_ENUM_DEVICE_EXTENSION BusDeviceExtension, IN PBUS_DEVICE_ENTRY DeviceEntry)
VOID NTAPI KspBusDpcRoutine(IN PKDPC Dpc, IN PVOID DeferredContext OPTIONAL, IN PVOID SystemArgument1 OPTIONAL, IN PVOID SystemArgument2 OPTIONAL)
NTSTATUS KspDoReparseForIrp(PIRP Irp, PBUS_DEVICE_ENTRY DeviceEntry)
NTSTATUS KspQueryBusRelations(IN PBUS_ENUM_DEVICE_EXTENSION BusDeviceExtension, IN PIRP Irp)
NTSTATUS(NTAPI * PKSP_BUS_ENUM_CALLBACK)(IN PHANDLE hKey, IN PBUS_ENUM_DEVICE_EXTENSION BusDeviceExtension, IN PBUS_DEVICE_ENTRY DummyEntry, IN LPWSTR RootName, IN LPWSTR DirectoryName)
KSDDKAPI NTSTATUS NTAPI KsServiceBusEnumCreateRequest(IN PDEVICE_OBJECT DeviceObject, IN OUT PIRP Irp)
NTSTATUS KspRegisterDeviceAssociation(IN PBUS_ENUM_DEVICE_EXTENSION BusDeviceExtension, IN PBUS_DEVICE_ENTRY DeviceEntry, IN OUT PBUS_INSTANCE_ENTRY BusInstanceEntry)
KSDDKAPI NTSTATUS NTAPI KsRemoveBusEnumInterface(IN PIRP Irp)
NTSTATUS KspQueryBusDevicePnpState(IN PCOMMON_DEVICE_EXTENSION ChildDeviceExtension, IN PIRP Irp)
NTSTATUS KspScanBus(IN PBUS_ENUM_DEVICE_EXTENSION BusDeviceExtension)
KSDDKAPI NTSTATUS NTAPI KsGetBusEnumParentFDOFromChildPDO(IN PDEVICE_OBJECT DeviceObject, OUT PDEVICE_OBJECT *FunctionalDeviceObject)
NTSTATUS KspQueryBusInformation(IN PCOMMON_DEVICE_EXTENSION ChildDeviceExtension, IN PIRP Irp)
VOID KspCompletePendingIrps(IN PBUS_DEVICE_ENTRY DeviceEntry, IN OUT NTSTATUS ResultCode)
NTSTATUS NTAPI KspCreateDeviceReference(IN PHANDLE hKey, IN PBUS_ENUM_DEVICE_EXTENSION BusDeviceExtension, IN PBUS_DEVICE_ENTRY DummyEntry, IN LPWSTR InterfaceId, IN LPWSTR DeviceId)
KSDDKAPI NTSTATUS NTAPI KsCreateBusEnumObject(IN PWCHAR BusIdentifier, IN PDEVICE_OBJECT BusDeviceObject, IN PDEVICE_OBJECT PhysicalDeviceObject, IN PDEVICE_OBJECT PnpDeviceObject OPTIONAL, IN REFGUID InterfaceGuid OPTIONAL, IN PWCHAR ServiceRelativePath OPTIONAL)
NTSTATUS KspOpenBusRegistryKey(IN PBUS_ENUM_DEVICE_EXTENSION BusDeviceExtension, OUT PHANDLE hKey)
#define KSMEDIUMSETID_Standard
PVOID AllocateItem(IN POOL_TYPE PoolType, IN SIZE_T NumberOfBytes)
VOID FreeItem(IN PVOID Item)
struct __BUS_ENUM_DEVICE_EXTENSION__ * PBUS_ENUM_DEVICE_EXTENSION
struct BUS_INSTALL_ENUM_CONTEXT * PBUS_INSTALL_ENUM_CONTEXT
struct BUS_INSTANCE_ENTRY * PBUS_INSTANCE_ENTRY
struct DEV_EXTENSION * PDEV_EXTENSION
struct __BUS_DEVICE_ENTRY__ * PBUS_DEVICE_ENTRY
struct __BUS_ENUM_DEVICE_EXTENSION__ BUS_ENUM_DEVICE_EXTENSION
#define ExFreePoolWithTag(_P, _T)
#define SE_LOAD_DRIVER_PRIVILEGE
#define InitializeObjectAttributes(p, n, a, r, s)
static PLARGE_INTEGER Time
_Inout_opt_ PDEVICE_OBJECT _Inout_opt_ PDEVICE_OBJECT * FunctionalDeviceObject
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
NTSYSAPI NTSTATUS NTAPI RtlAppendUnicodeStringToString(PUNICODE_STRING Destination, PUNICODE_STRING Source)
struct _KEY_BASIC_INFORMATION KEY_BASIC_INFORMATION
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
struct _KEY_BASIC_INFORMATION * PKEY_BASIC_INFORMATION
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
#define Int32x32To64(a, b)
_In_ ULONG _In_ ULONG _In_ ULONG Length
PDEVICE_OBJECT NTAPI IoAttachDeviceToDeviceStack(IN PDEVICE_OBJECT SourceDevice, IN PDEVICE_OBJECT TargetDevice)
NTSTATUS NTAPI IoCreateDevice(IN PDRIVER_OBJECT DriverObject, IN ULONG DeviceExtensionSize, IN PUNICODE_STRING DeviceName, IN DEVICE_TYPE DeviceType, IN ULONG DeviceCharacteristics, IN BOOLEAN Exclusive, OUT PDEVICE_OBJECT *DeviceObject)
VOID NTAPI IoDetachDevice(IN PDEVICE_OBJECT TargetDevice)
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
NTSTATUS NTAPI IoRegisterDeviceInterface(IN PDEVICE_OBJECT PhysicalDeviceObject, IN CONST GUID *InterfaceClassGuid, IN PUNICODE_STRING ReferenceString OPTIONAL, OUT PUNICODE_STRING SymbolicLinkName)
NTSTATUS NTAPI IoSetDeviceInterfaceState(IN PUNICODE_STRING SymbolicLinkName, IN BOOLEAN Enable)
ULONG NTAPI KeQueryTimeIncrement(VOID)
BOOLEAN NTAPI SeSinglePrivilegeCheck(_In_ LUID PrivilegeValue, _In_ KPROCESSOR_MODE PreviousMode)
Checks if a single privilege is present in the context of the calling thread.
NTSTRSAFEAPI RtlStringCbCopyW(_Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest, _In_ size_t cbDest, _In_ NTSTRSAFE_PCWSTR pszSrc)
NTSTATUS NTAPI IoGetDeviceProperty(IN PDEVICE_OBJECT DeviceObject, IN DEVICE_REGISTRY_PROPERTY DeviceProperty, IN ULONG BufferLength, OUT PVOID PropertyBuffer, OUT PULONG ResultLength)
VOID NTAPI IoInvalidateDeviceRelations(IN PDEVICE_OBJECT DeviceObject, IN DEVICE_RELATION_TYPE Type)
#define FILE_DEVICE_UNKNOWN
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
#define KeQueryTickCount(CurrentCount)
#define STATUS_BUFFER_TOO_SMALL
#define STATUS_BUFFER_OVERFLOW
PULONG MinorVersion OPTIONAL
PBUS_ENUM_DEVICE_EXTENSION BusDeviceExtension
UNICODE_STRING SymbolicLink
ULONG DeviceObjectReferenceCount
ULONG DeviceReferenceCount
struct __BUS_ENUM_DEVICE_EXTENSION__ * BusDeviceExtension
PCOMMON_DEVICE_EXTENSION Ext
base of all file and directory entries
PDEVICE_OBJECT DeviceObject
PDEVICE_OBJECT Objects[1]
struct _IO_STACK_LOCATION::@4104::@4130 QueryInterface
struct _IO_STACK_LOCATION::@4104::@4131 DeviceCapabilities
PDEVICE_OBJECT DeviceObject
struct _IO_STACK_LOCATION::@4104::@4129 QueryDeviceRelations
union _IO_STACK_LOCATION::@1611 Parameters
struct _IO_STACK_LOCATION::@4104::@4135 QueryId
struct _IO_STACK_LOCATION::@1611::@1612 DeviceIoControl
struct _LIST_ENTRY * Flink
LIST_ENTRY DeviceInterfaceList
LARGE_INTEGER TimeCreated
LIST_ENTRY IrpPendingList
COMMON_DEVICE_EXTENSION Common
UNICODE_STRING ServicePath
PDEVICE_OBJECT PnpDeviceObject
UNICODE_STRING DeviceInterfaceLink
PDEVICE_OBJECT PhysicalDeviceObject
PDEVICE_OBJECT BusDeviceObject
struct _SWENUM_INSTALL_INTERFACE * PSWENUM_INSTALL_INTERFACE
BOOLEAN NTAPI KeSetTimer(IN OUT PKTIMER Timer, IN LARGE_INTEGER DueTime, IN PKDPC Dpc OPTIONAL)
VOID NTAPI KeInitializeTimer(OUT PKTIMER Timer)
#define RTL_CONSTANT_STRING(s)
#define RtlZeroMemory(Destination, Length)
#define RtlMoveMemory(Destination, Source, Length)
#define CONTAINING_RECORD(address, type, field)
#define STATUS_INVALID_PARAMETER
#define STATUS_INVALID_DEVICE_STATE
#define STATUS_INSUFFICIENT_RESOURCES
#define STATUS_OBJECT_NAME_NOT_FOUND
_In_ WDFCOLLECTION _In_ ULONG Index
_In_ PDEVICE_OBJECT DeviceObject
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG _Out_ PULONG ResultLength
_Must_inspect_result_ _In_ WDFDEVICE _In_ CONST GUID _In_opt_ PCUNICODE_STRING ReferenceString
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFSTRING String
_In_ WDFDEVICE _In_ PPNP_BUS_INFORMATION BusInformation
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_opt_ PCUNICODE_STRING DeviceName
_Must_inspect_result_ _In_ PWDF_DPC_CONFIG _In_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFDPC * Dpc
_Must_inspect_result_ _In_ WDFDEVICE _In_ LPCGUID _Out_ PINTERFACE Interface
_In_ WDFINTERRUPT _In_ PFN_WDF_INTERRUPT_SYNCHRONIZE Callback
#define IsEqualGUIDAligned(guid1, guid2)
static const GUID InterfaceGuid
VOID NTAPI ExQueueWorkItem(IN PWORK_QUEUE_ITEM WorkItem, IN WORK_QUEUE_TYPE QueueType)
struct _PNP_BUS_INFORMATION * PPNP_BUS_INFORMATION
#define ExInitializeWorkItem(Item, Routine, Context)
#define IRP_DEALLOCATE_BUFFER
#define IRP_MN_QUERY_PNP_DEVICE_STATE
#define PNP_DEVICE_NOT_DISABLEABLE
#define IRP_INPUT_OPERATION
#define IRP_MN_QUERY_INTERFACE
#define IRP_MN_START_DEVICE
#define PNP_DEVICE_DONT_DISPLAY_IN_UI
#define IRP_MN_QUERY_RESOURCE_REQUIREMENTS
#define IRP_MN_REMOVE_DEVICE
@ DevicePropertyPhysicalDeviceObjectName
struct _DEVICE_RELATIONS * PDEVICE_RELATIONS
#define IRP_MN_QUERY_DEVICE_RELATIONS
#define IRP_MN_QUERY_CAPABILITIES
#define IRP_MN_QUERY_RESOURCES
struct _DEVICE_RELATIONS DEVICE_RELATIONS
#define IRP_MN_QUERY_BUS_INFORMATION
_In_opt_ PVOID _In_opt_ PVOID SystemArgument1
_In_opt_ PVOID DeferredContext
_In_opt_ PVOID _In_opt_ PVOID _In_opt_ PVOID SystemArgument2
#define ObReferenceObject
FORCEINLINE LUID NTAPI_INLINE RtlConvertUlongToLuid(_In_ ULONG Val)
_Inout_opt_ PVOID Parameter