ReactOS  0.4.14-dev-608-gd495a4f
private.hpp File Reference
#include <stdio.h>
#include <ntddk.h>
#include <portcls.h>
#include <dmusicks.h>
#include <kcom.h>
#include "interfaces.hpp"
Include dependency graph for private.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  PCLASS_DEVICE_EXTENSION
 
struct  CLOSESTREAM_CONTEXT
 
struct  TIMER_CONTEXT
 
struct  DISPATCH_CONTEXT
 

Macros

#define PC_IMPLEMENTATION
 
#define COM_STDMETHOD_CAN_THROW
 
#define PC_NO_IMPORTS
 
#define TAG_PORTCLASS   'SLCP'
 
#define PC_ASSERT(exp)
 
#define PC_ASSERT_IRQL(x)   PC_ASSERT(KeGetCurrentIrql() <= (x))
 
#define PC_ASSERT_IRQL_EQUAL(x)   PC_ASSERT(KeGetCurrentIrql()==(x))
 
#define DEFINE_KSPROPERTY_CONNECTIONSET(PinSet, PropStateHandler, PropDataFormatHandler, PropAllocatorFraming)
 
#define DEFINE_KSPROPERTY_ITEM_AUDIO_POSITION(GetHandler, SetHandler)
 
#define DEFINE_KSPROPERTY_AUDIOSET(PinSet, PropPositionHandler)
 
#define DEFINE_KSPROPERTY_ITEM_DRMAUDIOSTREAM_CONTENTID(SetHandler)
 
#define DEFINE_KSPROPERTY_DRMSET(PinSet, PropPositionHandler)
 
#define DEFINE_KSPROPERTY_PINPROPOSEDATAFORMAT(PinSet, PropGeneral, PropInstances, PropIntersection)
 

Typedefs

typedef struct PCLASS_DEVICE_EXTENSIONPPCLASS_DEVICE_EXTENSION
 
typedef struct CLOSESTREAM_CONTEXTPCLOSESTREAM_CONTEXT
 
typedef struct TIMER_CONTEXTPTIMER_CONTEXT
 
typedef struct DISPATCH_CONTEXTPDISPATCH_CONTEXT
 

Functions

PVOID __cdecl operator new (size_t Size, POOL_TYPE PoolType, ULONG Tag)
 
NTSTATUS NTAPI PortClsCreate (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
NTSTATUS NTAPI PortClsPnp (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
NTSTATUS NTAPI PortClsPower (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
NTSTATUS NTAPI PortClsSysControl (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
NTSTATUS NewMiniportDMusUART (OUT PMINIPORT *OutMiniport, IN REFCLSID ClassId)
 
NTSTATUS NewMiniportFmSynth (OUT PMINIPORT *OutMiniport, IN REFCLSID ClassId)
 
NTSTATUS NewPortDMus (OUT PPORT *OutPort)
 
NTSTATUS NewPortTopology (OUT PPORT *OutPort)
 
NTSTATUS NewPortWaveCyclic (OUT PPORT *OutPort)
 
NTSTATUS NewPortWavePci (OUT PPORT *OutPort)
 
NTSTATUS NewIDrmPort (OUT PDRMPORT2 *OutPort)
 
NTSTATUS NewPortClsVersion (OUT PPORTCLSVERSION *OutVersion)
 
NTSTATUS NewPortFilterWaveCyclic (OUT IPortFilterWaveCyclic **OutFilter)
 
NTSTATUS NewPortPinWaveCyclic (OUT IPortPinWaveCyclic **OutPin)
 
NTSTATUS NewPortFilterWavePci (OUT IPortFilterWavePci **OutFilter)
 
NTSTATUS NewPortPinWavePci (OUT IPortPinWavePci **OutPin)
 
PDEVICE_OBJECT GetDeviceObjectFromWaveCyclic (IPortWavePci *iface)
 
PDEVICE_OBJECT GetDeviceObjectFromPortWavePci (IPortWavePci *iface)
 
PMINIPORTWAVEPCI GetWavePciMiniport (PPORTWAVEPCI Port)
 
NTSTATUS NewPortFilterDMus (OUT PPORTFILTERDMUS *OutFilter)
 
NTSTATUS NewPortPinDMus (OUT PPORTPINDMUS *OutPin)
 
VOID GetDMusMiniport (IN IPortDMus *iface, IN PMINIPORTDMUS *Miniport, IN PMINIPORTMIDI *MidiMiniport)
 
NTSTATUS NewPortFilterWaveRT (OUT IPortFilterWaveRT **OutFilter)
 
NTSTATUS NewPortPinWaveRT (OUT IPortPinWaveRT **OutPin)
 
PMINIPORTWAVERT GetWaveRTMiniport (IN IPortWaveRT *iface)
 
PDEVICE_OBJECT GetDeviceObjectFromPortWaveRT (IPortWaveRT *iface)
 
NTSTATUS NewPortWaveRTStream (PPORTWAVERTSTREAM *OutStream)
 
NTSTATUS NewPortWaveRT (OUT PPORT *OutPort)
 
NTSTATUS NewPortFilterTopology (OUT IPortFilterTopology **OutFilter)
 
PMINIPORTTOPOLOGY GetTopologyMiniport (PPORTTOPOLOGY Port)
 
NTSTATUS NTAPI NewDispatchObject (IN PIRP Irp, IN IIrpTarget *Target, IN ULONG ObjectCreateItemCount, IN PKSOBJECT_CREATE_ITEM ObjectCreateItem)
 
PMINIPORTWAVECYCLIC GetWaveCyclicMiniport (IN IPortWaveCyclic *iface)
 
PVOID AllocateItem (IN POOL_TYPE PoolType, IN SIZE_T NumberOfBytes, IN ULONG Tag)
 
VOID FreeItem (IN PVOID Item, IN ULONG Tag)
 
NTSTATUS NTAPI NewIrpQueue (IN IIrpQueue **Queue)
 
NTSTATUS NTAPI TopologyPropertyHandler (IN PIRP Irp, IN PKSIDENTIFIER Request, IN OUT PVOID Data)
 
NTSTATUS NTAPI PinPropertyHandler (IN PIRP Irp, IN PKSIDENTIFIER Request, IN OUT PVOID Data)
 
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 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)
 
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 *Descriptor, OUT PKSPIN_CONNECT *Connect)
 
NTSTATUS NTAPI PcCreateItemDispatch (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
PDEVICE_OBJECT GetDeviceObject (IPortWaveCyclic *iface)
 
VOID NTAPI PcIoTimerRoutine (IN PDEVICE_OBJECT DeviceObject, IN PVOID Context)
 
NTSTATUS NTAPI NewIUnregisterSubdevice (OUT PUNREGISTERSUBDEVICE *OutDevice)
 
NTSTATUS NTAPI NewIUnregisterPhysicalConnection (OUT PUNREGISTERPHYSICALCONNECTION *OutConnection)
 
NTSTATUS NTAPI PcHandlePropertyWithTable (IN PIRP Irp, IN ULONG PropertySetCount, IN PKSPROPERTY_SET PropertySet, IN PSUBDEVICE_DESCRIPTOR Descriptor)
 
NTSTATUS NTAPI PcHandleEnableEventWithTable (IN PIRP Irp, IN PSUBDEVICE_DESCRIPTOR Descriptor)
 
NTSTATUS NTAPI PcHandleDisableEventWithTable (IN PIRP Irp, IN PSUBDEVICE_DESCRIPTOR Descriptor)
 
IIrpTarget *NTAPI KsoGetIrpTargetFromIrp (PIRP Irp)
 

Macro Definition Documentation

◆ COM_STDMETHOD_CAN_THROW

#define COM_STDMETHOD_CAN_THROW

Definition at line 14 of file private.hpp.

◆ DEFINE_KSPROPERTY_AUDIOSET

#define DEFINE_KSPROPERTY_AUDIOSET (   PinSet,
  PropPositionHandler 
)
Value:
DEFINE_KSPROPERTY_TABLE(PinSet) {\
DEFINE_KSPROPERTY_ITEM_AUDIO_POSITION(PropPositionHandler, PropPositionHandler)\
}

Definition at line 357 of file private.hpp.

◆ DEFINE_KSPROPERTY_CONNECTIONSET

#define DEFINE_KSPROPERTY_CONNECTIONSET (   PinSet,
  PropStateHandler,
  PropDataFormatHandler,
  PropAllocatorFraming 
)
Value:
DEFINE_KSPROPERTY_TABLE(PinSet) {\
DEFINE_KSPROPERTY_ITEM_CONNECTION_STATE(PropStateHandler, PropStateHandler),\
DEFINE_KSPROPERTY_ITEM_CONNECTION_DATAFORMAT(PropDataFormatHandler, PropDataFormatHandler),\
DEFINE_KSPROPERTY_ITEM_CONNECTION_ALLOCATORFRAMING(PropAllocatorFraming)\
}

Definition at line 340 of file private.hpp.

◆ DEFINE_KSPROPERTY_DRMSET

#define DEFINE_KSPROPERTY_DRMSET (   PinSet,
  PropPositionHandler 
)
Value:
DEFINE_KSPROPERTY_TABLE(PinSet) {\
DEFINE_KSPROPERTY_ITEM_DRMAUDIOSTREAM_CONTENTID(PropPositionHandler)\
}

Definition at line 373 of file private.hpp.

◆ DEFINE_KSPROPERTY_ITEM_AUDIO_POSITION

#define DEFINE_KSPROPERTY_ITEM_AUDIO_POSITION (   GetHandler,
  SetHandler 
)
Value:
(GetHandler),\
sizeof(KSPROPERTY),\
sizeof(KSAUDIO_POSITION),\
(SetHandler),\
NULL, 0, NULL, NULL, 0)
smooth NULL
Definition: ftsmooth.c:416
#define DEFINE_KSPROPERTY_ITEM(PropertyId, GetHandler, MinProperty, MinData, SetHandler, Values, RelationsCount, Relations, SupportHandler, SerializedSize)
Definition: ks.h:1177

Definition at line 348 of file private.hpp.

◆ DEFINE_KSPROPERTY_ITEM_DRMAUDIOSTREAM_CONTENTID

#define DEFINE_KSPROPERTY_ITEM_DRMAUDIOSTREAM_CONTENTID (   SetHandler)
Value:
NULL,\
sizeof(KSPROPERTY),\
sizeof(ULONG),\
(SetHandler),\
NULL, 0, NULL, NULL, 0)
smooth NULL
Definition: ftsmooth.c:416
#define DEFINE_KSPROPERTY_ITEM(PropertyId, GetHandler, MinProperty, MinData, SetHandler, Values, RelationsCount, Relations, SupportHandler, SerializedSize)
Definition: ks.h:1177
unsigned int ULONG
Definition: retypes.h:1

Definition at line 364 of file private.hpp.

◆ DEFINE_KSPROPERTY_PINPROPOSEDATAFORMAT

#define DEFINE_KSPROPERTY_PINPROPOSEDATAFORMAT (   PinSet,
  PropGeneral,
  PropInstances,
  PropIntersection 
)
Value:
DEFINE_KSPROPERTY_TABLE(PinSet) {\
DEFINE_KSPROPERTY_ITEM_PIN_CINSTANCES(PropInstances),\
DEFINE_KSPROPERTY_ITEM_PIN_CTYPES(PropGeneral),\
DEFINE_KSPROPERTY_ITEM_PIN_DATAFLOW(PropGeneral),\
DEFINE_KSPROPERTY_ITEM_PIN_DATARANGES(PropGeneral),\
DEFINE_KSPROPERTY_ITEM_PIN_DATAINTERSECTION(PropIntersection),\
DEFINE_KSPROPERTY_ITEM_PIN_INTERFACES(PropGeneral),\
DEFINE_KSPROPERTY_ITEM_PIN_MEDIUMS(PropGeneral),\
DEFINE_KSPROPERTY_ITEM_PIN_COMMUNICATION(PropGeneral),\
DEFINE_KSPROPERTY_ITEM_PIN_GLOBALCINSTANCES(PropGeneral),\
DEFINE_KSPROPERTY_ITEM_PIN_NECESSARYINSTANCES(PropGeneral),\
DEFINE_KSPROPERTY_ITEM_PIN_PHYSICALCONNECTION(PropGeneral),\
DEFINE_KSPROPERTY_ITEM_PIN_CATEGORY(PropGeneral),\
DEFINE_KSPROPERTY_ITEM_PIN_NAME(PropGeneral),\
DEFINE_KSPROPERTY_ITEM_PIN_CONSTRAINEDDATARANGES(PropGeneral),\
DEFINE_KSPROPERTY_ITEM_PIN_PROPOSEDATAFORMAT(PropGeneral)\
}

Definition at line 379 of file private.hpp.

◆ PC_ASSERT

#define PC_ASSERT (   exp)
Value:
(VOID)((!(exp)) ? \
RtlAssert((PVOID) #exp, (PVOID)__FILE__, __LINE__, NULL ), FALSE : TRUE)
#define TRUE
Definition: types.h:120
smooth NULL
Definition: ftsmooth.c:416
#define VOID
Definition: acefi.h:82
DWORD exp
Definition: msg.c:16038

Definition at line 26 of file private.hpp.

◆ PC_ASSERT_IRQL

#define PC_ASSERT_IRQL (   x)    PC_ASSERT(KeGetCurrentIrql() <= (x))

Definition at line 30 of file private.hpp.

◆ PC_ASSERT_IRQL_EQUAL

#define PC_ASSERT_IRQL_EQUAL (   x)    PC_ASSERT(KeGetCurrentIrql()==(x))

Definition at line 31 of file private.hpp.

◆ PC_IMPLEMENTATION

#define PC_IMPLEMENTATION

Definition at line 13 of file private.hpp.

◆ PC_NO_IMPORTS

#define PC_NO_IMPORTS

Definition at line 15 of file private.hpp.

◆ TAG_PORTCLASS

#define TAG_PORTCLASS   'SLCP'

Definition at line 24 of file private.hpp.

Typedef Documentation

◆ PCLOSESTREAM_CONTEXT

◆ PDISPATCH_CONTEXT

◆ PPCLASS_DEVICE_EXTENSION

◆ PTIMER_CONTEXT

Function Documentation

◆ AllocateItem()

PVOID AllocateItem ( IN POOL_TYPE  PoolType,
IN SIZE_T  NumberOfBytes,
IN ULONG  Tag 
)

Definition at line 18 of file pool.cpp.

22 {
24  if (!Item)
25  return Item;
26 
28  return Item;
29 }
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
IN ULONG IN ULONG Tag
Definition: evtlib.h:159
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS _Inout_ PLARGE_INTEGER NumberOfBytes
Definition: iotypes.h:998
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
_Must_inspect_result_ _In_ FLT_CONTEXT_TYPE _In_ SIZE_T _In_ POOL_TYPE PoolType
Definition: fltkernel.h:1444

◆ FreeItem()

VOID FreeItem ( IN PVOID  Item,
IN ULONG  Tag 
)

Definition at line 32 of file pool.cpp.

35 {
36 
37  ExFreePoolWithTag(Item, Tag);
38 }
IN ULONG IN ULONG Tag
Definition: evtlib.h:159
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099

◆ GetDeviceObject()

PDEVICE_OBJECT GetDeviceObject ( IPortWaveCyclic *  iface)

Definition at line 563 of file port_wavecyclic.cpp.

565 {
566  CPortWaveCyclic * This = (CPortWaveCyclic *)iface;
567  return This->m_pDeviceObject;
568 }

◆ GetDeviceObjectFromPortWavePci()

PDEVICE_OBJECT GetDeviceObjectFromPortWavePci ( IPortWavePci *  iface)

Definition at line 562 of file port_wavepci.cpp.

564 {
565  CPortWavePci * This = (CPortWavePci*)iface;
566  return This->m_pDeviceObject;
567 }

◆ GetDeviceObjectFromPortWaveRT()

PDEVICE_OBJECT GetDeviceObjectFromPortWaveRT ( IPortWaveRT *  iface)

Definition at line 471 of file port_wavert.cpp.

473 {
474  CPortWaveRT * This = (CPortWaveRT *)iface;
475  return This->m_pDeviceObject;
476 }

◆ GetDeviceObjectFromWaveCyclic()

PDEVICE_OBJECT GetDeviceObjectFromWaveCyclic ( IPortWavePci *  iface)

◆ GetDMusMiniport()

VOID GetDMusMiniport ( IN IPortDMus *  iface,
IN PMINIPORTDMUS Miniport,
IN PMINIPORTMIDI MidiMiniport 
)

Definition at line 533 of file port_dmus.cpp.

537 {
538  CPortDMus * This = (CPortDMus*)iface;
539 
540  *Miniport = This->m_pMiniport;
541  *MidiMiniport = This->m_pMiniportMidi;
542 }

◆ GetTopologyMiniport()

PMINIPORTTOPOLOGY GetTopologyMiniport ( PPORTTOPOLOGY  Port)

Definition at line 619 of file port_topology.cpp.

621 {
623  return This->m_pMiniport;
624 }
CPPORT Port[4]
Definition: headless.c:34

◆ GetWaveCyclicMiniport()

PMINIPORTWAVECYCLIC GetWaveCyclicMiniport ( IN IPortWaveCyclic *  iface)

Definition at line 555 of file port_wavecyclic.cpp.

557 {
558  CPortWaveCyclic * This = (CPortWaveCyclic *)iface;
559  return This->m_pMiniport;
560 }

◆ GetWavePciMiniport()

PMINIPORTWAVEPCI GetWavePciMiniport ( PPORTWAVEPCI  Port)

Definition at line 570 of file port_wavepci.cpp.

572 {
573  CPortWavePci * This = (CPortWavePci*)iface;
574  return This->m_Miniport;
575 }

◆ GetWaveRTMiniport()

PMINIPORTWAVERT GetWaveRTMiniport ( IN IPortWaveRT *  iface)

Definition at line 463 of file port_wavert.cpp.

465 {
466  CPortWaveRT * This = (CPortWaveRT *)iface;
467  return This->m_pMiniport;
468 }

◆ KsoGetIrpTargetFromIrp()

IIrpTarget* NTAPI KsoGetIrpTargetFromIrp ( PIRP  Irp)

Definition at line 40 of file undoc.cpp.

42 {
43  PIO_STACK_LOCATION IoStack;
44 
45  // get current irp stack location
47 
48  // IIrpTarget is stored in Context member
49  return (IIrpTarget*)IoStack->FileObject->FsContext;
50 }
_In_ PIRP Irp
Definition: csq.h:116
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
PFILE_OBJECT FileObject
Definition: iotypes.h:2813

◆ NewDispatchObject()

NTSTATUS NTAPI NewDispatchObject ( IN PIRP  Irp,
IN IIrpTarget *  Target,
IN ULONG  ObjectCreateItemCount,
IN PKSOBJECT_CREATE_ITEM  ObjectCreateItem 
)

Definition at line 242 of file dispatcher.cpp.

247 {
249  KSOBJECT_HEADER ObjectHeader;
250  PIO_STACK_LOCATION IoStack;
251  PDISPATCH_CONTEXT DispatchContext;
252 
253  // get current irp stack location
255 
257  if (!DispatchContext)
259 
260  // allocate object header
261  Status = KsAllocateObjectHeader(&ObjectHeader, CreateItemCount, CreateItem, Irp, &DispatchTable);
262 
263  if (!NT_SUCCESS(Status))
264  {
265  // free dispatch context
266  FreeItem(DispatchContext, TAG_PORTCLASS);
267  // done
268  return Status;
269  }
270 
271  // initialize dispatch context
272  DispatchContext->ObjectHeader = ObjectHeader;
273  DispatchContext->Target = Target;
274  DispatchContext->CreateItem = CreateItem;
275 
276  // store dispatch context
277  IoStack->FileObject->FsContext = DispatchContext;
278 
279  DPRINT("KsAllocateObjectHeader result %x Target %p Context %p\n", Status, Target, DispatchContext);
280  return Status;
281 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_In_ PIRP Irp
Definition: csq.h:116
#define TAG_PORTCLASS
Definition: private.hpp:24
PVOID AllocateItem(IN POOL_TYPE PoolType, IN SIZE_T NumberOfBytes)
Definition: misc.c:30
LONG NTSTATUS
Definition: precomp.h:26
static KSDISPATCH_TABLE DispatchTable
Definition: dispatcher.cpp:226
IIrpTarget * Target
Definition: private.hpp:438
VOID FreeItem(IN PVOID Item)
Definition: misc.c:43
void DPRINT(...)
Definition: polytest.cpp:61
struct DISPATCH_CONTEXT * PDISPATCH_CONTEXT
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
_Must_inspect_result_ typedef _In_ ULONG _In_ BOOLEAN Target
Definition: iotypes.h:1068
Status
Definition: gdiplustypes.h:24
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
PFILE_OBJECT FileObject
Definition: iotypes.h:2813
KSDDKAPI NTSTATUS NTAPI KsAllocateObjectHeader(OUT KSOBJECT_HEADER *Header, IN ULONG ItemsCount, IN PKSOBJECT_CREATE_ITEM ItemsList OPTIONAL, IN PIRP Irp, IN KSDISPATCH_TABLE *Table)
Definition: api.c:610
KSOBJECT_HEADER ObjectHeader
Definition: private.hpp:437
PKSOBJECT_CREATE_ITEM CreateItem
Definition: private.hpp:439

Referenced by PcCreateItemDispatch(), and PcCreatePinDispatch().

◆ NewIDrmPort()

NTSTATUS NewIDrmPort ( OUT PDRMPORT2 OutPort)

Definition at line 145 of file drm_port.cpp.

147 {
149  if (!This)
151 
152  This->AddRef();
153 
154  *OutPort = (PDRMPORT2)This;
155  return STATUS_SUCCESS;
156 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define TAG_PORTCLASS
Definition: private.hpp:24
smooth NULL
Definition: ftsmooth.c:416
IDrmPort2 * PDRMPORT2
Definition: portcls.h:2172
return STATUS_SUCCESS
Definition: btrfs.c:2938

Referenced by CPortDMus::QueryInterface(), CPortWaveRT::QueryInterface(), CPortTopology::QueryInterface(), CPortWavePci::QueryInterface(), and CPortWaveCyclic::QueryInterface().

◆ NewIrpQueue()

NTSTATUS NTAPI NewIrpQueue ( IN IIrpQueue **  Queue)

Definition at line 808 of file irpstream.cpp.

810 {
812  if (!This)
814 
815  This->AddRef();
816 
817  *Queue = (IIrpQueue*)This;
818  return STATUS_SUCCESS;
819 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define TAG_PORTCLASS
Definition: private.hpp:24
smooth NULL
Definition: ftsmooth.c:416
return STATUS_SUCCESS
Definition: btrfs.c:2938

◆ NewIUnregisterPhysicalConnection()

NTSTATUS NTAPI NewIUnregisterPhysicalConnection ( OUT PUNREGISTERPHYSICALCONNECTION OutConnection)

Definition at line 148 of file connection.cpp.

150 {
151 
153 
154  if (!new_ptr)
156 
157  new_ptr->AddRef();
158  *OutConnection = (PUNREGISTERPHYSICALCONNECTION)new_ptr;
159  return STATUS_SUCCESS;
160 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define TAG_PORTCLASS
Definition: private.hpp:24
smooth NULL
Definition: ftsmooth.c:416
IUnregisterPhysicalConnection * PUNREGISTERPHYSICALCONNECTION
Definition: portcls.h:675
return STATUS_SUCCESS
Definition: btrfs.c:2938

Referenced by CPortDMus::QueryInterface(), CPortWaveRT::QueryInterface(), CPortTopology::QueryInterface(), CPortWavePci::QueryInterface(), and CPortWaveCyclic::QueryInterface().

◆ NewIUnregisterSubdevice()

NTSTATUS NTAPI NewIUnregisterSubdevice ( OUT PUNREGISTERSUBDEVICE OutDevice)

Definition at line 143 of file unregister.cpp.

145 {
148  if (!This)
150 
151  Status = This->QueryInterface(IID_IUnregisterSubdevice, (PVOID*)OutDevice);
152  if (!NT_SUCCESS(Status))
153  {
154  delete This;
155  return Status;
156  }
157 
158  *OutDevice = (PUNREGISTERSUBDEVICE)This;
159  return Status;
160 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define TAG_PORTCLASS
Definition: private.hpp:24
LONG NTSTATUS
Definition: precomp.h:26
IUnregisterSubdevice * PUNREGISTERSUBDEVICE
Definition: portcls.h:633
smooth NULL
Definition: ftsmooth.c:416
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:24

Referenced by CPortDMus::QueryInterface(), CPortWaveRT::QueryInterface(), CPortTopology::QueryInterface(), CPortWavePci::QueryInterface(), and CPortWaveCyclic::QueryInterface().

◆ NewMiniportDMusUART()

NTSTATUS NewMiniportDMusUART ( OUT PMINIPORT OutMiniport,
IN REFCLSID  ClassId 
)

Definition at line 1264 of file miniport_dmus.cpp.

1267 {
1269  NTSTATUS Status;
1270 
1272  if (!This)
1274 
1275  Status = This->QueryInterface(IID_IMiniport, (PVOID*)OutMiniport);
1276 
1277  if (!NT_SUCCESS(Status))
1278  {
1279  delete This;
1280  }
1281 
1282  DPRINT("NewMiniportDMusUART %p Status %x\n", *OutMiniport, Status);
1283  return Status;
1284 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define TAG_PORTCLASS
Definition: private.hpp:24
LONG NTSTATUS
Definition: precomp.h:26
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:24

Referenced by PcNewMiniport().

◆ NewMiniportFmSynth()

NTSTATUS NewMiniportFmSynth ( OUT PMINIPORT OutMiniport,
IN REFCLSID  ClassId 
)

Definition at line 17 of file miniport_fmsynth.cpp.

20 {
21  return STATUS_UNSUCCESSFUL;
22 }
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132

Referenced by PcNewMiniport().

◆ NewPortClsVersion()

NTSTATUS NewPortClsVersion ( OUT PPORTCLSVERSION OutVersion)

Definition at line 93 of file version.cpp.

95 {
97 
98  if (!This)
100 
101  This->AddRef();
102 
103  *OutVersion = (PPORTCLSVERSION)This;
104 
105  return STATUS_SUCCESS;
106 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define TAG_PORTCLASS
Definition: private.hpp:24
smooth NULL
Definition: ftsmooth.c:416
return STATUS_SUCCESS
Definition: btrfs.c:2938
IPortClsVersion * PPORTCLSVERSION
Definition: portcls.h:2209

Referenced by CPortDMus::QueryInterface(), CPortWaveRT::QueryInterface(), CPortTopology::QueryInterface(), CPortWavePci::QueryInterface(), and CPortWaveCyclic::QueryInterface().

◆ NewPortDMus()

NTSTATUS NewPortDMus ( OUT PPORT OutPort)

Definition at line 510 of file port_dmus.cpp.

512 {
515  if (!Port)
517 
518  Status = Port->QueryInterface(IID_IPort, (PVOID*)OutPort);
519 
520  if (!NT_SUCCESS(Status))
521  {
522  delete Port;
523  }
524 
525  DPRINT("NewPortDMus %p Status %u\n", Port, Status);
526  return Status;
527 
528 }
CPPORT Port[4]
Definition: headless.c:34
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define TAG_PORTCLASS
Definition: private.hpp:24
LONG NTSTATUS
Definition: precomp.h:26
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:24

Referenced by PcNewPort().

◆ NewPortFilterDMus()

NTSTATUS NewPortFilterDMus ( OUT PPORTFILTERDMUS OutFilter)

Definition at line 343 of file filter_dmus.cpp.

345 {
347 
349  if (!This)
351 
352  This->AddRef();
353 
354  // return result
355  *OutFilter = (CPortFilterDMus*)This;
356 
357  return STATUS_SUCCESS;
358 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define TAG_PORTCLASS
Definition: private.hpp:24
smooth NULL
Definition: ftsmooth.c:416
return STATUS_SUCCESS
Definition: btrfs.c:2938

◆ NewPortFilterTopology()

NTSTATUS NewPortFilterTopology ( OUT IPortFilterTopology **  OutFilter)

Definition at line 277 of file filter_topology.cpp.

279 {
281 
283  if (!This)
285 
286  This->AddRef();
287 
288  // return result
289  *OutFilter = (CPortFilterTopology*)This;
290 
291  return STATUS_SUCCESS;
292 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define TAG_PORTCLASS
Definition: private.hpp:24
smooth NULL
Definition: ftsmooth.c:416
return STATUS_SUCCESS
Definition: btrfs.c:2938

◆ NewPortFilterWaveCyclic()

NTSTATUS NewPortFilterWaveCyclic ( OUT IPortFilterWaveCyclic **  OutFilter)

Definition at line 354 of file filter_wavecyclic.cpp.

356 {
358 
360 
361  if (!This)
363 
364  This->AddRef();
365 
366  // return result
367  *OutFilter = (IPortFilterWaveCyclic*)This;
368 
369  return STATUS_SUCCESS;
370 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define TAG_PORTCLASS
Definition: private.hpp:24
smooth NULL
Definition: ftsmooth.c:416
return STATUS_SUCCESS
Definition: btrfs.c:2938

◆ NewPortFilterWavePci()

NTSTATUS NewPortFilterWavePci ( OUT IPortFilterWavePci **  OutFilter)

Definition at line 336 of file filter_wavepci.cpp.

338 {
340 
342  if (!This)
344 
345  This->AddRef();
346 
347  // return result
348  *OutFilter = (IPortFilterWavePci*)This;
349 
350  return STATUS_SUCCESS;
351 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define TAG_PORTCLASS
Definition: private.hpp:24
smooth NULL
Definition: ftsmooth.c:416
return STATUS_SUCCESS
Definition: btrfs.c:2938

◆ NewPortFilterWaveRT()

NTSTATUS NewPortFilterWaveRT ( OUT IPortFilterWaveRT **  OutFilter)

Definition at line 320 of file filter_wavert.cpp.

322 {
324 
326  if (!This)
328 
329  This->AddRef();
330 
331  // return result
332  *OutFilter = (CPortFilterWaveRT*)This;
333 
334  return STATUS_SUCCESS;
335 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define TAG_PORTCLASS
Definition: private.hpp:24
smooth NULL
Definition: ftsmooth.c:416
return STATUS_SUCCESS
Definition: btrfs.c:2938

◆ NewPortPinDMus()

NTSTATUS NewPortPinDMus ( OUT PPORTPINDMUS OutPin)

◆ NewPortPinWaveCyclic()

NTSTATUS NewPortPinWaveCyclic ( OUT IPortPinWaveCyclic **  OutPin)

Definition at line 1396 of file pin_wavecyclic.cpp.

1398 {
1400 
1402  if (!This)
1404 
1405  This->AddRef();
1406 
1407  // store result
1408  *OutPin = (IPortPinWaveCyclic*)This;
1409 
1410  return STATUS_SUCCESS;
1411 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define TAG_PORTCLASS
Definition: private.hpp:24
smooth NULL
Definition: ftsmooth.c:416
return STATUS_SUCCESS
Definition: btrfs.c:2938

◆ NewPortPinWavePci()

NTSTATUS NewPortPinWavePci ( OUT IPortPinWavePci **  OutPin)

Definition at line 1007 of file pin_wavepci.cpp.

1009 {
1011 
1013  if (!This)
1015 
1016  This->AddRef();
1017 
1018  // store result
1019  *OutPin = (IPortPinWavePci*)This;
1020 
1021  return STATUS_SUCCESS;
1022 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define TAG_PORTCLASS
Definition: private.hpp:24
smooth NULL
Definition: ftsmooth.c:416
return STATUS_SUCCESS
Definition: btrfs.c:2938

◆ NewPortPinWaveRT()

NTSTATUS NewPortPinWaveRT ( OUT IPortPinWaveRT **  OutPin)

Definition at line 686 of file pin_wavert.cpp.

688 {
690 
692  if (!This)
694 
695  This->AddRef();
696 
697  // store result
698  *OutPin = (PPORTPINWAVERT)This;
699 
700  return STATUS_SUCCESS;
701 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define TAG_PORTCLASS
Definition: private.hpp:24
smooth NULL
Definition: ftsmooth.c:416
IPortPinWaveRT * PPORTPINWAVERT
Definition: interfaces.hpp:723
return STATUS_SUCCESS
Definition: btrfs.c:2938

◆ NewPortTopology()

NTSTATUS NewPortTopology ( OUT PPORT OutPort)

Definition at line 596 of file port_topology.cpp.

598 {
601 
603  if (!This)
605 
606  Status = This->QueryInterface(IID_IPort, (PVOID*)OutPort);
607 
608  if (!NT_SUCCESS(Status))
609  {
610  delete This;
611  }
612 
613  DPRINT("NewPortTopology %p Status %x\n", *OutPort, Status);
614  return Status;
615 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define TAG_PORTCLASS
Definition: private.hpp:24
LONG NTSTATUS
Definition: precomp.h:26
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:24

Referenced by PcNewPort().

◆ NewPortWaveCyclic()

NTSTATUS NewPortWaveCyclic ( OUT PPORT OutPort)

Definition at line 575 of file port_wavecyclic.cpp.

577 {
580 
582  if (!Port)
584 
585  Status = Port->QueryInterface(IID_IPort, (PVOID*)OutPort);
586 
587  if (!NT_SUCCESS(Status))
588  {
589  delete Port;
590  }
591 
592  DPRINT("NewPortWaveCyclic %p Status %u\n", Port, Status);
593  return Status;
594 }
CPPORT Port[4]
Definition: headless.c:34
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define TAG_PORTCLASS
Definition: private.hpp:24
LONG NTSTATUS
Definition: precomp.h:26
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:24

Referenced by PcNewPort().

◆ NewPortWavePci()

NTSTATUS NewPortWavePci ( OUT PPORT OutPort)

Definition at line 538 of file port_wavepci.cpp.

540 {
541  CPortWavePci * Port;
543 
545  if (!Port)
547 
548  Status = Port->QueryInterface(IID_IPort, (PVOID*)OutPort);
549 
550  if (!NT_SUCCESS(Status))
551  {
552  delete Port;
553  }
554 
555  DPRINT("NewPortWavePci %p Status %u\n", Port, Status);
556  return Status;
557 
558 }
CPPORT Port[4]
Definition: headless.c:34
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define TAG_PORTCLASS
Definition: private.hpp:24
LONG NTSTATUS
Definition: precomp.h:26
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:24

Referenced by PcNewPort().

◆ NewPortWaveRT()

NTSTATUS NewPortWaveRT ( OUT PPORT OutPort)

Definition at line 484 of file port_wavert.cpp.

486 {
487  CPortWaveRT * Port;
489 
491  if (!Port)
493 
494  Status = Port->QueryInterface(IID_IPort, (PVOID*)OutPort);
495 
496  if (!NT_SUCCESS(Status))
497  {
498  delete Port;
499  }
500 
501  DPRINT("NewPortWaveRT %p Status %u\n", Port, Status);
502  return Status;
503 }
CPPORT Port[4]
Definition: headless.c:34
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define TAG_PORTCLASS
Definition: private.hpp:24
LONG NTSTATUS
Definition: precomp.h:26
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:24

Referenced by PcNewPort().

◆ NewPortWaveRTStream()

NTSTATUS NewPortWaveRTStream ( PPORTWAVERTSTREAM OutStream)

Definition at line 181 of file port_wavertstream.cpp.

183 {
186  if (!This)
188 
189  Status = This->QueryInterface(IID_IPortWaveRTStream, (PVOID*)OutStream);
190 
191  if (!NT_SUCCESS(Status))
192  {
193  delete This;
194  return Status;
195  }
196 
197  *OutStream = (PPORTWAVERTSTREAM)This;
198  return Status;
199 }
IPortWaveRTStream * PPORTWAVERTSTREAM
Definition: portcls.h:1791
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define TAG_PORTCLASS
Definition: private.hpp:24
LONG NTSTATUS
Definition: precomp.h:26
smooth NULL
Definition: ftsmooth.c:416
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:24

◆ operator new()

PVOID __cdecl operator new ( size_t  Size,
POOL_TYPE  PoolType,
ULONG  Tag 
)

Definition at line 19 of file miniport.cpp.

23 {
25  if (P)
27  return P;
28 }
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
#define P(row, col)
IN ULONG IN ULONG Tag
Definition: evtlib.h:159
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
_Must_inspect_result_ _In_ FLT_CONTEXT_TYPE _In_ SIZE_T _In_ POOL_TYPE PoolType
Definition: fltkernel.h:1444

◆ PcCreateItemDispatch()

NTSTATUS NTAPI PcCreateItemDispatch ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp 
)

Definition at line 520 of file port_topology.cpp.

523 {
525  ISubdevice * SubDevice;
526  IIrpTarget *Filter;
527  PKSOBJECT_CREATE_ITEM CreateItem, PinCreateItem;
528 
529  // access the create item
530  CreateItem = KSCREATE_ITEM_IRP_STORAGE(Irp);
531 
532  DPRINT("PcCreateItemDispatch called DeviceObject %p %S Name\n", DeviceObject, CreateItem->ObjectClass.Buffer);
533 
534  // get the subdevice
535  SubDevice = (ISubdevice*)CreateItem->Context;
536 
537  // sanity checks
538  PC_ASSERT(SubDevice != NULL);
539 
540 
541 #if KS_IMPLEMENTED
542  Status = KsReferenceSoftwareBusObject(DeviceExt->KsDeviceHeader);
544  {
545  DPRINT("PcCreateItemDispatch failed to reference device header\n");
546 
548  goto cleanup;
549  }
550 #endif
551 
552  // get filter object
553  Status = SubDevice->NewIrpTarget(&Filter,
554  NULL,
555  NULL,
556  NonPagedPool,
557  DeviceObject,
558  Irp,
559  NULL);
560  if (!NT_SUCCESS(Status))
561  {
562  DPRINT("Failed to get filter object\n");
563  Irp->IoStatus.Status = Status;
565  return Status;
566  }
567 
568  // allocate pin create item
569  PinCreateItem = (PKSOBJECT_CREATE_ITEM)AllocateItem(NonPagedPool, sizeof(KSOBJECT_CREATE_ITEM), TAG_PORTCLASS);
570  if (!PinCreateItem)
571  {
572  // not enough memory
573  Irp->IoStatus.Status = STATUS_INSUFFICIENT_RESOURCES;
576  }
577 
578  // initialize pin create item
579  PinCreateItem->Context = (PVOID)Filter;
580  PinCreateItem->Create = PcCreatePinDispatch;
581  RtlInitUnicodeString(&PinCreateItem->ObjectClass, KSSTRING_Pin);
582  // FIXME copy security descriptor
583 
584  // now allocate a dispatch object
585  Status = NewDispatchObject(Irp, Filter, 1, PinCreateItem);
586 
587  // complete request
588  Irp->IoStatus.Status = Status;
590 
591  return STATUS_SUCCESS;
592 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define PC_ASSERT(exp)
Definition: usbehci.h:17
KSDDKAPI NTSTATUS NTAPI KsReferenceSoftwareBusObject(IN KSDEVICE_HEADER Header)
Definition: device.c:805
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
_In_ PIRP Irp
Definition: csq.h:116
#define TAG_PORTCLASS
Definition: private.hpp:24
PVOID AllocateItem(IN POOL_TYPE PoolType, IN SIZE_T NumberOfBytes)
Definition: misc.c:30
#define KSSTRING_Pin
Definition: ks.h:48
LONG NTSTATUS
Definition: precomp.h:26
VOID FreeItem(IN PVOID Item)
Definition: misc.c:43
_Must_inspect_result_ _In_opt_ PFLT_FILTER Filter
Definition: fltkernel.h:1802
smooth NULL
Definition: ftsmooth.c:416
#define IoCompleteRequest
Definition: irp.c:1240
void DPRINT(...)
Definition: polytest.cpp:61
void * PVOID
Definition: retypes.h:9
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:24
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
NTSTATUS NTAPI PcCreatePinDispatch(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
#define IO_NO_INCREMENT
Definition: iotypes.h:566
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
char * cleanup(char *str)
Definition: wpickclick.c:99
return STATUS_SUCCESS
Definition: btrfs.c:2938
NTSTATUS NTAPI NewDispatchObject(IN PIRP Irp, IN IIrpTarget *Target, IN ULONG CreateItemCount, IN PKSOBJECT_CREATE_ITEM CreateItem)
Definition: dispatcher.cpp:242
base of all file and directory entries
Definition: entries.h:82

Referenced by PcRegisterSubdevice().

◆ 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 730 of file undoc.cpp.

745 {
747  ULONG Index, SubIndex;
749  PPCPIN_DESCRIPTOR SrcDescriptor;
752 
753  // allocate subdevice descriptor
755  if (!Descriptor)
757 
758  // initialize physical / symbolic link connection list
759  InitializeListHead(&Descriptor->SymbolicLinkList);
760  InitializeListHead(&Descriptor->PhysicalConnectionList);
761 
762  //FIXME add driver category guids
763  Descriptor->Interfaces = (GUID*)AllocateItem(NonPagedPool, sizeof(GUID) * InterfaceCount, TAG_PORTCLASS);
764  if (!Descriptor->Interfaces)
765  goto cleanup;
766 
767  // copy interface guids
768  RtlCopyMemory(Descriptor->Interfaces, InterfaceGuids, sizeof(GUID) * InterfaceCount);
769  Descriptor->InterfaceCount = InterfaceCount;
770 
771  //DumpFilterDescriptor(FilterDescription);
772 
773  // are any property sets supported by the portcls
774  if (FilterPropertiesCount)
775  {
776  // first allocate filter properties set
777  Descriptor->FilterPropertySet = (PKSPROPERTY_SET)AllocateItem(NonPagedPool, sizeof(KSPROPERTY_SET) * FilterPropertiesCount, TAG_PORTCLASS);
778  if (! Descriptor->FilterPropertySet)
779  goto cleanup;
780 
781  // now copy all filter property sets
782  Descriptor->FilterPropertySetCount = FilterPropertiesCount;
783  for(Index = 0; Index < FilterPropertiesCount; Index++)
784  {
785  // copy property set
786  RtlMoveMemory(&Descriptor->FilterPropertySet[Index], &FilterProperties[Index], sizeof(KSPROPERTY_SET));
787 
788  if (Descriptor->FilterPropertySet[Index].PropertiesCount)
789  {
790  // copy property items to make sure they are dynamically allocated
791  Descriptor->FilterPropertySet[Index].PropertyItem = (PKSPROPERTY_ITEM)AllocateItem(NonPagedPool, FilterProperties[Index].PropertiesCount * sizeof(KSPROPERTY_ITEM), TAG_PORTCLASS);
792  if (!Descriptor->FilterPropertySet[Index].PropertyItem)
793  {
794  // no memory
795  goto cleanup;
796  }
797 
798  // copy filter property items
799  RtlMoveMemory((PVOID)Descriptor->FilterPropertySet[Index].PropertyItem, FilterProperties[Index].PropertyItem, FilterProperties[Index].PropertiesCount * sizeof(KSPROPERTY_ITEM));
800  }
801  }
802  }
803 
804  // now check if the filter descriptor supports filter properties
805  if (FilterDescription->AutomationTable)
806  {
807  // get first entry
808  PropertyItem = (PPCPROPERTY_ITEM)FilterDescription->AutomationTable->Properties;
809 
810  // copy driver filter property sets
811  for(Index = 0; Index < FilterDescription->AutomationTable->PropertyCount; Index++)
812  {
813  // add the property item
815 
816  // check for success
817  if (Status != STATUS_SUCCESS)
818  {
819  // goto cleanup
820  goto cleanup;
821  }
822 
823  // move to next entry
824  PropertyItem = (PPCPROPERTY_ITEM)((ULONG_PTR)PropertyItem + FilterDescription->AutomationTable->PropertyItemSize);
825  }
826  }
827 
828  // check if the filter has pins
829  if (FilterDescription->PinCount)
830  {
831  // allocate pin factory descriptors
832  Descriptor->Factory.KsPinDescriptor = (PKSPIN_DESCRIPTOR)AllocateItem(NonPagedPool, sizeof(KSPIN_DESCRIPTOR) * FilterDescription->PinCount, TAG_PORTCLASS);
833  if (!Descriptor->Factory.KsPinDescriptor)
834  goto cleanup;
835 
836  // allocate pin instance info
837  Descriptor->Factory.Instances = (PPIN_INSTANCE_INFO)AllocateItem(NonPagedPool, FilterDescription->PinCount * sizeof(PIN_INSTANCE_INFO), TAG_PORTCLASS);
838  if (!Descriptor->Factory.Instances)
839  goto cleanup;
840 
841  // initialize pin factory descriptor
842  Descriptor->Factory.PinDescriptorCount = FilterDescription->PinCount;
843  Descriptor->Factory.PinDescriptorSize = sizeof(KSPIN_DESCRIPTOR);
844 
845  // grab first entry
846  SrcDescriptor = (PPCPIN_DESCRIPTOR)FilterDescription->Pins;
847 
848  // copy pin factories
849  for(Index = 0; Index < FilterDescription->PinCount; Index++)
850  {
851  // copy pin descriptor
852  RtlMoveMemory(&Descriptor->Factory.KsPinDescriptor[Index], &SrcDescriptor->KsPinDescriptor, sizeof(KSPIN_DESCRIPTOR));
853 
854  // initialize pin factory instance data
855  Descriptor->Factory.Instances[Index].CurrentPinInstanceCount = 0;
856  Descriptor->Factory.Instances[Index].MaxFilterInstanceCount = SrcDescriptor->MaxFilterInstanceCount;
857  Descriptor->Factory.Instances[Index].MaxGlobalInstanceCount = SrcDescriptor->MaxGlobalInstanceCount;
858  Descriptor->Factory.Instances[Index].MinFilterInstanceCount = SrcDescriptor->MinFilterInstanceCount;
859 
860  // check if the descriptor has an automation table
861  if (SrcDescriptor->AutomationTable)
862  {
863  // it has, grab first entry
865 
866  // now add all supported property items
867  for(SubIndex = 0; SubIndex < SrcDescriptor->AutomationTable->PropertyCount; SubIndex++)
868  {
869  // add the property item to the table
871 
872  // check for success
873  if (Status != STATUS_SUCCESS)
874  {
875  // goto cleanup
876  goto cleanup;
877  }
878 
879  // move to next entry
881  }
882  }
883 
884  // move to next entry
885  SrcDescriptor = (PPCPIN_DESCRIPTOR)((ULONG_PTR)SrcDescriptor + FilterDescription->PinSize);
886  }
887  }
888 
889  // allocate topology descriptor
891  if (!Descriptor->Topology)
892  goto cleanup;
893 
894  // are there any connections
895  if (FilterDescription->ConnectionCount)
896  {
897  // allocate connection descriptor
898  Descriptor->Topology->TopologyConnections = (PKSTOPOLOGY_CONNECTION)AllocateItem(NonPagedPool, sizeof(KSTOPOLOGY_CONNECTION) * FilterDescription->ConnectionCount, TAG_PORTCLASS);
899  if (!Descriptor->Topology->TopologyConnections)
900  goto cleanup;
901 
902  // copy connection descriptor
903  RtlMoveMemory((PVOID)Descriptor->Topology->TopologyConnections, FilterDescription->Connections, FilterDescription->ConnectionCount * sizeof(PCCONNECTION_DESCRIPTOR));
904 
905  // store connection count
906  Descriptor->Topology->TopologyConnectionsCount = FilterDescription->ConnectionCount;
907  }
908 
909  // does the filter have nodes
910  if (FilterDescription->NodeCount)
911  {
912  // allocate topology node types array
913  Descriptor->Topology->TopologyNodes = (const GUID *)AllocateItem(NonPagedPool, sizeof(GUID) * FilterDescription->NodeCount, TAG_PORTCLASS);
914  if (!Descriptor->Topology->TopologyNodes)
915  goto cleanup;
916 
917  // allocate topology node names array
918  Descriptor->Topology->TopologyNodesNames = (const GUID *)AllocateItem(NonPagedPool, sizeof(GUID) * FilterDescription->NodeCount, TAG_PORTCLASS);
919  if (!Descriptor->Topology->TopologyNodesNames)
920  goto cleanup;
921 
922  // grab first entry
923  NodeDescriptor = (PPCNODE_DESCRIPTOR)FilterDescription->Nodes;
924 
925  // iterate all nodes and copy node types / names and node properties
926  for(Index = 0; Index < FilterDescription->NodeCount; Index++)
927  {
928  // does it have a type
929  if (NodeDescriptor->Type)
930  {
931  // copy node type
932  RtlMoveMemory((PVOID)&Descriptor->Topology->TopologyNodes[Index], NodeDescriptor->Type, sizeof(GUID));
933  }
934 
935  // does it have a node name
936  if (NodeDescriptor->Name)
937  {
938  // copy node name
939  RtlMoveMemory((PVOID)&Descriptor->Topology->TopologyNodesNames[Index], NodeDescriptor->Name, sizeof(GUID));
940  }
941 
942  // check if has an automation table
943  if (NodeDescriptor->AutomationTable)
944  {
945  // grab first entry
946  PropertyItem = (PPCPROPERTY_ITEM)NodeDescriptor->AutomationTable->Properties;
947 
948  // copy all node properties into the global property set
949  for(SubIndex = 0; SubIndex < NodeDescriptor->AutomationTable->PropertyCount; SubIndex++)
950  {
951  // add to property set
953 
954  // check for success
955  if (Status != STATUS_SUCCESS)
956  {
957  // failed
958  goto cleanup;
959  }
960 
961  // move to next property item
962  PropertyItem = (PPCPROPERTY_ITEM)((ULONG_PTR)PropertyItem + NodeDescriptor->AutomationTable->PropertyItemSize);
963  }
964  }
965 
966  // move to next descriptor
967  NodeDescriptor = (PPCNODE_DESCRIPTOR)((ULONG_PTR)NodeDescriptor + FilterDescription->NodeSize);
968  }
969 
970  // now store the topology node count
971  Descriptor->Topology->TopologyNodesCount = FilterDescription->NodeCount;
972  }
973 
974  // store descriptor
975  Descriptor->DeviceDescriptor = FilterDescription;
976 
977  // store result
978  *OutSubdeviceDescriptor = Descriptor;
979  // done
980  return STATUS_SUCCESS;
981 
982 cleanup:
983  if (Descriptor)
984  {
985  if (Descriptor->Interfaces)
986  FreeItem(Descriptor->Interfaces, TAG_PORTCLASS);
987 
988  if (Descriptor->Factory.KsPinDescriptor)
989  FreeItem(Descriptor->Factory.KsPinDescriptor, TAG_PORTCLASS);
990 
992  }
993  return Status;
994 }
ULONG MaxGlobalInstanceCount
Definition: portcls.h:339
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
const PCPROPERTY_ITEM * Properties
Definition: portcls.h:321
#define TAG_PORTCLASS
Definition: private.hpp:24
PVOID AllocateItem(IN POOL_TYPE PoolType, IN SIZE_T NumberOfBytes)
Definition: misc.c:30
LONG NTSTATUS
Definition: precomp.h:26
struct KSTOPOLOGY_CONNECTION * PKSTOPOLOGY_CONNECTION
static GUID InterfaceGuids[3]
Definition: port_dmus.cpp:64
struct PCNODE_DESCRIPTOR * PPCNODE_DESCRIPTOR
KSPIN_DESCRIPTOR KsPinDescriptor
Definition: portcls.h:343
_In_ const GUID _In_ ULONG PinCount
Definition: strmini.h:504
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:263
uint32_t ULONG_PTR
Definition: typedefs.h:63
struct PCPIN_DESCRIPTOR * PPCPIN_DESCRIPTOR
VOID FreeItem(IN PVOID Item)
Definition: misc.c:43
ULONG PropertyItemSize
Definition: portcls.h:319
static const UCHAR Index[8]
Definition: usbohci.c:18
const KSNODE_DESCRIPTOR NodeDescriptor[]
Definition: splitter.c:217
struct KSTOPOLOGY * PKSTOPOLOGY
struct PropertyItem PropertyItem
Status
Definition: gdiplustypes.h:24
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
ULONG MaxFilterInstanceCount
Definition: portcls.h:340
ULONG MinFilterInstanceCount
Definition: portcls.h:341
unsigned int ULONG
Definition: retypes.h:1
char * cleanup(char *str)
Definition: wpickclick.c:99
NTSTATUS PcAddToPropertyTable(IN PSUBDEVICE_DESCRIPTOR SubDeviceDescriptor, IN PPCPROPERTY_ITEM PropertyItem, IN ULONG bNode)
Definition: undoc.cpp:311
const PCAUTOMATION_TABLE * AutomationTable
Definition: portcls.h:342
return STATUS_SUCCESS
Definition: btrfs.c:2938
struct SUBDEVICE_DESCRIPTOR * PSUBDEVICE_DESCRIPTOR
struct PIN_INSTANCE_INFO * PPIN_INSTANCE_INFO
struct PCPROPERTY_ITEM * PPCPROPERTY_ITEM
_In_ PSTORAGE_PROPERTY_ID _Outptr_ PSTORAGE_DESCRIPTOR_HEADER * Descriptor
Definition: classpnp.h:966

◆ PcDmaMasterDescription()

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 
)

Definition at line 213 of file api.cpp.

224 {
225 
227 
231  DeviceDescription->Dma32BitAddresses = Dma32BitAddresses;
232  DeviceDescription->IgnoreCount = IgnoreCount;
234  DeviceDescription->DmaWidth = DmaWidth;
235  DeviceDescription->DmaSpeed = DmaSpeed;
237  DeviceDescription->DmaPort = DmaPort;
238 
239  return STATUS_SUCCESS;
240 }
#define TRUE
Definition: types.h:120
DMA_SPEED DmaSpeed
Definition: iotypes.h:2038
BOOLEAN IgnoreCount
Definition: iotypes.h:2031
_In_ BOOLEAN Dma64BitAddresses
Definition: ndis.h:4652
BOOLEAN Dma32BitAddresses
Definition: iotypes.h:2030
BOOLEAN Dma64BitAddresses
Definition: iotypes.h:2033
_Must_inspect_result_ _In_ PDEVICE_DESCRIPTION DeviceDescription
Definition: iofuncs.h:1015
BOOLEAN ScatterGather
Definition: iotypes.h:2027
DMA_WIDTH DmaWidth
Definition: iotypes.h:2037
UnicodeString MaximumLength
Definition: rtlfuncs.h:2982
_In_ struct _IRP _In_ struct _SCATTER_GATHER_LIST * ScatterGather
Definition: iotypes.h:2259
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
#define DEVICE_DESCRIPTION_VERSION1
Definition: iotypes.h:2021
return STATUS_SUCCESS
Definition: btrfs.c:2938

◆ PcDmaSlaveDescription()

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 
)

Definition at line 244 of file api.cpp.

253 {
254 
256 
258  DeviceDescription->DemandMode = DemandMode;
259  DeviceDescription->AutoInitialize = AutoInitialize;
260  DeviceDescription->DmaSpeed = DmaSpeed;
262  DeviceDescription->DmaPort = DmaPort;
263 
264  return STATUS_SUCCESS;
265 }
DMA_SPEED DmaSpeed
Definition: iotypes.h:2038
_Must_inspect_result_ _In_ PDEVICE_DESCRIPTION DeviceDescription
Definition: iofuncs.h:1015
BOOLEAN DemandMode
Definition: iotypes.h:2028
UnicodeString MaximumLength
Definition: rtlfuncs.h:2982
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
#define DEVICE_DESCRIPTION_VERSION1
Definition: iotypes.h:2021
return STATUS_SUCCESS
Definition: btrfs.c:2938
BOOLEAN AutoInitialize
Definition: iotypes.h:2029

◆ PcHandleDisableEventWithTable()

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

Definition at line 67 of file undoc.cpp.

70 {
71  // store descriptor
72  KSEVENT_ITEM_IRP_STORAGE(Irp) = (PKSEVENT_ITEM)Descriptor;
73 
74  // FIXME seh probing
75 
76  return KsDisableEvent(Irp, Descriptor->EventList, KSEVENTS_SPINLOCK, (PVOID)Descriptor->EventListLock);
77 }
_In_ PIRP Irp
Definition: csq.h:116
KSDDKAPI NTSTATUS NTAPI KsDisableEvent(IN PIRP Irp, IN OUT PLIST_ENTRY EventsList, IN KSEVENTS_LOCKTYPE EventsFlags, IN PVOID EventsLock)
Definition: event.c:469
_In_ PSTORAGE_PROPERTY_ID _Outptr_ PSTORAGE_DESCRIPTOR_HEADER * Descriptor
Definition: classpnp.h:966

◆ PcHandleEnableEventWithTable()

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

Definition at line 54 of file undoc.cpp.

57 {
58  // store descriptor
59  KSEVENT_ITEM_IRP_STORAGE(Irp) = (PKSEVENT_ITEM)Descriptor;
60 
61  // FIXME seh probing
62  return KsEnableEvent(Irp, Descriptor->EventSetCount, Descriptor->EventSet, NULL, KSEVENTS_NONE, NULL);
63 }
_In_ PIRP Irp
Definition: csq.h:116
smooth NULL
Definition: ftsmooth.c:416
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
_In_ PSTORAGE_PROPERTY_ID _Outptr_ PSTORAGE_DESCRIPTOR_HEADER * Descriptor
Definition: classpnp.h:966

◆ PcHandlePropertyWithTable()

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

Definition at line 81 of file undoc.cpp.

86 {
87  PIO_STACK_LOCATION IoStack;
88 
89  // get current irp stack location
91 
92  if (IoStack->Parameters.DeviceIoControl.InputBufferLength < sizeof(KSPROPERTY))
93  {
94  // certainly an invalid request
96  }
97 
98  // store device descriptor
99  KSPROPERTY_ITEM_IRP_STORAGE(Irp) = (PKSPROPERTY_ITEM)SubDeviceDescriptor;
100 
101 
102  // then try KsPropertyHandler
103  return KsPropertyHandler(Irp, PropertySetCount, PropertySet);
104 }
_In_ PIRP Irp
Definition: csq.h:116
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
KSDDKAPI NTSTATUS NTAPI KsPropertyHandler(IN PIRP Irp, IN ULONG PropertySetsCount, IN const KSPROPERTY_SET *PropertySet)
Definition: property.c:358
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:2772

Referenced by CPortPinWavePci::HandleKsProperty().

◆ PcIoTimerRoutine()

VOID NTAPI PcIoTimerRoutine ( IN PDEVICE_OBJECT  DeviceObject,
IN PVOID  Context 
)

Definition at line 49 of file api.cpp.

52 {
53  PPCLASS_DEVICE_EXTENSION DeviceExtension;
54  KIRQL OldIrql;
55  PLIST_ENTRY ListEntry;
56  PTIMER_CONTEXT CurContext;
57 
59  return;
60 
62 
63  KeAcquireSpinLock(&DeviceExtension->TimerListLock, &OldIrql);
64 
65  ListEntry = DeviceExtension->TimerList.Flink;
66  while(ListEntry != &DeviceExtension->TimerList)
67  {
68  CurContext = (PTIMER_CONTEXT)CONTAINING_RECORD(ListEntry, TIMER_CONTEXT, Entry);
69 
70  CurContext->pTimerRoutine(DeviceObject, CurContext->Context);
71  ListEntry = ListEntry->Flink;
72  }
73 
74  KeReleaseSpinLock(&DeviceExtension->TimerListLock, OldIrql);
75 }
PVOID Context
Definition: private.hpp:432
struct TIMER_CONTEXT * PTIMER_CONTEXT
struct PCLASS_DEVICE_EXTENSION * PPCLASS_DEVICE_EXTENSION
PIO_TIMER_ROUTINE pTimerRoutine
Definition: private.hpp:431
UCHAR KIRQL
Definition: env_spec_w32.h:591
PVOID DeviceExtension
Definition: env_spec_w32.h:418
KSPIN_LOCK TimerListLock
Definition: private.hpp:413
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
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
#define KeAcquireSpinLock(sl, irql)
Definition: env_spec_w32.h:609
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:803
Definition: typedefs.h:117
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
#define KeReleaseSpinLock(sl, irql)
Definition: env_spec_w32.h:627
base of all file and directory entries
Definition: entries.h:82

Referenced by PcAddAdapterDevice().

◆ PcValidateConnectRequest()

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

Definition at line 998 of file undoc.cpp.

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

◆ PinPropertyHandler()

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

Definition at line 218 of file propertyhandler.cpp.

222 {
223  PIO_STACK_LOCATION IoStack;
224  //PKSOBJECT_CREATE_ITEM CreateItem;
226  IIrpTarget * IrpTarget;
227  IPort *Port;
228  ISubdevice *SubDevice;
229  PDISPATCH_CONTEXT DispatchContext;
230 
232 
233  Descriptor = (PSUBDEVICE_DESCRIPTOR)KSPROPERTY_ITEM_IRP_STORAGE(Irp);
235 
236  // get current irp stack
238 
239  // get dispatch context
240  DispatchContext = (PDISPATCH_CONTEXT)IoStack->FileObject->FsContext;
241 
242  // Get the IrpTarget
243  IrpTarget = DispatchContext->Target;
244  PC_ASSERT(IrpTarget);
245 
246  // Get the parent
247  Status = IrpTarget->QueryInterface(IID_IPort, (PVOID*)&Port);
248  if (!NT_SUCCESS(Status))
249  {
250  DPRINT("Failed to obtain IPort interface from filter\n");
251  Irp->IoStatus.Information = 0;
252  Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
253  return STATUS_UNSUCCESSFUL;
254  }
255 
256  // Get private ISubdevice interface
257  Status = Port->QueryInterface(IID_ISubdevice, (PVOID*)&SubDevice);
258  if (!NT_SUCCESS(Status))
259  {
260  DPRINT("Failed to obtain ISubdevice interface from port driver\n");
261  DbgBreakPoint();
262  while(TRUE);
263  }
264 
265  // get current stack location
267 
268  switch(Request->Id)
269  {
277  case KSPROPERTY_PIN_NAME:
279  Status = KsPinPropertyHandler(Irp, Request, Data, Descriptor->Factory.PinDescriptorCount, Descriptor->Factory.KsPinDescriptor);
280  break;
282  Status = HandlePropertyInstances(&Irp->IoStatus, Request, Data, Descriptor, TRUE, SubDevice);
283  break;
285  Status = HandlePropertyInstances(&Irp->IoStatus, Request, Data, Descriptor, FALSE, SubDevice);
286  break;
289  break;
290 
292  Status = HandleDataIntersection(&Irp->IoStatus, Request, Data, IoStack->Parameters.DeviceIoControl.OutputBufferLength, Descriptor, SubDevice);
293  break;
295  Status = HandlePhysicalConnection(&Irp->IoStatus, Request, IoStack->Parameters.DeviceIoControl.InputBufferLength, Data, IoStack->Parameters.DeviceIoControl.OutputBufferLength, Descriptor);
296  break;
300  break;
301  default:
304  }
305 
306  // Release reference
307  Port->Release();
308 
309  // Release subdevice reference
310  SubDevice->Release();
311 
312  return Status;
313 }
CPPORT Port[4]
Definition: headless.c:34
#define TRUE
Definition: types.h:120
#define PC_ASSERT(exp)
Definition: usbehci.h:17
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
_In_ PIRP Irp
Definition: csq.h:116
LONG NTSTATUS
Definition: precomp.h:26
void DbgBreakPoint()
Definition: mach.c:553
_In_ NDIS_HANDLE _In_ PNDIS_REQUEST Request
Definition: ndis.h:5173
IIrpTarget * Target
Definition: private.hpp:438
void DPRINT(...)
Definition: polytest.cpp:61
struct DISPATCH_CONTEXT * PDISPATCH_CONTEXT
NTSTATUS HandleNecessaryPropertyInstances(IN PIO_STATUS_BLOCK IoStatus, IN PKSIDENTIFIER Request, IN OUT PVOID Data, IN PSUBDEVICE_DESCRIPTOR Descriptor, IN ISubdevice *SubDevice)
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
nsrefcnt Release()
KSDDKAPI NTSTATUS NTAPI KsPinPropertyHandler(IN PIRP Irp, IN PKSPROPERTY Property, IN OUT PVOID Data, IN ULONG DescriptorsCount, IN const KSPIN_DESCRIPTOR *Descriptor)
Definition: connectivity.c:666
NTSTATUS HandlePropertyInstances(IN PIO_STATUS_BLOCK IoStatus, IN PKSIDENTIFIER Request, IN OUT PVOID Data, IN PSUBDEVICE_DESCRIPTOR Descriptor, IN BOOL Global, IN ISubdevice *SubDevice)
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
NTSTATUS HandlePhysicalConnection(IN PIO_STATUS_BLOCK IoStatus, IN PKSIDENTIFIER Request, IN ULONG RequestLength, IN OUT PVOID Data, IN ULONG DataLength, IN PSUBDEVICE_DESCRIPTOR Descriptor)
Status
Definition: gdiplustypes.h:24
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
PFILE_OBJECT FileObject
Definition: iotypes.h:2813
#define UNIMPLEMENTED
Definition: debug.h:114
NTSTATUS HandleDataIntersection(IN PIO_STATUS_BLOCK IoStatus, IN PKSIDENTIFIER Request, IN OUT PVOID Data, IN ULONG DataLength, IN PSUBDEVICE_DESCRIPTOR Descriptor, IN ISubdevice *SubDevice)
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:2772
struct SUBDEVICE_DESCRIPTOR * PSUBDEVICE_DESCRIPTOR
_In_ PSTORAGE_PROPERTY_ID _Outptr_ PSTORAGE_DESCRIPTOR_HEADER * Descriptor
Definition: classpnp.h:966

◆ PortClsCreate()

NTSTATUS NTAPI PortClsCreate ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp 
)

Definition at line 29 of file irp.cpp.

32 {
33  DPRINT("PortClsCreate called\n");
34 
36 }
KSDDKAPI NTSTATUS NTAPI KsDispatchIrp(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:2051
_In_ PIRP Irp
Definition: csq.h:116
void DPRINT(...)
Definition: polytest.cpp:61
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560

Referenced by PcDispatchIrp().

◆ PortClsPnp()

NTSTATUS NTAPI PortClsPnp ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp 
)

Definition at line 41 of file irp.cpp.

44 {
46  PPCLASS_DEVICE_EXTENSION DeviceExt;
47  PIO_STACK_LOCATION IoStack;
49  IResourceList* resource_list = NULL;
50  //ULONG Index;
51  //PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor, UnPartialDescriptor;
52 
55 
56 
57  DPRINT("PortClsPnp called %u\n", IoStack->MinorFunction);
58 
59  //PC_ASSERT(DeviceExt);
60 
61  switch (IoStack->MinorFunction)
62  {
64  DPRINT("IRP_MN_START_DEVICE\n");
65 
66  // Create the resource list
68  &resource_list,
69  NULL,
70  PagedPool,
71  IoStack->Parameters.StartDevice.AllocatedResourcesTranslated,
72  IoStack->Parameters.StartDevice.AllocatedResources);
73  if (!NT_SUCCESS(Status))
74  {
75  DPRINT("PcNewResourceList failed [0x%8x]\n", Status);
76  Irp->IoStatus.Status = Status;
78  return Status;
79  }
80 
81  // forward irp to lower device object
83 
84  if (!NT_SUCCESS(Status))
85  {
86  // lower device object failed to start
87  resource_list->Release();
88  // complete the request
90  // return result
91  return Status;
92  }
93 
94  // sanity check
95  //PC_ASSERT(DeviceExt->StartDevice);
96  // Call the StartDevice routine
97  DPRINT("Calling StartDevice at 0x%8p\n", DeviceExt->StartDevice);
98  Status = DeviceExt->StartDevice(DeviceObject, Irp, resource_list);
99  if (!NT_SUCCESS(Status))
100  {
101  DPRINT("StartDevice returned a failure code [0x%8x]\n", Status);
102  Irp->IoStatus.Status = Status;
104  return Status;
105  }
106 
107  // Assign the resource list to our extension
108  DeviceExt->resources = resource_list;
109 
110  // store device power state
111  DeviceExt->DevicePowerState = PowerDeviceD0;
113 
114  // notify power manager of current state
117 
118  Irp->IoStatus.Status = STATUS_SUCCESS;
120  return Status;
121 
123  // Clean up
124  DPRINT("IRP_MN_REMOVE_DEVICE\n");
125 
126  // sanity check
127  PC_ASSERT(DeviceExt);
128 
129  // FIXME more cleanup */
130  if (DeviceExt->resources)
131  {
132  // free resource list */
133  DeviceExt->resources->Release();
134 
135  // set to null
136  DeviceExt->resources = NULL;
137  }
138 
139  // Forward request
141 
143 
145  DPRINT("IRP_MN_QUERY_INTERFACE\n");
149  DPRINT("IRP_MN_QUERY_DEVICE_RELATIONS\n");
153  DPRINT("IRP_MN_FILTER_RESOURCE_REQUIREMENTS\n");
157  DPRINT("IRP_MN_QUERY_RESOURCE_REQUIREMENTS\n");
160  case IRP_MN_READ_CONFIG:
161  DPRINT("IRP_MN_READ_CONFIG\n");
164  }
165 
166  DPRINT("unhandled function %u\n", IoStack->MinorFunction);
167  Status = Irp->IoStatus.Status;
169  return Status;
170 }
_In_ UCHAR _In_ POWER_STATE PowerState
Definition: pofuncs.h:42
#define IRP_MN_REMOVE_DEVICE
#define PC_ASSERT(exp)
Definition: usbehci.h:17
struct PCLASS_DEVICE_EXTENSION * PPCLASS_DEVICE_EXTENSION
_In_ PIRP Irp
Definition: csq.h:116
#define IRP_MN_FILTER_RESOURCE_REQUIREMENTS
#define IRP_MN_QUERY_RESOURCE_REQUIREMENTS
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS NTAPI PcForwardIrpSynchronous(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.cpp:536
IResourceList * resources
Definition: private.hpp:410
PCPFNSTARTDEVICE StartDevice
Definition: private.hpp:404
DEVICE_POWER_STATE DevicePowerState
Definition: private.hpp:415
PVOID DeviceExtension
Definition: env_spec_w32.h:418
smooth NULL
Definition: ftsmooth.c:416
#define IoCompleteRequest
Definition: irp.c:1240
void DPRINT(...)
Definition: polytest.cpp:61
#define IRP_MN_READ_CONFIG
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define IRP_MN_START_DEVICE
DEVICE_POWER_STATE DeviceState
Definition: ntpoapi.h:58
#define IRP_MN_QUERY_INTERFACE
Status
Definition: gdiplustypes.h:24
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
PORTCLASSAPI NTSTATUS NTAPI PcNewResourceList(OUT PRESOURCELIST *OutResourceList, IN PUNKNOWN OuterUnknown OPTIONAL, IN POOL_TYPE PoolType, IN PCM_RESOURCE_LIST TranslatedResourceList, IN PCM_RESOURCE_LIST UntranslatedResourceList)
Definition: resource.cpp:310
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
#define IRP_MN_QUERY_DEVICE_RELATIONS
NTSTATUS NTAPI PcCompleteIrp(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN NTSTATUS Status)
Definition: irp.cpp:483
SYSTEM_POWER_STATE SystemPowerState
Definition: private.hpp:416
#define IO_NO_INCREMENT
Definition: iotypes.h:566
POWER_STATE NTAPI PoSetPowerState(IN PDEVICE_OBJECT DeviceObject, IN POWER_STATE_TYPE Type, IN POWER_STATE State)
Definition: power.c:597
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:2772
return STATUS_SUCCESS
Definition: btrfs.c:2938

Referenced by PcDispatchIrp().

◆ PortClsPower()

NTSTATUS NTAPI PortClsPower ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp 
)

Definition at line 209 of file irp.cpp.

212 {
213  PIO_STACK_LOCATION IoStack;
214  PPCLASS_DEVICE_EXTENSION DeviceExtension;
215  PQUERY_POWER_CONTEXT PwrContext;
218 
219  DPRINT("PortClsPower called\n");
220 
221  // get currrent stack location
223 
224  if (IoStack->MinorFunction != IRP_MN_SET_POWER && IoStack->MinorFunction != IRP_MN_QUERY_POWER)
225  {
226  // just forward the request
228 
229  // start next power irp
231 
232  // complete request
233  Irp->IoStatus.Status = Status;
235 
236  // done
237  return Status;
238  }
239 
240 
241  // get device extension
243 
244  // get current request type
245  if (IoStack->Parameters.Power.Type == DevicePowerState)
246  {
247  // request for device power state
248  if (DeviceExtension->DevicePowerState == IoStack->Parameters.Power.State.DeviceState)
249  {
250  // nothing has changed
251  if (IoStack->MinorFunction == IRP_MN_QUERY_POWER)
252  {
253  // only forward query requests
255  }
256 
257  // start next power irp
259 
260  // complete request
261  Irp->IoStatus.Status = Status;
263 
264  // done
265  return Status;
266  }
267 
268  if (IoStack->MinorFunction == IRP_MN_QUERY_POWER)
269  {
270  // check if there is a registered adapter power management
271  if (DeviceExtension->AdapterPowerManagement)
272  {
273  // it is query if the change can be changed
274  PowerState = IoStack->Parameters.Power.State;
275  Status = DeviceExtension->AdapterPowerManagement->QueryPowerChangeState(PowerState);
276 
277  // sanity check
279  }
280 
281  // only forward query requests
283 
284  // start next power irp
286 
287  // complete request
288  Irp->IoStatus.Status = Status;
290 
291  // done
292  return Status;
293  }
294  else
295  {
296  // set power state
297  PowerState = IoStack->Parameters.Power.State;
299 
300  // check if there is a registered adapter power management
301  if (DeviceExtension->AdapterPowerManagement)
302  {
303  // notify of a power change state
304  DeviceExtension->AdapterPowerManagement->PowerChangeState(PowerState);
305  }
306 
307  // FIXME call all registered IPowerNotify interfaces via ISubdevice interface
308 
309  // store new power state
310  DeviceExtension->DevicePowerState = IoStack->Parameters.Power.State.DeviceState;
311 
312  // complete request
313  Irp->IoStatus.Status = Status;
315 
316  // done
317  return Status;
318  }
319  }
320  else
321  {
322  // sanity check
323  PC_ASSERT(IoStack->Parameters.Power.Type == SystemPowerState);
324 
325  if (IoStack->MinorFunction == IRP_MN_QUERY_POWER)
326  {
327  // mark irp as pending
329 
330  // allocate power completion context
332 
333  if (!PwrContext)
334  {
335  // no memory
337 
338  // complete and forget
339  Irp->IoStatus.Status = STATUS_INSUFFICIENT_RESOURCES;
341 
342  // done
343  return Status;
344  }
345 
346  // setup power context
347  PwrContext->Irp = Irp;
348  PwrContext->DeviceObject = DeviceObject;
349 
350  // pass the irp down
351  PowerState = IoStack->Parameters.Power.State;
353 
354  // check for success
355  if (!NT_SUCCESS(Status))
356  {
357  // failed
358  Irp->IoStatus.Status = Status;
360 
361  // done
362  return Status;
363  }
364 
365  // done
366  return STATUS_PENDING;
367  }
368  else
369  {
370  // set power request
371  DeviceExtension->SystemPowerState = IoStack->Parameters.Power.State.SystemState;
372 
373  // only forward query requests
375 
376  // start next power irp
378 
379  // complete request
380  Irp->IoStatus.Status = Status;
382 
383  // done
384  return Status;
385  }
386  }
387 }
PDEVICE_OBJECT DeviceObject
Definition: irp.cpp:23
_In_ UCHAR _In_ POWER_STATE PowerState
Definition: pofuncs.h:42
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define PC_ASSERT(exp)
Definition: usbehci.h:17
#define IRP_MN_QUERY_POWER
struct PCLASS_DEVICE_EXTENSION * PPCLASS_DEVICE_EXTENSION
_In_ PIRP Irp
Definition: csq.h:116
#define TAG_PORTCLASS
Definition: private.hpp:24
PVOID AllocateItem(IN POOL_TYPE PoolType, IN SIZE_T NumberOfBytes)
Definition: misc.c:30
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS NTAPI PcForwardIrpSynchronous(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.cpp:536
struct QUERY_POWER_CONTEXT * PQUERY_POWER_CONTEXT
DEVICE_POWER_STATE DevicePowerState
Definition: private.hpp:415
PVOID DeviceExtension
Definition: env_spec_w32.h:418
smooth NULL
Definition: ftsmooth.c:416
#define IoCompleteRequest
Definition: irp.c:1240
void DPRINT(...)
Definition: polytest.cpp:61
if(!(yy_init))
Definition: macro.lex.yy.c:714
VOID CALLBACK PwrCompletionFunction(IN PDEVICE_OBJECT DeviceObject, IN UCHAR MinorFunction, IN POWER_STATE PowerState, IN PVOID Context, IN PIO_STATUS_BLOCK IoStatus)
Definition: irp.cpp:174
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_PENDING
Definition: ntstatus.h:82
PDEVICE_OBJECT PhysicalDeviceObject
Definition: private.hpp:402
#define IRP_MN_SET_POWER
Status
Definition: gdiplustypes.h:24
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
IAdapterPowerManagement * AdapterPowerManagement
Definition: private.hpp:406
VOID NTAPI PoStartNextPowerIrp(IN PIRP Irp)
Definition: power.c:626
SYSTEM_POWER_STATE SystemPowerState
Definition: private.hpp:416
#define IO_NO_INCREMENT
Definition: iotypes.h:566
POWER_STATE NTAPI PoSetPowerState(IN PDEVICE_OBJECT DeviceObject, IN POWER_STATE_TYPE Type, IN POWER_STATE State)
Definition: power.c:597
NTSTATUS NTAPI PoRequestPowerIrp(IN PDEVICE_OBJECT DeviceObject, IN UCHAR MinorFunction, IN POWER_STATE PowerState, IN PREQUEST_POWER_COMPLETE CompletionFunction, IN PVOID Context, OUT PIRP *pIrp OPTIONAL)
Definition: power.c:528
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:2772
return STATUS_SUCCESS
Definition: btrfs.c:2938
IoMarkIrpPending(Irp)

Referenced by PcDispatchIrp().

◆ PortClsSysControl()

NTSTATUS NTAPI PortClsSysControl ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp 
)

Definition at line 391 of file irp.cpp.

394 {
395  DPRINT("PortClsSysControl called\n");
396 
397  // TODO
398 
399  Irp->IoStatus.Status = STATUS_SUCCESS;
400  Irp->IoStatus.Information = 0;
402 
403  return STATUS_SUCCESS;
404 }
_In_ PIRP Irp
Definition: csq.h:116
#define IoCompleteRequest
Definition: irp.c:1240
void DPRINT(...)
Definition: polytest.cpp:61
#define IO_NO_INCREMENT
Definition: iotypes.h:566
return STATUS_SUCCESS
Definition: btrfs.c:2938

Referenced by PcDispatchIrp().

◆ TopologyPropertyHandler()

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

Definition at line 317 of file propertyhandler.cpp.

321 {
323 
324  Descriptor = (PSUBDEVICE_DESCRIPTOR)KSPROPERTY_ITEM_IRP_STORAGE(Irp);
325 
326  return KsTopologyPropertyHandler(Irp, Request, Data, Descriptor->Topology);
327 }
_In_ PIRP Irp
Definition: csq.h:116
_In_ NDIS_HANDLE _In_ PNDIS_REQUEST Request
Definition: ndis.h:5173
KSDDKAPI NTSTATUS NTAPI KsTopologyPropertyHandler(IN PIRP Irp, IN PKSPROPERTY Property, IN OUT PVOID Data, IN const KSTOPOLOGY *Topology)
Definition: topology.c:144
struct SUBDEVICE_DESCRIPTOR * PSUBDEVICE_DESCRIPTOR
_In_ PSTORAGE_PROPERTY_ID _Outptr_ PSTORAGE_DESCRIPTOR_HEADER * Descriptor
Definition: classpnp.h:966