ReactOS  0.4.14-dev-52-g6116262
port_topology.cpp File Reference
#include "private.hpp"
#include <debug.h>
Include dependency graph for port_topology.cpp:

Go to the source code of this file.

Classes

class  CPortTopology
 

Macros

#define NDEBUG
 

Functions

 DEFINE_KSPROPERTY_TOPOLOGYSET (PortFilterTopologyTopologySet, TopologyPropertyHandler)
 
 DEFINE_KSPROPERTY_PINPROPOSEDATAFORMAT (PortFilterTopologyPinSet, PinPropertyHandler, PinPropertyHandler, PinPropertyHandler)
 
NTSTATUS NTAPI PcCreatePinDispatch (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
NTSTATUS NTAPI PcCreateItemDispatch (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
NTSTATUS NewPortTopology (OUT PPORT *OutPort)
 
PMINIPORTTOPOLOGY GetTopologyMiniport (PPORTTOPOLOGY Port)
 

Variables

static GUID InterfaceGuids [2]
 
KSPROPERTY_SET TopologyPropertySet []
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 12 of file port_topology.cpp.

Function Documentation

◆ DEFINE_KSPROPERTY_PINPROPOSEDATAFORMAT()

DEFINE_KSPROPERTY_PINPROPOSEDATAFORMAT ( PortFilterTopologyPinSet  ,
PinPropertyHandler  ,
PinPropertyHandler  ,
PinPropertyHandler   
)

◆ DEFINE_KSPROPERTY_TOPOLOGYSET()

DEFINE_KSPROPERTY_TOPOLOGYSET ( PortFilterTopologyTopologySet  ,
TopologyPropertyHandler   
)

◆ GetTopologyMiniport()

PMINIPORTTOPOLOGY GetTopologyMiniport ( PPORTTOPOLOGY  Port)

Definition at line 619 of file port_topology.cpp.

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

◆ NewPortTopology()

NTSTATUS NewPortTopology ( OUT PPORT OutPort)

Definition at line 596 of file port_topology.cpp.

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

Referenced by PcNewPort().

◆ PcCreateItemDispatch()

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

Definition at line 520 of file port_topology.cpp.

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

Referenced by PcRegisterSubdevice().

◆ PcCreatePinDispatch()

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

Definition at line 457 of file port_topology.cpp.

460 {
462  IIrpTarget *Filter;
463  IIrpTarget *Pin;
464  PKSOBJECT_CREATE_ITEM CreateItem;
465 
466  // access the create item
467  CreateItem = KSCREATE_ITEM_IRP_STORAGE(Irp);
468  // sanity check
469  PC_ASSERT(CreateItem);
470 
471  DPRINT("PcCreatePinDispatch called DeviceObject %p %S Name\n", DeviceObject, CreateItem->ObjectClass.Buffer);
472 
473  Filter = (IIrpTarget*)CreateItem->Context;
474 
475  // sanity checks
476  PC_ASSERT(Filter != NULL);
478 
479 
480 #if KS_IMPLEMENTED
481  Status = KsReferenceSoftwareBusObject(DeviceExt->KsDeviceHeader);
483  {
484  DPRINT("PcCreatePinDispatch failed to reference device header\n");
485 
487  goto cleanup;
488  }
489 #endif
490 
491  Status = Filter->NewIrpTarget(&Pin,
492  KSSTRING_Pin,
493  NULL,
494  NonPagedPool,
495  DeviceObject,
496  Irp,
497  NULL);
498 
499  DPRINT("PcCreatePinDispatch Status %x\n", Status);
500 
501  if (NT_SUCCESS(Status))
502  {
503  // create the dispatch object
504  // FIXME need create item for clock
506  DPRINT("Pin %p\n", Pin);
507  }
508 
509  DPRINT("CreatePinWorkerRoutine completing irp %p\n", Irp);
510  // save status in irp
511  Irp->IoStatus.Status = Status;
512  Irp->IoStatus.Information = 0;
513  // complete the request
515  return Status;
516 }
#define PC_ASSERT(exp)
Definition: usbehci.h:17
KSDDKAPI NTSTATUS NTAPI KsReferenceSoftwareBusObject(IN KSDEVICE_HEADER Header)
Definition: device.c:805
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
_In_ PIRP Irp
Definition: csq.h:116
#define TAG_PORTCLASS
Definition: private.hpp:24
#define KSSTRING_Pin
Definition: ks.h:48
LONG NTSTATUS
Definition: precomp.h:26
VOID FreeItem(IN PVOID Item)
Definition: misc.c:43
_Must_inspect_result_ _In_opt_ PFLT_FILTER Filter
Definition: fltkernel.h:1802
smooth NULL
Definition: ftsmooth.c:416
#define IoCompleteRequest
Definition: irp.c:1240
void DPRINT(...)
Definition: polytest.cpp:61
IN PDCB IN VBO IN ULONG IN BOOLEAN Pin
Definition: fatprocs.h:415
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
Status
Definition: gdiplustypes.h:24
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
#define IO_NO_INCREMENT
Definition: iotypes.h:566
char * cleanup(char *str)
Definition: wpickclick.c:99
NTSTATUS NTAPI NewDispatchObject(IN PIRP Irp, IN IIrpTarget *Target, IN ULONG CreateItemCount, IN PKSOBJECT_CREATE_ITEM CreateItem)
Definition: dispatcher.cpp:242
base of all file and directory entries
Definition: entries.h:82
#define PC_ASSERT_IRQL(x)
Definition: private.hpp:30

Referenced by PcCreateItemDispatch().

Variable Documentation

◆ InterfaceGuids

GUID InterfaceGuids[2]
static
Initial value:
=
{
{
0x6994AD04, 0x93EF, 0x11D0, {0xA3, 0xCC, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96}
},
{
0xDDA54A40, 0x1E4C, 0x11D1, {0xA0, 0x50, 0x40, 0x57, 0x05, 0xC1, 0x00, 0x00}
}
}

Definition at line 64 of file port_topology.cpp.

◆ TopologyPropertySet

KSPROPERTY_SET TopologyPropertySet[]
Initial value:
=
{
{
sizeof(PortFilterTopologyTopologySet) / sizeof(KSPROPERTY_ITEM),
(const KSPROPERTY_ITEM*)&PortFilterTopologyTopologySet,
0,
},
{
sizeof(PortFilterTopologyPinSet) / sizeof(KSPROPERTY_ITEM),
(const KSPROPERTY_ITEM*)&PortFilterTopologyPinSet,
0,
}
}
smooth NULL
Definition: ftsmooth.c:416
#define KSPROPSETID_Topology
Definition: ks.h:842
#define KSPROPSETID_Pin
Definition: ks.h:617

Definition at line 79 of file port_topology.cpp.