Author: janderwald Date: Mon Aug 24 15:00:14 2009 New Revision: 42913
URL: http://svn.reactos.org/svn/reactos?rev=42913&view=rev Log: - Check that all pins have been closed when the last filter reference is gone - Fix freeing of stream data (hacked atm) - Implement retrieving of all property items for PinWaveCyclic
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/filter_wavecyclic.c trunk/reactos/drivers/wdm/audio/backpln/portcls/guids.c trunk/reactos/drivers/wdm/audio/backpln/portcls/irpstream.c trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_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/p... ============================================================================== --- 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] Mon Aug 24 15:00:14 2009 @@ -235,16 +235,16 @@ NTSTATUS Status = STATUS_SUCCESS; IPortFilterWaveCyclicImpl * This = (IPortFilterWaveCyclicImpl *)iface;
- for(Index = 0; Index < This->Descriptor->Factory.PinDescriptorCount; Index++) - { - /* all pins should have been closed by now */ - ASSERT(This->Pins[Index] == NULL); - } - DPRINT("IPortFilterWaveCyclic_fnClose ref %u\n", This->ref);
if (This->ref == 1) { + for(Index = 0; Index < This->Descriptor->Factory.PinDescriptorCount; Index++) + { + /* all pins should have been closed by now */ + ASSERT(This->Pins[Index] == NULL); + } + /* release reference to port */ This->SubDevice->lpVtbl->Release(This->SubDevice);
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/guids.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/p... ============================================================================== --- trunk/reactos/drivers/wdm/audio/backpln/portcls/guids.c [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/backpln/portcls/guids.c [iso-8859-1] Mon Aug 24 15:00:14 2009 @@ -73,6 +73,7 @@ const GUID KSPROPSETID_Topology = {0x720D4AC0L, 0x7533, 0x11D0, {0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00}}; const GUID KSPROPSETID_Pin = {0x8C134960L, 0x51AD, 0x11CF, {0x87, 0x8A, 0x94, 0xF8, 0x01, 0xC1, 0x00, 0x00}}; const GUID KSPROPSETID_Connection = {0x1D58C920L, 0xAC9B, 0x11CF, {0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00}}; +const GUID KSPROPTYPESETID_General = {0x97E99BA0L, 0xBDEA, 0x11CF, {0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00}};
const GUID IID_IAllocatorMXF = {0xa5f0d62cL, 0xb30f, 0x11d2, {0xb7, 0xa3, 0x00, 0x60, 0x08, 0x33, 0x16, 0xc1}};
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/irpstream.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/p... ============================================================================== --- trunk/reactos/drivers/wdm/audio/backpln/portcls/irpstream.c [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/backpln/portcls/irpstream.c [iso-8859-1] Mon Aug 24 15:00:14 2009 @@ -300,11 +300,12 @@ */ This->Irp->IoStatus.Information = StreamHeader->FrameExtent;
- /* free stream data, no tag as wdmaud.drv does it atm */ - //ExFreePool(StreamHeader->Data); - - /* free stream header, no tag as wdmaud.drv allocates it atm */ - //ExFreePool(StreamHeader); + if (This->Irp->RequestorMode != KernelMode) + { + /* HACK - WDMAUD should pass PKSSTREAM_HEADERs */ + ExFreePool(StreamHeader->Data); + ExFreePool(StreamHeader); + }
/* complete the request */ IoCompleteRequest(This->Irp, IO_SOUND_INCREMENT);
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_wavecyclic.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/p... ============================================================================== --- trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_wavecyclic.c [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_wavecyclic.c [iso-8859-1] Mon Aug 24 15:00:14 2009 @@ -463,6 +463,34 @@ }
Property = (PKSPROPERTY)IoStack->Parameters.DeviceIoControl.Type3InputBuffer; + + if (IsEqualGUIDAligned(&Property->Set, &GUID_NULL)) + { + if (Property->Flags & KSPROPERTY_TYPE_SETSUPPORT) + { + if (IoStack->Parameters.DeviceIoControl.OutputBufferLength < sizeof(GUID)) + { + /* buffer too small */ + Irp->IoStatus.Status = STATUS_BUFFER_OVERFLOW; + Irp->IoStatus.Information = sizeof(GUID); + IoCompleteRequest(Irp, IO_NO_INCREMENT); + + return STATUS_BUFFER_OVERFLOW; + } + /* FIXME copy guids + * KSPROPSETID_Audio when available + * KSPROPSETID_Sysaudio_Pin + */ + RtlMoveMemory(Irp->UserBuffer, &KSPROPSETID_Connection, sizeof(GUID)); + + Irp->IoStatus.Status = STATUS_SUCCESS; + Irp->IoStatus.Information = sizeof(GUID); + IoCompleteRequest(Irp, IO_NO_INCREMENT); + + return STATUS_SUCCESS; + } + } +
if (IsEqualGUIDAligned(&Property->Set, &KSPROPSETID_Connection)) { @@ -1041,6 +1069,7 @@ KeBugCheck(0); }
+ Status = This->Miniport->lpVtbl->NewStream(This->Miniport, &This->Stream, NULL,
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/propertyhandler.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/p... ============================================================================== --- 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] Mon Aug 24 15:00:14 2009 @@ -15,6 +15,7 @@ IN PKSPROPERTY Property, IN ULONG InputBufferLength, IN ULONG OutputBufferLength, + OUT PVOID OutputBuffer, OUT PFNKSHANDLER *PropertyHandler);
NTSTATUS @@ -237,7 +238,7 @@ }
/* property handler is used to verify input parameters */ - Status = FindPropertyHandler(IoStatus, Descriptor, Property, PropertyLength, DataLength, &PropertyHandler); + Status = FindPropertyHandler(IoStatus, Descriptor, Property, PropertyLength, DataLength, Data, &PropertyHandler); if (!NT_SUCCESS(Status)) { DPRINT("FindPropertyHandler failed with %x\n", Status); @@ -368,9 +369,12 @@ IN PKSPROPERTY Property, IN ULONG InputBufferLength, IN ULONG OutputBufferLength, + OUT PVOID OutputBuffer, OUT PFNKSHANDLER *PropertyHandler) { ULONG Index, ItemIndex; + PULONG Flags; + PKSPROPERTY_DESCRIPTION Description;
for(Index = 0; Index < Descriptor->FilterPropertySet.FreeKsPropertySetOffset; Index++) { @@ -385,6 +389,48 @@
if (Property->Flags & KSPROPERTY_TYPE_GET) *PropertyHandler = Descriptor->FilterPropertySet.Properties[Index].PropertyItem[ItemIndex].GetPropertyHandler; + + if (Property->Flags & KSPROPERTY_TYPE_BASICSUPPORT) + { + if (sizeof(ULONG) > OutputBufferLength) + { + /* too small buffer */ + return STATUS_INVALID_PARAMETER; + } + + /* get output buffer */ + Flags = (PULONG)OutputBuffer; + + /* clear flags */ + *Flags = KSPROPERTY_TYPE_BASICSUPPORT; + + if (Descriptor->FilterPropertySet.Properties[Index].PropertyItem[ItemIndex].GetSupported) + *Flags |= KSPROPERTY_TYPE_GET; + + if (Descriptor->FilterPropertySet.Properties[Index].PropertyItem[ItemIndex].SetSupported) + *Flags |= KSPROPERTY_TYPE_SET; + + IoStatus->Information = sizeof(ULONG); + + if (OutputBufferLength >= sizeof(KSPROPERTY_DESCRIPTION)) + { + /* get output buffer */ + Description = (PKSPROPERTY_DESCRIPTION)OutputBuffer; + + /* store result */ + Description->DescriptionSize = sizeof(KSPROPERTY_DESCRIPTION); + Description->PropTypeSet.Set = KSPROPTYPESETID_General; + Description->PropTypeSet.Id = 0; + Description->PropTypeSet.Flags = 0; + Description->MembersListCount = 0; + Description->Reserved = 0; + + IoStatus->Information = sizeof(KSPROPERTY_DESCRIPTION); + } + + return STATUS_SUCCESS; + } +
if (Descriptor->FilterPropertySet.Properties[Index].PropertyItem[ItemIndex].MinProperty > InputBufferLength) { @@ -536,14 +582,14 @@ } }
- Status = FindPropertyHandler(&Irp->IoStatus, Descriptor, Property, IoStack->Parameters.DeviceIoControl.InputBufferLength, IoStack->Parameters.DeviceIoControl.OutputBufferLength, &PropertyHandler); - if (PropertyHandler) + Status = FindPropertyHandler(&Irp->IoStatus, Descriptor, Property, IoStack->Parameters.DeviceIoControl.InputBufferLength, IoStack->Parameters.DeviceIoControl.OutputBufferLength, Irp->UserBuffer, &PropertyHandler); + if (NT_SUCCESS(Status) && PropertyHandler) { KSPROPERTY_ITEM_IRP_STORAGE(Irp) = (PVOID)Descriptor; DPRINT("Calling property handler %p\n", PropertyHandler); Status = PropertyHandler(Irp, Property, Irp->UserBuffer); } - else + else if (!NT_SUCCESS(Status)) { RtlStringFromGUID(&Property->Set, &GuidString); DPRINT1("Unhandeled property: Set %S Id %u Flags %x InputLength %u OutputLength %u\n", GuidString.Buffer, Property->Id, Property->Flags, IoStack->Parameters.DeviceIoControl.InputBufferLength, IoStack->Parameters.DeviceIoControl.OutputBufferLength);