PBUS_ENUM_DEVICE_EXTENSION BusDeviceExtension;
PDEVICE_EXTENSION DeviceExtension;
+ DPRINT1("KsCreateBusEnumObject %S\n", ServiceRelativePath);
+ DbgBreakPoint();
+
/* calculate sizeof bus enum device extension */
Length = wcslen(BusIdentifier) * sizeof(WCHAR);
Length += sizeof(BUS_ENUM_DEVICE_EXTENSION);
/* zero device extension */
RtlZeroMemory(BusDeviceExtension, sizeof(BUS_ENUM_DEVICE_EXTENSION));
+ /* store bus device extension */
+ *((PVOID*)BusDeviceObject->DeviceExtension) = BusDeviceExtension;
+
/* initialize bus device extension */
wcscpy(BusDeviceExtension->BusIdentifier, BusIdentifier);
if (ServiceRelativePath)
{
/* relative path for devices */
- Length += wcslen(ServiceRelativePath) + 2 * sizeof(WCHAR);
+ Length += (wcslen(ServiceRelativePath) + 2) * sizeof(WCHAR);
}
BusDeviceExtension->ServicePath.Length = 0;
return STATUS_DEVICE_REMOVED;
}
}
+ else
+ {
+ /* directly attach */
+ BusDeviceExtension->PnpDeviceObject = PnpDeviceObject;
+ }
/* attach device extension */
DeviceExtension = (PDEVICE_EXTENSION)BusDeviceObject->DeviceExtension;
}
/*
- @unimplemented
+ @implemented
*/
KSDDKAPI
NTSTATUS
KsGetBusEnumIdentifier(
IN PIRP Irp)
{
- UNIMPLEMENTED
+ PBUS_ENUM_DEVICE_EXTENSION BusDeviceExtension;
+ PIO_STACK_LOCATION IoStack;
+ ULONG Length;
+ NTSTATUS Status;
+ LPWSTR Buffer;
- return STATUS_UNSUCCESSFUL;
+ /* get stack location */
+ IoStack = IoGetCurrentIrpStackLocation(Irp);
+
+ /* sanity checks */
+ ASSERT(IoStack->DeviceObject);
+ ASSERT(IoStack->DeviceObject->DeviceExtension);
+
+ /* get bus device extension */
+ BusDeviceExtension = *(PBUS_ENUM_DEVICE_EXTENSION*)(IoStack->DeviceObject->DeviceExtension);
+
+ if (!BusDeviceExtension)
+ {
+ /* invalid parameter */
+ return STATUS_INVALID_PARAMETER;
+ }
+
+ /* get length */
+ Length = (wcslen(BusDeviceExtension->BusIdentifier)+1) * sizeof(WCHAR);
+
+ /* is there an output buffer provided */
+ if (IoStack->Parameters.DeviceIoControl.InputBufferLength)
+ {
+ if (Length > IoStack->Parameters.DeviceIoControl.InputBufferLength)
+ {
+ /* buffer is too small */
+ return STATUS_BUFFER_TOO_SMALL;
+ }
+
+ /* now allocate buffer */
+ Buffer = AllocateItem(NonPagedPool, Length);
+ if (!Buffer)
+ {
+ /* no memory */
+ Status = STATUS_INSUFFICIENT_RESOURCES;
+ }
+ else
+ {
+ /* copy bus identifier */
+ wcscpy(Buffer, BusDeviceExtension->BusIdentifier);
+
+ /* store buffer */
+ Irp->AssociatedIrp.SystemBuffer = Buffer;
+
+ /* set flag that buffer gets copied back */
+ Irp->Flags |= IRP_BUFFERED_IO | IRP_DEALLOCATE_BUFFER | IRP_INPUT_OPERATION;
+
+ /* done */
+ Status = STATUS_SUCCESS;
+ }
+ }
+ else
+ {
+ /* no buffer provided */
+ Status = STATUS_BUFFER_OVERFLOW;
+ }
+
+ /* done */
+ return Status;
}
/*
IN PDEVICE_OBJECT DeviceObject,
OUT PDEVICE_OBJECT *FunctionalDeviceObject)
{
- UNIMPLEMENTED
+ DPRINT1("KsGetBusEnumParentFDOFromChildPDO\n");
+ DbgBreakPoint();
return STATUS_UNSUCCESSFUL;
}
/*
- @unimplemented
+ @implemented
*/
KSDDKAPI
NTSTATUS
IN PDEVICE_OBJECT DeviceObject,
IN PDEVICE_OBJECT *PnpDeviceObject)
{
- UNIMPLEMENTED
- return STATUS_UNSUCCESSFUL;
+ PBUS_ENUM_DEVICE_EXTENSION BusDeviceExtension;
+
+ if (!DeviceObject->DeviceExtension)
+ {
+ /* invalid parameter */
+ return STATUS_INVALID_PARAMETER;
+ }
+
+ /* get bus device extension */
+ BusDeviceExtension = *(PBUS_ENUM_DEVICE_EXTENSION*)(DeviceObject->DeviceExtension);
+
+ if (!BusDeviceExtension)
+ {
+ /* invalid parameter */
+ return STATUS_INVALID_PARAMETER;
+ }
+
+ /* store result */
+ *PnpDeviceObject = BusDeviceExtension->PnpDeviceObject;
+
+
+ /* done */
+ return STATUS_SUCCESS;
}
/*
PIRP Irp)
{
UNIMPLEMENTED
+ DPRINT1("KsInstallBusEnumInterface\n");
+ DbgBreakPoint();
return STATUS_UNSUCCESSFUL;
}
OUT PBOOLEAN ChildDevice)
{
UNIMPLEMENTED
+ DPRINT1("KsIsBusEnumChildDevice\n");
+ DbgBreakPoint();
return STATUS_UNSUCCESSFUL;
}
IN OUT PIRP Irp)
{
UNIMPLEMENTED
+ DPRINT1("KsServiceBusEnumCreateRequest\n");
+ DbgBreakPoint();
return STATUS_UNSUCCESSFUL;
}
IN OUT PIRP Irp)
{
UNIMPLEMENTED
+ DPRINT1("KsServiceBusEnumPnpRequest\n");
+ DbgBreakPoint();
+/*
+KsServiceBusEnumPnpRequest services the following Plug and Play IRPs for an FDO or parent device:
+
+ *
+ IRP_MN_START_DEVICE
+ IRP_MN_QUERY_BUS_INFORMATION OK
+ IRP_MN_QUERY_DEVICE_RELATIONS
+ IRP_MN_QUERY_STOP_DEVICE
+ IRP_MN_QUERY_REMOVE_DEVICE
+ IRP_MN_CANCEL_STOP_DEVICE
+ IRP_MN_CANCEL_REMOVE_DEVICE
+ IRP_MN_STOP_DEVICE
+ IRP_MN_REMOVE_DEVICE
+*/
+
+/*
+Plug and Play IRPs for a PDO or child device:
+
+ *
+ IRP_MN_START_DEVICE
+ IRP_MN_QUERY_STOP_DEVICE
+ IRP_MN_QUERY_REMOVE_DEVICE
+ IRP_MN_STOP_DEVICE
+ IRP_MN_REMOVE_DEVICE
+ IRP_MN_QUERY_DEVICE_RELATIONS (TargetDeviceRelations)
+ IRP_MN_QUERY_PNP_DEVICE_STATE
+ IRP_MN_QUERY_ID
+ IRP_MN_QUERY_INTERFACE
+ IRP_MN_QUERY_RESOURCES NOP
+ IRP_MN_QUERY_RESOURCE_REQUIREMENTS NOP
+ IRP_MN_READ_CONFIG
+ IRP_MN_WRITE_CONFIG
+ IRP_MN_QUERY_CAPABILITIES
+
+*/
+/**
+ Request: IRP_MN_QUERY_BUS_INFORMATION
+ : GUID PNP_BUS_INFORMATION
+ BusTypeGuid: KSMEDIUMSETID_Standard
+ LegacyBusType: InterfaceTypeUndefined
+ BusNumber: 0
+*/
+
return STATUS_UNSUCCESSFUL;
}
KSREMOVE_BUS_INTERFACE_CTX Ctx;
WORK_QUEUE_ITEM WorkItem;
+ DPRINT1("KsRemoveBusEnumInterface\n");
+ DbgBreakPoint();
+
/* get previous mode */
Mode = ExGetPreviousMode();