Author: janderwald
Date: Tue Apr 14 15:07:15 2009
New Revision: 40499
URL:
http://svn.reactos.org/svn/reactos?rev=40499&view=rev
Log:
- Handle KSPROPERTY_PIN_DATAINTERSECTION
Modified:
trunk/reactos/drivers/wdm/audio/backpln/portcls/filter_wavecyclic.c
trunk/reactos/drivers/wdm/audio/backpln/portcls/propertyhandler.c
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/filter_wavecyclic.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/filter_wavecyclic.c [iso-8859-1]
(original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/filter_wavecyclic.c [iso-8859-1] Tue
Apr 14 15:07:15 2009
@@ -33,13 +33,19 @@
IPortFilterWaveCyclicImpl * This = (IPortFilterWaveCyclicImpl*)iface;
if (IsEqualGUIDAligned(refiid, &IID_IIrpTarget) ||
- //IsEqualGUIDAligned(refiid, &IID_IPortFilterWaveCyclic) ||
IsEqualGUIDAligned(refiid, &IID_IUnknown))
{
*Output = &This->lpVtbl;
InterlockedIncrement(&This->ref);
return STATUS_SUCCESS;
}
+ else if (IsEqualGUIDAligned(refiid, &IID_IPort))
+ {
+ *Output = This->Port;
+ This->Port->lpVtbl->AddRef(This->Port);
+ return STATUS_SUCCESS;
+ }
+
return STATUS_UNSUCCESSFUL;
}
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/propertyhandler.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/propertyhandler.c [iso-8859-1]
(original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/propertyhandler.c [iso-8859-1] Tue Apr
14 15:07:15 2009
@@ -63,6 +63,74 @@
Irp->IoStatus.Information = sizeof(ULONG);
Irp->IoStatus.Status = STATUS_SUCCESS;
return STATUS_SUCCESS;
+}
+
+NTSTATUS
+HandleDataIntersection(
+ IN PIRP Irp,
+ IN PKSIDENTIFIER Request,
+ IN OUT PVOID Data,
+ IN PSUBDEVICE_DESCRIPTOR Descriptor)
+{
+ IIrpTarget * IrpTarget;
+ IPort *Port;
+ ISubdevice *SubDevice;
+ KSP_PIN * Pin = (KSP_PIN*)Request;
+ PKSOBJECT_CREATE_ITEM CreateItem;
+ PKSMULTIPLE_ITEM MultipleItem;
+ PKSDATARANGE DataRange;
+ PIO_STACK_LOCATION IoStack;
+ NTSTATUS Status;
+ ULONG Index, Length;
+
+ /* Access the create item */
+ CreateItem = KSCREATE_ITEM_IRP_STORAGE(Irp);
+ /* Get the IrpTarget */
+ IrpTarget = (IIrpTarget*)CreateItem->Context;
+ /* Get the parent */
+ Status = IrpTarget->lpVtbl->QueryInterface(IrpTarget, &IID_IPort,
(PVOID*)&Port);
+ if (!NT_SUCCESS(Status))
+ {
+ DPRINT1("Failed to obtain IPort interface from filter\n");
+ Irp->IoStatus.Information = 0;
+ Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
+ return STATUS_UNSUCCESSFUL;
+ }
+
+ /* Get private ISubdevice interface */
+ Status = Port->lpVtbl->QueryInterface(Port, &IID_ISubdevice,
(PVOID*)&SubDevice);
+ if (!NT_SUCCESS(Status))
+ {
+ DPRINT1("Failed to obtain ISubdevice interface from port driver\n");
+ KeBugCheck(0);
+ }
+
+ /* Access parameters */
+ MultipleItem = (PKSMULTIPLE_ITEM)(Request + 1);
+ DataRange = (PKSDATARANGE)(MultipleItem + 1);
+
+ /* Get current stack location */
+ IoStack = IoGetCurrentIrpStackLocation(Irp);
+
+ for(Index = 0; Index < MultipleItem->Count; Index++)
+ {
+ /* Call miniport's properitary handler */
+ Status = SubDevice->lpVtbl->DataRangeIntersection(SubDevice, Pin->PinId,
DataRange,
(PKSDATARANGE)&Descriptor->Factory.KsPinDescriptor[Pin->PinId].DataRanges[0],
+
IoStack->Parameters.DeviceIoControl.OutputBufferLength, Data, &Length);
+
+ if (Status == STATUS_SUCCESS)
+ {
+ Irp->IoStatus.Information = Length;
+ break;
+ }
+ DataRange = UlongToPtr(PtrToUlong(DataRange) + DataRange->FormatSize);
+ }
+
+ /* Release reference */
+ Port->lpVtbl->Release(Port);
+
+ Irp->IoStatus.Status = Status;
+ return Status;
}
@@ -103,6 +171,8 @@
break;
case KSPROPERTY_PIN_DATAINTERSECTION:
+ Status = HandleDataIntersection(Irp, Request, Data, Descriptor);
+ break;
case KSPROPERTY_PIN_PHYSICALCONNECTION:
case KSPROPERTY_PIN_CONSTRAINEDDATARANGES:
DPRINT1("Unhandled %x\n", Request->Id);
@@ -141,7 +211,7 @@
PFNKSHANDLER PropertyHandler = NULL;
UNICODE_STRING GuidString;
NTSTATUS Status = STATUS_UNSUCCESSFUL;
- PCPROPERTY_REQUEST PropertyRequest;
+ PPCPROPERTY_REQUEST PropertyRequest;
IoStack = IoGetCurrentIrpStackLocation(Irp);
@@ -159,17 +229,25 @@
{
if(Descriptor->DeviceDescriptor->AutomationTable->Properties[Index].Flags &
Property->Flags)
{
- RtlZeroMemory(&PropertyRequest, sizeof(PCPROPERTY_REQUEST));
- PropertyRequest.PropertyItem =
&Descriptor->DeviceDescriptor->AutomationTable->Properties[Index];
- PropertyRequest.Verb = Property->Flags;
- PropertyRequest.Value = Irp->UserBuffer;
- PropertyRequest.ValueSize =
IoStack->Parameters.DeviceIoControl.OutputBufferLength;
- PropertyRequest.Irp = Irp;
+ PropertyRequest = ExAllocatePool(NonPagedPool,
sizeof(PCPROPERTY_REQUEST));
+ if (!PropertyRequest)
+ {
+ /* no memory */
+ Irp->IoStatus.Information = 0;
+ Irp->IoStatus.Status = STATUS_INSUFFICIENT_RESOURCES;
+ IoCompleteRequest(Irp, IO_NO_INCREMENT);
+ return STATUS_INSUFFICIENT_RESOURCES;
+ }
+ RtlZeroMemory(PropertyRequest, sizeof(PCPROPERTY_REQUEST));
+ PropertyRequest->PropertyItem =
&Descriptor->DeviceDescriptor->AutomationTable->Properties[Index];
+ PropertyRequest->Verb = Property->Flags;
+ PropertyRequest->Value = Irp->UserBuffer;
+ PropertyRequest->ValueSize =
IoStack->Parameters.DeviceIoControl.OutputBufferLength;
+ PropertyRequest->Irp = Irp;
DPRINT("Calling handler %p\n",
Descriptor->DeviceDescriptor->AutomationTable->Properties[Index].Handler);
- Status =
Descriptor->DeviceDescriptor->AutomationTable->Properties[Index].Handler(&PropertyRequest);
-
- Irp->IoStatus.Information = PropertyRequest.ValueSize;
+ Status =
Descriptor->DeviceDescriptor->AutomationTable->Properties[Index].Handler(PropertyRequest);
+
Irp->IoStatus.Status = Status;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return Status;
@@ -236,5 +314,3 @@
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return STATUS_NOT_IMPLEMENTED;
}
-
-