- Handle custom sized nodes

svn path=/trunk/; revision=55984
This commit is contained in:
Johannes Anderwald 2012-03-04 02:39:37 +00:00
parent 0b301f3da8
commit 0e20c445f1

View file

@ -1104,6 +1104,7 @@ IKsFilter_CreateDescriptors(
{ {
ULONG Index = 0; ULONG Index = 0;
NTSTATUS Status; NTSTATUS Status;
PKSNODE_DESCRIPTOR NodeDescriptor;
/* initialize pin descriptors */ /* initialize pin descriptors */
This->FirstPin = NULL; This->FirstPin = NULL;
@ -1190,8 +1191,8 @@ IKsFilter_CreateDescriptors(
/* sanity check */ /* sanity check */
ASSERT(FilterDescriptor->NodeDescriptors); ASSERT(FilterDescriptor->NodeDescriptors);
/* FIXME handle variable sized node descriptors */ /* sanity check */
ASSERT(FilterDescriptor->NodeDescriptorSize == sizeof(KSNODE_DESCRIPTOR)); ASSERT(FilterDescriptor->NodeDescriptorSize >= sizeof(KSNODE_DESCRIPTOR));
This->Topology.TopologyNodes = AllocateItem(NonPagedPool, sizeof(GUID) * FilterDescriptor->NodeDescriptorsCount); This->Topology.TopologyNodes = AllocateItem(NonPagedPool, sizeof(GUID) * FilterDescriptor->NodeDescriptorsCount);
/* allocate topology node types array */ /* allocate topology node types array */
@ -1211,17 +1212,21 @@ IKsFilter_CreateDescriptors(
} }
DPRINT("NodeDescriptorCount %lu\n", FilterDescriptor->NodeDescriptorsCount); DPRINT("NodeDescriptorCount %lu\n", FilterDescriptor->NodeDescriptorsCount);
NodeDescriptor = (PKSNODE_DESCRIPTOR)FilterDescriptor->NodeDescriptors;
for(Index = 0; Index < FilterDescriptor->NodeDescriptorsCount; Index++) 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 */ /* copy topology type */
if (FilterDescriptor->NodeDescriptors[Index].Type) if (NodeDescriptor->Type)
RtlMoveMemory((PVOID)&This->Topology.TopologyNodes[Index], FilterDescriptor->NodeDescriptors[Index].Type, sizeof(GUID)); RtlMoveMemory((PVOID)&This->Topology.TopologyNodes[Index], NodeDescriptor->Type, sizeof(GUID));
/* copy topology name */ /* copy topology name */
if (FilterDescriptor->NodeDescriptors[Index].Name) if (NodeDescriptor->Name)
RtlMoveMemory((PVOID)&This->Topology.TopologyNodesNames[Index], FilterDescriptor->NodeDescriptors[Index].Name, sizeof(GUID)); RtlMoveMemory((PVOID)&This->Topology.TopologyNodesNames[Index], NodeDescriptor->Name, sizeof(GUID));
// next node descriptor
NodeDescriptor = (PKSNODE_DESCRIPTOR)((ULONG_PTR)NodeDescriptor + FilterDescriptor->NodeDescriptorSize);
} }
} }
/* done! */ /* done! */