From 0e20c445f107b0bf0de83903029da3269cfdf169 Mon Sep 17 00:00:00 2001 From: Johannes Anderwald Date: Sun, 4 Mar 2012 02:39:37 +0000 Subject: [PATCH] [KS] - Handle custom sized nodes svn path=/trunk/; revision=55984 --- reactos/drivers/ksfilter/ks/filter.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/reactos/drivers/ksfilter/ks/filter.c b/reactos/drivers/ksfilter/ks/filter.c index b18b7635b93..bed12f632d7 100644 --- a/reactos/drivers/ksfilter/ks/filter.c +++ b/reactos/drivers/ksfilter/ks/filter.c @@ -1104,6 +1104,7 @@ IKsFilter_CreateDescriptors( { ULONG Index = 0; NTSTATUS Status; + PKSNODE_DESCRIPTOR NodeDescriptor; /* initialize pin descriptors */ This->FirstPin = NULL; @@ -1190,8 +1191,8 @@ IKsFilter_CreateDescriptors( /* sanity check */ ASSERT(FilterDescriptor->NodeDescriptors); - /* FIXME handle variable sized node descriptors */ - ASSERT(FilterDescriptor->NodeDescriptorSize == sizeof(KSNODE_DESCRIPTOR)); + /* sanity check */ + ASSERT(FilterDescriptor->NodeDescriptorSize >= sizeof(KSNODE_DESCRIPTOR)); This->Topology.TopologyNodes = AllocateItem(NonPagedPool, sizeof(GUID) * FilterDescriptor->NodeDescriptorsCount); /* allocate topology node types array */ @@ -1211,17 +1212,21 @@ IKsFilter_CreateDescriptors( } DPRINT("NodeDescriptorCount %lu\n", FilterDescriptor->NodeDescriptorsCount); + NodeDescriptor = (PKSNODE_DESCRIPTOR)FilterDescriptor->NodeDescriptors; for(Index = 0; Index < FilterDescriptor->NodeDescriptorsCount; Index++) { - DPRINT("Index %lu Type %p Name %p\n", Index, FilterDescriptor->NodeDescriptors[Index].Type, FilterDescriptor->NodeDescriptors[Index].Name); + DPRINT("Index %lu Type %p Name %p\n", Index, NodeDescriptor->Type, NodeDescriptor->Name); /* copy topology type */ - if (FilterDescriptor->NodeDescriptors[Index].Type) - RtlMoveMemory((PVOID)&This->Topology.TopologyNodes[Index], FilterDescriptor->NodeDescriptors[Index].Type, sizeof(GUID)); + if (NodeDescriptor->Type) + RtlMoveMemory((PVOID)&This->Topology.TopologyNodes[Index], NodeDescriptor->Type, sizeof(GUID)); /* copy topology name */ - if (FilterDescriptor->NodeDescriptors[Index].Name) - RtlMoveMemory((PVOID)&This->Topology.TopologyNodesNames[Index], FilterDescriptor->NodeDescriptors[Index].Name, sizeof(GUID)); + if (NodeDescriptor->Name) + RtlMoveMemory((PVOID)&This->Topology.TopologyNodesNames[Index], NodeDescriptor->Name, sizeof(GUID)); + + // next node descriptor + NodeDescriptor = (PKSNODE_DESCRIPTOR)((ULONG_PTR)NodeDescriptor + FilterDescriptor->NodeDescriptorSize); } } /* done! */