ReactOS 0.4.15-dev-6712-g46b4b55
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 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
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
_In_ WDFCOLLECTION _In_ WDFOBJECT Item
_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 32 of file pool.cpp.

35{
36
38}
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109

◆ GetDeviceObject()

PDEVICE_OBJECT GetDeviceObject ( IPortWaveCyclic *  iface)

Definition at line 40 of file port_wavecyclic.cpp.

546{
548 return This->m_pDeviceObject;
549}

◆ GetDeviceObjectFromPortWavePci()

PDEVICE_OBJECT GetDeviceObjectFromPortWavePci ( IPortWavePci *  iface)

Definition at line 43 of file port_wavepci.cpp.

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

◆ GetDeviceObjectFromPortWaveRT()

PDEVICE_OBJECT GetDeviceObjectFromPortWaveRT ( IPortWaveRT *  iface)

Definition at line 41 of file port_wavert.cpp.

453{
454 CPortWaveRT * This = (CPortWaveRT *)iface;
455 return This->m_pDeviceObject;
456}

◆ GetDeviceObjectFromWaveCyclic()

PDEVICE_OBJECT GetDeviceObjectFromWaveCyclic ( IPortWavePci *  iface)

◆ GetDMusMiniport()

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

Definition at line 41 of file port_dmus.cpp.

518{
519 CPortDMus * This = (CPortDMus*)iface;
520
521 *Miniport = This->m_pMiniport;
522 *MidiMiniport = This->m_pMiniportMidi;
523}

◆ GetTopologyMiniport()

PMINIPORTTOPOLOGY GetTopologyMiniport ( PPORTTOPOLOGY  Port)

Definition at line 40 of file port_topology.cpp.

601{
603 return This->m_pMiniport;
604}
CPPORT Port[4]
Definition: headless.c:35

◆ GetWaveCyclicMiniport()

PMINIPORTWAVECYCLIC GetWaveCyclicMiniport ( IN IPortWaveCyclic *  iface)

Definition at line 39 of file port_wavecyclic.cpp.

538{
540 return This->m_pMiniport;
541}

◆ GetWavePciMiniport()

PMINIPORTWAVEPCI GetWavePciMiniport ( PPORTWAVEPCI  Port)

Definition at line 44 of file port_wavepci.cpp.

551{
552 CPortWavePci * This = (CPortWavePci*)iface;
553 return This->m_Miniport;
554}

◆ GetWaveRTMiniport()

PMINIPORTWAVERT GetWaveRTMiniport ( IN IPortWaveRT *  iface)

Definition at line 40 of file port_wavert.cpp.

445{
446 CPortWaveRT * This = (CPortWaveRT *)iface;
447 return This->m_pMiniport;
448}

◆ 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
PFILE_OBJECT FileObject
Definition: iotypes.h:3169
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2793

◆ 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;
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
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}
LONG NTSTATUS
Definition: precomp.h:26
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
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:30
VOID FreeItem(IN PVOID Item)
Definition: misc.c:43
struct DISPATCH_CONTEXT * PDISPATCH_CONTEXT
#define TAG_PORTCLASS
Definition: private.hpp:24
#define DPRINT
Definition: sndvol32.h:71
#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 125 of file drm_port.cpp.

127{
129 if (!This)
131
132 This->AddRef();
133
134 *OutPort = (PDRMPORT2)This;
135 return STATUS_SUCCESS;
136}
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 869 of file irpstream.cpp.

871{
873 if (!This)
875
876 This->AddRef();
877
878 *Queue = (IIrpQueue*)This;
879 return STATUS_SUCCESS;
880}
_Must_inspect_result_ _In_ WDFDEVICE _In_ PIRP _In_ WDFQUEUE Queue
Definition: wdfdevice.h:2225

◆ NewIUnregisterPhysicalConnection()

NTSTATUS NTAPI NewIUnregisterPhysicalConnection ( OUT PUNREGISTERPHYSICALCONNECTION OutConnection)

Definition at line 128 of file connection.cpp.

130{
131
133
134 if (!new_ptr)
136
137 new_ptr->AddRef();
138 *OutConnection = (PUNREGISTERPHYSICALCONNECTION)new_ptr;
139 return STATUS_SUCCESS;
140}
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 122 of file unregister.cpp.

124{
127 if (!This)
129
130 Status = This->QueryInterface(IID_IUnregisterSubdevice, (PVOID*)OutDevice);
131 if (!NT_SUCCESS(Status))
132 {
133 delete This;
134 return Status;
135 }
136
137 *OutDevice = (PUNREGISTERSUBDEVICE)This;
138 return Status;
139}
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 1225 of file miniport_dmus.cpp.

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

Referenced by PcNewMiniport().

◆ NewMiniportFmSynth()

NTSTATUS NewMiniportFmSynth ( OUT PMINIPORT OutMiniport,
IN REFCLSID  ClassId 
)

Definition at line 17 of file miniport_fmsynth.cpp.

20{
22}
#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 491 of file port_dmus.cpp.

493{
496 if (!Port)
498
499 Status = Port->QueryInterface(IID_IPort, (PVOID*)OutPort);
500
501 if (!NT_SUCCESS(Status))
502 {
503 delete Port;
504 }
505
506 DPRINT("NewPortDMus %p Status %u\n", Port, Status);
507 return Status;
508
509}

Referenced by PcNewPort().

◆ NewPortFilterDMus()

NTSTATUS NewPortFilterDMus ( OUT PPORTFILTERDMUS OutFilter)

Definition at line 326 of file filter_dmus.cpp.

328{
330
332 if (!This)
334
335 This->AddRef();
336
337 // return result
338 *OutFilter = (CPortFilterDMus*)This;
339
340 return STATUS_SUCCESS;
341}

◆ NewPortFilterTopology()

NTSTATUS NewPortFilterTopology ( OUT IPortFilterTopology **  OutFilter)

Definition at line 260 of file filter_topology.cpp.

262{
264
266 if (!This)
268
269 This->AddRef();
270
271 // return result
272 *OutFilter = (CPortFilterTopology*)This;
273
274 return STATUS_SUCCESS;
275}

◆ NewPortFilterWaveCyclic()

NTSTATUS NewPortFilterWaveCyclic ( OUT IPortFilterWaveCyclic **  OutFilter)

Definition at line 337 of file filter_wavecyclic.cpp.

339{
341
343
344 if (!This)
346
347 This->AddRef();
348
349 // return result
350 *OutFilter = (IPortFilterWaveCyclic*)This;
351
352 return STATUS_SUCCESS;
353}

◆ NewPortFilterWavePci()

NTSTATUS NewPortFilterWavePci ( OUT IPortFilterWavePci **  OutFilter)

Definition at line 318 of file filter_wavepci.cpp.

320{
322
324 if (!This)
326
327 This->AddRef();
328
329 // return result
330 *OutFilter = (IPortFilterWavePci*)This;
331
332 return STATUS_SUCCESS;
333}

◆ NewPortFilterWaveRT()

NTSTATUS NewPortFilterWaveRT ( OUT IPortFilterWaveRT **  OutFilter)

Definition at line 302 of file filter_wavert.cpp.

304{
306
308 if (!This)
310
311 This->AddRef();
312
313 // return result
314 *OutFilter = (CPortFilterWaveRT*)This;
315
316 return STATUS_SUCCESS;
317}

◆ NewPortPinDMus()

NTSTATUS NewPortPinDMus ( OUT PPORTPINDMUS OutPin)

Definition at line 616 of file pin_dmus.cpp.

618{
620
622 if (!This)
624
625 This->AddRef();
626
627 // store result
628 *OutPin = (IPortPinDMus*)This;
629
630 return STATUS_SUCCESS;
631}

◆ NewPortPinWaveCyclic()

NTSTATUS NewPortPinWaveCyclic ( OUT IPortPinWaveCyclic **  OutPin)

Definition at line 1401 of file pin_wavecyclic.cpp.

1403{
1405
1407 if (!This)
1409
1410 This->AddRef();
1411
1412 // store result
1413 *OutPin = (IPortPinWaveCyclic*)This;
1414
1415 return STATUS_SUCCESS;
1416}

◆ NewPortPinWavePci()

NTSTATUS NewPortPinWavePci ( OUT IPortPinWavePci **  OutPin)

Definition at line 984 of file pin_wavepci.cpp.

986{
988
990 if (!This)
992
993 This->AddRef();
994
995 // store result
996 *OutPin = (IPortPinWavePci*)This;
997
998 return STATUS_SUCCESS;
999}

◆ NewPortPinWaveRT()

NTSTATUS NewPortPinWaveRT ( OUT IPortPinWaveRT **  OutPin)

Definition at line 676 of file pin_wavert.cpp.

678{
680
682 if (!This)
684
685 This->AddRef();
686
687 // store result
688 *OutPin = (PPORTPINWAVERT)This;
689
690 return STATUS_SUCCESS;
691}
IPortPinWaveRT * PPORTPINWAVERT
Definition: interfaces.hpp:724

◆ NewPortTopology()

NTSTATUS NewPortTopology ( OUT PPORT OutPort)

Definition at line 576 of file port_topology.cpp.

578{
581
583 if (!This)
585
586 Status = This->QueryInterface(IID_IPort, (PVOID*)OutPort);
587
588 if (!NT_SUCCESS(Status))
589 {
590 delete This;
591 }
592
593 DPRINT("NewPortTopology %p Status %x\n", *OutPort, Status);
594 return Status;
595}

Referenced by PcNewPort().

◆ NewPortWaveCyclic()

NTSTATUS NewPortWaveCyclic ( OUT PPORT OutPort)

Definition at line 556 of file port_wavecyclic.cpp.

558{
561
563 if (!Port)
565
566 Status = Port->QueryInterface(IID_IPort, (PVOID*)OutPort);
567
568 if (!NT_SUCCESS(Status))
569 {
570 delete Port;
571 }
572
573 DPRINT("NewPortWaveCyclic %p Status %u\n", Port, Status);
574 return Status;
575}

Referenced by PcNewPort().

◆ NewPortWavePci()

NTSTATUS NewPortWavePci ( OUT PPORT OutPort)

Definition at line 517 of file port_wavepci.cpp.

519{
522
524 if (!Port)
526
527 Status = Port->QueryInterface(IID_IPort, (PVOID*)OutPort);
528
529 if (!NT_SUCCESS(Status))
530 {
531 delete Port;
532 }
533
534 DPRINT("NewPortWavePci %p Status %u\n", Port, Status);
535 return Status;
536
537}

Referenced by PcNewPort().

◆ NewPortWaveRT()

NTSTATUS NewPortWaveRT ( OUT PPORT OutPort)

Definition at line 464 of file port_wavert.cpp.

466{
469
471 if (!Port)
473
474 Status = Port->QueryInterface(IID_IPort, (PVOID*)OutPort);
475
476 if (!NT_SUCCESS(Status))
477 {
478 delete Port;
479 }
480
481 DPRINT("NewPortWaveRT %p Status %u\n", Port, Status);
482 return Status;
483}

Referenced by PcNewPort().

◆ NewPortWaveRTStream()

NTSTATUS NewPortWaveRTStream ( PPORTWAVERTSTREAM OutStream)

Definition at line 162 of file port_wavertstream.cpp.

164{
167 if (!This)
169
170 Status = This->QueryInterface(IID_IPortWaveRTStream, (PVOID*)OutStream);
171
172 if (!NT_SUCCESS(Status))
173 {
174 delete This;
175 return Status;
176 }
177
178 *OutStream = (PPORTWAVERTSTREAM)This;
179 return Status;
180}
IPortWaveRTStream * PPORTWAVERTSTREAM
Definition: portcls.h:1847

◆ 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 P(row, col)
_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 500 of file port_topology.cpp.

503{
505 ISubdevice * SubDevice;
506 IIrpTarget *Filter;
507 PKSOBJECT_CREATE_ITEM CreateItem, PinCreateItem;
508
509 // access the create item
510 CreateItem = KSCREATE_ITEM_IRP_STORAGE(Irp);
511
512 DPRINT("PcCreateItemDispatch called DeviceObject %p %S Name\n", DeviceObject, CreateItem->ObjectClass.Buffer);
513
514 // get the subdevice
515 SubDevice = (ISubdevice*)CreateItem->Context;
516
517 // sanity checks
518 PC_ASSERT(SubDevice != NULL);
519
520
521#if KS_IMPLEMENTED
522 Status = KsReferenceSoftwareBusObject(DeviceExt->KsDeviceHeader);
524 {
525 DPRINT("PcCreateItemDispatch failed to reference device header\n");
526
528 goto cleanup;
529 }
530#endif
531
532 // get filter object
533 Status = SubDevice->NewIrpTarget(&Filter,
534 NULL,
535 NULL,
538 Irp,
539 NULL);
540 if (!NT_SUCCESS(Status))
541 {
542 DPRINT("Failed to get filter object\n");
543 Irp->IoStatus.Status = Status;
545 return Status;
546 }
547
548 // allocate pin create item
549 PinCreateItem = (PKSOBJECT_CREATE_ITEM)AllocateItem(NonPagedPool, sizeof(KSOBJECT_CREATE_ITEM), TAG_PORTCLASS);
550 if (!PinCreateItem)
551 {
552 // not enough memory
553 Irp->IoStatus.Status = STATUS_INSUFFICIENT_RESOURCES;
556 }
557
558 // initialize pin create item
559 PinCreateItem->Context = (PVOID)Filter;
560 PinCreateItem->Create = PcCreatePinDispatch;
561 RtlInitUnicodeString(&PinCreateItem->ObjectClass, KSSTRING_Pin);
562 // FIXME copy security descriptor
563
564 // now allocate a dispatch object
565 Status = NewDispatchObject(Irp, Filter, 1, PinCreateItem);
566
567 // complete request
568 Irp->IoStatus.Status = Status;
570
571 return STATUS_SUCCESS;
572}
NTSTATUS NTAPI NewDispatchObject(IN PIRP Irp, IN IIrpTarget *Target, IN ULONG CreateItemCount, IN PKSOBJECT_CREATE_ITEM CreateItem)
Definition: dispatcher.cpp:242
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
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:239
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 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
982cleanup:
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}
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:45
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:311
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 213 of file api.cpp.

224{
225
227
228 DeviceDescription->Master = TRUE;
230 DeviceDescription->ScatterGather= ScatterGather;
231 DeviceDescription->Dma32BitAddresses = Dma32BitAddresses;
232 DeviceDescription->IgnoreCount = IgnoreCount;
233 DeviceDescription->Dma64BitAddresses = Dma64BitAddresses;
234 DeviceDescription->DmaWidth = DmaWidth;
235 DeviceDescription->DmaSpeed = DmaSpeed;
236 DeviceDescription->MaximumLength = MaximumLength;
237 DeviceDescription->DmaPort = DmaPort;
238
239 return STATUS_SUCCESS;
240}
_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 244 of file api.cpp.

253{
254
256
258 DeviceDescription->DemandMode = DemandMode;
259 DeviceDescription->AutoInitialize = AutoInitialize;
260 DeviceDescription->DmaSpeed = DmaSpeed;
261 DeviceDescription->MaximumLength = MaximumLength;
262 DeviceDescription->DmaPort = DmaPort;
263
264 return STATUS_SUCCESS;
265}

◆ 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}
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 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}
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 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}
KSDDKAPI NTSTATUS NTAPI KsPropertyHandler(IN PIRP Irp, IN ULONG PropertySetsCount, IN const KSPROPERTY_SET *PropertySet)
Definition: property.c:358
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:3128
#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 49 of file api.cpp.

52{
53 PPCLASS_DEVICE_EXTENSION DeviceExtension;
55 PLIST_ENTRY ListEntry;
56 PTIMER_CONTEXT CurContext;
57
58 if (!DeviceObject || !DeviceObject->DeviceExtension)
59 return;
60
61 DeviceExtension = (PPCLASS_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
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}
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:792

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}
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 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;
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");
262 while(TRUE);
263 }
264
265 // get current stack location
267
268 switch(Request->Id)
269 {
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}
#define UNIMPLEMENTED
Definition: debug.h:115
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 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:2063

Referenced by PcDispatchIrp().

◆ PortClsPnp()

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

Definition at line 41 of file irp.cpp.

44{
47 PIO_STACK_LOCATION IoStack;
49 IResourceList* resource_list = NULL;
50 //ULONG Index;
51 //PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor, UnPartialDescriptor;
52
53 DeviceExt = (PPCLASS_DEVICE_EXTENSION) DeviceObject->DeviceExtension;
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,
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
115 PowerState.DeviceState = DeviceExt->DevicePowerState;
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");
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}
#define PagedPool
Definition: env_spec_w32.h:308
NTSTATUS NTAPI PcForwardIrpSynchronous(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.cpp:519
NTSTATUS NTAPI PcCompleteIrp(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN NTSTATUS Status)
Definition: irp.cpp:466
POWER_STATE NTAPI PoSetPowerState(IN PDEVICE_OBJECT DeviceObject, IN POWER_STATE_TYPE Type, IN POWER_STATE State)
Definition: power.c:717
@ 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:300
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
_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 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 // get device extension
225 DeviceExtension = (PPCLASS_DEVICE_EXTENSION) DeviceObject->DeviceExtension;
226
228 {
229 // forward unknown requests down the stack and forget
232 return PoCallDriver(DeviceExtension->PrevDeviceObject, Irp);
233 }
234
235 // get current request type
236 if (IoStack->Parameters.Power.Type == DevicePowerState)
237 {
238 // request for device power state
239 if (DeviceExtension->DevicePowerState == IoStack->Parameters.Power.State.DeviceState)
240 {
241 // nothing has changed
242 if (IoStack->MinorFunction == IRP_MN_QUERY_POWER)
243 {
244 // only forward query requests; we can forget about them
247 return PoCallDriver(DeviceExtension->PrevDeviceObject, Irp);
248 }
249
250 // start next power irp
252
253 // complete request
254 Irp->IoStatus.Status = Status;
256
257 // done
258 return Status;
259 }
260
261 if (IoStack->MinorFunction == IRP_MN_QUERY_POWER)
262 {
263 // check if there is a registered adapter power management
264 if (DeviceExtension->AdapterPowerManagement)
265 {
266 // it is query if the change can be changed
267 PowerState = IoStack->Parameters.Power.State;
268 Status = DeviceExtension->AdapterPowerManagement->QueryPowerChangeState(PowerState);
269
270 if (!NT_SUCCESS(Status))
271 {
272 // fail the IRP if the adapter power manager failed
274 Irp->IoStatus.Status = Status;
276 return Status;
277 }
278 }
279
280 // only forward query requests
283 return PoCallDriver(DeviceExtension->PrevDeviceObject, Irp);
284 }
285 else
286 {
287 // set power state
288 PowerState = IoStack->Parameters.Power.State;
290
291 // check if there is a registered adapter power management
292 if (DeviceExtension->AdapterPowerManagement)
293 {
294 // notify of a power change state
295 DeviceExtension->AdapterPowerManagement->PowerChangeState(PowerState);
296 }
297
298 // FIXME call all registered IPowerNotify interfaces via ISubdevice interface
299
300 // store new power state
301 DeviceExtension->DevicePowerState = IoStack->Parameters.Power.State.DeviceState;
302
303 // complete request
304 Irp->IoStatus.Status = Status;
306
307 // done
308 return Status;
309 }
310 }
311 else
312 {
313 // sanity check
314 PC_ASSERT(IoStack->Parameters.Power.Type == SystemPowerState);
315
316 if (IoStack->MinorFunction == IRP_MN_QUERY_POWER)
317 {
318 // mark irp as pending
320
321 // allocate power completion context
323
324 if (!PwrContext)
325 {
326 // no memory
328
329 // complete and forget
330 Irp->IoStatus.Status = STATUS_INSUFFICIENT_RESOURCES;
332
333 // done
334 return STATUS_PENDING;
335 }
336
337 // setup power context
338 PwrContext->Irp = Irp;
339 PwrContext->DeviceObject = DeviceObject;
340
341 // pass the irp down
342 PowerState = IoStack->Parameters.Power.State;
344
345 // check for success
346 if (!NT_SUCCESS(Status))
347 {
348 // failed
349 Irp->IoStatus.Status = Status;
351
352 // done
353 return STATUS_PENDING;
354 }
355
356 // done
357 return STATUS_PENDING;
358 }
359 else
360 {
361 // set power request
362 DeviceExtension->SystemPowerState = IoStack->Parameters.Power.State.SystemState;
363
364 // only forward query requests
367 return PoCallDriver(DeviceExtension->PrevDeviceObject, Irp);
368 }
369 }
370}
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:174
if(dx< 0)
Definition: linetemp.h:194
#define IoSkipCurrentIrpStackLocation(Irp)
Definition: ntifs_ex.h:421
VOID NTAPI PoStartNextPowerIrp(IN PIRP Irp)
Definition: power.c:746
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:647
#define STATUS_PENDING
Definition: ntstatus.h:82
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:23
#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 374 of file irp.cpp.

377{
378 DPRINT("PortClsSysControl called\n");
379
380 // TODO
381
382 Irp->IoStatus.Status = STATUS_SUCCESS;
383 Irp->IoStatus.Information = 0;
385
386 return STATUS_SUCCESS;
387}

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
327}
KSDDKAPI NTSTATUS NTAPI KsTopologyPropertyHandler(IN PIRP Irp, IN PKSPROPERTY Property, IN OUT PVOID Data, IN const KSTOPOLOGY *Topology)
Definition: topology.c:144