ReactOS 0.4.16-dev-297-gc569aee
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
 
class  CUnknownImpl< Interfaces >
 

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)
#define NULL
Definition: types.h:112
#define DEFINE_KSPROPERTY_ITEM(PropertyId, GetHandler, MinProperty, MinData, SetHandler, Values, RelationsCount, Relations, SupportHandler, SerializedSize)
Definition: ks.h:1177
@ KSPROPERTY_AUDIO_POSITION
Definition: ksmedia.h:1058

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)
@ KSPROPERTY_DRMAUDIOSTREAM_CONTENTID
Definition: ksmedia.h:1154
uint32_t ULONG
Definition: typedefs.h:59

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 VOID
Definition: acefi.h:82
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
DWORD exp
Definition: msg.c:16058

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 12 of file pool.cpp.

16{
18}
FORCEINLINE PVOID ExAllocatePoolZero(ULONG PoolType, SIZE_T NumberOfBytes, ULONG Tag)
Definition: precomp.h:45
_Must_inspect_result_ _In_ WDFDEVICE _In_ BOOLEAN _In_opt_ PVOID Tag
Definition: wdfdevice.h:4065
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ _Strict_type_match_ POOL_TYPE PoolType
Definition: wdfdevice.h:3815
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS _Inout_ PLARGE_INTEGER NumberOfBytes
Definition: iotypes.h:1036

◆ FreeItem()

VOID FreeItem ( IN PVOID  Item,
IN ULONG  Tag 
)

Definition at line 21 of file pool.cpp.

24{
26}
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
_In_ WDFCOLLECTION _In_ WDFOBJECT Item

◆ GetDeviceObject()

PDEVICE_OBJECT GetDeviceObject ( IPortWaveCyclic *  iface)

Definition at line 37 of file port_wavecyclic.cpp.

534{
536 return This->m_pDeviceObject;
537}

◆ GetDeviceObjectFromPortWavePci()

PDEVICE_OBJECT GetDeviceObjectFromPortWavePci ( IPortWavePci *  iface)

Definition at line 40 of file port_wavepci.cpp.

534{
535 CPortWavePci * This = (CPortWavePci*)iface;
536 return This->m_pDeviceObject;
537}

◆ GetDeviceObjectFromPortWaveRT()

PDEVICE_OBJECT GetDeviceObjectFromPortWaveRT ( IPortWaveRT *  iface)

Definition at line 38 of file port_wavert.cpp.

443{
444 CPortWaveRT * This = (CPortWaveRT *)iface;
445 return This->m_pDeviceObject;
446}

◆ GetDeviceObjectFromWaveCyclic()

PDEVICE_OBJECT GetDeviceObjectFromWaveCyclic ( IPortWavePci *  iface)

◆ GetDMusMiniport()

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

Definition at line 38 of file port_dmus.cpp.

507{
508 CPortDMus * This = (CPortDMus*)iface;
509
510 *Miniport = This->m_pMiniport;
511 *MidiMiniport = This->m_pMiniportMidi;
512}

◆ GetTopologyMiniport()

PMINIPORTTOPOLOGY GetTopologyMiniport ( PPORTTOPOLOGY  Port)

Definition at line 37 of file port_topology.cpp.

589{
591 return This->m_pMiniport;
592}
CPPORT Port[4]
Definition: headless.c:35

◆ GetWaveCyclicMiniport()

PMINIPORTWAVECYCLIC GetWaveCyclicMiniport ( IN IPortWaveCyclic *  iface)

Definition at line 36 of file port_wavecyclic.cpp.

526{
528 return This->m_pMiniport;
529}

◆ GetWavePciMiniport()

PMINIPORTWAVEPCI GetWavePciMiniport ( PPORTWAVEPCI  Port)

Definition at line 41 of file port_wavepci.cpp.

542{
543 CPortWavePci * This = (CPortWavePci*)iface;
544 return This->m_Miniport;
545}

◆ GetWaveRTMiniport()

PMINIPORTWAVERT GetWaveRTMiniport ( IN IPortWaveRT *  iface)

Definition at line 37 of file port_wavert.cpp.

435{
436 CPortWaveRT * This = (CPortWaveRT *)iface;
437 return This->m_pMiniport;
438}

◆ 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:3169

◆ NewDispatchObject()

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

Definition at line 234 of file dispatcher.cpp.

239{
241 KSOBJECT_HEADER ObjectHeader;
242 PIO_STACK_LOCATION IoStack;
244
245 // get current irp stack location
247
249 if (!DispatchContext)
251
252 // allocate object header
253 Status = KsAllocateObjectHeader(&ObjectHeader, CreateItemCount, CreateItem, Irp, &DispatchTable);
254
255 if (!NT_SUCCESS(Status))
256 {
257 // free dispatch context
259 // done
260 return Status;
261 }
262
263 // initialize dispatch context
264 DispatchContext->ObjectHeader = ObjectHeader;
265 DispatchContext->Target = Target;
266 DispatchContext->CreateItem = CreateItem;
267
268 // store dispatch context
269 IoStack->FileObject->FsContext = DispatchContext;
270
271 DPRINT("KsAllocateObjectHeader result %x Target %p Context %p\n", Status, Target, DispatchContext);
272 return Status;
273}
LONG NTSTATUS
Definition: precomp.h:26
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
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
#define NonPagedPool
Definition: env_spec_w32.h:307
Status
Definition: gdiplustypes.h:25
PVOID AllocateItem(IN POOL_TYPE PoolType, IN SIZE_T NumberOfBytes)
Definition: misc.c:29
VOID FreeItem(IN PVOID Item)
Definition: misc.c:37
struct DISPATCH_CONTEXT * PDISPATCH_CONTEXT
#define TAG_PORTCLASS
Definition: private.hpp:24
#define DPRINT
Definition: sndvol32.h:73
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_In_ UCHAR _In_ UCHAR _In_ ULONG _In_ WDFCONTEXT _Inout_ PIRP _In_ WDFCONTEXT DispatchContext
Definition: wdfdevice.h:1708
_In_ PWDFDEVICE_INIT _In_ PWDF_PDO_EVENT_CALLBACKS DispatchTable
Definition: wdfpdo.h:248
_In_ WDFIOTARGET Target
Definition: wdfrequest.h:306

Referenced by PcCreateItemDispatch(), and PcCreatePinDispatch().

◆ NewIDrmPort()

NTSTATUS NewIDrmPort ( OUT PDRMPORT2 OutPort)

Definition at line 122 of file drm_port.cpp.

124{
126 if (!This)
128
129 This->AddRef();
130
131 *OutPort = (PDRMPORT2)This;
132 return STATUS_SUCCESS;
133}
IDrmPort2 * PDRMPORT2
Definition: portcls.h:2228
#define STATUS_SUCCESS
Definition: shellext.h:65

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

◆ NewIrpQueue()

NTSTATUS NTAPI NewIrpQueue ( IN IIrpQueue **  Queue)

Definition at line 864 of file irpstream.cpp.

866{
868 if (!This)
870
871 This->AddRef();
872
873 *Queue = (IIrpQueue*)This;
874 return STATUS_SUCCESS;
875}
_Must_inspect_result_ _In_ WDFDEVICE _In_ PIRP _In_ WDFQUEUE Queue
Definition: wdfdevice.h:2225

◆ NewIUnregisterPhysicalConnection()

NTSTATUS NTAPI NewIUnregisterPhysicalConnection ( OUT PUNREGISTERPHYSICALCONNECTION OutConnection)

Definition at line 124 of file connection.cpp.

126{
127
129
130 if (!new_ptr)
132
133 new_ptr->AddRef();
134 *OutConnection = (PUNREGISTERPHYSICALCONNECTION)new_ptr;
135 return STATUS_SUCCESS;
136}
IUnregisterPhysicalConnection * PUNREGISTERPHYSICALCONNECTION
Definition: portcls.h:677

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

◆ NewIUnregisterSubdevice()

NTSTATUS NTAPI NewIUnregisterSubdevice ( OUT PUNREGISTERSUBDEVICE OutDevice)

Definition at line 119 of file unregister.cpp.

121{
124 if (!This)
126
127 Status = This->QueryInterface(IID_IUnregisterSubdevice, (PVOID*)OutDevice);
128 if (!NT_SUCCESS(Status))
129 {
130 delete This;
131 return Status;
132 }
133
134 *OutDevice = (PUNREGISTERSUBDEVICE)This;
135 return Status;
136}
IUnregisterSubdevice * PUNREGISTERSUBDEVICE
Definition: portcls.h:635

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

◆ NewMiniportDMusUART()

NTSTATUS NewMiniportDMusUART ( OUT PMINIPORT OutMiniport,
IN REFCLSID  ClassId 
)

Definition at line 1222 of file miniport_dmus.cpp.

1225{
1228
1230 if (!This)
1232
1233 Status = This->QueryInterface(IID_IMiniport, (PVOID*)OutMiniport);
1234
1235 if (!NT_SUCCESS(Status))
1236 {
1237 delete This;
1238 }
1239
1240 DPRINT("NewMiniportDMusUART %p Status %x\n", *OutMiniport, Status);
1241 return Status;
1242}

Referenced by PcNewMiniport().

◆ NewMiniportFmSynth()

NTSTATUS NewMiniportFmSynth ( OUT PMINIPORT OutMiniport,
IN REFCLSID  ClassId 
)

Definition at line 11 of file miniport_fmsynth.cpp.

14{
16}
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132

Referenced by PcNewMiniport().

◆ NewPortClsVersion()

NTSTATUS NewPortClsVersion ( OUT PPORTCLSVERSION OutVersion)

◆ NewPortDMus()

NTSTATUS NewPortDMus ( OUT PPORT OutPort)

Definition at line 482 of file port_dmus.cpp.

484{
487 if (!Port)
489
490 Status = Port->QueryInterface(IID_IPort, (PVOID*)OutPort);
491
492 if (!NT_SUCCESS(Status))
493 {
494 delete Port;
495 }
496
497 DPRINT("NewPortDMus %p Status %u\n", Port, Status);
498 return Status;
499
500}

Referenced by PcNewPort().

◆ NewPortFilterDMus()

NTSTATUS NewPortFilterDMus ( OUT PPORTFILTERDMUS OutFilter)

Definition at line 321 of file filter_dmus.cpp.

323{
325
327 if (!This)
329
330 This->AddRef();
331
332 // return result
333 *OutFilter = (CPortFilterDMus*)This;
334
335 return STATUS_SUCCESS;
336}

◆ NewPortFilterTopology()

NTSTATUS NewPortFilterTopology ( OUT IPortFilterTopology **  OutFilter)

Definition at line 254 of file filter_topology.cpp.

256{
258
260 if (!This)
262
263 This->AddRef();
264
265 // return result
266 *OutFilter = (CPortFilterTopology*)This;
267
268 return STATUS_SUCCESS;
269}

◆ NewPortFilterWaveCyclic()

NTSTATUS NewPortFilterWaveCyclic ( OUT IPortFilterWaveCyclic **  OutFilter)

Definition at line 332 of file filter_wavecyclic.cpp.

334{
336
338
339 if (!This)
341
342 This->AddRef();
343
344 // return result
345 *OutFilter = (IPortFilterWaveCyclic*)This;
346
347 return STATUS_SUCCESS;
348}

◆ NewPortFilterWavePci()

NTSTATUS NewPortFilterWavePci ( OUT IPortFilterWavePci **  OutFilter)

Definition at line 313 of file filter_wavepci.cpp.

315{
317
319 if (!This)
321
322 This->AddRef();
323
324 // return result
325 *OutFilter = (IPortFilterWavePci*)This;
326
327 return STATUS_SUCCESS;
328}

◆ NewPortFilterWaveRT()

NTSTATUS NewPortFilterWaveRT ( OUT IPortFilterWaveRT **  OutFilter)

Definition at line 299 of file filter_wavert.cpp.

301{
303
305 if (!This)
307
308 This->AddRef();
309
310 // return result
311 *OutFilter = (CPortFilterWaveRT*)This;
312
313 return STATUS_SUCCESS;
314}

◆ NewPortPinDMus()

NTSTATUS NewPortPinDMus ( OUT PPORTPINDMUS OutPin)

Definition at line 606 of file pin_dmus.cpp.

608{
610
612 if (!This)
614
615 This->AddRef();
616
617 // store result
618 *OutPin = (IPortPinDMus*)This;
619
620 return STATUS_SUCCESS;
621}

◆ NewPortPinWaveCyclic()

NTSTATUS NewPortPinWaveCyclic ( OUT IPortPinWaveCyclic **  OutPin)

Definition at line 1374 of file pin_wavecyclic.cpp.

1376{
1378
1380 if (!This)
1382
1383 This->AddRef();
1384
1385 // store result
1386 *OutPin = (IPortPinWaveCyclic*)This;
1387
1388 return STATUS_SUCCESS;
1389}

◆ NewPortPinWavePci()

NTSTATUS NewPortPinWavePci ( OUT IPortPinWavePci **  OutPin)

Definition at line 968 of file pin_wavepci.cpp.

970{
972
974 if (!This)
976
977 This->AddRef();
978
979 // store result
980 *OutPin = (IPortPinWavePci*)This;
981
982 return STATUS_SUCCESS;
983}

◆ NewPortPinWaveRT()

NTSTATUS NewPortPinWaveRT ( OUT IPortPinWaveRT **  OutPin)

Definition at line 670 of file pin_wavert.cpp.

672{
674
676 if (!This)
678
679 This->AddRef();
680
681 // store result
682 *OutPin = (PPORTPINWAVERT)This;
683
684 return STATUS_SUCCESS;
685}
IPortPinWaveRT * PPORTPINWAVERT
Definition: interfaces.hpp:724

◆ NewPortTopology()

NTSTATUS NewPortTopology ( OUT PPORT OutPort)

Definition at line 565 of file port_topology.cpp.

567{
570
572 if (!This)
574
575 Status = This->QueryInterface(IID_IPort, (PVOID*)OutPort);
576
577 if (!NT_SUCCESS(Status))
578 {
579 delete This;
580 }
581
582 DPRINT("NewPortTopology %p Status %x\n", *OutPort, Status);
583 return Status;
584}

Referenced by PcNewPort().

◆ NewPortWaveCyclic()

NTSTATUS NewPortWaveCyclic ( OUT PPORT OutPort)

Definition at line 544 of file port_wavecyclic.cpp.

546{
549
551 if (!Port)
553
554 Status = Port->QueryInterface(IID_IPort, (PVOID*)OutPort);
555
556 if (!NT_SUCCESS(Status))
557 {
558 delete Port;
559 }
560
561 DPRINT("NewPortWaveCyclic %p Status %u\n", Port, Status);
562 return Status;
563}

Referenced by PcNewPort().

◆ NewPortWavePci()

NTSTATUS NewPortWavePci ( OUT PPORT OutPort)

Definition at line 509 of file port_wavepci.cpp.

511{
514
516 if (!Port)
518
519 Status = Port->QueryInterface(IID_IPort, (PVOID*)OutPort);
520
521 if (!NT_SUCCESS(Status))
522 {
523 delete Port;
524 }
525
526 DPRINT("NewPortWavePci %p Status %u\n", Port, Status);
527 return Status;
528
529}

Referenced by PcNewPort().

◆ NewPortWaveRT()

NTSTATUS NewPortWaveRT ( OUT PPORT OutPort)

Definition at line 453 of file port_wavert.cpp.

455{
458
460 if (!Port)
462
463 Status = Port->QueryInterface(IID_IPort, (PVOID*)OutPort);
464
465 if (!NT_SUCCESS(Status))
466 {
467 delete Port;
468 }
469
470 DPRINT("NewPortWaveRT %p Status %u\n", Port, Status);
471 return Status;
472}

Referenced by PcNewPort().

◆ NewPortWaveRTStream()

NTSTATUS NewPortWaveRTStream ( PPORTWAVERTSTREAM OutStream)

Definition at line 157 of file port_wavertstream.cpp.

159{
162 if (!This)
164
165 Status = This->QueryInterface(IID_IPortWaveRTStream, (PVOID*)OutStream);
166
167 if (!NT_SUCCESS(Status))
168 {
169 delete This;
170 return Status;
171 }
172
173 *OutStream = (PPORTWAVERTSTREAM)This;
174 return Status;
175}
IPortWaveRTStream * PPORTWAVERTSTREAM
Definition: portcls.h:1847

◆ operator new()

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

Definition at line 16 of file miniport.cpp.

20{
22 if (P)
24 return P;
25}
#define P(row, col)
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533

◆ PcCreateItemDispatch()

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

Definition at line 491 of file port_topology.cpp.

494{
496 ISubdevice * SubDevice;
497 IIrpTarget *Filter;
498 PKSOBJECT_CREATE_ITEM CreateItem, PinCreateItem;
499
500 // access the create item
501 CreateItem = KSCREATE_ITEM_IRP_STORAGE(Irp);
502
503 DPRINT("PcCreateItemDispatch called DeviceObject %p %S Name\n", DeviceObject, CreateItem->ObjectClass.Buffer);
504
505 // get the subdevice
506 SubDevice = (ISubdevice*)CreateItem->Context;
507
508 // sanity checks
509 PC_ASSERT(SubDevice != NULL);
510
511#if KS_IMPLEMENTED
512 Status = KsReferenceSoftwareBusObject(DeviceExt->KsDeviceHeader);
514 {
515 DPRINT("PcCreateItemDispatch failed to reference device header\n");
516
518 goto cleanup;
519 }
520#endif
521
522 // get filter object
523 Status = SubDevice->NewIrpTarget(&Filter,
524 NULL,
525 NULL,
528 Irp,
529 NULL);
530 if (!NT_SUCCESS(Status))
531 {
532 DPRINT("Failed to get filter object\n");
533 Irp->IoStatus.Status = Status;
535 return Status;
536 }
537
538 // allocate pin create item
539 PinCreateItem = (PKSOBJECT_CREATE_ITEM)AllocateItem(NonPagedPool, sizeof(KSOBJECT_CREATE_ITEM), TAG_PORTCLASS);
540 if (!PinCreateItem)
541 {
542 // not enough memory
543 Irp->IoStatus.Status = STATUS_INSUFFICIENT_RESOURCES;
546 }
547
548 // initialize pin create item
549 PinCreateItem->Context = (PVOID)Filter;
550 PinCreateItem->Create = PcCreatePinDispatch;
551 RtlInitUnicodeString(&PinCreateItem->ObjectClass, KSSTRING_Pin);
552 // FIXME copy security descriptor
553
554 // now allocate a dispatch object
555 Status = NewDispatchObject(Irp, Filter, 1, PinCreateItem);
556
557 // complete request
558 Irp->IoStatus.Status = Status;
560
561 return STATUS_SUCCESS;
562}
#define STATUS_NOT_IMPLEMENTED
Definition: d3dkmdt.h:42
NTSTATUS NTAPI NewDispatchObject(IN PIRP Irp, IN IIrpTarget *Target, IN ULONG CreateItemCount, IN PKSOBJECT_CREATE_ITEM CreateItem)
Definition: dispatcher.cpp:234
static void cleanup(void)
Definition: main.c:1335
KSDDKAPI NTSTATUS NTAPI KsReferenceSoftwareBusObject(IN KSDEVICE_HEADER Header)
Definition: device.c:780
_Must_inspect_result_ _In_opt_ PFLT_FILTER Filter
Definition: fltkernel.h:1801
#define KSSTRING_Pin
Definition: ks.h:48
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define IoCompleteRequest
Definition: irp.c:1240
NTSTATUS NTAPI PcCreatePinDispatch(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
#define PC_ASSERT(exp)
Definition: private.hpp:26
base of all file and directory entries
Definition: entries.h:83
void * PVOID
Definition: typedefs.h:50
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
#define IO_NO_INCREMENT
Definition: iotypes.h:598

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

732{
734 ULONG Index, SubIndex;
736 PPCPIN_DESCRIPTOR SrcDescriptor;
739
740 // allocate subdevice descriptor
742 if (!Descriptor)
744
745 // initialize physical / symbolic link connection list
746 InitializeListHead(&Descriptor->SymbolicLinkList);
747 InitializeListHead(&Descriptor->PhysicalConnectionList);
748
749 //FIXME add driver category guids
750 Descriptor->Interfaces = (GUID*)AllocateItem(NonPagedPool, sizeof(GUID) * InterfaceCount, TAG_PORTCLASS);
751 if (!Descriptor->Interfaces)
752 goto cleanup;
753
754 // copy interface guids
755 RtlCopyMemory(Descriptor->Interfaces, InterfaceGuids, sizeof(GUID) * InterfaceCount);
756 Descriptor->InterfaceCount = InterfaceCount;
757
758 //DumpFilterDescriptor(FilterDescription);
759
760 // are any property sets supported by the portcls
761 if (FilterPropertiesCount)
762 {
763 // first allocate filter properties set
764 Descriptor->FilterPropertySet = (PKSPROPERTY_SET)AllocateItem(NonPagedPool, sizeof(KSPROPERTY_SET) * FilterPropertiesCount, TAG_PORTCLASS);
765 if (! Descriptor->FilterPropertySet)
766 goto cleanup;
767
768 // now copy all filter property sets
769 Descriptor->FilterPropertySetCount = FilterPropertiesCount;
770 for(Index = 0; Index < FilterPropertiesCount; Index++)
771 {
772 // copy property set
773 RtlMoveMemory(&Descriptor->FilterPropertySet[Index], &FilterProperties[Index], sizeof(KSPROPERTY_SET));
774
775 if (Descriptor->FilterPropertySet[Index].PropertiesCount)
776 {
777 // copy property items to make sure they are dynamically allocated
778 Descriptor->FilterPropertySet[Index].PropertyItem = (PKSPROPERTY_ITEM)AllocateItem(NonPagedPool, FilterProperties[Index].PropertiesCount * sizeof(KSPROPERTY_ITEM), TAG_PORTCLASS);
779 if (!Descriptor->FilterPropertySet[Index].PropertyItem)
780 {
781 // no memory
782 goto cleanup;
783 }
784
785 // copy filter property items
786 RtlMoveMemory((PVOID)Descriptor->FilterPropertySet[Index].PropertyItem, FilterProperties[Index].PropertyItem, FilterProperties[Index].PropertiesCount * sizeof(KSPROPERTY_ITEM));
787 }
788 }
789 }
790
791 // now check if the filter descriptor supports filter properties
792 if (FilterDescription->AutomationTable)
793 {
794 // get first entry
795 PropertyItem = (PPCPROPERTY_ITEM)FilterDescription->AutomationTable->Properties;
796
797 // copy driver filter property sets
798 for(Index = 0; Index < FilterDescription->AutomationTable->PropertyCount; Index++)
799 {
800 // add the property item
802
803 // check for success
804 if (Status != STATUS_SUCCESS)
805 {
806 // goto cleanup
807 goto cleanup;
808 }
809
810 // move to next entry
811 PropertyItem = (PPCPROPERTY_ITEM)((ULONG_PTR)PropertyItem + FilterDescription->AutomationTable->PropertyItemSize);
812 }
813 }
814
815 // check if the filter has pins
816 if (FilterDescription->PinCount)
817 {
818 // allocate pin factory descriptors
819 Descriptor->Factory.KsPinDescriptor = (PKSPIN_DESCRIPTOR)AllocateItem(NonPagedPool, sizeof(KSPIN_DESCRIPTOR) * FilterDescription->PinCount, TAG_PORTCLASS);
820 if (!Descriptor->Factory.KsPinDescriptor)
821 goto cleanup;
822
823 // allocate pin instance info
824 Descriptor->Factory.Instances = (PPIN_INSTANCE_INFO)AllocateItem(NonPagedPool, FilterDescription->PinCount * sizeof(PIN_INSTANCE_INFO), TAG_PORTCLASS);
825 if (!Descriptor->Factory.Instances)
826 goto cleanup;
827
828 // initialize pin factory descriptor
829 Descriptor->Factory.PinDescriptorCount = FilterDescription->PinCount;
830 Descriptor->Factory.PinDescriptorSize = sizeof(KSPIN_DESCRIPTOR);
831
832 // grab first entry
833 SrcDescriptor = (PPCPIN_DESCRIPTOR)FilterDescription->Pins;
834
835 // copy pin factories
836 for(Index = 0; Index < FilterDescription->PinCount; Index++)
837 {
838 // copy pin descriptor
839 RtlMoveMemory(&Descriptor->Factory.KsPinDescriptor[Index], &SrcDescriptor->KsPinDescriptor, sizeof(KSPIN_DESCRIPTOR));
840
841 // initialize pin factory instance data
842 Descriptor->Factory.Instances[Index].CurrentPinInstanceCount = 0;
843 Descriptor->Factory.Instances[Index].MaxFilterInstanceCount = SrcDescriptor->MaxFilterInstanceCount;
844 Descriptor->Factory.Instances[Index].MaxGlobalInstanceCount = SrcDescriptor->MaxGlobalInstanceCount;
845 Descriptor->Factory.Instances[Index].MinFilterInstanceCount = SrcDescriptor->MinFilterInstanceCount;
846
847 // check if the descriptor has an automation table
848 if (SrcDescriptor->AutomationTable)
849 {
850 // it has, grab first entry
852
853 // now add all supported property items
854 for(SubIndex = 0; SubIndex < SrcDescriptor->AutomationTable->PropertyCount; SubIndex++)
855 {
856 // add the property item to the table
858
859 // check for success
860 if (Status != STATUS_SUCCESS)
861 {
862 // goto cleanup
863 goto cleanup;
864 }
865
866 // move to next entry
868 }
869 }
870
871 // move to next entry
872 SrcDescriptor = (PPCPIN_DESCRIPTOR)((ULONG_PTR)SrcDescriptor + FilterDescription->PinSize);
873 }
874 }
875
876 // allocate topology descriptor
878 if (!Descriptor->Topology)
879 goto cleanup;
880
881 // are there any connections
882 if (FilterDescription->ConnectionCount)
883 {
884 // allocate connection descriptor
885 Descriptor->Topology->TopologyConnections = (PKSTOPOLOGY_CONNECTION)AllocateItem(NonPagedPool, sizeof(KSTOPOLOGY_CONNECTION) * FilterDescription->ConnectionCount, TAG_PORTCLASS);
886 if (!Descriptor->Topology->TopologyConnections)
887 goto cleanup;
888
889 // copy connection descriptor
890 RtlMoveMemory((PVOID)Descriptor->Topology->TopologyConnections, FilterDescription->Connections, FilterDescription->ConnectionCount * sizeof(PCCONNECTION_DESCRIPTOR));
891
892 // store connection count
893 Descriptor->Topology->TopologyConnectionsCount = FilterDescription->ConnectionCount;
894 }
895
896 // does the filter have nodes
897 if (FilterDescription->NodeCount)
898 {
899 // allocate topology node types array
900 Descriptor->Topology->TopologyNodes = (const GUID *)AllocateItem(NonPagedPool, sizeof(GUID) * FilterDescription->NodeCount, TAG_PORTCLASS);
901 if (!Descriptor->Topology->TopologyNodes)
902 goto cleanup;
903
904 // allocate topology node names array
905 Descriptor->Topology->TopologyNodesNames = (const GUID *)AllocateItem(NonPagedPool, sizeof(GUID) * FilterDescription->NodeCount, TAG_PORTCLASS);
906 if (!Descriptor->Topology->TopologyNodesNames)
907 goto cleanup;
908
909 // grab first entry
910 NodeDescriptor = (PPCNODE_DESCRIPTOR)FilterDescription->Nodes;
911
912 // iterate all nodes and copy node types / names and node properties
913 for(Index = 0; Index < FilterDescription->NodeCount; Index++)
914 {
915 // does it have a type
916 if (NodeDescriptor->Type)
917 {
918 // copy node type
919 RtlMoveMemory((PVOID)&Descriptor->Topology->TopologyNodes[Index], NodeDescriptor->Type, sizeof(GUID));
920 }
921
922 // does it have a node name
923 if (NodeDescriptor->Name)
924 {
925 // copy node name
926 RtlMoveMemory((PVOID)&Descriptor->Topology->TopologyNodesNames[Index], NodeDescriptor->Name, sizeof(GUID));
927 }
928
929 // check if has an automation table
930 if (NodeDescriptor->AutomationTable)
931 {
932 // grab first entry
933 PropertyItem = (PPCPROPERTY_ITEM)NodeDescriptor->AutomationTable->Properties;
934
935 // copy all node properties into the global property set
936 for(SubIndex = 0; SubIndex < NodeDescriptor->AutomationTable->PropertyCount; SubIndex++)
937 {
938 // add to property set
940
941 // check for success
942 if (Status != STATUS_SUCCESS)
943 {
944 // failed
945 goto cleanup;
946 }
947
948 // move to next property item
949 PropertyItem = (PPCPROPERTY_ITEM)((ULONG_PTR)PropertyItem + NodeDescriptor->AutomationTable->PropertyItemSize);
950 }
951 }
952
953 // move to next descriptor
954 NodeDescriptor = (PPCNODE_DESCRIPTOR)((ULONG_PTR)NodeDescriptor + FilterDescription->NodeSize);
955 }
956
957 // now store the topology node count
958 Descriptor->Topology->TopologyNodesCount = FilterDescription->NodeCount;
959 }
960
961 // store descriptor
962 Descriptor->DeviceDescriptor = FilterDescription;
963
964 // store result
965 *OutSubdeviceDescriptor = Descriptor;
966 // done
967 return STATUS_SUCCESS;
968
969cleanup:
970 if (Descriptor)
971 {
972 if (Descriptor->Interfaces)
973 FreeItem(Descriptor->Interfaces, TAG_PORTCLASS);
974
975 if (Descriptor->Factory.KsPinDescriptor)
976 FreeItem(Descriptor->Factory.KsPinDescriptor, TAG_PORTCLASS);
977
979 }
980 return Status;
981}
struct SUBDEVICE_DESCRIPTOR * PSUBDEVICE_DESCRIPTOR
struct PIN_INSTANCE_INFO * PPIN_INSTANCE_INFO
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
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
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:264
NTSTATUS PcAddToPropertyTable(IN PSUBDEVICE_DESCRIPTOR SubDeviceDescriptor, IN PPCPROPERTY_ITEM PropertyItem, IN ULONG bNode)
Definition: undoc.cpp:306
struct KSTOPOLOGY_CONNECTION * PKSTOPOLOGY_CONNECTION
_In_ WDFCOLLECTION _In_ ULONG Index
_Must_inspect_result_ _In_ WDFIORESLIST _In_ PIO_RESOURCE_DESCRIPTOR Descriptor
Definition: wdfresource.h:342

◆ 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 206 of file api.cpp.

217{
218
220
221 DeviceDescription->Master = TRUE;
223 DeviceDescription->ScatterGather= ScatterGather;
224 DeviceDescription->Dma32BitAddresses = Dma32BitAddresses;
225 DeviceDescription->IgnoreCount = IgnoreCount;
226 DeviceDescription->Dma64BitAddresses = Dma64BitAddresses;
227 DeviceDescription->DmaWidth = DmaWidth;
228 DeviceDescription->DmaSpeed = DmaSpeed;
229 DeviceDescription->MaximumLength = MaximumLength;
230 DeviceDescription->DmaPort = DmaPort;
231
232 return STATUS_SUCCESS;
233}
_In_ BOOLEAN Dma64BitAddresses
Definition: ndis.h:4652
_In_ WDFDMATRANSACTION _In_ size_t MaximumLength
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_ PCUNICODE_STRING DeviceDescription
Definition: wdfpdo.h:432
#define DEVICE_DESCRIPTION_VERSION1
Definition: iotypes.h:2064
_In_ struct _IRP _In_ struct _SCATTER_GATHER_LIST * ScatterGather
Definition: iotypes.h:2375

◆ 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 237 of file api.cpp.

246{
247
249
251 DeviceDescription->DemandMode = DemandMode;
252 DeviceDescription->AutoInitialize = AutoInitialize;
253 DeviceDescription->DmaSpeed = DmaSpeed;
254 DeviceDescription->MaximumLength = MaximumLength;
255 DeviceDescription->DmaPort = DmaPort;
256
257 return STATUS_SUCCESS;
258}

◆ 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  Descriptor 
)

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
struct _IO_STACK_LOCATION::@1579::@1580 DeviceIoControl
union _IO_STACK_LOCATION::@1579 Parameters
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135

Referenced by CPortPinWavePci::HandleKsProperty().

◆ PcIoTimerRoutine()

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

Definition at line 46 of file api.cpp.

49{
50 PPCLASS_DEVICE_EXTENSION DeviceExtension;
52 PLIST_ENTRY ListEntry;
53 PTIMER_CONTEXT CurContext;
54
55 if (!DeviceObject || !DeviceObject->DeviceExtension)
56 return;
57
58 DeviceExtension = (PPCLASS_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
59
60 KeAcquireSpinLock(&DeviceExtension->TimerListLock, &OldIrql);
61
62 ListEntry = DeviceExtension->TimerList.Flink;
63 while(ListEntry != &DeviceExtension->TimerList)
64 {
65 CurContext = (PTIMER_CONTEXT)CONTAINING_RECORD(ListEntry, TIMER_CONTEXT, Entry);
66
67 CurContext->pTimerRoutine(DeviceObject, CurContext->Context);
68 ListEntry = ListEntry->Flink;
69 }
70
71 KeReleaseSpinLock(&DeviceExtension->TimerListLock, OldIrql);
72}
UCHAR KIRQL
Definition: env_spec_w32.h:591
#define KeReleaseSpinLock(sl, irql)
Definition: env_spec_w32.h:627
#define KeAcquireSpinLock(sl, irql)
Definition: env_spec_w32.h:609
struct TIMER_CONTEXT * PTIMER_CONTEXT
struct PCLASS_DEVICE_EXTENSION * PPCLASS_DEVICE_EXTENSION
KSPIN_LOCK TimerListLock
Definition: private.hpp:413
PVOID Context
Definition: private.hpp:432
PIO_TIMER_ROUTINE pTimerRoutine
Definition: private.hpp:431
Definition: typedefs.h:120
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:778

Referenced by PcAddAdapterDevice().

◆ PcValidateConnectRequest()

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

Definition at line 985 of file undoc.cpp.

989{
990 return KsValidateConnectRequest(Irp, Factory->PinDescriptorCount, Factory->KsPinDescriptor, Connect);
991}
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

◆ PinPropertyHandler()

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

Definition at line 214 of file propertyhandler.cpp.

218{
219 PIO_STACK_LOCATION IoStack;
220 //PKSOBJECT_CREATE_ITEM CreateItem;
222 IIrpTarget * IrpTarget;
223 IPort *Port;
224 ISubdevice *SubDevice;
226
228
229 Descriptor = (PSUBDEVICE_DESCRIPTOR)KSPROPERTY_ITEM_IRP_STORAGE(Irp);
231
232 // get current irp stack
234
235 // get dispatch context
236 DispatchContext = (PDISPATCH_CONTEXT)IoStack->FileObject->FsContext;
237
238 // Get the IrpTarget
239 IrpTarget = DispatchContext->Target;
240 PC_ASSERT(IrpTarget);
241
242 // Get the parent
243 Status = IrpTarget->QueryInterface(IID_IPort, (PVOID*)&Port);
244 if (!NT_SUCCESS(Status))
245 {
246 DPRINT("Failed to obtain IPort interface from filter\n");
247 Irp->IoStatus.Information = 0;
248 Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
249 return STATUS_UNSUCCESSFUL;
250 }
251
252 // Get private ISubdevice interface
253 Status = Port->QueryInterface(IID_ISubdevice, (PVOID*)&SubDevice);
254 if (!NT_SUCCESS(Status))
255 {
256 DPRINT("Failed to obtain ISubdevice interface from port driver\n");
258 while(TRUE);
259 }
260
261 // get current stack location
263
264 switch(Request->Id)
265 {
275 Status = KsPinPropertyHandler(Irp, Request, Data, Descriptor->Factory.PinDescriptorCount, Descriptor->Factory.KsPinDescriptor);
276 break;
278 Status = HandlePropertyInstances(&Irp->IoStatus, Request, Data, Descriptor, TRUE, SubDevice);
279 break;
281 Status = HandlePropertyInstances(&Irp->IoStatus, Request, Data, Descriptor, FALSE, SubDevice);
282 break;
285 break;
286
288 Status = HandleDataIntersection(&Irp->IoStatus, Request, Data, IoStack->Parameters.DeviceIoControl.OutputBufferLength, Descriptor, SubDevice);
289 break;
291 Status = HandlePhysicalConnection(&Irp->IoStatus, Request, IoStack->Parameters.DeviceIoControl.InputBufferLength, Data, IoStack->Parameters.DeviceIoControl.OutputBufferLength, Descriptor);
292 break;
296 break;
297 default:
300 }
301
302 // Release reference
303 Port->Release();
304
305 // Release subdevice reference
306 SubDevice->Release();
307
308 return Status;
309}
#define UNIMPLEMENTED
Definition: ntoskrnl.c:15
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
NTSYSAPI void WINAPI DbgBreakPoint(void)
nsrefcnt Release()
@ KSPROPERTY_PIN_COMMUNICATION
Definition: ks.h:632
@ KSPROPERTY_PIN_CATEGORY
Definition: ks.h:636
@ KSPROPERTY_PIN_DATAINTERSECTION
Definition: ks.h:629
@ KSPROPERTY_PIN_NECESSARYINSTANCES
Definition: ks.h:634
@ KSPROPERTY_PIN_GLOBALCINSTANCES
Definition: ks.h:633
@ KSPROPERTY_PIN_CINSTANCES
Definition: ks.h:625
@ KSPROPERTY_PIN_MEDIUMS
Definition: ks.h:631
@ KSPROPERTY_PIN_NAME
Definition: ks.h:637
@ KSPROPERTY_PIN_PROPOSEDATAFORMAT
Definition: ks.h:639
@ KSPROPERTY_PIN_CONSTRAINEDDATARANGES
Definition: ks.h:638
@ KSPROPERTY_PIN_DATARANGES
Definition: ks.h:628
@ KSPROPERTY_PIN_PHYSICALCONNECTION
Definition: ks.h:635
@ KSPROPERTY_PIN_CTYPES
Definition: ks.h:626
@ KSPROPERTY_PIN_DATAFLOW
Definition: ks.h:627
@ KSPROPERTY_PIN_INTERFACES
Definition: ks.h:630
NTSTATUS HandlePhysicalConnection(IN PIO_STATUS_BLOCK IoStatus, IN PKSIDENTIFIER Request, IN ULONG RequestLength, IN OUT PVOID Data, IN ULONG DataLength, IN PSUBDEVICE_DESCRIPTOR Descriptor)
NTSTATUS HandlePropertyInstances(IN PIO_STATUS_BLOCK IoStatus, IN PKSIDENTIFIER Request, IN OUT PVOID Data, IN PSUBDEVICE_DESCRIPTOR Descriptor, IN BOOL Global, IN ISubdevice *SubDevice)
NTSTATUS HandleDataIntersection(IN PIO_STATUS_BLOCK IoStatus, IN PKSIDENTIFIER Request, IN OUT PVOID Data, IN ULONG DataLength, IN PSUBDEVICE_DESCRIPTOR Descriptor, IN ISubdevice *SubDevice)
NTSTATUS HandleNecessaryPropertyInstances(IN PIO_STATUS_BLOCK IoStatus, IN PKSIDENTIFIER Request, IN OUT PVOID Data, IN PSUBDEVICE_DESCRIPTOR Descriptor, IN ISubdevice *SubDevice)
_In_ WDFREQUEST Request
Definition: wdfdevice.h:547

◆ PortClsCreate()

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

Definition at line 25 of file irp.cpp.

28{
29 DPRINT("PortClsCreate called\n");
30
32}
KSDDKAPI NTSTATUS NTAPI KsDispatchIrp(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:2084

Referenced by PcDispatchIrp().

◆ PortClsPnp()

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

Definition at line 36 of file irp.cpp.

39{
42 PIO_STACK_LOCATION IoStack;
44 IResourceList* resource_list = NULL;
45 //ULONG Index;
46 //PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor, UnPartialDescriptor;
47
48 DeviceExt = (PPCLASS_DEVICE_EXTENSION) DeviceObject->DeviceExtension;
50
51 DPRINT("PortClsPnp called %u\n", IoStack->MinorFunction);
52
53 //PC_ASSERT(DeviceExt);
54
55 switch (IoStack->MinorFunction)
56 {
58 DPRINT("IRP_MN_START_DEVICE\n");
59
60 // Create the resource list
62 &resource_list,
63 NULL,
65 IoStack->Parameters.StartDevice.AllocatedResourcesTranslated,
66 IoStack->Parameters.StartDevice.AllocatedResources);
67 if (!NT_SUCCESS(Status))
68 {
69 DPRINT("PcNewResourceList failed [0x%8x]\n", Status);
70 Irp->IoStatus.Status = Status;
72 return Status;
73 }
74
75 // forward irp to lower device object
77
78 if (!NT_SUCCESS(Status))
79 {
80 // lower device object failed to start
81 resource_list->Release();
82 // complete the request
84 // return result
85 return Status;
86 }
87
88 // sanity check
89 //PC_ASSERT(DeviceExt->StartDevice);
90 // Call the StartDevice routine
91 DPRINT("Calling StartDevice at 0x%8p\n", DeviceExt->StartDevice);
92 Status = DeviceExt->StartDevice(DeviceObject, Irp, resource_list);
93 if (!NT_SUCCESS(Status))
94 {
95 DPRINT("StartDevice returned a failure code [0x%8x]\n", Status);
96 Irp->IoStatus.Status = Status;
98 return Status;
99 }
100
101 // Assign the resource list to our extension
102 DeviceExt->resources = resource_list;
103
104 // store device power state
105 DeviceExt->DevicePowerState = PowerDeviceD0;
107
108 // notify power manager of current state
109 PowerState.DeviceState = DeviceExt->DevicePowerState;
111
112 Irp->IoStatus.Status = STATUS_SUCCESS;
114 return Status;
115
117 // Clean up
118 DPRINT("IRP_MN_REMOVE_DEVICE\n");
119
120 // sanity check
121 PC_ASSERT(DeviceExt);
122
123 // FIXME more cleanup */
124 if (DeviceExt->resources)
125 {
126 // free resource list */
127 DeviceExt->resources->Release();
128
129 // set to null
130 DeviceExt->resources = NULL;
131 }
132
133 // Forward request
135
137
139 DPRINT("IRP_MN_QUERY_INTERFACE\n");
143 DPRINT("IRP_MN_QUERY_DEVICE_RELATIONS\n");
147 DPRINT("IRP_MN_FILTER_RESOURCE_REQUIREMENTS\n");
151 DPRINT("IRP_MN_QUERY_RESOURCE_REQUIREMENTS\n");
155 DPRINT("IRP_MN_READ_CONFIG\n");
158 }
159
160 DPRINT("unhandled function %u\n", IoStack->MinorFunction);
161 Status = Irp->IoStatus.Status;
163 return Status;
164}
#define PagedPool
Definition: env_spec_w32.h:308
NTSTATUS NTAPI PcForwardIrpSynchronous(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.cpp:509
NTSTATUS NTAPI PcCompleteIrp(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN NTSTATUS Status)
Definition: irp.cpp:458
POWER_STATE NTAPI PoSetPowerState(IN PDEVICE_OBJECT DeviceObject, IN POWER_STATE_TYPE Type, IN POWER_STATE State)
Definition: power.c:729
@ PowerSystemWorking
Definition: ntpoapi.h:36
@ DevicePowerState
Definition: ntpoapi.h:63
@ PowerDeviceD0
Definition: ntpoapi.h:49
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:295
IResourceList * resources
Definition: private.hpp:410
SYSTEM_POWER_STATE SystemPowerState
Definition: private.hpp:416
PCPFNSTARTDEVICE StartDevice
Definition: private.hpp:404
DEVICE_POWER_STATE DevicePowerState
Definition: private.hpp:415
struct _IO_STACK_LOCATION::@3978::@4015 StartDevice
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_ WDF_DEVICE_POWER_STATE PowerState
Definition: wdfdevice.h:3034
#define IRP_MN_QUERY_INTERFACE
#define IRP_MN_START_DEVICE
#define IRP_MN_READ_CONFIG
#define IRP_MN_QUERY_RESOURCE_REQUIREMENTS
#define IRP_MN_REMOVE_DEVICE
#define IRP_MN_FILTER_RESOURCE_REQUIREMENTS
#define IRP_MN_QUERY_DEVICE_RELATIONS

Referenced by PcDispatchIrp().

◆ PortClsPower()

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

Definition at line 202 of file irp.cpp.

205{
206 PIO_STACK_LOCATION IoStack;
207 PPCLASS_DEVICE_EXTENSION DeviceExtension;
208 PQUERY_POWER_CONTEXT PwrContext;
211
212 DPRINT("PortClsPower called\n");
213
214 // get currrent stack location
216
217 // get device extension
218 DeviceExtension = (PPCLASS_DEVICE_EXTENSION) DeviceObject->DeviceExtension;
219
221 {
222 // forward unknown requests down the stack and forget
225 return PoCallDriver(DeviceExtension->PrevDeviceObject, Irp);
226 }
227
228 // get current request type
229 if (IoStack->Parameters.Power.Type == DevicePowerState)
230 {
231 // request for device power state
232 if (DeviceExtension->DevicePowerState == IoStack->Parameters.Power.State.DeviceState)
233 {
234 // nothing has changed
235 if (IoStack->MinorFunction == IRP_MN_QUERY_POWER)
236 {
237 // only forward query requests; we can forget about them
240 return PoCallDriver(DeviceExtension->PrevDeviceObject, Irp);
241 }
242
243 // start next power irp
245
246 // complete request
247 Irp->IoStatus.Status = Status;
249
250 // done
251 return Status;
252 }
253
254 if (IoStack->MinorFunction == IRP_MN_QUERY_POWER)
255 {
256 // check if there is a registered adapter power management
257 if (DeviceExtension->AdapterPowerManagement)
258 {
259 // it is query if the change can be changed
260 PowerState = IoStack->Parameters.Power.State;
261 Status = DeviceExtension->AdapterPowerManagement->QueryPowerChangeState(PowerState);
262
263 if (!NT_SUCCESS(Status))
264 {
265 // fail the IRP if the adapter power manager failed
267 Irp->IoStatus.Status = Status;
269 return Status;
270 }
271 }
272
273 // only forward query requests
276 return PoCallDriver(DeviceExtension->PrevDeviceObject, Irp);
277 }
278 else
279 {
280 // set power state
281 PowerState = IoStack->Parameters.Power.State;
283
284 // check if there is a registered adapter power management
285 if (DeviceExtension->AdapterPowerManagement)
286 {
287 // notify of a power change state
288 DeviceExtension->AdapterPowerManagement->PowerChangeState(PowerState);
289 }
290
291 // FIXME call all registered IPowerNotify interfaces via ISubdevice interface
292
293 // store new power state
294 DeviceExtension->DevicePowerState = IoStack->Parameters.Power.State.DeviceState;
295
296 // complete request
297 Irp->IoStatus.Status = Status;
299
300 // done
301 return Status;
302 }
303 }
304 else
305 {
306 // sanity check
307 PC_ASSERT(IoStack->Parameters.Power.Type == SystemPowerState);
308
309 if (IoStack->MinorFunction == IRP_MN_QUERY_POWER)
310 {
311 // mark irp as pending
313
314 // allocate power completion context
316
317 if (!PwrContext)
318 {
319 // no memory
321
322 // complete and forget
323 Irp->IoStatus.Status = STATUS_INSUFFICIENT_RESOURCES;
325
326 // done
327 return STATUS_PENDING;
328 }
329
330 // setup power context
331 PwrContext->Irp = Irp;
332 PwrContext->DeviceObject = DeviceObject;
333
334 // pass the irp down
335 PowerState = IoStack->Parameters.Power.State;
337
338 // check for success
339 if (!NT_SUCCESS(Status))
340 {
341 // failed
342 Irp->IoStatus.Status = Status;
344
345 // done
346 return STATUS_PENDING;
347 }
348
349 // done
350 return STATUS_PENDING;
351 }
352 else
353 {
354 // set power request
355 DeviceExtension->SystemPowerState = IoStack->Parameters.Power.State.SystemState;
356
357 // only forward query requests
360 return PoCallDriver(DeviceExtension->PrevDeviceObject, Irp);
361 }
362 }
363}
#define STATUS_PENDING
Definition: d3dkmdt.h:43
IoMarkIrpPending(Irp)
struct QUERY_POWER_CONTEXT * PQUERY_POWER_CONTEXT
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:168
if(dx< 0)
Definition: linetemp.h:194
#define IoSkipCurrentIrpStackLocation(Irp)
Definition: ntifs_ex.h:421
VOID NTAPI PoStartNextPowerIrp(IN PIRP Irp)
Definition: power.c:758
NTSTATUS NTAPI PoRequestPowerIrp(_In_ PDEVICE_OBJECT DeviceObject, _In_ UCHAR MinorFunction, _In_ POWER_STATE PowerState, _In_opt_ PREQUEST_POWER_COMPLETE CompletionFunction, _In_opt_ __drv_aliasesMem PVOID Context, _Outptr_opt_ PIRP *pIrp)
Definition: power.c:659
PDEVICE_OBJECT PhysicalDeviceObject
Definition: private.hpp:402
PDEVICE_OBJECT PrevDeviceObject
Definition: private.hpp:403
IAdapterPowerManagement * AdapterPowerManagement
Definition: private.hpp:406
PDEVICE_OBJECT DeviceObject
Definition: irp.cpp:20
struct _IO_STACK_LOCATION::@3978::@4014 Power
#define IRP_MN_SET_POWER
_In_ SYSTEM_POWER_STATE SystemPowerState
Definition: iotypes.h:7519
#define IRP_MN_QUERY_POWER

Referenced by PcDispatchIrp().

◆ PortClsSysControl()

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

Definition at line 367 of file irp.cpp.

370{
371 DPRINT("PortClsSysControl called\n");
372
373 // TODO
374
375 Irp->IoStatus.Status = STATUS_SUCCESS;
376 Irp->IoStatus.Information = 0;
378
379 return STATUS_SUCCESS;
380}

Referenced by PcDispatchIrp().

◆ TopologyPropertyHandler()

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

Definition at line 313 of file propertyhandler.cpp.

317{
319
320 Descriptor = (PSUBDEVICE_DESCRIPTOR)KSPROPERTY_ITEM_IRP_STORAGE(Irp);
321
323}
KSDDKAPI NTSTATUS NTAPI KsTopologyPropertyHandler(IN PIRP Irp, IN PKSPROPERTY Property, IN OUT PVOID Data, IN const KSTOPOLOGY *Topology)
Definition: topology.c:144