From 755f485b8eb7dc3f812553b2d0c7e8c06fdec163 Mon Sep 17 00:00:00 2001 From: Johannes Anderwald Date: Sat, 3 Dec 2011 16:59:47 +0000 Subject: [PATCH] [KS] - store property item when there are custom specific properties - Fix bug where the property handle routine received an invalid pointer to the data svn path=/trunk/; revision=54572 --- reactos/drivers/ksfilter/ks/property.c | 28 +++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/reactos/drivers/ksfilter/ks/property.c b/reactos/drivers/ksfilter/ks/property.c index cf0468292d1..757b393deee 100644 --- a/reactos/drivers/ksfilter/ks/property.c +++ b/reactos/drivers/ksfilter/ks/property.c @@ -20,7 +20,8 @@ FindPropertyHandler( IN ULONG OutputBufferLength, OUT PVOID OutputBuffer, OUT PFNKSHANDLER *PropertyHandler, - OUT PKSPROPERTY_SET * Set) + OUT PKSPROPERTY_SET * Set, + OUT PKSPROPERTY_ITEM *PropertyItem) { ULONG Index, ItemIndex; @@ -50,6 +51,7 @@ FindPropertyHandler( /* store property set */ *Set = (PKSPROPERTY_SET)&PropertySet[Index]; + *PropertyItem = (PKSPROPERTY_ITEM)&PropertySet[Index].PropertyItem[ItemIndex]; if (Property->Flags & KSPROPERTY_TYPE_SET) { @@ -132,12 +134,14 @@ KspPropertyHandler( IN ULONG PropertyItemSize OPTIONAL) { PKSPROPERTY Property; + PKSPROPERTY_ITEM PropertyItem; PKSPROPERTY_SET Set; PIO_STACK_LOCATION IoStack; NTSTATUS Status; PFNKSHANDLER PropertyHandler = NULL; ULONG Index, InputBufferLength, OutputBufferLength, TotalSize; LPGUID Guid; + //UNICODE_STRING GuidBuffer; /* get current irp stack */ IoStack = IoGetCurrentIrpStackLocation(Irp); @@ -248,19 +252,33 @@ KspPropertyHandler( Property = (PKSPROPERTY)((ULONG_PTR)Irp->AssociatedIrp.SystemBuffer + OutputBufferLength); } - DPRINT("KspPropertyHandler Irp %p PropertySetsCount %u PropertySet %p Allocator %p PropertyItemSize %u ExpectedPropertyItemSize %u\n", Irp, PropertySetsCount, PropertySet, Allocator, PropertyItemSize, sizeof(KSPROPERTY_ITEM)); + //RtlStringFromGUID(&Property->Set, &GuidBuffer); + + //DPRINT("KspPropertyHandler Irp %p PropertySetsCount %u PropertySet %p Allocator %p PropertyItemSize %u ExpectedPropertyItemSize %u\n", Irp, PropertySetsCount, PropertySet, Allocator, PropertyItemSize, sizeof(KSPROPERTY_ITEM)); + //DPRINT("PropertyId %lu PropertyFlags %x Guid %S\n", Property->Id, Property->Flags, GuidBuffer.Buffer); + + //RtlFreeUnicodeString(&GuidBuffer); /* sanity check */ ASSERT(PropertyItemSize == 0 || PropertyItemSize == sizeof(KSPROPERTY_ITEM)); /* find the property handler */ - Status = FindPropertyHandler(&Irp->IoStatus, PropertySet, PropertySetsCount, Property, InputBufferLength, OutputBufferLength, Irp->AssociatedIrp.SystemBuffer, &PropertyHandler, &Set); + Status = FindPropertyHandler(&Irp->IoStatus, PropertySet, PropertySetsCount, Property, InputBufferLength, OutputBufferLength, Irp->AssociatedIrp.SystemBuffer, &PropertyHandler, &Set, &PropertyItem); if (NT_SUCCESS(Status) && PropertyHandler) { - /* call property handler */ + /* store set */ KSPROPERTY_SET_IRP_STORAGE(Irp) = Set; - Status = PropertyHandler(Irp, Property, Irp->AssociatedIrp.SystemBuffer); + + /* are any custom property item sizes used */ + if (PropertyItemSize) + { + /* store custom property item */ + KSPROPERTY_ITEM_IRP_STORAGE(Irp) = PropertyItem; + } + + /* call property handler */ + Status = PropertyHandler(Irp, Property, (OutputBufferLength > 0 ? Irp->AssociatedIrp.SystemBuffer : NULL)); if (Status == STATUS_BUFFER_TOO_SMALL) {