ReactOS 0.4.17-dev-683-g0dafdc5
undoc.cpp File Reference
#include "private.hpp"
#include <debug.h>
Include dependency graph for undoc.cpp:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

NTSTATUS NTAPI KsoDispatchCreateWithGenericFactory (LONG Unknown, PIRP Irp)
 
IIrpTarget *NTAPI KsoGetIrpTargetFromFileObject (PFILE_OBJECT FileObject)
 
IIrpTarget *NTAPI KsoGetIrpTargetFromIrp (PIRP Irp)
 
NTSTATUS NTAPI PcHandleEnableEventWithTable (IN PIRP Irp, IN PSUBDEVICE_DESCRIPTOR Descriptor)
 
NTSTATUS NTAPI PcHandleDisableEventWithTable (IN PIRP Irp, IN PSUBDEVICE_DESCRIPTOR Descriptor)
 
NTSTATUS NTAPI PcHandlePropertyWithTable (IN PIRP Irp, IN ULONG PropertySetCount, IN PKSPROPERTY_SET PropertySet, IN PSUBDEVICE_DESCRIPTOR SubDeviceDescriptor)
 
VOID NTAPI PcAcquireFormatResources (LONG Unknown, LONG Unknown2, LONG Unknown3, LONG Unknown4)
 
NTSTATUS PcAddToEventTable (PVOID Ptr, LONG Unknown2, ULONG Length, LONG Unknown3, LONG Unknown4, LONG Unknown5, LONG Unknown6, LONG Unknown7)
 
NTSTATUS NTAPI PropertyItemDispatch (IN PIRP Irp, IN PKSIDENTIFIER Request, IN OUT PVOID Data)
 
NTSTATUS PcAddToPropertyTable (IN PSUBDEVICE_DESCRIPTOR SubDeviceDescriptor, IN PPCPROPERTY_ITEM PropertyItem, IN ULONG bNode)
 
NTSTATUS PcCaptureFormat (LONG Unknown, LONG Unknown2, LONG Unknown3, LONG Unknown4)
 
NTSTATUS NTAPI PcCreateSubdeviceDescriptor (OUT SUBDEVICE_DESCRIPTOR **OutSubdeviceDescriptor, IN ULONG InterfaceCount, IN GUID *InterfaceGuids, IN ULONG IdentifierCount, IN KSIDENTIFIER *Identifier, IN ULONG FilterPropertiesCount, IN KSPROPERTY_SET *FilterProperties, IN ULONG Unknown1, IN ULONG Unknown2, IN ULONG PinPropertiesCount, IN KSPROPERTY_SET *PinProperties, IN ULONG EventSetCount, IN KSEVENT_SET *EventSet, IN PPCFILTER_DESCRIPTOR FilterDescription)
 
NTSTATUS NTAPI PcValidateConnectRequest (IN PIRP Irp, IN KSPIN_FACTORY *Factory, OUT PKSPIN_CONNECT *Connect)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 11 of file undoc.cpp.

Function Documentation

◆ KsoDispatchCreateWithGenericFactory()

NTSTATUS NTAPI KsoDispatchCreateWithGenericFactory ( LONG  Unknown,
PIRP  Irp 
)

Definition at line 16 of file undoc.cpp.

19{
22}
#define UNIMPLEMENTED
Definition: ntoskrnl.c:15
#define STATUS_NOT_IMPLEMENTED
Definition: d3dkmdt.h:42

◆ KsoGetIrpTargetFromFileObject()

IIrpTarget *NTAPI KsoGetIrpTargetFromFileObject ( PFILE_OBJECT  FileObject)

Definition at line 26 of file undoc.cpp.

28{
30
31 // IrpTarget is stored in FsContext
32 return (IIrpTarget*)FileObject->FsContext;
33}
#define PC_ASSERT(exp)
Definition: private.hpp:26
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
Definition: wdfdevice.h:550

◆ KsoGetIrpTargetFromIrp()

IIrpTarget *NTAPI KsoGetIrpTargetFromIrp ( PIRP  Irp)

Definition at line 37 of file undoc.cpp.

39{
40 PIO_STACK_LOCATION IoStack;
41
42 // get current irp stack location
44
45 // IIrpTarget is stored in Context member
46 return (IIrpTarget*)IoStack->FileObject->FsContext;
47}
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
_In_ PIRP Irp
Definition: csq.h:116
PFILE_OBJECT FileObject
Definition: iotypes.h:3171

◆ PcAcquireFormatResources()

VOID NTAPI PcAcquireFormatResources ( LONG  Unknown,
LONG  Unknown2,
LONG  Unknown3,
LONG  Unknown4 
)

Definition at line 104 of file undoc.cpp.

109{
111}

◆ PcAddToEventTable()

NTSTATUS PcAddToEventTable ( PVOID  Ptr,
LONG  Unknown2,
ULONG  Length,
LONG  Unknown3,
LONG  Unknown4,
LONG  Unknown5,
LONG  Unknown6,
LONG  Unknown7 
)

Definition at line 114 of file undoc.cpp.

123{
126}

◆ PcAddToPropertyTable()

NTSTATUS PcAddToPropertyTable ( IN PSUBDEVICE_DESCRIPTOR  SubDeviceDescriptor,
IN PPCPROPERTY_ITEM  PropertyItem,
IN ULONG  bNode 
)

Definition at line 306 of file undoc.cpp.

310{
311 ULONG bFound = FALSE;
312 ULONG Index, PropertySetIndex, PropertySetItemIndex;
313 PKSPROPERTY_SET NewPropertySet;
314 PKSPROPERTY_ITEM FilterPropertyItem, NewFilterPropertyItem;
315 LPGUID Guid;
316 //UNICODE_STRING GuidBuffer;
317
318ASSERT(PropertyItem->Set);
319 // RtlStringFromGUID(*PropertyItem->Set, &GuidBuffer);
320 // DPRINT1("PcAddToPropertyTable Adding Item Set %S Id %lu Flags %lx\n", GuidBuffer.Buffer, PropertyItem->Id, PropertyItem->Flags);
321
322 //DPRINT1("FilterPropertySetCount %lu\n", SubDeviceDescriptor->FilterPropertySetCount);
323 // first step check if the property set is present already
324 for(Index = 0; Index < SubDeviceDescriptor->FilterPropertySetCount; Index++)
325 {
326
327 //RtlStringFromGUID(*SubDeviceDescriptor->FilterPropertySet[Index].Set, &GuidBuffer);
328 //DPRINT1("FilterProperty Set %S PropertyCount %lu\n", GuidBuffer.Buffer, SubDeviceDescriptor->FilterPropertySet[Index].PropertiesCount);
329 if (IsEqualGUIDAligned(*SubDeviceDescriptor->FilterPropertySet[Index].Set, *PropertyItem->Set))
330 {
331 // property set is already present
332 bFound = TRUE;
333 PropertySetIndex = Index;
334
335 // break out
336 break;
337 }
338 }
339
340 // is the property set present
341 if (!bFound)
342 {
343 // need to allocate a property set
344 NewPropertySet = (PKSPROPERTY_SET)AllocateItem(NonPagedPool, (SubDeviceDescriptor->FilterPropertySetCount + 1) * sizeof(KSPROPERTY_SET), TAG_PORTCLASS);
345 if (!NewPropertySet)
346 {
347 // out of memory
349 }
350
351 // need to allocate property set guid
353 if (!Guid)
354 {
355 // out of memory
356 FreeItem(NewPropertySet, TAG_PORTCLASS);
358 }
359
360 // are any existing property sets
361 if (SubDeviceDescriptor->FilterPropertySetCount)
362 {
363 // copy property sets
364 RtlMoveMemory(NewPropertySet, SubDeviceDescriptor->FilterPropertySet, SubDeviceDescriptor->FilterPropertySetCount * sizeof(KSPROPERTY_SET));
365
366 // release memory
367 FreeItem(SubDeviceDescriptor->FilterPropertySet, TAG_PORTCLASS);
368 }
369
370 // store new property set descriptors
371 SubDeviceDescriptor->FilterPropertySet = NewPropertySet;
372
373 // store index
374 PropertySetIndex = SubDeviceDescriptor->FilterPropertySetCount;
375
376 // increment property set count
377 SubDeviceDescriptor->FilterPropertySetCount++;
378
379 // copy property guid
380 RtlMoveMemory(Guid, PropertyItem->Set, sizeof(GUID));
381
382 // initialize property set
383 SubDeviceDescriptor->FilterPropertySet[PropertySetIndex].Set = Guid;
384 SubDeviceDescriptor->FilterPropertySet[PropertySetIndex].PropertiesCount = 0;
385 }
386
387 // as the property set has been identified, now search for duplicate property set item entries
388 FilterPropertyItem = (PKSPROPERTY_ITEM)SubDeviceDescriptor->FilterPropertySet[PropertySetIndex].PropertyItem;
389 bFound = FALSE;
390
391 for(Index = 0; Index < SubDeviceDescriptor->FilterPropertySet[PropertySetIndex].PropertiesCount; Index++)
392 {
393 // now search for an equal property set item
394 if (FilterPropertyItem->PropertyId == PropertyItem->Id)
395 {
396 // found existing property set item
397 bFound = TRUE;
398 PropertySetItemIndex = Index;
399 break;
400 }
401
402 // move to next entry
404 }
405
406 if (!bFound)
407 {
408 // need to allocate memory for new property set item
409 NewFilterPropertyItem = (PKSPROPERTY_ITEM)AllocateItem(NonPagedPool, (SubDeviceDescriptor->FilterPropertySet[PropertySetIndex].PropertiesCount + 1) * sizeof(KSPROPERTY_ITEM), TAG_PORTCLASS);
410 if (!NewFilterPropertyItem)
411 {
412 // out of memory
414 }
415
416 // are any existing property set items
417 if (SubDeviceDescriptor->FilterPropertySet[PropertySetIndex].PropertiesCount)
418 {
419 // copy property item sets
420 RtlMoveMemory(NewFilterPropertyItem,
421 (PVOID)SubDeviceDescriptor->FilterPropertySet[PropertySetIndex].PropertyItem,
422 SubDeviceDescriptor->FilterPropertySet[PropertySetIndex].PropertiesCount * sizeof(KSPROPERTY_ITEM));
423
424 // release old descriptors
425 FreeItem((PVOID)SubDeviceDescriptor->FilterPropertySet[PropertySetIndex].PropertyItem, TAG_PORTCLASS);
426 }
427
428 // store new descriptor
429 SubDeviceDescriptor->FilterPropertySet[PropertySetIndex].PropertyItem = NewFilterPropertyItem;
430
431 // store index
432 PropertySetItemIndex = SubDeviceDescriptor->FilterPropertySet[PropertySetIndex].PropertiesCount;
433
434 // increment property item set count
435 SubDeviceDescriptor->FilterPropertySet[PropertySetIndex].PropertiesCount++;
436
437 // now initialize property item
438 FilterPropertyItem = (PKSPROPERTY_ITEM)&SubDeviceDescriptor->FilterPropertySet[PropertySetIndex].PropertyItem[PropertySetItemIndex];
439 FilterPropertyItem->PropertyId = PropertyItem->Id;
440 FilterPropertyItem->MinProperty = sizeof(KSPROPERTY);
441 FilterPropertyItem->MinData = 0;
442
443 // are any set operations supported
445 {
446 // setup handler
447 FilterPropertyItem->SetPropertyHandler = PropertyItemDispatch;
448 }
449
450 // are set operation supported
452 {
453 // setup handler
454 FilterPropertyItem->GetPropertyHandler = PropertyItemDispatch;
455 }
456
457 // are get operations supported
459 {
460 // setup handler
461 FilterPropertyItem->GetPropertyHandler = PropertyItemDispatch;
462 }
463
464 // are basic support operations supported
466 {
467 // setup handler
469 }
470
471 if (!bNode)
472 {
473 // store property item in relations
474 // only store property item of filter properties / pin properties
475 // because filter & pin properties do not require a specific context
476 // on the other hand node properties are specifically bound to a node
477
478 FilterPropertyItem->Relations = (const KSPROPERTY*)PropertyItem;
479 }
480 }
481 else
482 {
483 // property set item handler already present
484
485 if (bNode)
486 {
487 // filter & pin properties should not be exposed on a node
488 ASSERT(SubDeviceDescriptor->FilterPropertySet[PropertySetIndex].PropertyItem[PropertySetItemIndex].Relations == NULL);
489 }
490 else
491 {
492 // node properties should not be exposed on a filter & pin
493 ASSERT(SubDeviceDescriptor->FilterPropertySet[PropertySetIndex].PropertyItem[PropertySetItemIndex].Relations != NULL);
494 }
495 }
496
497 // done
498 return STATUS_SUCCESS;
499}
KSPROPERTY_ITEM FilterPropertyItem[]
Definition: bdasup.c:17
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
KSPROPERTY_SET FilterPropertySet[]
Definition: filter.c:63
#define NonPagedPool
Definition: env_spec_w32.h:307
PVOID AllocateItem(IN POOL_TYPE PoolType, IN SIZE_T NumberOfBytes)
Definition: misc.c:29
VOID FreeItem(IN PVOID Item)
Definition: misc.c:37
#define ASSERT(a)
Definition: mode.c:44
#define PCPROPERTY_ITEM_FLAG_SET
Definition: portcls.h:241
#define PCPROPERTY_ITEM_FLAG_GET
Definition: portcls.h:240
#define PCPROPERTY_ITEM_FLAG_BASICSUPPORT
Definition: portcls.h:242
#define TAG_PORTCLASS
Definition: private.hpp:24
GUID * LPGUID
Definition: guiddef.h:81
#define STATUS_SUCCESS
Definition: shellext.h:65
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:264
uint32_t ULONG
Definition: typedefs.h:59
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
NTSTATUS NTAPI PropertyItemDispatch(IN PIRP Irp, IN PKSIDENTIFIER Request, IN OUT PVOID Data)
Definition: undoc.cpp:130
_In_ WDFCOLLECTION _In_ ULONG Index
_Must_inspect_result_ _In_ WDFOBJECT _In_ CONST GUID * Guid
Definition: wdfobject.h:762
#define IsEqualGUIDAligned(guid1, guid2)
Definition: wdm.template.h:235

Referenced by PcCreateSubdeviceDescriptor().

◆ PcCaptureFormat()

NTSTATUS PcCaptureFormat ( LONG  Unknown,
LONG  Unknown2,
LONG  Unknown3,
LONG  Unknown4 
)

Definition at line 502 of file undoc.cpp.

507{
510}

◆ PcCreateSubdeviceDescriptor()

NTSTATUS NTAPI PcCreateSubdeviceDescriptor ( OUT SUBDEVICE_DESCRIPTOR **  OutSubdeviceDescriptor,
IN ULONG  InterfaceCount,
IN GUID InterfaceGuids,
IN ULONG  IdentifierCount,
IN KSIDENTIFIER Identifier,
IN ULONG  FilterPropertiesCount,
IN KSPROPERTY_SET *  FilterProperties,
IN ULONG  Unknown1,
IN ULONG  Unknown2,
IN ULONG  PinPropertiesCount,
IN KSPROPERTY_SET *  PinProperties,
IN ULONG  EventSetCount,
IN KSEVENT_SET *  EventSet,
IN PPCFILTER_DESCRIPTOR  FilterDescription 
)

Definition at line 752 of file undoc.cpp.

767{
769 ULONG Index, SubIndex;
771 PPCPIN_DESCRIPTOR SrcDescriptor;
774
775 // allocate subdevice descriptor
777 if (!Descriptor)
779
780 // initialize physical / symbolic link connection list
781 InitializeListHead(&Descriptor->SymbolicLinkList);
782 InitializeListHead(&Descriptor->PhysicalConnectionList);
783
784 //FIXME add driver category guids
785 Descriptor->Interfaces = (GUID*)AllocateItem(NonPagedPool, sizeof(GUID) * InterfaceCount, TAG_PORTCLASS);
786 if (!Descriptor->Interfaces)
787 goto cleanup;
788
789 // copy interface guids
790 RtlCopyMemory(Descriptor->Interfaces, InterfaceGuids, sizeof(GUID) * InterfaceCount);
791 Descriptor->InterfaceCount = InterfaceCount;
792
793#if DBG
794 DumpFilterDescriptor(FilterDescription);
795#endif
796
797 // are any property sets supported by the portcls
798 if (FilterPropertiesCount)
799 {
800 // first allocate filter properties set
801 Descriptor->FilterPropertySet = (PKSPROPERTY_SET)AllocateItem(NonPagedPool, sizeof(KSPROPERTY_SET) * FilterPropertiesCount, TAG_PORTCLASS);
802 if (! Descriptor->FilterPropertySet)
803 goto cleanup;
804
805 // now copy all filter property sets
806 Descriptor->FilterPropertySetCount = FilterPropertiesCount;
807 for(Index = 0; Index < FilterPropertiesCount; Index++)
808 {
809 // copy property set
810 RtlMoveMemory(&Descriptor->FilterPropertySet[Index], &FilterProperties[Index], sizeof(KSPROPERTY_SET));
811
812 if (Descriptor->FilterPropertySet[Index].PropertiesCount)
813 {
814 // copy property items to make sure they are dynamically allocated
815 Descriptor->FilterPropertySet[Index].PropertyItem = (PKSPROPERTY_ITEM)AllocateItem(NonPagedPool, FilterProperties[Index].PropertiesCount * sizeof(KSPROPERTY_ITEM), TAG_PORTCLASS);
816 if (!Descriptor->FilterPropertySet[Index].PropertyItem)
817 {
818 // no memory
819 goto cleanup;
820 }
821
822 // copy filter property items
823 RtlMoveMemory((PVOID)Descriptor->FilterPropertySet[Index].PropertyItem, FilterProperties[Index].PropertyItem, FilterProperties[Index].PropertiesCount * sizeof(KSPROPERTY_ITEM));
824 }
825 }
826 }
827
828 // now check if the filter descriptor supports filter properties
829 if (FilterDescription->AutomationTable)
830 {
831 // get first entry
832 PropertyItem = (PPCPROPERTY_ITEM)FilterDescription->AutomationTable->Properties;
833
834 // copy driver filter property sets
835 for(Index = 0; Index < FilterDescription->AutomationTable->PropertyCount; Index++)
836 {
837 // add the property item
839
840 // check for success
841 if (Status != STATUS_SUCCESS)
842 {
843 // goto cleanup
844 goto cleanup;
845 }
846
847 // move to next entry
848 PropertyItem = (PPCPROPERTY_ITEM)((ULONG_PTR)PropertyItem + FilterDescription->AutomationTable->PropertyItemSize);
849 }
850 }
851
852 // check if the filter has pins
853 if (FilterDescription->PinCount)
854 {
855 // allocate pin factory descriptors
856 Descriptor->Factory.KsPinDescriptor = (PKSPIN_DESCRIPTOR)AllocateItem(NonPagedPool, sizeof(KSPIN_DESCRIPTOR) * FilterDescription->PinCount, TAG_PORTCLASS);
857 if (!Descriptor->Factory.KsPinDescriptor)
858 goto cleanup;
859
860 // allocate pin instance info
861 Descriptor->Factory.Instances = (PPIN_INSTANCE_INFO)AllocateItem(NonPagedPool, FilterDescription->PinCount * sizeof(PIN_INSTANCE_INFO), TAG_PORTCLASS);
862 if (!Descriptor->Factory.Instances)
863 goto cleanup;
864
865 // initialize pin factory descriptor
866 Descriptor->Factory.PinDescriptorCount = FilterDescription->PinCount;
867 Descriptor->Factory.PinDescriptorSize = sizeof(KSPIN_DESCRIPTOR);
868
869 // grab first entry
870 SrcDescriptor = (PPCPIN_DESCRIPTOR)FilterDescription->Pins;
871
872 // copy pin factories
873 for(Index = 0; Index < FilterDescription->PinCount; Index++)
874 {
875 // copy pin descriptor
876 RtlMoveMemory(&Descriptor->Factory.KsPinDescriptor[Index], &SrcDescriptor->KsPinDescriptor, sizeof(KSPIN_DESCRIPTOR));
877
878 // initialize pin factory instance data
879 Descriptor->Factory.Instances[Index].CurrentPinInstanceCount = 0;
880 Descriptor->Factory.Instances[Index].MaxFilterInstanceCount = SrcDescriptor->MaxFilterInstanceCount;
881 Descriptor->Factory.Instances[Index].MaxGlobalInstanceCount = SrcDescriptor->MaxGlobalInstanceCount;
882 Descriptor->Factory.Instances[Index].MinFilterInstanceCount = SrcDescriptor->MinFilterInstanceCount;
883
884 // check if the descriptor has an automation table
885 if (SrcDescriptor->AutomationTable)
886 {
887 // it has, grab first entry
889
890 // now add all supported property items
891 for(SubIndex = 0; SubIndex < SrcDescriptor->AutomationTable->PropertyCount; SubIndex++)
892 {
893 // add the property item to the table
895
896 // check for success
897 if (Status != STATUS_SUCCESS)
898 {
899 // goto cleanup
900 goto cleanup;
901 }
902
903 // move to next entry
905 }
906 }
907
908 // move to next entry
909 SrcDescriptor = (PPCPIN_DESCRIPTOR)((ULONG_PTR)SrcDescriptor + FilterDescription->PinSize);
910 }
911 }
912
913 // allocate topology descriptor
915 if (!Descriptor->Topology)
916 goto cleanup;
917
918 // are there any connections
919 if (FilterDescription->ConnectionCount)
920 {
921 // allocate connection descriptor
922 Descriptor->Topology->TopologyConnections = (PKSTOPOLOGY_CONNECTION)AllocateItem(NonPagedPool, sizeof(KSTOPOLOGY_CONNECTION) * FilterDescription->ConnectionCount, TAG_PORTCLASS);
923 if (!Descriptor->Topology->TopologyConnections)
924 goto cleanup;
925
926 // copy connection descriptor
927 RtlMoveMemory((PVOID)Descriptor->Topology->TopologyConnections, FilterDescription->Connections, FilterDescription->ConnectionCount * sizeof(PCCONNECTION_DESCRIPTOR));
928
929 // store connection count
930 Descriptor->Topology->TopologyConnectionsCount = FilterDescription->ConnectionCount;
931 }
932
933 // does the filter have nodes
934 if (FilterDescription->NodeCount)
935 {
936 // allocate topology node types array
937 Descriptor->Topology->TopologyNodes = (const GUID *)AllocateItem(NonPagedPool, sizeof(GUID) * FilterDescription->NodeCount, TAG_PORTCLASS);
938 if (!Descriptor->Topology->TopologyNodes)
939 goto cleanup;
940
941 // allocate topology node names array
942 Descriptor->Topology->TopologyNodesNames = (const GUID *)AllocateItem(NonPagedPool, sizeof(GUID) * FilterDescription->NodeCount, TAG_PORTCLASS);
943 if (!Descriptor->Topology->TopologyNodesNames)
944 goto cleanup;
945
946 // grab first entry
947 NodeDescriptor = (PPCNODE_DESCRIPTOR)FilterDescription->Nodes;
948
949 // iterate all nodes and copy node types / names and node properties
950 for(Index = 0; Index < FilterDescription->NodeCount; Index++)
951 {
952 // does it have a type
953 if (NodeDescriptor->Type)
954 {
955 // copy node type
956 RtlMoveMemory((PVOID)&Descriptor->Topology->TopologyNodes[Index], NodeDescriptor->Type, sizeof(GUID));
957 }
958
959 // does it have a node name
960 if (NodeDescriptor->Name)
961 {
962 // copy node name
963 RtlMoveMemory((PVOID)&Descriptor->Topology->TopologyNodesNames[Index], NodeDescriptor->Name, sizeof(GUID));
964 }
965
966 // check if has an automation table
967 if (NodeDescriptor->AutomationTable)
968 {
969 // grab first entry
970 PropertyItem = (PPCPROPERTY_ITEM)NodeDescriptor->AutomationTable->Properties;
971
972 // copy all node properties into the global property set
973 for(SubIndex = 0; SubIndex < NodeDescriptor->AutomationTable->PropertyCount; SubIndex++)
974 {
975 // add to property set
977
978 // check for success
979 if (Status != STATUS_SUCCESS)
980 {
981 // failed
982 goto cleanup;
983 }
984
985 // move to next property item
986 PropertyItem = (PPCPROPERTY_ITEM)((ULONG_PTR)PropertyItem + NodeDescriptor->AutomationTable->PropertyItemSize);
987 }
988 }
989
990 // move to next descriptor
991 NodeDescriptor = (PPCNODE_DESCRIPTOR)((ULONG_PTR)NodeDescriptor + FilterDescription->NodeSize);
992 }
993
994 // now store the topology node count
995 Descriptor->Topology->TopologyNodesCount = FilterDescription->NodeCount;
996 }
997
998 // store descriptor
999 Descriptor->DeviceDescriptor = FilterDescription;
1000
1001 // store result
1002 *OutSubdeviceDescriptor = Descriptor;
1003 // done
1004 return STATUS_SUCCESS;
1005
1006cleanup:
1007 if (Descriptor)
1008 {
1009 if (Descriptor->Interfaces)
1010 FreeItem(Descriptor->Interfaces, TAG_PORTCLASS);
1011
1012 if (Descriptor->Factory.KsPinDescriptor)
1013 FreeItem(Descriptor->Factory.KsPinDescriptor, TAG_PORTCLASS);
1014
1016 }
1017 return Status;
1018}
struct SUBDEVICE_DESCRIPTOR * PSUBDEVICE_DESCRIPTOR
struct PIN_INSTANCE_INFO * PPIN_INSTANCE_INFO
LONG NTSTATUS
Definition: precomp.h:26
static void cleanup(void)
Definition: main.c:1335
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
Status
Definition: gdiplustypes.h:24
struct KSTOPOLOGY * PKSTOPOLOGY
static GUID InterfaceGuids[3]
Definition: port_dmus.cpp:42
struct PCPROPERTY_ITEM * PPCPROPERTY_ITEM
struct PCNODE_DESCRIPTOR * PPCNODE_DESCRIPTOR
struct PCPIN_DESCRIPTOR * PPCPIN_DESCRIPTOR
const KSNODE_DESCRIPTOR NodeDescriptor[]
Definition: splitter.c:217
_In_ const GUID _In_ ULONG PinCount
Definition: strmini.h:505
const PCPROPERTY_ITEM * Properties
Definition: portcls.h:321
ULONG PropertyItemSize
Definition: portcls.h:319
ULONG MaxGlobalInstanceCount
Definition: portcls.h:339
ULONG MinFilterInstanceCount
Definition: portcls.h:341
KSPIN_DESCRIPTOR KsPinDescriptor
Definition: portcls.h:343
const PCAUTOMATION_TABLE * AutomationTable
Definition: portcls.h:342
ULONG MaxFilterInstanceCount
Definition: portcls.h:340
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
uint32_t ULONG_PTR
Definition: typedefs.h:65
NTSTATUS PcAddToPropertyTable(IN PSUBDEVICE_DESCRIPTOR SubDeviceDescriptor, IN PPCPROPERTY_ITEM PropertyItem, IN ULONG bNode)
Definition: undoc.cpp:306
struct KSTOPOLOGY_CONNECTION * PKSTOPOLOGY_CONNECTION
_Must_inspect_result_ _In_ WDFIORESLIST _In_ PIO_RESOURCE_DESCRIPTOR Descriptor
Definition: wdfresource.h:342

◆ PcHandleDisableEventWithTable()

NTSTATUS NTAPI PcHandleDisableEventWithTable ( IN PIRP  Irp,
IN PSUBDEVICE_DESCRIPTOR  Descriptor 
)

Definition at line 64 of file undoc.cpp.

67{
68 // store descriptor
69 KSEVENT_ITEM_IRP_STORAGE(Irp) = (PKSEVENT_ITEM)Descriptor;
70
71 // FIXME seh probing
72
73 return KsDisableEvent(Irp, Descriptor->EventList, KSEVENTS_SPINLOCK, (PVOID)Descriptor->EventListLock);
74}
KSDDKAPI NTSTATUS NTAPI KsDisableEvent(IN PIRP Irp, IN OUT PLIST_ENTRY EventsList, IN KSEVENTS_LOCKTYPE EventsFlags, IN PVOID EventsLock)
Definition: event.c:469
@ KSEVENTS_SPINLOCK
Definition: ks.h:1233

◆ PcHandleEnableEventWithTable()

NTSTATUS NTAPI PcHandleEnableEventWithTable ( IN PIRP  Irp,
IN PSUBDEVICE_DESCRIPTOR  Descriptor 
)

Definition at line 51 of file undoc.cpp.

54{
55 // store descriptor
56 KSEVENT_ITEM_IRP_STORAGE(Irp) = (PKSEVENT_ITEM)Descriptor;
57
58 // FIXME seh probing
59 return KsEnableEvent(Irp, Descriptor->EventSetCount, Descriptor->EventSet, NULL, KSEVENTS_NONE, NULL);
60}
KSDDKAPI NTSTATUS NTAPI KsEnableEvent(IN PIRP Irp, IN ULONG EventSetsCount, IN KSEVENT_SET *EventSet, IN OUT PLIST_ENTRY EventsList OPTIONAL, IN KSEVENTS_LOCKTYPE EventsFlags OPTIONAL, IN PVOID EventsLock OPTIONAL)
Definition: event.c:387
@ KSEVENTS_NONE
Definition: ks.h:1232

◆ PcHandlePropertyWithTable()

NTSTATUS NTAPI PcHandlePropertyWithTable ( IN PIRP  Irp,
IN ULONG  PropertySetCount,
IN PKSPROPERTY_SET  PropertySet,
IN PSUBDEVICE_DESCRIPTOR  SubDeviceDescriptor 
)

Definition at line 78 of file undoc.cpp.

83{
84 PIO_STACK_LOCATION IoStack;
85
86 // get current irp stack location
88
89 if (IoStack->Parameters.DeviceIoControl.InputBufferLength < sizeof(KSPROPERTY))
90 {
91 // certainly an invalid request
93 }
94
95 // store device descriptor
96 KSPROPERTY_ITEM_IRP_STORAGE(Irp) = (PKSPROPERTY_ITEM)SubDeviceDescriptor;
97
98 // then try KsPropertyHandler
99 return KsPropertyHandler(Irp, PropertySetCount, PropertySet);
100}
KSDDKAPI NTSTATUS NTAPI KsPropertyHandler(IN PIRP Irp, IN ULONG PropertySetsCount, IN const KSPROPERTY_SET *PropertySet)
Definition: property.c:358
union _IO_STACK_LOCATION::@1708 Parameters
struct _IO_STACK_LOCATION::@1708::@1709 DeviceIoControl
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135

Referenced by CPortPinWavePci::HandleKsProperty().

◆ PcValidateConnectRequest()

NTSTATUS NTAPI PcValidateConnectRequest ( IN PIRP  Irp,
IN KSPIN_FACTORY Factory,
OUT PKSPIN_CONNECT Connect 
)

Definition at line 1022 of file undoc.cpp.

1026{
1027 return KsValidateConnectRequest(Irp, Factory->PinDescriptorCount, Factory->KsPinDescriptor, Connect);
1028}
KSDDKAPI NTSTATUS NTAPI KsValidateConnectRequest(IN PIRP Irp, IN ULONG DescriptorsCount, IN KSPIN_DESCRIPTOR *Descriptor, OUT PKSPIN_CONNECT *Connect)
Definition: connectivity.c:222
_In_ PKSPIN_CONNECT Connect
Definition: ks.h:4536

◆ PropertyItemDispatch()

NTSTATUS NTAPI PropertyItemDispatch ( IN PIRP  Irp,
IN PKSIDENTIFIER  Request,
IN OUT PVOID  Data 
)

Definition at line 130 of file undoc.cpp.

134{
135 PPCPROPERTY_REQUEST PropertyRequest;
139 PKSNODEPROPERTY NodeProperty;
140 PKSPROPERTY_SET PropertySet;
142 PPCAUTOMATION_TABLE NodeAutomation;
143 PIO_STACK_LOCATION IoStack;
144 ULONG InstanceSize, ValueSize, Index;
147
148 // allocate a property request
150 if (!PropertyRequest)
152
153 // grab device descriptor
154 Descriptor = (PSUBDEVICE_DESCRIPTOR)KSPROPERTY_ITEM_IRP_STORAGE(Irp);
155
156 // get current irp stack
158
159 // get input property request
161
162 // get property set
163 PropertySet = (PKSPROPERTY_SET)KSPROPERTY_SET_IRP_STORAGE(Irp);
164
165 // sanity check
167 PC_ASSERT(Descriptor->UnknownMiniport);
168
169 // get instance / value size
170 InstanceSize = IoStack->Parameters.DeviceIoControl.InputBufferLength;
172 ValueSize = IoStack->Parameters.DeviceIoControl.OutputBufferLength;
173
174 // initialize property request
175 PropertyRequest->MajorTarget = Descriptor->UnknownMiniport;
176 PropertyRequest->MinorTarget = Descriptor->UnknownStream;
177 PropertyRequest->Irp = Irp;
178 PropertyRequest->Verb = Property->Flags;
179
180 // check if this is filter / pin property request
181 if (!(Property->Flags & KSPROPERTY_TYPE_TOPOLOGY))
182 {
183 // adjust input buffer size
184 InstanceSize -= sizeof(KSPROPERTY);
186
187 // filter / pin property request dont use node field
188 PropertyRequest->Node = MAXULONG;
189 }
190 else if (InstanceSize >= sizeof(KSNODEPROPERTY))
191 {
192 // request is for a node
193 InstanceSize -= sizeof(KSNODEPROPERTY);
195
196 // cast node property request
197 NodeProperty = (PKSNODEPROPERTY)Request;
198
199 // store node id
200 PropertyRequest->Node = NodeProperty->NodeId;
201 }
202 else
203 {
204 // invalid buffer size
205 FreeItem(PropertyRequest, TAG_PORTCLASS);
207 }
208
209 // store instance size
210 PropertyRequest->InstanceSize = InstanceSize;
211 PropertyRequest->Instance = (InstanceSize != 0 ? Instance : NULL);
212
213 // store value size
214 PropertyRequest->ValueSize = ValueSize;
215 PropertyRequest->Value = Data;
216
217 // now scan the property set for the attached property set item stored in Relations member
218 if (PropertySet)
219 {
220 // sanity check
221 PC_ASSERT(IsEqualGUIDAligned(Property->Set, *PropertySet->Set));
222
223 for(Index = 0; Index < PropertySet->PropertiesCount; Index++)
224 {
225 // check if they got the same property id
226 if (PropertySet->PropertyItem[Index].PropertyId == Property->Id)
227 {
228 // found item
229 PropertyRequest->PropertyItem = (const PCPROPERTY_ITEM*)PropertySet->PropertyItem[Index].Relations;
230
231 // done
232 break;
233 }
234 }
235 }
236
237 // check if there has been a property set item attached
238 if (!PropertyRequest->PropertyItem)
239 {
240 // is topology node id valid
241 if (PropertyRequest->Node < Descriptor->DeviceDescriptor->NodeCount)
242 {
243 // get node descriptor
244 NodeDescriptor = (PPCNODE_DESCRIPTOR) ((ULONG_PTR)Descriptor->DeviceDescriptor->Nodes + PropertyRequest->Node * Descriptor->DeviceDescriptor->NodeSize);
245
246 // get node automation table
247 NodeAutomation = (PPCAUTOMATION_TABLE)NodeDescriptor->AutomationTable;
248
249 // has it got a automation table
250 if (NodeAutomation)
251 {
252 // now scan the properties and check if it supports this request
253 PropertyItem = (PPCPROPERTY_ITEM)NodeAutomation->Properties;
254 for(Index = 0; Index < NodeAutomation->PropertyCount; Index++)
255 {
256 // are they same property
258 {
259 if (PropertyItem->Id == Property->Id)
260 {
261 // found match
262 PropertyRequest->PropertyItem = PropertyItem;
263 DPRINT("Using property item %p\n", PropertyItem);
264 // done
265 break;
266 }
267 }
268
269 // move to next property item
271 }
272 }
273 }
274 }
275
276 if (PropertyRequest->PropertyItem && PropertyRequest->PropertyItem->Handler)
277 {
278 // now call the handler
279 UNICODE_STRING GuidBuffer;
280 RtlStringFromGUID(Property->Set, &GuidBuffer);
281 DPRINT("Calling Node %lu MajorTarget %p MinorTarget %p PropertySet %S PropertyId %lu PropertyFlags %lx InstanceSize %lu ValueSize %lu Handler %p PropertyRequest %p PropertyItemFlags %lx PropertyItemId %lu\n",
282 PropertyRequest->Node, PropertyRequest->MajorTarget, PropertyRequest->MinorTarget, GuidBuffer.Buffer, Property->Id, Property->Flags, PropertyRequest->InstanceSize, PropertyRequest->ValueSize,
283 PropertyRequest->PropertyItem->Handler, PropertyRequest, PropertyRequest->PropertyItem->Flags, PropertyRequest->PropertyItem->Id);
284 RtlFreeUnicodeString(&GuidBuffer);
285 Status = PropertyRequest->PropertyItem->Handler(PropertyRequest);
286 DPRINT("Status %lx ValueSize %lu Information %lu\n", Status, PropertyRequest->ValueSize, Irp->IoStatus.Information);
287 Irp->IoStatus.Information = PropertyRequest->ValueSize;
288
289 if (Status != STATUS_PENDING)
290 {
291 // free property request
292 FreeItem(PropertyRequest, TAG_PORTCLASS);
293 }
294 }
295 else
296 {
297 FreeItem(PropertyRequest, TAG_PORTCLASS);
299 }
300
301 /* done */
302 return Status;
303}
#define KSPROPERTY_TYPE_TOPOLOGY
Definition: dmksctrl.h:53
struct KSIDENTIFIER KSPROPERTY
struct KSIDENTIFIER * PKSPROPERTY
struct KSNODEPROPERTY * PKSNODEPROPERTY
if(dx< 0)
Definition: linetemp.h:194
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
#define STATUS_INVALID_BUFFER_SIZE
Definition: ntstatus.h:772
struct _PCPROPERTY_REQUEST * PPCPROPERTY_REQUEST
Definition: portcls.h:230
struct PCAUTOMATION_TABLE * PPCAUTOMATION_TABLE
#define STATUS_NOT_FOUND
Definition: shellext.h:72
#define DPRINT
Definition: sndvol32.h:73
ULONG NodeId
Definition: ksmedia.h:1234
PCPFNPROPERTY_HANDLER Handler
Definition: portcls.h:253
PUNKNOWN MinorTarget
Definition: portcls.h:259
const PCPROPERTY_ITEM * PropertyItem
Definition: portcls.h:261
PUNKNOWN MajorTarget
Definition: portcls.h:258
#define STATUS_PENDING
Definition: telnetd.h:14
#define MAXULONG
Definition: typedefs.h:251
void * PVOID
Definition: typedefs.h:50
_In_ WDFREQUEST Request
Definition: wdfdevice.h:547
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_WMI_INSTANCE_CONFIG _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_opt_ WDFWMIINSTANCE * Instance
Definition: wdfwmi.h:481
NTSYSAPI NTSTATUS WINAPI RtlStringFromGUID(REFGUID, PUNICODE_STRING)

Referenced by PcAddToPropertyTable().