ReactOS  0.4.14-dev-49-gfb4591c
bdasup.c
Go to the documentation of this file.
1 
2 #include "precomp.h"
3 
4 const GUID KSPROPSETID_BdaPinControl = {0xded49d5, 0xa8b7, 0x4d5d, {0x97, 0xa1, 0x12, 0xb0, 0xc1, 0x95, 0x87, 0x4d}};
5 const GUID KSMETHODSETID_BdaDeviceConfiguration = {0x71985f45, 0x1ca1, 0x11d3, {0x9c, 0xc8, 0x0, 0xc0, 0x4f, 0x79, 0x71, 0xe0}};
6 const GUID KSPROPSETID_BdaTopology = {0xa14ee835, 0x0a23, 0x11d3, {0x9c, 0xc7, 0x0, 0xc0, 0x4f, 0x79, 0x71, 0xe0}};
7 
9 {
10  0,
11  0,
12  {NULL, NULL}
13 };
14 
15 KSPROPERTY_ITEM FilterPropertyItem[] =
16 {
25 };
26 
27 
28 KSPROPERTY_SET FilterPropertySet =
29 {
31  8,
33  0,
34  NULL
35 };
36 
37 KSMETHOD_ITEM FilterMethodItem[] =
38 {
39  //DEFINE_KSMETHOD_ITEM_BDA_CREATE_PIN_FACTORY(BdaMethodCreatePin, NULL),
41 };
42 
43 KSMETHOD_SET FilterMethodSet =
44 {
46  2,
48  0,
49  NULL
50 };
51 
52 KSAUTOMATION_TABLE FilterAutomationTable =
53 {
54  1,
55  sizeof(KSPROPERTY_ITEM),
57  1,
58  sizeof(KSMETHOD_ITEM),
60  0,
61  sizeof(KSEVENT_ITEM),
62  NULL
63 };
64 
65 KSPROPERTY_ITEM PinPropertyItem[] =
66 {
69 };
70 
71 KSPROPERTY_SET PinPropertySet =
72 {
74  2,
76  0,
77  NULL
78 };
79 
80 KSAUTOMATION_TABLE PinAutomationTable =
81 {
82  1,
83  sizeof(KSPROPERTY_ITEM),
85  0,
86  sizeof(KSMETHOD_ITEM),
87  NULL,
88  0,
89  sizeof(KSEVENT_ITEM),
90  NULL
91 };
92 
93 
94 PVOID
98 {
100  if (!Item)
101  return Item;
102 
104  return Item;
105 }
106 
107 VOID
109  IN PVOID Item)
110 {
111  ExFreePool(Item);
112 }
113 
114 
117  IN PKSFILTERFACTORY FilterFactory)
118 {
119  PBDA_FILTER_INSTANCE_ENTRY InstanceEntry = NULL;
121  KIRQL OldLevel;
122 
123  /* acquire list lock */
125 
126  /* point to first entry */
128 
130  {
131  /* get instance entry from list entry offset */
133 
134  /* is the instance entry the requested one */
135  if (InstanceEntry->FilterFactoryInstance == FilterFactory)
136  break;
137 
138  /* move to next entry */
139  Entry = Entry->Flink;
140  /* set to null as it has not been found */
141  InstanceEntry = NULL;
142  }
143 
144 
145  /* release spin lock */
147 
148  /* return result */
149  return InstanceEntry;
150 }
151 
152 /*
153  @implemented
154 */
155 NTSTATUS
156 NTAPI
159 {
160  DPRINT("BDASUP::DllInitialize\n");
161 
165 
166  return STATUS_SUCCESS;
167 }
168 
169 /*
170  @implemented
171 */
172 NTSTATUS
173 NTAPI
175 {
176  DPRINT("BdaCheckChanges\n");
177 
178  if (!Irp)
180 
181  return STATUS_SUCCESS;
182 }
183 
184 /*
185  @implemented
186 */
187 NTSTATUS
188 NTAPI
190 {
191  DPRINT("BdaCommitChanges\n");
192 
193  if (!Irp)
195 
196  return STATUS_SUCCESS;
197 }
198 
199 /*
200  @implemented
201 */
202 NTSTATUS
203 NTAPI
205  IN PKSDEVICE pKSDevice,
206  IN const KSFILTER_DESCRIPTOR *pFilterDescriptor,
208 {
210 }
211 
212 VOID
213 NTAPI
215  IN PVOID Context)
216 {
217  PBDA_FILTER_INSTANCE_ENTRY InstanceEntry = NULL;
219  KIRQL OldLevel;
220 
221  /* acquire list lock */
223 
224  /* point to first entry */
226 
228  {
229  /* get instance entry from list entry offset */
231 
232  /* is the instance entry the requested one */
233  if (InstanceEntry == (PBDA_FILTER_INSTANCE_ENTRY)Context)
234  {
235  RemoveEntryList(&InstanceEntry->Entry);
236  FreeItem(InstanceEntry);
237  break;
238  }
239 
240  /* move to next entry */
241  Entry = Entry->Flink;
242  }
243 
244  /* release spin lock */
246 }
247 
248 
249 /*
250  @implemented
251 */
252 NTSTATUS
253 NTAPI
255  IN PKSDEVICE pKSDevice,
256  IN const KSFILTER_DESCRIPTOR *pFilterDescriptor,
257  IN const BDA_FILTER_TEMPLATE *BdaFilterTemplate,
258  OUT PKSFILTERFACTORY *ppKSFilterFactory)
259 {
260  PKSFILTERFACTORY FilterFactory;
261  PBDA_FILTER_INSTANCE_ENTRY FilterInstance;
262  KIRQL OldLevel;
264  PKSFILTER_DESCRIPTOR FilterDescriptor;
265 
266  DPRINT("BdaCreateFilterFactoryEx\n");
267 
268  FilterDescriptor = AllocateItem(NonPagedPool, sizeof(KSFILTER_DESCRIPTOR));
269  if (!FilterDescriptor)
270  {
271  /* no memory */
273  }
274 
275  /* copy filter descriptor template */
276  RtlMoveMemory(FilterDescriptor, pFilterDescriptor, sizeof(KSFILTER_DESCRIPTOR));
277 
278  /* erase pin / nodes / connections from filter descriptor */
279  FilterDescriptor->PinDescriptorsCount = 0;
280  FilterDescriptor->PinDescriptors = NULL;
281  FilterDescriptor->NodeDescriptorsCount = 0;
282  FilterDescriptor->NodeDescriptors = NULL;
283  FilterDescriptor->ConnectionsCount = 0;
284  FilterDescriptor->Connections = NULL;
285 
286  /* merge the automation tables */
287  Status = KsMergeAutomationTables((PKSAUTOMATION_TABLE*)&FilterDescriptor->AutomationTable, (PKSAUTOMATION_TABLE)pFilterDescriptor->AutomationTable, &FilterAutomationTable, NULL);
288 
289  /* check for success */
290  if (!NT_SUCCESS(Status))
291  {
292  DPRINT1("KsMergeAutomationTables failed with %lx\n", Status);
294  return Status;
295  }
296 
297  /* allocate filter instance */
298  FilterInstance = AllocateItem(NonPagedPool, sizeof(BDA_FILTER_INSTANCE_ENTRY));
299  if (!FilterInstance)
300  {
301  /* not enough memory */
304  }
305 
306  /* create the filter factory */
307  Status = KsCreateFilterFactory(pKSDevice->FunctionalDeviceObject, FilterDescriptor, NULL, NULL, 0, NULL, NULL, &FilterFactory);
308 
309  /* check for success */
310  if (NT_SUCCESS(Status))
311  {
312  if (FilterDescriptor->AutomationTable != &FilterAutomationTable)
313  {
314  /* add the item to filter object bag */
315  KsAddItemToObjectBag(FilterFactory->Bag, (PVOID)FilterDescriptor->AutomationTable, FreeFilterInstance);
316  }
317  else
318  {
319  /* make sure the automation table is not-read only */
320  Status = _KsEdit(FilterFactory->Bag, (PVOID*)&FilterDescriptor->AutomationTable, sizeof(KSAUTOMATION_TABLE), sizeof(KSAUTOMATION_TABLE), 0);
321 
322  /* sanity check */
324 
325  /* add to object bag */
326  KsAddItemToObjectBag(FilterFactory->Bag, (PVOID)FilterDescriptor->AutomationTable, FreeFilterInstance);
327  }
328 
329  /* initialize filter instance entry */
330  FilterInstance->FilterFactoryInstance = FilterFactory;
331  FilterInstance->FilterTemplate = (BDA_FILTER_TEMPLATE *)BdaFilterTemplate;
332 
333  /* acquire list lock */
335 
336  /* insert factory at the end */
338 
339  /* release spin lock */
341 
342 
343  if (ppKSFilterFactory)
344  {
345  /* store result */
346  *ppKSFilterFactory = FilterFactory;
347  }
348  }
349  else
350  {
351  /* failed to create filter factory */
352  FreeItem(FilterInstance);
354  }
355 
356  /* done */
357  DPRINT("BdaCreateFilterFactoryEx Status %x\n", Status);
358  return Status;
359 }
360 
361 /*
362  @implemented
363 */
364 NTSTATUS
365 NTAPI
367  IN PKSFILTER pKSFilter,
369  OUT ULONG *pulPinId)
370 {
371  PKSPIN_DESCRIPTOR_EX PinDescriptor;
372  PKSFILTERFACTORY FilterFactory;
373  PBDA_FILTER_INSTANCE_ENTRY InstanceEntry;
375  ULONG PinId;
376  PKSPIN_DESCRIPTOR_EX NewPinDescriptor;
377 
378  DPRINT("BdaCreatePin\n");
379 
380  if (!pulPinId || !pKSFilter)
382 
383  /* get parent filter factory */
384  FilterFactory = KsFilterGetParentFilterFactory(pKSFilter);
385 
386  /* sanity check */
387  ASSERT(FilterFactory);
388 
389  /* find instance entry */
390  InstanceEntry = GetFilterInstanceEntry(FilterFactory);
391 
392  if (!InstanceEntry)
393  {
394  /* the filter was not initialized with BDA */
395  return STATUS_NOT_FOUND;
396  }
397 
398  /* sanity checks */
399  ASSERT(InstanceEntry->FilterTemplate);
400  ASSERT(InstanceEntry->FilterTemplate->pFilterDescriptor);
401 
402  /* does the filter support any pins */
403  if (!InstanceEntry->FilterTemplate->pFilterDescriptor->PinDescriptorsCount)
404  {
405  /* no pins supported */
406  DPRINT("BdaCreatePin NoPins supported\n");
407  return STATUS_UNSUCCESSFUL;
408  }
409 
410  /* is pin factory still existing */
411  if (InstanceEntry->FilterTemplate->pFilterDescriptor->PinDescriptorsCount <= ulPinType)
412  {
413  /* pin request is out of bounds */
414  DPRINT("BdaCreatePin ulPinType %lu >= PinDescriptorCount %lu\n", ulPinType, InstanceEntry->FilterTemplate->pFilterDescriptor->PinDescriptorsCount);
416  }
417 
418  /* FIXME custom pin descriptors */
419  ASSERT(InstanceEntry->FilterTemplate->pFilterDescriptor->PinDescriptorSize == sizeof(KSPIN_DESCRIPTOR_EX));
420 
421  /* get pin descriptor */
422  PinDescriptor = (PKSPIN_DESCRIPTOR_EX)&InstanceEntry->FilterTemplate->pFilterDescriptor->PinDescriptors[ulPinType];
423 
424  /* allocate pin descriptor */
425  NewPinDescriptor = AllocateItem(NonPagedPool, sizeof(KSPIN_DESCRIPTOR_EX));
426  if (!NewPinDescriptor)
427  {
428  /* no memory */
429  DPRINT("BdaCreatePin OutOfMemory\n");
431  }
432 
433  /* make a copy of the pin descriptor */
434  RtlMoveMemory(NewPinDescriptor, PinDescriptor, sizeof(KSPIN_DESCRIPTOR_EX));
435 
436  /* merge the automation tables */
437  Status = KsMergeAutomationTables((PKSAUTOMATION_TABLE*)&NewPinDescriptor->AutomationTable, (PKSAUTOMATION_TABLE)PinDescriptor->AutomationTable, &PinAutomationTable, pKSFilter->Bag);
438 
439  /* check for success */
440  if (NT_SUCCESS(Status))
441  {
442  /* create the pin factory */
443  Status = KsFilterCreatePinFactory(pKSFilter, NewPinDescriptor, &PinId);
444 
445  /* check for success */
446  if (NT_SUCCESS(Status))
447  {
448  /* store result */
449  *pulPinId = PinId;
450  }
451  }
452 
453 
454  DPRINT("BdaCreatePin Result %x PinId %u\n", Status, PinId);
455  return Status;
456 }
457 
458 /*
459  @implemented
460 */
461 NTSTATUS
462 NTAPI
464  IN PIRP Irp,
467 {
468  PKSM_PIN Pin;
469  PKSFILTER Filter;
470 
471  DPRINT("BdaMethodCreatePin\n");
472 
473  if (!Irp)
474  {
475  /* invalid parameter */
477  }
478 
479  /* get filter from irp */
481 
482  /* sanity check */
483  ASSERT(Filter);
484  ASSERT(pKSMethod);
485 
486  /* get method request */
488 
489  /* create the pin */
490  return BdaCreatePin(Filter, Pin->PinId, pulPinFactoryID);
491 }
492 
493 /*
494  @implemented
495 */
496 NTSTATUS
497 NTAPI
499  IN PKSFILTER pKSFilter,
501 {
502  PBDA_FILTER_INSTANCE_ENTRY InstanceEntry;
503  PKSFILTERFACTORY FilterFactory;
504  ULONG Index, PinId;
506 
507  DPRINT("BdaInitFilter %p\n", pBdaFilterTemplate);
508 
509  /* check input parameters */
510  if (!pKSFilter)
512 
513  /* get parent filter factory */
514  FilterFactory = KsFilterGetParentFilterFactory(pKSFilter);
515 
516  /* sanity check */
517  ASSERT(FilterFactory);
518 
519  /* find instance entry */
520  InstanceEntry = GetFilterInstanceEntry(FilterFactory);
521 
522  /* sanity check */
523  ASSERT(InstanceEntry);
524 
525  if (!pBdaFilterTemplate)
526  {
527  /* use template from BdaCreateFilterFactoryEx */
528  pBdaFilterTemplate = InstanceEntry->FilterTemplate;
529  }
530 
531  /* now create the pins */
532  for(Index = 0; Index < pBdaFilterTemplate->pFilterDescriptor->PinDescriptorsCount; Index++)
533  {
534  /* create the pin */
535  Status = BdaCreatePin(pKSFilter, Index, &PinId);
536 
537  /* check for success */
538  if (!NT_SUCCESS(Status))
539  break;
540  }
541 
542  /* done */
543  return Status;
544 }
545 
546 
547 
548 /*
549  @implemented
550 */
551 NTSTATUS
552 NTAPI
554  IN PKSFILTER pKSFilter,
557 {
558  PBDA_FILTER_INSTANCE_ENTRY InstanceEntry;
559  PKSFILTERFACTORY FilterFactory;
560  KSTOPOLOGY_CONNECTION Connection;
561 
562  DPRINT("BdaCreateTopology\n");
563 
564  /* check input parameters */
565  if (!pKSFilter)
567 
568  /* get parent filter factory */
569  FilterFactory = KsFilterGetParentFilterFactory(pKSFilter);
570 
571  /* sanity check */
572  ASSERT(FilterFactory);
573 
574  /* find instance entry */
575  InstanceEntry = GetFilterInstanceEntry(FilterFactory);
576 
577  if (!InstanceEntry)
578  {
579  /* the filter was not initialized with BDA */
580  return STATUS_NOT_FOUND;
581  }
582 
583  if (InputPinId >= InstanceEntry->FilterTemplate->pFilterDescriptor->PinDescriptorsCount ||
584  OutputPinId >= InstanceEntry->FilterTemplate->pFilterDescriptor->PinDescriptorsCount)
585  {
586  /* invalid pin id */
588  }
589 
590  /* initialize topology connection */
591  Connection.FromNode = KSFILTER_NODE;
592  Connection.ToNode = KSFILTER_NODE;
593  Connection.FromNodePin = InputPinId;
594  Connection.ToNodePin = OutputPinId;
595 
596  /* add the connection */
597  return KsFilterAddTopologyConnections(pKSFilter, 1, &Connection);
598 }
599 
600 /*
601  @unimplemented
602 */
603 NTSTATUS
604 NTAPI
606  IN PKSFILTER pKSFilter,
607  IN ULONG *pulPinId)
608 {
610  DPRINT("BdaDeletePin\n");
611  return STATUS_NOT_IMPLEMENTED;
612 }
613 
614 /*
615  @implemented
616 */
617 NTSTATUS
618 NTAPI
620  IN PKSFILTERFACTORY FilterFactory,
621  IN const KSFILTER_DESCRIPTOR *FilterDescriptor OPTIONAL)
622 {
623  DPRINT("BdaFilterFactoryUpdateCacheData\n");
624  return KsFilterFactoryUpdateCacheData(FilterFactory, FilterDescriptor);
625 }
626 
627 /*
628  @implemented
629 */
630 NTSTATUS
631 NTAPI
633  IN PIRP Irp,
634  OUT BDA_CHANGE_STATE *ChangeState)
635 {
636  DPRINT("BdaGetChangeState\n");
637 
638  if (Irp && ChangeState)
639  {
640  *ChangeState = BDA_CHANGES_COMPLETE;
641  return STATUS_SUCCESS;
642  }
643 
644  /* invalid parameters supplied */
646 
647 }
648 
649 /*
650  @implemented
651 */
652 NTSTATUS
653 NTAPI
655  IN PIRP Irp,
658 {
659  PKSFILTER Filter;
661 
662  DPRINT("BdaMethodCreateTopology\n");
663 
664  /* check input parameters */
665  if (!Irp || !pKSMethod)
667 
668  /* get filter */
670 
671  /* sanity check */
672  ASSERT(Filter);
673 
674  /* get method request */
676 
677  /* create the topology */
678  return BdaCreateTopology(Filter, Node->ulInputPinId, Node->ulOutputPinId);
679 }
680 
681 /*
682  @implemented
683 */
684 NTSTATUS
685 NTAPI
687  IN PIRP Irp,
690 {
691  DPRINT("BdaMethodDeletePin\n");
692 
693  if (!Irp)
695 
696  return STATUS_SUCCESS;
697 }
698 
699 /*
700  @unimplemented
701 */
702 NTSTATUS
703 NTAPI
705  IN PIRP Irp,
708 {
710  DPRINT("BdaPropertyGetControllingPinId\n");
711  return STATUS_NOT_IMPLEMENTED;
712 }
713 
714 /*
715  @implemented
716 */
717 NTSTATUS
718 NTAPI
720  IN PIRP Irp,
723 {
724  PKSPIN Pin;
725  PKSFILTER Filter;
726  PKSFILTERFACTORY FilterFactory;
727  PBDA_FILTER_INSTANCE_ENTRY InstanceEntry;
728 
729  DPRINT("BdaPropertyGetPinControl\n");
730 
731  /* first get the pin */
733  ASSERT(Pin);
734 
735  /* now get the parent filter */
737  ASSERT(Filter);
738 
739  /* get parent filter factory */
740  FilterFactory = KsFilterGetParentFilterFactory(Filter);
741  ASSERT(FilterFactory);
742 
743  /* find instance entry */
744  InstanceEntry = GetFilterInstanceEntry(FilterFactory);
745  ASSERT(InstanceEntry);
746 
747  /* sanity check */
748  pKSProperty++;
750 
751  /* store pin id */
752  *pulProperty = Pin->Id;
753 
754  return STATUS_SUCCESS;
755 }
756 
757 /*
758  @unimplemented
759 */
760 NTSTATUS
761 NTAPI
763  IN PIRP Irp,
766 {
768  DPRINT("BdaPropertyNodeDescriptors\n");
769  return STATUS_NOT_IMPLEMENTED;
770 }
771 
772 /*
773  @unimplemented
774 */
775 NTSTATUS
776 NTAPI
778  IN PIRP Irp,
781 {
783  DPRINT("BdaPropertyNodeEvents\n");
784  return STATUS_NOT_IMPLEMENTED;
785 }
786 
787 /*
788  @unimplemented
789 */
790 NTSTATUS
791 NTAPI
793  IN PIRP Irp,
796 {
798  DPRINT("BdaPropertyNodeMethods\n");
799  return STATUS_NOT_IMPLEMENTED;
800 }
801 
802 /*
803  @unimplemented
804 */
805 NTSTATUS
806 NTAPI
808  IN PIRP Irp,
811 {
813  DPRINT("BdaPropertyNodeProperties\n");
814  return STATUS_NOT_IMPLEMENTED;
815 }
816 
817 /*
818  @implemented
819 */
820 NTSTATUS
821 NTAPI
823  IN PIRP Irp,
826 {
827  PBDA_FILTER_INSTANCE_ENTRY InstanceEntry;
828  PKSFILTERFACTORY FilterFactory;
829  PKSFILTER pKSFilter;
830  PIO_STACK_LOCATION IoStack;
831  ULONG Index;
832 
833  DPRINT("BdaPropertyNodeTypes\n");
834 
835  /* check input parameter */
836  if (!Irp || !pKSProperty)
838 
839  /* first get the filter */
840  pKSFilter = KsGetFilterFromIrp(Irp);
841 
842  /* sanity check */
843  ASSERT(pKSFilter);
844 
845  /* get parent filter factory */
846  FilterFactory = KsFilterGetParentFilterFactory(pKSFilter);
847 
848  /* sanity check */
849  ASSERT(FilterFactory);
850 
851  /* find instance entry */
852  InstanceEntry = GetFilterInstanceEntry(FilterFactory);
853  ASSERT(InstanceEntry);
854 
855  /* get current irp stack */
857 
858  /* are there node types provided */
859  if (!pulProperty)
860  {
861  /* no node entry array provided */
862  Irp->IoStatus.Information = InstanceEntry->FilterTemplate->pFilterDescriptor->NodeDescriptorsCount * sizeof(ULONG);
863  Irp->IoStatus.Status = STATUS_MORE_ENTRIES;
864  return STATUS_MORE_ENTRIES;
865  }
866 
867  if (InstanceEntry->FilterTemplate->pFilterDescriptor->NodeDescriptorsCount * sizeof(ULONG) > IoStack->Parameters.DeviceIoControl.OutputBufferLength)
868  {
869  /* buffer too small */
870  Irp->IoStatus.Information = InstanceEntry->FilterTemplate->pFilterDescriptor->NodeDescriptorsCount * sizeof(ULONG);
871  Irp->IoStatus.Status = STATUS_BUFFER_TOO_SMALL;
873  }
874 
875  /* now copy all descriptors */
876  for(Index = 0; Index < InstanceEntry->FilterTemplate->pFilterDescriptor->NodeDescriptorsCount; Index++)
877  {
878  /* use the index as the type */
880  }
881 
882  return STATUS_SUCCESS;
883 }
884 
885 /*
886  @implemented
887 */
888 NTSTATUS
889 NTAPI
891  IN PIRP Irp,
894 {
895  PBDA_FILTER_INSTANCE_ENTRY InstanceEntry;
896  PKSFILTERFACTORY FilterFactory;
897  PKSFILTER pKSFilter;
898  PIO_STACK_LOCATION IoStack;
899  ULONG Index;
900 
901  DPRINT("BdaPropertyPinTypes\n");
902 
903  /* check input parameter */
904  if (!Irp || !pKSProperty)
906 
907  /* first get the filter */
908  pKSFilter = KsGetFilterFromIrp(Irp);
909 
910  /* sanity check */
911  ASSERT(pKSFilter);
912 
913  /* get parent filter factory */
914  FilterFactory = KsFilterGetParentFilterFactory(pKSFilter);
915 
916  /* sanity check */
917  ASSERT(FilterFactory);
918 
919  /* find instance entry */
920  InstanceEntry = GetFilterInstanceEntry(FilterFactory);
921  ASSERT(InstanceEntry);
922 
923  /* get current irp stack */
925 
926  /* are there node types provided */
927  if (!pKSProperty)
928  {
929  /* no node entry array provided */
930  Irp->IoStatus.Information = InstanceEntry->FilterTemplate->pFilterDescriptor->PinDescriptorsCount * sizeof(ULONG);
931  Irp->IoStatus.Status = STATUS_MORE_ENTRIES;
932  return STATUS_MORE_ENTRIES;
933  }
934 
935  if (InstanceEntry->FilterTemplate->pFilterDescriptor->PinDescriptorsCount * sizeof(ULONG) > IoStack->Parameters.DeviceIoControl.OutputBufferLength)
936  {
937  /* buffer too small */
938  Irp->IoStatus.Information = InstanceEntry->FilterTemplate->pFilterDescriptor->PinDescriptorsCount * sizeof(ULONG);
939  Irp->IoStatus.Status = STATUS_BUFFER_TOO_SMALL;
941  }
942 
943  /* now copy all descriptors */
944  for(Index = 0; Index < InstanceEntry->FilterTemplate->pFilterDescriptor->PinDescriptorsCount; Index++)
945  {
946  /* use the index as the type */
948  }
949 
950  return STATUS_SUCCESS;
951 }
952 
953 /*
954  @implemented
955 */
956 NTSTATUS
957 NTAPI
959  IN PIRP Irp,
962 {
963  PBDA_FILTER_INSTANCE_ENTRY FilterInstance;
964  PKSFILTER Filter;
965  PIO_STACK_LOCATION IoStack;
966  ULONG Index;
967 
968  DPRINT("BdaPropertyTemplateConnections\n");
969 
970  /* validate parameters */
971  if (!Irp || !pKSProperty)
973 
974  /* first get the filter */
976 
977  /* sanity check */
978  ASSERT(Filter);
979 
980  /* verify filter has been registered with BDA */
981  FilterInstance = GetFilterInstanceEntry(KsFilterGetParentFilterFactory(Filter));
982 
983  if (!FilterInstance)
985 
986  /* get current irp stack */
988 
989  if (!pConnectionProperty)
990  {
991  /* caller needs the size first */
992  Irp->IoStatus.Information = FilterInstance->FilterTemplate->pFilterDescriptor->ConnectionsCount * sizeof(KSTOPOLOGY_CONNECTION);
993  Irp->IoStatus.Status = STATUS_BUFFER_OVERFLOW;
994  return STATUS_BUFFER_OVERFLOW;
995  }
996 
997  /* sanity check */
998  ASSERT(FilterInstance->FilterTemplate->pFilterDescriptor->ConnectionsCount * sizeof(KSTOPOLOGY_CONNECTION) <= IoStack->Parameters.DeviceIoControl.OutputBufferLength);
999 
1000  for(Index = 0; Index < FilterInstance->FilterTemplate->pFilterDescriptor->ConnectionsCount; Index++)
1001  {
1002  /* sanity check */
1003  ASSERT(FilterInstance->FilterTemplate->pFilterDescriptor->Connections);
1004 
1005  /* copy connection */
1007  }
1008 
1009  /* store result */
1010  Irp->IoStatus.Information = FilterInstance->FilterTemplate->pFilterDescriptor->ConnectionsCount * sizeof(KSTOPOLOGY_CONNECTION);
1011  Irp->IoStatus.Status = STATUS_SUCCESS;
1012 
1013  /* done */
1014  return STATUS_SUCCESS;
1015 
1016 }
1017 
1018 /*
1019  @implemented
1020 */
1021 NTSTATUS
1022 NTAPI
1024 {
1025  DPRINT("BdaStartChanges\n");
1026 
1027  if (Irp)
1028  return STATUS_SUCCESS;
1029  else
1030  return STATUS_INVALID_PARAMETER;
1031 
1032 }
1033 
1034 /*
1035  @implemented
1036 */
1037 NTSTATUS
1038 NTAPI
1039 BdaUninitFilter(IN PKSFILTER pKSFilter)
1040 {
1041  DPRINT("BdaUninitFilter\n");
1042  return STATUS_SUCCESS;
1043 }
1044 
1045 /*
1046  @implemented
1047 */
1048 NTSTATUS
1049 NTAPI
1051  IN PIRP Irp,
1052  IN KSPROPERTY *KSProperty)
1053 {
1054  DPRINT("BdaValidateNodeProperty\n");
1055 
1056  /* check for valid parameter */
1057  if (Irp && KSProperty)
1058  return STATUS_SUCCESS;
1059 
1060  return STATUS_INVALID_PARAMETER;
1061 }
PKSFILTER NTAPI KsPinGetParentFilter(IN PKSPIN Pin)
Definition: pin.c:1097
NTSTATUS NTAPI BdaInitFilter(IN PKSFILTER pKSFilter, IN const BDA_FILTER_TEMPLATE *pBdaFilterTemplate)
Definition: bdasup.c:498
NTSTATUS NTAPI BdaCommitChanges(IN PIRP Irp)
Definition: bdasup.c:189
NTSTATUS NTAPI BdaPropertyTemplateConnections(IN PIRP Irp, IN KSPROPERTY *pKSProperty, OUT KSTOPOLOGY_CONNECTION *pConnectionProperty)
Definition: bdasup.c:958
#define IN
Definition: typedefs.h:38
const KSFILTER_DESCRIPTOR FilterDescriptor
Definition: splitter.c:229
#define TRUE
Definition: types.h:120
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
NTSTATUS NTAPI KsAddItemToObjectBag(IN KSOBJECT_BAG ObjectBag, IN PVOID Item, IN PFNKSFREE Free OPTIONAL)
Definition: bag.c:86
struct _Entry Entry
Definition: kefuncs.h:640
#define DEFINE_KSPROPERTY_ITEM_BDA_PIN_TYPES(GetHandler, SetHandler)
Definition: bdamedia.h:83
NTSTATUS NTAPI BdaPropertyNodeEvents(IN PIRP Irp, IN KSP_NODE *pKSProperty, OUT GUID *pguidProperty)
Definition: bdasup.c:777
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
NTSTATUS NTAPI KsMergeAutomationTables(OUT PKSAUTOMATION_TABLE *AutomationTableAB, IN PKSAUTOMATION_TABLE AutomationTableA OPTIONAL, IN PKSAUTOMATION_TABLE AutomationTableB OPTIONAL, IN KSOBJECT_BAG Bag OPTIONAL)
Definition: api.c:2303
NTSTATUS NTAPI BdaUninitFilter(IN PKSFILTER pKSFilter)
Definition: bdasup.c:1039
struct _KSM_PIN * PKSM_PIN
_In_ PIRP Irp
Definition: csq.h:116
_Must_inspect_result_ _In_ ULONG _In_ ULONG OutputPinId
Definition: bdasup.h:96
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define DEFINE_KSPROPERTY_ITEM_BDA_NODE_TYPES(GetHandler, SetHandler)
Definition: bdamedia.h:75
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS NTAPI BdaPropertyNodeMethods(IN PIRP Irp, IN KSP_NODE *pKSProperty, OUT GUID *pguidProperty)
Definition: bdasup.c:792
NTSTATUS NTAPI BdaGetChangeState(IN PIRP Irp, OUT BDA_CHANGE_STATE *ChangeState)
Definition: bdasup.c:632
KSDDKAPI NTSTATUS NTAPI _KsEdit(IN KSOBJECT_BAG ObjectBag, IN OUT PVOID *PointerToPointerToItem, IN ULONG NewSize, IN ULONG OldSize, IN ULONG Tag)
Definition: bag.c:358
#define DEFINE_KSPROPERTY_ITEM_BDA_TEMPLATE_CONNECTIONS(GetHandler, SetHandler)
Definition: bdamedia.h:91
LIST_ENTRY Entry
Definition: precomp.h:19
NTSTATUS NTAPI BdaPropertyPinTypes(IN PIRP Irp, IN KSPROPERTY *pKSProperty, OUT ULONG *pulProperty)
Definition: bdasup.c:890
PBDA_FILTER_INSTANCE_ENTRY GetFilterInstanceEntry(IN PKSFILTERFACTORY FilterFactory)
Definition: bdasup.c:116
NTSTATUS NTAPI BdaCheckChanges(IN PIRP Irp)
Definition: bdasup.c:174
#define InsertTailList(ListHead, Entry)
#define DEFINE_KSPROPERTY_ITEM_BDA_NODE_DESCRIPTORS(GetHandler, SetHandler)
Definition: bdamedia.h:131
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:64
Definition: precomp.h:17
FORCEINLINE BOOLEAN RemoveEntryList(_In_ PLIST_ENTRY Entry)
Definition: rtlfuncs.h:105
UCHAR KIRQL
Definition: env_spec_w32.h:591
NTSTATUS NTAPI BdaPropertyNodeProperties(IN PIRP Irp, IN KSP_NODE *pKSProperty, OUT GUID *pguidProperty)
Definition: bdasup.c:807
_Must_inspect_result_ _In_ KSP_NODE _Out_opt_ GUID * pguidProperty
Definition: bdasup.h:180
VOID FreeItem(IN PVOID Item)
Definition: bdasup.c:108
_Must_inspect_result_ _In_ ULONG ulPinType
Definition: bdasup.h:88
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
NTSTATUS NTAPI BdaMethodCreatePin(IN PIRP Irp, IN KSMETHOD *pKSMethod, OUT ULONG *pulPinFactoryID)
Definition: bdasup.c:463
union node Node
Definition: types.h:1255
_Must_inspect_result_ _In_opt_ PFLT_FILTER Filter
Definition: fltkernel.h:1802
_Must_inspect_result_ _In_ ULONG _Out_opt_ ULONG * pulPinId
Definition: bdasup.h:88
KSPROPERTY_ITEM FilterPropertyItem[]
Definition: bdasup.c:15
#define KSFILTER_NODE
Definition: ks.h:44
KSDDKAPI NTSTATUS NTAPI KsFilterFactoryUpdateCacheData(IN PKSFILTERFACTORY FilterFactory, IN const KSFILTER_DESCRIPTOR *FilterDescriptor OPTIONAL)
FORCEINLINE VOID KeInitializeSpinLock(_Out_ PKSPIN_LOCK SpinLock)
Definition: kefuncs.h:251
#define DEFINE_KSPROPERTY_ITEM_BDA_NODE_PROPERTIES(GetHandler, SetHandler)
Definition: bdamedia.h:107
smooth NULL
Definition: ftsmooth.c:416
NTSTATUS NTAPI BdaPropertyNodeDescriptors(IN PIRP Irp, IN KSPROPERTY *pKSProperty, OUT BDANODE_DESCRIPTOR *pNodeDescriptorProperty)
Definition: bdasup.c:762
Definition: ks.h:2074
void DPRINT(...)
Definition: polytest.cpp:61
const GUID KSPROPSETID_BdaTopology
Definition: bdasup.c:6
KSAUTOMATION_TABLE PinAutomationTable
Definition: bdasup.c:80
NTSTATUS NTAPI BdaCreateFilterFactoryEx(IN PKSDEVICE pKSDevice, IN const KSFILTER_DESCRIPTOR *pFilterDescriptor, IN const BDA_FILTER_TEMPLATE *BdaFilterTemplate, OUT PKSFILTERFACTORY *ppKSFilterFactory)
Definition: bdasup.c:254
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
_Must_inspect_result_ _In_ KSMETHOD _Out_opt_ ULONG * pulPinFactoryID
Definition: bdasup.h:132
NTSTATUS NTAPI BdaCreateTopology(IN PKSFILTER pKSFilter, IN ULONG InputPinId, IN ULONG OutputPinId)
Definition: bdasup.c:553
NTSTATUS NTAPI BdaPropertyGetPinControl(IN PIRP Irp, IN KSPROPERTY *pKSProperty, OUT ULONG *pulProperty)
Definition: bdasup.c:719
KSAUTOMATION_TABLE FilterAutomationTable
Definition: bdasup.c:52
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
KSPROPERTY_SET FilterPropertySet
Definition: bdasup.c:28
_Must_inspect_result_ _In_ KSP_BDA_NODE_PIN * pProperty
Definition: bdasup.h:156
#define STATUS_NOT_FOUND
Definition: shellext.h:67
_Must_inspect_result_ _In_ const KSFILTER_DESCRIPTOR _In_ const BDA_FILTER_TEMPLATE _Out_opt_ PKSFILTERFACTORY * ppKSFilterFactory
Definition: bdasup.h:79
struct BDA_FILTER_INSTANCE_ENTRY * PBDA_FILTER_INSTANCE_ENTRY
NTSTATUS NTAPI BdaPropertyNodeTypes(IN PIRP Irp, IN KSPROPERTY *pKSProperty, OUT ULONG *pulProperty)
Definition: bdasup.c:822
ULONG Id
Definition: dmksctrl.h:77
IN PDCB IN VBO IN ULONG IN BOOLEAN Pin
Definition: fatprocs.h:415
NTSTATUS NTAPI BdaDeletePin(IN PKSFILTER pKSFilter, IN ULONG *pulPinId)
Definition: bdasup.c:605
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
INT POOL_TYPE
Definition: typedefs.h:76
_Must_inspect_result_ _In_ KSP_BDA_NODE_PIN _Out_opt_ ULONG * pulControllingPinId
Definition: bdasup.h:156
BOOLEAN Initialized
Definition: precomp.h:26
#define KeAcquireSpinLock(sl, irql)
Definition: env_spec_w32.h:609
static const UCHAR Index[8]
Definition: usbohci.c:18
KSMETHOD_SET FilterMethodSet
Definition: bdasup.c:43
NTSTATUS NTAPI BdaFilterFactoryUpdateCacheData(IN PKSFILTERFACTORY FilterFactory, IN const KSFILTER_DESCRIPTOR *FilterDescriptor OPTIONAL)
Definition: bdasup.c:619
BDA_GLOBAL g_Settings
Definition: bdasup.c:8
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
NTSTATUS NTAPI BdaStartChanges(IN PIRP Irp)
Definition: bdasup.c:1023
#define DEFINE_KSPROPERTY_ITEM_BDA_NODE_METHODS(GetHandler, SetHandler)
Definition: bdamedia.h:99
KSDDKAPI NTSTATUS NTAPI KsCreateFilterFactory(IN PDEVICE_OBJECT DeviceObject, IN const KSFILTER_DESCRIPTOR *Descriptor, IN PWSTR RefString OPTIONAL, IN PSECURITY_DESCRIPTOR SecurityDescriptor OPTIONAL, IN ULONG CreateItemFlags, IN PFNKSFILTERFACTORYPOWER SleepCallback OPTIONAL, IN PFNKSFILTERFACTORYPOWER WakeCallback OPTIONAL, OUT PKSFILTERFACTORY *FilterFactory OPTIONAL)
KSPIN_LOCK FilterFactoryInstanceListLock
Definition: precomp.h:27
#define ExAllocatePool(type, size)
Definition: fbtusb.h:44
NTSTATUS NTAPI BdaMethodDeletePin(IN PIRP Irp, IN KSMETHOD *pKSMethod, OPTIONAL PVOID pvIgnored)
Definition: bdasup.c:686
struct _KSP_BDA_NODE_PIN * PKSP_BDA_NODE_PIN
Definition: typedefs.h:117
LIST_ENTRY FilterFactoryInstanceList
Definition: precomp.h:28
#define STATUS_MORE_ENTRIES
Definition: udferr_usr.h:124
_Must_inspect_result_ _In_ const KSFILTER_DESCRIPTOR _In_ const BDA_FILTER_TEMPLATE * pBdaFilterTemplate
Definition: bdasup.h:71
PBDA_FILTER_TEMPLATE FilterTemplate
Definition: precomp.h:21
_Must_inspect_result_ _In_ KSMETHOD PVOID pvIgnored
Definition: bdasup.h:140
Status
Definition: gdiplustypes.h:24
NTSTATUS NTAPI BdaMethodCreateTopology(IN PIRP Irp, IN KSMETHOD *pKSMethod, OPTIONAL PVOID pvIgnored)
Definition: bdasup.c:654
KSPROPERTY_ITEM PinPropertyItem[]
Definition: bdasup.c:65
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
ULONG_PTR SIZE_T
Definition: typedefs.h:78
#define DEFINE_KSPROPERTY_ITEM_BDA_PIN_TYPE(GetHandler, SetHandler)
Definition: bdamedia.h:206
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:61
NTSTATUS NTAPI BdaCreatePin(IN PKSFILTER pKSFilter, IN ULONG ulPinType, OUT ULONG *pulPinId)
Definition: bdasup.c:366
PVOID AllocateItem(IN POOL_TYPE PoolType, IN SIZE_T NumberOfBytes)
Definition: bdasup.c:95
const GUID KSPROPSETID_BdaPinControl
Definition: bdasup.c:4
_Must_inspect_result_ _In_ KSPROPERTY * pKSProperty
Definition: bdasup.h:164
#define DEFINE_KSPROPERTY_ITEM_BDA_CONTROLLING_PIN_ID(GetHandler, SetHandler)
Definition: bdamedia.h:123
#define DEFINE_KSPROPERTY_ITEM_BDA_NODE_EVENTS(GetHandler, SetHandler)
Definition: bdamedia.h:115
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
VOID NTAPI FreeFilterInstance(IN PVOID Context)
Definition: bdasup.c:214
KSPROPERTY_SET PinPropertySet
Definition: bdasup.c:71
BDA_CHANGE_STATE
Definition: bdatypes.h:115
NTSTATUS NTAPI BdaPropertyGetControllingPinId(IN PIRP Irp, IN KSP_BDA_NODE_PIN *pProperty, OUT ULONG *pulControllingPinId)
Definition: bdasup.c:704
KSMETHOD_ITEM FilterMethodItem[]
Definition: bdasup.c:37
KSDDKAPI NTSTATUS NTAPI KsFilterCreatePinFactory(IN PKSFILTER Filter, IN const KSPIN_DESCRIPTOR_EX *const InPinDescriptor, OUT PULONG PinID)
Definition: filter.c:1956
#define KeReleaseSpinLock(sl, irql)
Definition: env_spec_w32.h:627
const KSFILTER_DESCRIPTOR * pFilterDescriptor
Definition: bdasup.h:31
KSDDKAPI PKSFILTER NTAPI KsGetFilterFromIrp(IN PIRP Irp)
Definition: filter.c:2106
#define DPRINT1
Definition: precomp.h:8
_Must_inspect_result_ _In_ const KSFILTER_DESCRIPTOR * pFilterDescriptor
Definition: bdasup.h:71
_Must_inspect_result_ _In_ ULONG InputPinId
Definition: bdasup.h:96
const GUID KSMETHODSETID_BdaDeviceConfiguration
Definition: bdasup.c:5
#define DEFINE_KSMETHOD_ITEM_BDA_CREATE_TOPOLOGY(MethodHandler, SupportHandler)
Definition: bdamedia.h:173
KSDDKAPI PKSPIN NTAPI KsGetPinFromIrp(IN PIRP Irp)
Definition: pin.c:1211
#define OUT
Definition: typedefs.h:39
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS _Inout_ PLARGE_INTEGER NumberOfBytes
Definition: iotypes.h:998
struct tagContext Context
Definition: acpixf.h:1024
NTSTATUS NTAPI DllInitialize(PUNICODE_STRING RegistryPath)
Definition: bdasup.c:157
unsigned int ULONG
Definition: retypes.h:1
PKSFILTERFACTORY FilterFactoryInstance
Definition: precomp.h:20
#define UNIMPLEMENTED
Definition: debug.h:114
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
_Must_inspect_result_ _In_ KSPROPERTY _Out_opt_ BDANODE_DESCRIPTOR * pNodeDescriptorProperty
Definition: bdasup.h:172
_In_ PUNICODE_STRING RegistryPath
Definition: wmip.h:27
_Must_inspect_result_ _In_ KSMETHOD * pKSMethod
Definition: bdasup.h:132
NTSTATUS NTAPI BdaCreateFilterFactory(IN PKSDEVICE pKSDevice, IN const KSFILTER_DESCRIPTOR *pFilterDescriptor, IN const BDA_FILTER_TEMPLATE *pBdaFilterTemplate)
Definition: bdasup.c:204
_Must_inspect_result_ _In_ KSPROPERTY _Out_opt_ KSTOPOLOGY_CONNECTION * pConnectionProperty
Definition: bdasup.h:220
_Must_inspect_result_ _In_ KSPROPERTY _Out_opt_ ULONG * pulProperty
Definition: bdasup.h:164
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:2772
NTSTATUS NTAPI BdaValidateNodeProperty(IN PIRP Irp, IN KSPROPERTY *KSProperty)
Definition: bdasup.c:1050
return STATUS_SUCCESS
Definition: btrfs.c:2966
KSDDKAPI NTSTATUS NTAPI KsFilterAddTopologyConnections(IN PKSFILTER Filter, IN ULONG NewConnectionsCount, IN const KSTOPOLOGY_CONNECTION *const NewTopologyConnections)
Definition: filter.c:1865
_Must_inspect_result_ _In_ FLT_CONTEXT_TYPE _In_ SIZE_T _In_ POOL_TYPE PoolType
Definition: fltkernel.h:1444
base of all file and directory entries
Definition: entries.h:82
#define ExFreePool(addr)
Definition: env_spec_w32.h:352
Definition: dlist.c:348
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68
#define DEFINE_KSPROPERTY_ITEM_BDA_PIN_ID(GetHandler, SetHandler)
Definition: bdamedia.h:198