mirror of
https://github.com/reactos/reactos.git
synced 2024-10-18 15:07:43 +00:00
[KS]
- Fix 2 bugs in KsCreateBusEnumObject. It didnt store the allocated device extension and it didnt store the PnpDeviceObject when it was provided by the caller - Implement KsGetBusEnumIdentifier, KsGetBusEnumPnpDeviceObject svn path=/branches/audio-bringup/; revision=50012
This commit is contained in:
parent
30d346530e
commit
7a95ed1cfa
|
@ -1743,6 +1743,9 @@ KsCreateBusEnumObject(
|
||||||
PBUS_ENUM_DEVICE_EXTENSION BusDeviceExtension;
|
PBUS_ENUM_DEVICE_EXTENSION BusDeviceExtension;
|
||||||
PDEVICE_EXTENSION DeviceExtension;
|
PDEVICE_EXTENSION DeviceExtension;
|
||||||
|
|
||||||
|
DPRINT1("KsCreateBusEnumObject %S\n", ServiceRelativePath);
|
||||||
|
DbgBreakPoint();
|
||||||
|
|
||||||
/* calculate sizeof bus enum device extension */
|
/* calculate sizeof bus enum device extension */
|
||||||
Length = wcslen(BusIdentifier) * sizeof(WCHAR);
|
Length = wcslen(BusIdentifier) * sizeof(WCHAR);
|
||||||
Length += sizeof(BUS_ENUM_DEVICE_EXTENSION);
|
Length += sizeof(BUS_ENUM_DEVICE_EXTENSION);
|
||||||
|
@ -1757,6 +1760,9 @@ KsCreateBusEnumObject(
|
||||||
/* zero device extension */
|
/* zero device extension */
|
||||||
RtlZeroMemory(BusDeviceExtension, sizeof(BUS_ENUM_DEVICE_EXTENSION));
|
RtlZeroMemory(BusDeviceExtension, sizeof(BUS_ENUM_DEVICE_EXTENSION));
|
||||||
|
|
||||||
|
/* store bus device extension */
|
||||||
|
*((PVOID*)BusDeviceObject->DeviceExtension) = BusDeviceExtension;
|
||||||
|
|
||||||
/* initialize bus device extension */
|
/* initialize bus device extension */
|
||||||
wcscpy(BusDeviceExtension->BusIdentifier, BusIdentifier);
|
wcscpy(BusDeviceExtension->BusIdentifier, BusIdentifier);
|
||||||
|
|
||||||
|
@ -1767,7 +1773,7 @@ KsCreateBusEnumObject(
|
||||||
if (ServiceRelativePath)
|
if (ServiceRelativePath)
|
||||||
{
|
{
|
||||||
/* relative path for devices */
|
/* relative path for devices */
|
||||||
Length += wcslen(ServiceRelativePath) + 2 * sizeof(WCHAR);
|
Length += (wcslen(ServiceRelativePath) + 2) * sizeof(WCHAR);
|
||||||
}
|
}
|
||||||
|
|
||||||
BusDeviceExtension->ServicePath.Length = 0;
|
BusDeviceExtension->ServicePath.Length = 0;
|
||||||
|
@ -1842,6 +1848,11 @@ KsCreateBusEnumObject(
|
||||||
return STATUS_DEVICE_REMOVED;
|
return STATUS_DEVICE_REMOVED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* directly attach */
|
||||||
|
BusDeviceExtension->PnpDeviceObject = PnpDeviceObject;
|
||||||
|
}
|
||||||
|
|
||||||
/* attach device extension */
|
/* attach device extension */
|
||||||
DeviceExtension = (PDEVICE_EXTENSION)BusDeviceObject->DeviceExtension;
|
DeviceExtension = (PDEVICE_EXTENSION)BusDeviceObject->DeviceExtension;
|
||||||
|
@ -1980,7 +1991,7 @@ KsDeviceRegisterAdapterObject(
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@unimplemented
|
@implemented
|
||||||
*/
|
*/
|
||||||
KSDDKAPI
|
KSDDKAPI
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
|
@ -1988,9 +1999,70 @@ NTAPI
|
||||||
KsGetBusEnumIdentifier(
|
KsGetBusEnumIdentifier(
|
||||||
IN PIRP Irp)
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -2003,12 +2075,13 @@ KsGetBusEnumParentFDOFromChildPDO(
|
||||||
IN PDEVICE_OBJECT DeviceObject,
|
IN PDEVICE_OBJECT DeviceObject,
|
||||||
OUT PDEVICE_OBJECT *FunctionalDeviceObject)
|
OUT PDEVICE_OBJECT *FunctionalDeviceObject)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED
|
DPRINT1("KsGetBusEnumParentFDOFromChildPDO\n");
|
||||||
|
DbgBreakPoint();
|
||||||
return STATUS_UNSUCCESSFUL;
|
return STATUS_UNSUCCESSFUL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@unimplemented
|
@implemented
|
||||||
*/
|
*/
|
||||||
KSDDKAPI
|
KSDDKAPI
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
|
@ -2017,8 +2090,29 @@ KsGetBusEnumPnpDeviceObject(
|
||||||
IN PDEVICE_OBJECT DeviceObject,
|
IN PDEVICE_OBJECT DeviceObject,
|
||||||
IN PDEVICE_OBJECT *PnpDeviceObject)
|
IN PDEVICE_OBJECT *PnpDeviceObject)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED
|
PBUS_ENUM_DEVICE_EXTENSION BusDeviceExtension;
|
||||||
return STATUS_UNSUCCESSFUL;
|
|
||||||
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -2071,6 +2165,8 @@ KsInstallBusEnumInterface(
|
||||||
PIRP Irp)
|
PIRP Irp)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED
|
UNIMPLEMENTED
|
||||||
|
DPRINT1("KsInstallBusEnumInterface\n");
|
||||||
|
DbgBreakPoint();
|
||||||
return STATUS_UNSUCCESSFUL;
|
return STATUS_UNSUCCESSFUL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2085,6 +2181,8 @@ KsIsBusEnumChildDevice(
|
||||||
OUT PBOOLEAN ChildDevice)
|
OUT PBOOLEAN ChildDevice)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED
|
UNIMPLEMENTED
|
||||||
|
DPRINT1("KsIsBusEnumChildDevice\n");
|
||||||
|
DbgBreakPoint();
|
||||||
return STATUS_UNSUCCESSFUL;
|
return STATUS_UNSUCCESSFUL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2609,6 +2707,8 @@ KsServiceBusEnumCreateRequest(
|
||||||
IN OUT PIRP Irp)
|
IN OUT PIRP Irp)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED
|
UNIMPLEMENTED
|
||||||
|
DPRINT1("KsServiceBusEnumCreateRequest\n");
|
||||||
|
DbgBreakPoint();
|
||||||
return STATUS_UNSUCCESSFUL;
|
return STATUS_UNSUCCESSFUL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2624,6 +2724,51 @@ KsServiceBusEnumPnpRequest(
|
||||||
IN OUT PIRP Irp)
|
IN OUT PIRP Irp)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED
|
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;
|
return STATUS_UNSUCCESSFUL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2663,6 +2808,9 @@ KsRemoveBusEnumInterface(
|
||||||
KSREMOVE_BUS_INTERFACE_CTX Ctx;
|
KSREMOVE_BUS_INTERFACE_CTX Ctx;
|
||||||
WORK_QUEUE_ITEM WorkItem;
|
WORK_QUEUE_ITEM WorkItem;
|
||||||
|
|
||||||
|
DPRINT1("KsRemoveBusEnumInterface\n");
|
||||||
|
DbgBreakPoint();
|
||||||
|
|
||||||
/* get previous mode */
|
/* get previous mode */
|
||||||
Mode = ExGetPreviousMode();
|
Mode = ExGetPreviousMode();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue