7#ifndef PORTCLS_PRIVATE_H
8#define PORTCLS_PRIVATE_H
13#define PC_IMPLEMENTATION
14#define COM_STDMETHOD_CAN_THROW
24#define TAG_PORTCLASS 'SLCP'
26#define PC_ASSERT(exp) \
28 RtlAssert((PVOID) #exp, (PVOID)__FILE__, __LINE__, NULL ), FALSE : TRUE)
30#define PC_ASSERT_IRQL(x) PC_ASSERT(KeGetCurrentIrql() <= (x))
31#define PC_ASSERT_IRQL_EQUAL(x) PC_ASSERT(KeGetCurrentIrql()==(x))
108 OUT IPortFilterWaveCyclic ** OutFilter);
112 OUT IPortPinWaveCyclic ** OutPin);
116 OUT IPortFilterWavePci ** OutFilter);
120 OUT IPortPinWavePci ** OutPin);
124 IPortWavePci* iface);
128 IPortWavePci* iface);
146 IN IPortDMus * iface,
150#if (NTDDI_VERSION >= NTDDI_VISTA)
154 OUT IPortFilterWaveRT ** OutFilter);
158 OUT IPortPinWaveRT ** OutPin);
162 IN IPortWaveRT* iface);
182 OUT IPortFilterTopology ** OutFilter);
193 IN ULONG ObjectCreateItemCount,
194 IN PKSOBJECT_CREATE_ITEM ObjectCreateItem);
198 IN IPortWaveCyclic* iface);
270 IN ULONG FilterPropertiesCount,
271 IN KSPROPERTY_SET * FilterProperties,
275 IN KSPROPERTY_SET * PinProperties,
277 IN KSEVENT_SET * EventSet,
297 IPortWaveCyclic* iface);
320 IN PKSPROPERTY_SET PropertySet,
340#define DEFINE_KSPROPERTY_CONNECTIONSET(PinSet,\
341 PropStateHandler, PropDataFormatHandler, PropAllocatorFraming)\
342DEFINE_KSPROPERTY_TABLE(PinSet) {\
343 DEFINE_KSPROPERTY_ITEM_CONNECTION_STATE(PropStateHandler, PropStateHandler),\
344 DEFINE_KSPROPERTY_ITEM_CONNECTION_DATAFORMAT(PropDataFormatHandler, PropDataFormatHandler),\
345 DEFINE_KSPROPERTY_ITEM_CONNECTION_ALLOCATORFRAMING(PropAllocatorFraming)\
348#define DEFINE_KSPROPERTY_ITEM_AUDIO_POSITION(GetHandler, SetHandler)\
349 DEFINE_KSPROPERTY_ITEM(\
350 KSPROPERTY_AUDIO_POSITION,\
353 sizeof(KSAUDIO_POSITION),\
355 NULL, 0, NULL, NULL, 0)
357#define DEFINE_KSPROPERTY_AUDIOSET(PinSet,\
358 PropPositionHandler)\
359DEFINE_KSPROPERTY_TABLE(PinSet) {\
360 DEFINE_KSPROPERTY_ITEM_AUDIO_POSITION(PropPositionHandler, PropPositionHandler)\
364#define DEFINE_KSPROPERTY_ITEM_DRMAUDIOSTREAM_CONTENTID(SetHandler)\
365 DEFINE_KSPROPERTY_ITEM(\
366 KSPROPERTY_DRMAUDIOSTREAM_CONTENTID,\
371 NULL, 0, NULL, NULL, 0)
373#define DEFINE_KSPROPERTY_DRMSET(PinSet,\
374 PropPositionHandler)\
375DEFINE_KSPROPERTY_TABLE(PinSet) {\
376 DEFINE_KSPROPERTY_ITEM_DRMAUDIOSTREAM_CONTENTID(PropPositionHandler)\
379#define DEFINE_KSPROPERTY_PINPROPOSEDATAFORMAT(PinSet,\
380 PropGeneral, PropInstances, PropIntersection)\
381DEFINE_KSPROPERTY_TABLE(PinSet) {\
382 DEFINE_KSPROPERTY_ITEM_PIN_CINSTANCES(PropInstances),\
383 DEFINE_KSPROPERTY_ITEM_PIN_CTYPES(PropGeneral),\
384 DEFINE_KSPROPERTY_ITEM_PIN_DATAFLOW(PropGeneral),\
385 DEFINE_KSPROPERTY_ITEM_PIN_DATARANGES(PropGeneral),\
386 DEFINE_KSPROPERTY_ITEM_PIN_DATAINTERSECTION(PropIntersection),\
387 DEFINE_KSPROPERTY_ITEM_PIN_INTERFACES(PropGeneral),\
388 DEFINE_KSPROPERTY_ITEM_PIN_MEDIUMS(PropGeneral),\
389 DEFINE_KSPROPERTY_ITEM_PIN_COMMUNICATION(PropGeneral),\
390 DEFINE_KSPROPERTY_ITEM_PIN_GLOBALCINSTANCES(PropGeneral),\
391 DEFINE_KSPROPERTY_ITEM_PIN_NECESSARYINSTANCES(PropGeneral),\
392 DEFINE_KSPROPERTY_ITEM_PIN_PHYSICALCONNECTION(PropGeneral),\
393 DEFINE_KSPROPERTY_ITEM_PIN_CATEGORY(PropGeneral),\
394 DEFINE_KSPROPERTY_ITEM_PIN_NAME(PropGeneral),\
395 DEFINE_KSPROPERTY_ITEM_PIN_CONSTRAINEDDATARANGES(PropGeneral),\
396 DEFINE_KSPROPERTY_ITEM_PIN_PROPOSEDATAFORMAT(PropGeneral)\
442template<
typename... Interfaces>
#define InterlockedIncrement
#define InterlockedDecrement
IPortFilterDMus * PPORTFILTERDMUS
IPortPinDMus * PPORTPINDMUS
STDMETHODIMP_(ULONG) Release()
STDMETHODIMP_(ULONG) AddRef()
IMiniportDMus * PMINIPORTDMUS
return pDevice GetDeviceObject()
_In_ PKSPIN_CONNECT Connect
static ULONG WINAPI AddRef(IStream *iface)
_In_ BOOLEAN Dma64BitAddresses
enum _DEVICE_POWER_STATE DEVICE_POWER_STATE
enum _SYSTEM_POWER_STATE SYSTEM_POWER_STATE
static GUID InterfaceGuids[3]
IMiniportWaveCyclic * PMINIPORTWAVECYCLIC
IMiniportWaveRT * PMINIPORTWAVERT
IMiniportTopology * PMINIPORTTOPOLOGY
IResourceList * PRESOURCELIST
IPortWaveRTStream * PPORTWAVERTSTREAM
IUnregisterSubdevice * PUNREGISTERSUBDEVICE
IPortClsVersion * PPORTCLSVERSION
IUnregisterPhysicalConnection * PUNREGISTERPHYSICALCONNECTION
NTSTATUS(NTAPI * PCPFNSTARTDEVICE)(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PRESOURCELIST ResourceList)
IMiniportWavePci * PMINIPORTWAVEPCI
IMiniportMidi * PMINIPORTMIDI
IPortTopology * PPORTTOPOLOGY
IPortWavePci * PPORTWAVEPCI
NTSTATUS NewPortWavePci(OUT PPORT *OutPort)
PMINIPORTWAVERT GetWaveRTMiniport(IN IPortWaveRT *iface)
NTSTATUS NewPortFilterDMus(OUT PPORTFILTERDMUS *OutFilter)
NTSTATUS NTAPI PcValidateConnectRequest(IN PIRP Irp, IN KSPIN_FACTORY *Descriptor, OUT PKSPIN_CONNECT *Connect)
NTSTATUS NTAPI PinPropertyHandler(IN PIRP Irp, IN PKSIDENTIFIER Request, IN OUT PVOID Data)
NTSTATUS NewPortPinWaveRT(OUT IPortPinWaveRT **OutPin)
struct CLOSESTREAM_CONTEXT * PCLOSESTREAM_CONTEXT
NTSTATUS NewPortDMus(OUT PPORT *OutPort)
NTSTATUS NTAPI NewDispatchObject(IN PIRP Irp, IN IIrpTarget *Target, IN ULONG ObjectCreateItemCount, IN PKSOBJECT_CREATE_ITEM ObjectCreateItem)
NTSTATUS NewPortPinWavePci(OUT IPortPinWavePci **OutPin)
NTSTATUS NTAPI PortClsPnp(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
NTSTATUS NewIDrmPort(OUT PDRMPORT2 *OutPort)
PVOID AllocateItem(IN POOL_TYPE PoolType, IN SIZE_T NumberOfBytes, IN ULONG Tag)
NTSTATUS NewMiniportDMusUART(OUT PMINIPORT *OutMiniport, IN REFCLSID ClassId)
NTSTATUS NTAPI PcDmaSlaveDescription(IN PRESOURCELIST ResourceList OPTIONAL, IN ULONG DmaIndex, IN BOOLEAN DemandMode, IN BOOLEAN AutoInitialize, IN DMA_SPEED DmaSpeed, IN ULONG MaximumLength, IN ULONG DmaPort, OUT PDEVICE_DESCRIPTION DeviceDescription)
PDEVICE_OBJECT GetDeviceObjectFromPortWavePci(IPortWavePci *iface)
NTSTATUS NewPortWaveRT(OUT PPORT *OutPort)
NTSTATUS NTAPI NewIUnregisterSubdevice(OUT PUNREGISTERSUBDEVICE *OutDevice)
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)
struct DISPATCH_CONTEXT * PDISPATCH_CONTEXT
struct TIMER_CONTEXT * PTIMER_CONTEXT
NTSTATUS NewPortFilterTopology(OUT IPortFilterTopology **OutFilter)
NTSTATUS NewPortFilterWaveCyclic(OUT IPortFilterWaveCyclic **OutFilter)
IIrpTarget *NTAPI KsoGetIrpTargetFromIrp(PIRP Irp)
PMINIPORTTOPOLOGY GetTopologyMiniport(PPORTTOPOLOGY Port)
NTSTATUS NTAPI PcHandleDisableEventWithTable(IN PIRP Irp, IN PSUBDEVICE_DESCRIPTOR Descriptor)
NTSTATUS NewPortClsVersion(OUT PPORTCLSVERSION *OutVersion)
struct PCLASS_DEVICE_EXTENSION * PPCLASS_DEVICE_EXTENSION
NTSTATUS NTAPI PcCreateItemDispatch(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
NTSTATUS NTAPI TopologyPropertyHandler(IN PIRP Irp, IN PKSIDENTIFIER Request, IN OUT PVOID Data)
NTSTATUS NewPortWaveRTStream(PPORTWAVERTSTREAM *OutStream)
NTSTATUS NewPortFilterWaveRT(OUT IPortFilterWaveRT **OutFilter)
PDEVICE_OBJECT GetDeviceObjectFromPortWaveRT(IPortWaveRT *iface)
NTSTATUS NTAPI PortClsPower(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
NTSTATUS NTAPI NewIrpQueue(IN IIrpQueue **Queue)
NTSTATUS NTAPI NewIUnregisterPhysicalConnection(OUT PUNREGISTERPHYSICALCONNECTION *OutConnection)
NTSTATUS NewPortPinWaveCyclic(OUT IPortPinWaveCyclic **OutPin)
PMINIPORTWAVECYCLIC GetWaveCyclicMiniport(IN IPortWaveCyclic *iface)
NTSTATUS NTAPI PcDmaMasterDescription(IN PRESOURCELIST ResourceList OPTIONAL, IN BOOLEAN ScatterGather, IN BOOLEAN Dma32BitAddresses, IN BOOLEAN IgnoreCount, IN BOOLEAN Dma64BitAddresses, IN DMA_WIDTH DmaWidth, IN DMA_SPEED DmaSpeed, IN ULONG MaximumLength, IN ULONG DmaPort, OUT PDEVICE_DESCRIPTION DeviceDescription)
NTSTATUS NewPortPinDMus(OUT PPORTPINDMUS *OutPin)
NTSTATUS NTAPI PortClsCreate(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
PDEVICE_OBJECT GetDeviceObjectFromWaveCyclic(IPortWavePci *iface)
VOID NTAPI PcIoTimerRoutine(IN PDEVICE_OBJECT DeviceObject, IN PVOID Context)
NTSTATUS NewPortFilterWavePci(OUT IPortFilterWavePci **OutFilter)
NTSTATUS NTAPI PortClsSysControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
NTSTATUS NTAPI PcHandleEnableEventWithTable(IN PIRP Irp, IN PSUBDEVICE_DESCRIPTOR Descriptor)
NTSTATUS NewPortWaveCyclic(OUT PPORT *OutPort)
VOID FreeItem(IN PVOID Item, IN ULONG Tag)
NTSTATUS NewPortTopology(OUT PPORT *OutPort)
NTSTATUS NewMiniportFmSynth(OUT PMINIPORT *OutMiniport, IN REFCLSID ClassId)
VOID GetDMusMiniport(IN IPortDMus *iface, IN PMINIPORTDMUS *Miniport, IN PMINIPORTMIDI *MidiMiniport)
PMINIPORTWAVEPCI GetWavePciMiniport(PPORTWAVEPCI Port)
NTSTATUS NTAPI PcHandlePropertyWithTable(IN PIRP Irp, IN ULONG PropertySetCount, IN PKSPROPERTY_SET PropertySet, IN PSUBDEVICE_DESCRIPTOR Descriptor)
enum _DMA_SPEED DMA_SPEED
enum _DMA_WIDTH DMA_WIDTH
PULONG MinorVersion OPTIONAL
PKSOBJECT_CREATE_ITEM CreateItem
KSOBJECT_HEADER ObjectHeader
IResourceList * resources
KSDEVICE_HEADER KsDeviceHeader
PDEVICE_OBJECT PhysicalDeviceObject
PDEVICE_OBJECT PrevDeviceObject
IAdapterPowerManagement * AdapterPowerManagement
SYSTEM_POWER_STATE SystemPowerState
KSOBJECT_CREATE_ITEM * CreateItems
PCPFNSTARTDEVICE StartDevice
DEVICE_POWER_STATE DevicePowerState
PIO_TIMER_ROUTINE pTimerRoutine
_In_ WDFCOLLECTION _In_ WDFOBJECT Item
_In_ PDEVICE_OBJECT DeviceObject
_Must_inspect_result_ _In_ WDFDEVICE _In_ BOOLEAN _In_opt_ PVOID Tag
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ _Strict_type_match_ POOL_TYPE PoolType
_Must_inspect_result_ _In_ WDFDEVICE _In_ PIRP _In_ WDFQUEUE Queue
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
_In_ WDFDMATRANSACTION _In_ size_t MaximumLength
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_ PCUNICODE_STRING DeviceDescription
_Must_inspect_result_ _In_ WDFIORESREQLIST _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFIORESLIST * ResourceList
_Must_inspect_result_ _In_ WDFIORESLIST _In_ PIO_RESOURCE_DESCRIPTOR Descriptor
_In_ struct _IRP _In_ struct _SCATTER_GATHER_LIST * ScatterGather
IO_TIMER_ROUTINE * PIO_TIMER_ROUTINE
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS _Inout_ PLARGE_INTEGER NumberOfBytes