49 return (IIrpTarget*)IoStack->
FileObject->FsContext;
84 IN PKSPROPERTY_SET PropertySet,
99 KSPROPERTY_ITEM_IRP_STORAGE(
Irp) = (PKSPROPERTY_ITEM)SubDeviceDescriptor;
144 PKSPROPERTY_SET PropertySet;
154 if (!PropertyRequest)
167 PropertySet = (PKSPROPERTY_SET)KSPROPERTY_SET_IRP_STORAGE(
Irp);
174 InstanceSize = IoStack->
Parameters.DeviceIoControl.InputBufferLength;
176 ValueSize = IoStack->
Parameters.DeviceIoControl.OutputBufferLength;
181 PropertyRequest->
Irp =
Irp;
231 if (PropertySet->PropertyItem[
Index].PropertyId ==
Property->Id)
246 if (PropertyRequest->
Node <
Descriptor->DeviceDescriptor->NodeCount)
259 for(
Index = 0; Index < NodeAutomation->PropertyCount;
Index++)
286 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",
291 DPRINT(
"Status %lx ValueSize %lu Information %lu\n",
Status, PropertyRequest->
ValueSize,
Irp->IoStatus.Information);
317 ULONG Index, PropertySetIndex, PropertySetItemIndex;
318 PKSPROPERTY_SET NewPropertySet;
331 for(
Index = 0;
Index < SubDeviceDescriptor->FilterPropertySetCount;
Index++)
340 PropertySetIndex =
Index;
368 if (SubDeviceDescriptor->FilterPropertySetCount)
371 RtlMoveMemory(NewPropertySet, SubDeviceDescriptor->FilterPropertySet, SubDeviceDescriptor->FilterPropertySetCount *
sizeof(KSPROPERTY_SET));
378 SubDeviceDescriptor->FilterPropertySet = NewPropertySet;
381 PropertySetIndex = SubDeviceDescriptor->FilterPropertySetCount;
384 SubDeviceDescriptor->FilterPropertySetCount++;
390 SubDeviceDescriptor->FilterPropertySet[PropertySetIndex].Set =
Guid;
391 SubDeviceDescriptor->FilterPropertySet[PropertySetIndex].PropertiesCount = 0;
395 FilterPropertyItem = (PKSPROPERTY_ITEM)SubDeviceDescriptor->FilterPropertySet[PropertySetIndex].PropertyItem;
405 PropertySetItemIndex =
Index;
416 NewFilterPropertyItem = (PKSPROPERTY_ITEM)
AllocateItem(
NonPagedPool, (SubDeviceDescriptor->FilterPropertySet[PropertySetIndex].PropertiesCount + 1) *
sizeof(KSPROPERTY_ITEM),
TAG_PORTCLASS);
417 if (!NewFilterPropertyItem)
424 if (SubDeviceDescriptor->FilterPropertySet[PropertySetIndex].PropertiesCount)
428 (
PVOID)SubDeviceDescriptor->FilterPropertySet[PropertySetIndex].PropertyItem,
429 SubDeviceDescriptor->FilterPropertySet[PropertySetIndex].PropertiesCount *
sizeof(KSPROPERTY_ITEM));
436 SubDeviceDescriptor->FilterPropertySet[PropertySetIndex].PropertyItem = NewFilterPropertyItem;
439 PropertySetItemIndex = SubDeviceDescriptor->FilterPropertySet[PropertySetIndex].PropertiesCount;
442 SubDeviceDescriptor->FilterPropertySet[PropertySetIndex].PropertiesCount++;
445 FilterPropertyItem = (PKSPROPERTY_ITEM)&SubDeviceDescriptor->FilterPropertySet[PropertySetIndex].PropertyItem[PropertySetItemIndex];
495 ASSERT(SubDeviceDescriptor->FilterPropertySet[PropertySetIndex].PropertyItem[PropertySetItemIndex].Relations ==
NULL);
500 ASSERT(SubDeviceDescriptor->FilterPropertySet[PropertySetIndex].PropertyItem[PropertySetItemIndex].Relations !=
NULL);
534 if (!AutomationTable)
540 DPRINT(
"=====================================================================\n");
541 DPRINT(
"%S%S AutomationTable %p\n", DebugIndentation, DebugPrefix, AutomationTable);
542 DPRINT(
"%S%S PropertyCount %lu\n", DebugIndentation, DebugPrefix, AutomationTable->PropertyCount);
543 DPRINT(
"%S%S EventCount %lu\n", DebugIndentation, DebugPrefix, AutomationTable->EventCount);
544 DPRINT(
"%S%S MethodCount %lu\n", DebugIndentation, DebugPrefix, AutomationTable->MethodCount);
547 if (AutomationTable->PropertyCount)
571 DPRINT1(
"DRIVER BUG: property item must be at least %lu but got %lu\n",
sizeof(
PCPROPERTY_ITEM), AutomationTable->PropertyItemSize);
576 if (AutomationTable->EventCount)
578 if (AutomationTable->EventItemSize >=
sizeof(
PCEVENT_ITEM))
590 DPRINT(
"%SEventItemIndex %lu %p GUID %S Id %u Flags %x\n", DebugIndentation,
Index, EventItem,
GuidString.Buffer, EventItem->
Id, EventItem->
Flags);
599 DPRINT1(
"DRIVER BUG: event item must be at least %lu but got %lu\n",
sizeof(
PCEVENT_ITEM), AutomationTable->EventItemSize);
604 if (AutomationTable->MethodCount)
606 if (AutomationTable->MethodItemSize >=
sizeof(
PCMETHOD_ITEM))
618 DPRINT(
"%SMethodItemIndex %lu %p GUID %S Id %u Flags %x\n", DebugIndentation,
Index, MethodItem,
GuidString.Buffer, MethodItem->
Id, MethodItem->
Flags);
628 DPRINT1(
"DRIVER BUG: method item must be at least %lu but got %lu\n",
sizeof(
PCEVENT_ITEM), AutomationTable->MethodItemSize);
631 DPRINT(
"=====================================================================\n");
644 DPRINT(
"======================\n");
645 DPRINT(
"Descriptor Automation Table %p\n",FilterDescription->AutomationTable);
646 DPRINT(
"PinCount %lu PinSize %lu StandardSize %lu\n", FilterDescription->PinCount, FilterDescription->PinSize,
sizeof(
PCPIN_DESCRIPTOR));
647 DPRINT(
"NodeCount %lu NodeSize %lu StandardSize %lu\n", FilterDescription->NodeCount, FilterDescription->NodeSize,
sizeof(
PCNODE_DESCRIPTOR));
653 if (FilterDescription->PinCount)
677 DPRINT1(
"DRIVER BUG: pin size smaller than minimum size\n");
682 if (FilterDescription->Nodes)
706 DPRINT1(
"DRIVER BUG: node size smaller than standard descriptor size\n");
710 DPRINT(
"ConnectionCount: %lu\n", FilterDescription->ConnectionCount);
712 if (FilterDescription->ConnectionCount)
714 DPRINT(
"------ Start of Nodes Connections ----------------\n");
717 DPRINT1(
"Index %ld FromPin %ld FromNode %ld -> ToPin %ld ToNode %ld\n",
Index,
718 FilterDescription->Connections[
Index].FromNodePin,
719 FilterDescription->Connections[
Index].FromNode,
720 FilterDescription->Connections[
Index].ToNodePin,
721 FilterDescription->Connections[
Index].ToNode);
723 DPRINT(
"------ End of Nodes Connections----------------\n");
725 DPRINT1(
"======================\n");
736 IN ULONG FilterPropertiesCount,
737 IN KSPROPERTY_SET * FilterProperties,
741 IN KSPROPERTY_SET * PinProperties,
743 IN KSEVENT_SET * EventSet,
774 if (FilterPropertiesCount)
782 Descriptor->FilterPropertySetCount = FilterPropertiesCount;
805 if (FilterDescription->AutomationTable)
811 for(
Index = 0; Index < FilterDescription->AutomationTable->PropertyCount;
Index++)
829 if (FilterDescription->PinCount)
842 Descriptor->Factory.PinDescriptorCount = FilterDescription->PinCount;
843 Descriptor->Factory.PinDescriptorSize =
sizeof(KSPIN_DESCRIPTOR);
867 for(SubIndex = 0; SubIndex < SrcDescriptor->AutomationTable->PropertyCount; SubIndex++)
895 if (FilterDescription->ConnectionCount)
899 if (!
Descriptor->Topology->TopologyConnections)
906 Descriptor->Topology->TopologyConnectionsCount = FilterDescription->ConnectionCount;
910 if (FilterDescription->NodeCount)
919 if (!
Descriptor->Topology->TopologyNodesNames)
926 for(
Index = 0; Index < FilterDescription->NodeCount;
Index++)
949 for(SubIndex = 0; SubIndex < NodeDescriptor->AutomationTable->PropertyCount; SubIndex++)
971 Descriptor->Topology->TopologyNodesCount = FilterDescription->NodeCount;
975 Descriptor->DeviceDescriptor = FilterDescription;
PRTL_UNICODE_STRING_BUFFER PULONG PULONG Unknown4
struct SUBDEVICE_DESCRIPTOR * PSUBDEVICE_DESCRIPTOR
struct PIN_INSTANCE_INFO * PPIN_INSTANCE_INFO
KSPROPERTY_ITEM FilterPropertyItem[]
KSDDKAPI NTSTATUS NTAPI KsValidateConnectRequest(IN PIRP Irp, IN ULONG DescriptorsCount, IN KSPIN_DESCRIPTOR *Descriptor, OUT PKSPIN_CONNECT *Connect)
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES IN DWORD IN DWORD IN DWORD IN DWORD Unknown6
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES IN DWORD IN DWORD IN DWORD Unknown5
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES IN DWORD Unknown3
static void cleanup(void)
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)
KSDDKAPI NTSTATUS NTAPI KsDisableEvent(IN PIRP Irp, IN OUT PLIST_ENTRY EventsList, IN KSEVENTS_LOCKTYPE EventsFlags, IN PVOID EventsLock)
KSPROPERTY_SET FilterPropertySet[]
KSDDKAPI NTSTATUS NTAPI KsPropertyHandler(IN PIRP Irp, IN ULONG PropertySetsCount, IN const KSPROPERTY_SET *PropertySet)
#define KSPROPERTY_TYPE_TOPOLOGY
struct KSIDENTIFIER KSPROPERTY
struct KSIDENTIFIER * PKSPROPERTY
#define InitializeListHead(ListHead)
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
NTSYSAPI NTSTATUS WINAPI RtlStringFromGUID(REFGUID, PUNICODE_STRING)
struct KSTOPOLOGY * PKSTOPOLOGY
_In_ PKSPIN_CONNECT Connect
PVOID AllocateItem(IN POOL_TYPE PoolType, IN SIZE_T NumberOfBytes)
VOID FreeItem(IN PVOID Item)
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
_In_ ULONG _In_ ULONG _In_ ULONG Length
#define STATUS_INVALID_BUFFER_SIZE
#define STATUS_NOT_IMPLEMENTED
static GUID InterfaceGuids[3]
struct _PCPROPERTY_REQUEST * PPCPROPERTY_REQUEST
#define PCPROPERTY_ITEM_FLAG_SET
struct PCPROPERTY_ITEM * PPCPROPERTY_ITEM
struct _PCMETHOD_ITEM * PPCMETHOD_ITEM
#define PCPROPERTY_ITEM_FLAG_GET
struct PCAUTOMATION_TABLE * PPCAUTOMATION_TABLE
struct _PCEVENT_ITEM * PPCEVENT_ITEM
struct PCNODE_DESCRIPTOR * PPCNODE_DESCRIPTOR
struct PCPIN_DESCRIPTOR * PPCPIN_DESCRIPTOR
#define PCPROPERTY_ITEM_FLAG_BASICSUPPORT
const KSNODE_DESCRIPTOR NodeDescriptor[]
_In_ const GUID _In_ ULONG PinCount
const PCPROPERTY_ITEM * Properties
ULONG MaxGlobalInstanceCount
ULONG MinFilterInstanceCount
KSPIN_DESCRIPTOR KsPinDescriptor
const PCAUTOMATION_TABLE * AutomationTable
ULONG MaxFilterInstanceCount
PCPFNPROPERTY_HANDLER Handler
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
const PCPROPERTY_ITEM * PropertyItem
#define RtlCopyMemory(Destination, Source, Length)
#define RtlMoveMemory(Destination, Source, Length)
#define STATUS_INVALID_PARAMETER
#define STATUS_INSUFFICIENT_RESOURCES
NTSTATUS PcCaptureFormat(LONG Unknown, LONG Unknown2, LONG Unknown3, LONG Unknown4)
NTSTATUS NTAPI PcValidateConnectRequest(IN PIRP Irp, IN KSPIN_FACTORY *Factory, OUT PKSPIN_CONNECT *Connect)
IIrpTarget *NTAPI KsoGetIrpTargetFromFileObject(PFILE_OBJECT FileObject)
NTSTATUS NTAPI PcHandlePropertyWithTable(IN PIRP Irp, IN ULONG PropertySetCount, IN PKSPROPERTY_SET PropertySet, IN PSUBDEVICE_DESCRIPTOR SubDeviceDescriptor)
NTSTATUS NTAPI KsoDispatchCreateWithGenericFactory(LONG Unknown, PIRP Irp)
NTSTATUS NTAPI PropertyItemDispatch(IN PIRP Irp, IN PKSIDENTIFIER Request, IN OUT PVOID Data)
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)
IIrpTarget *NTAPI KsoGetIrpTargetFromIrp(PIRP Irp)
NTSTATUS NTAPI PcHandleDisableEventWithTable(IN PIRP Irp, IN PSUBDEVICE_DESCRIPTOR Descriptor)
NTSTATUS PcAddToPropertyTable(IN PSUBDEVICE_DESCRIPTOR SubDeviceDescriptor, IN PPCPROPERTY_ITEM PropertyItem, IN ULONG bNode)
VOID DumpFilterDescriptor(IN PPCFILTER_DESCRIPTOR FilterDescription)
NTSTATUS PcAddToEventTable(PVOID Ptr, LONG Unknown2, ULONG Length, LONG Unknown3, LONG Unknown4, LONG Unknown5, LONG Unknown6, LONG Unknown7)
NTSTATUS NTAPI PcHandleEnableEventWithTable(IN PIRP Irp, IN PSUBDEVICE_DESCRIPTOR Descriptor)
VOID DumpAutomationTable(IN PPCAUTOMATION_TABLE AutomationTable, IN LPCWSTR DebugPrefix, IN LPCWSTR DebugIndentation)
VOID NTAPI PcAcquireFormatResources(LONG Unknown, LONG Unknown2, LONG Unknown3, LONG Unknown4)
struct KSTOPOLOGY_CONNECTION * PKSTOPOLOGY_CONNECTION
_In_ WDFCOLLECTION _In_ ULONG Index
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
_Must_inspect_result_ _In_ WDFOBJECT _In_ CONST GUID * Guid
_Must_inspect_result_ _In_ WDFIORESLIST _In_ PIO_RESOURCE_DESCRIPTOR Descriptor
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_WMI_INSTANCE_CONFIG _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_opt_ WDFWMIINSTANCE * Instance
#define IsEqualGUIDAligned(guid1, guid2)
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)