ReactOS 0.4.16-dev-297-gc569aee
stream.h File Reference
#include <strmini.h>
#include <debug.h>
Include dependency graph for stream.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  STREAM_CLASS_DRIVER_EXTENSION
 
struct  MEMORY_RESOURCE_LIST
 
struct  STREAM_DEVICE_EXTENSION
 
struct  HW_STREAM_REQUEST_BLOCK_EXT
 

Macros

#define STREAMDEBUG_LEVEL   DebugLevelMaximum
 

Typedefs

typedef BOOLEAN(NTAPISYNCHRONIZE_FUNC) (IN PKINTERRUPT Interrupt, IN PKSYNCHRONIZE_ROUTINE SynchronizeRoutine, IN PVOID SynchronizeContext)
 
typedef struct STREAM_CLASS_DRIVER_EXTENSIONPSTREAM_CLASS_DRIVER_EXTENSION
 
typedef struct MEMORY_RESOURCE_LISTPMEMORY_RESOURCE_LIST
 
typedef struct STREAM_DEVICE_EXTENSIONPSTREAM_DEVICE_EXTENSION
 
typedef struct HW_STREAM_REQUEST_BLOCK_EXTPHW_STREAM_REQUEST_BLOCK_EXT
 

Functions

NTSTATUS NTAPI StreamClassCreateFilter (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
NTSTATUS NTAPI StreamClassPnp (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
NTSTATUS NTAPI StreamClassPower (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
NTSTATUS NTAPI StreamClassSystemControl (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
NTSTATUS NTAPI StreamClassCleanup (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
NTSTATUS NTAPI StreamClassFlushBuffers (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
NTSTATUS NTAPI StreamClassDeviceControl (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
NTSTATUS NTAPI StreamClassAddDevice (IN PDRIVER_OBJECT DriverObject, IN PDEVICE_OBJECT PhysicalDeviceObject)
 
BOOLEAN NTAPI StreamClassSynchronize (IN PKINTERRUPT Interrupt, IN PKSYNCHRONIZE_ROUTINE SynchronizeRoutine, IN PVOID SynchronizeContext)
 
BOOLEAN NTAPI StreamClassInterruptRoutine (IN PKINTERRUPT Interrupt, IN PVOID ServiceContext)
 
VOID NTAPI StreamClassInterruptDpc (IN PKDPC Dpc, IN PVOID DeferredContext, IN PVOID SystemArgument1, IN PVOID SystemArgument2)
 
VOID CompleteIrp (IN PIRP Irp, IN NTSTATUS Status, IN ULONG_PTR Information)
 

Macro Definition Documentation

◆ STREAMDEBUG_LEVEL

#define STREAMDEBUG_LEVEL   DebugLevelMaximum

Definition at line 8 of file stream.h.

Typedef Documentation

◆ PHW_STREAM_REQUEST_BLOCK_EXT

◆ PMEMORY_RESOURCE_LIST

◆ PSTREAM_CLASS_DRIVER_EXTENSION

◆ PSTREAM_DEVICE_EXTENSION

◆ SYNCHRONIZE_FUNC

Definition at line 10 of file stream.h.

Function Documentation

◆ CompleteIrp()

VOID CompleteIrp ( IN PIRP  Irp,
IN NTSTATUS  Status,
IN ULONG_PTR  Information 
)

Definition at line 12 of file pnp.c.

16{
17 Irp->IoStatus.Status = Status;
18 Irp->IoStatus.Information = Information;
20}
_In_ PIRP Irp
Definition: csq.h:116
Status
Definition: gdiplustypes.h:25
#define IoCompleteRequest
Definition: irp.c:1240
_In_ WDFREQUEST _In_ NTSTATUS _In_ ULONG_PTR Information
Definition: wdfrequest.h:1049
#define IO_NO_INCREMENT
Definition: iotypes.h:598

Referenced by _Dispatch_type_(), AfdEventReceiveDatagramHandler(), FxPkgIo::DispatchStep1(), FxPkgIo::DispatchStep2(), Ext2LockControl(), StreamClassStartDevice(), UDFCommonDeviceControl(), UDFMountVolume(), and VfatDispatchRequest().

◆ StreamClassAddDevice()

NTSTATUS NTAPI StreamClassAddDevice ( IN PDRIVER_OBJECT  DriverObject,
IN PDEVICE_OBJECT  PhysicalDeviceObject 
)

Definition at line 13 of file driver.c.

16{
17 PSTREAM_CLASS_DRIVER_EXTENSION DriverObjectExtension;
19 PSTREAM_DEVICE_EXTENSION DeviceExtension;
20 PKSOBJECT_CREATE_ITEM ItemList;
22
23 /* Fetch driver object extension */
25 if (!DriverObjectExtension)
26 {
27 /* Failed to get driver extension */
29 }
30 /* Allocate Create Item */
31 ItemList = ExAllocatePool(NonPagedPool, sizeof(KSOBJECT_CREATE_ITEM));
32 if (!ItemList)
33 {
34 /* Failed to allocated Create Item */
36 }
37
38 /* Create the FDO */
40 if (!NT_SUCCESS(Status))
41 {
42 /* Failed to create the FDO */
43 ExFreePool(ItemList);
44 return Status;
45 }
46
47 /* Attach to device stack */
50 {
51 /* Failed to attach */
53 ExFreePool(ItemList);
55 }
56
57 /* Zero Create item */
58 RtlZeroMemory(ItemList, sizeof(KSOBJECT_CREATE_ITEM));
59 /* Setup object class */
60 RtlInitUnicodeString(&ItemList->ObjectClass, L"GLOBAL");
61 /* Setup CreateDispatch routine */
62 ItemList->Create = StreamClassCreateFilter;
63
64 /* Get device extension */
66 /* Zero device extension */
67 RtlZeroMemory(DeviceExtension, sizeof(STREAM_DEVICE_EXTENSION));
68 /* Initialize Ks streaming */
69 Status = KsAllocateDeviceHeader(&DeviceExtension->Header, 1, ItemList);
70 if (!NT_SUCCESS(Status))
71 {
72 /* Cleanup resources */
75 ExFreePool(ItemList);
76 return Status;
77 }
78
79 /* Store lower device object */
80 DeviceExtension->LowerDeviceObject = LowerDeviceObject;
81
82 /* Store physical device object */
84 /* Store driver object extension */
85 DeviceExtension->DriverExtension = DriverObjectExtension;
86 /* Initialize memory list */
87 InitializeListHead(&DeviceExtension->MemoryResourceList);
88 /* Setup device extension */
89 DeviceExtension->DeviceExtension = (PVOID) (DeviceExtension + 1);
90 /* Init interrupt dpc */
91 KeInitializeDpc(&DeviceExtension->InterruptDpc, StreamClassInterruptDpc, (PVOID)DeviceExtension);
92
93 /* Set device transfer method */
95 /* Clear init flag */
96 DeviceObject->Flags &= ~ DO_DEVICE_INITIALIZING;
97
98 return Status;
99}
LONG NTSTATUS
Definition: precomp.h:26
PDEVICE_OBJECT PhysicalDeviceObject
Definition: btrfs_drv.h:1157
#define FILE_DEVICE_SECURE_OPEN
Definition: cdrw_usr.h:46
_In_z_ PCCHAR _In_ PDEVICE_OBJECT LowerDeviceObject
Definition: classpnp.h:983
#define NULL
Definition: types.h:112
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
VOID NTAPI KeInitializeDpc(IN PKDPC Dpc, IN PKDEFERRED_ROUTINE DeferredRoutine, IN PVOID DeferredContext)
Definition: dpc.c:712
KSDDKAPI NTSTATUS NTAPI KsAllocateDeviceHeader(OUT KSDEVICE_HEADER *OutHeader, IN ULONG ItemsCount, IN PKSOBJECT_CREATE_ITEM ItemsList OPTIONAL)
Definition: api.c:522
NTSTATUS NTAPI StreamClassAddDevice(IN PDRIVER_OBJECT DriverObject, IN PDEVICE_OBJECT PhysicalDeviceObject)
Definition: driver.c:13
NTSTATUS NTAPI StreamClassCreateFilter(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: filter.c:261
VOID NTAPI StreamClassInterruptDpc(IN PKDPC Dpc, IN PVOID DeferredContext, IN PVOID SystemArgument1, IN PVOID SystemArgument2)
Definition: pnp.c:74
struct STREAM_DEVICE_EXTENSION * PSTREAM_DEVICE_EXTENSION
#define DO_DIRECT_IO
Definition: env_spec_w32.h:396
#define ExFreePool(addr)
Definition: env_spec_w32.h:352
#define NonPagedPool
Definition: env_spec_w32.h:307
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
#define ExAllocatePool(type, size)
Definition: fbtusb.h:44
#define FILE_AUTOGENERATED_DEVICE_NAME
Definition: iotypes.h:138
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
PDEVICE_OBJECT NTAPI IoAttachDeviceToDeviceStack(IN PDEVICE_OBJECT SourceDevice, IN PDEVICE_OBJECT TargetDevice)
Definition: device.c:966
NTSTATUS NTAPI IoCreateDevice(IN PDRIVER_OBJECT DriverObject, IN ULONG DeviceExtensionSize, IN PUNICODE_STRING DeviceName, IN DEVICE_TYPE DeviceType, IN ULONG DeviceCharacteristics, IN BOOLEAN Exclusive, OUT PDEVICE_OBJECT *DeviceObject)
Definition: device.c:1031
VOID NTAPI IoDetachDevice(IN PDEVICE_OBJECT TargetDevice)
Definition: device.c:1296
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1251
PVOID NTAPI IoGetDriverObjectExtension(IN PDRIVER_OBJECT DriverObject, IN PVOID ClientIdentificationAddress)
Definition: driver.c:1904
#define STATUS_DEVICE_DOES_NOT_EXIST
Definition: ntstatus.h:428
#define L(x)
Definition: ntvdm.h:50
#define FILE_DEVICE_KS
Definition: winioctl.h:92
HW_INITIALIZATION_DATA Data
Definition: stream.h:14
PSTREAM_CLASS_DRIVER_EXTENSION DriverExtension
Definition: stream.h:45
KSDEVICE_HEADER Header
Definition: stream.h:27
PDEVICE_OBJECT PhysicalDeviceObject
Definition: stream.h:29
PDEVICE_OBJECT LowerDeviceObject
Definition: stream.h:28
LIST_ENTRY MemoryResourceList
Definition: stream.h:41
ULONG DeviceExtensionSize
Definition: srb.h:574
void * PVOID
Definition: typedefs.h:50
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
Definition: wdfdriver.h:213
#define DO_POWER_PAGABLE

Referenced by StreamClassAddDevice(), StreamClassRegisterAdapter(), and StreamClassStartDevice().

◆ StreamClassCleanup()

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

Definition at line 39 of file control.c.

42{
43 Irp->IoStatus.Information = 0;
44 Irp->IoStatus.Status = STATUS_SUCCESS;
46 return STATUS_SUCCESS;
47}
#define STATUS_SUCCESS
Definition: shellext.h:65

Referenced by StreamClassRegisterAdapter().

◆ StreamClassCreateFilter()

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

Definition at line 261 of file filter.c.

264{
266 DPRINT1("StreamClassCreateFilter Called\n");
267
268 /* Init filter */
270
271 Irp->IoStatus.Status = Status;
272 Irp->IoStatus.Information = 0;
274 return Status;
275}
#define DPRINT1
Definition: precomp.h:8
NTSTATUS InitializeFilterWithKs(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: filter.c:150

Referenced by StreamClassAddDevice().

◆ StreamClassDeviceControl()

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

Definition at line 63 of file control.c.

66{
67 Irp->IoStatus.Information = 0;
68 Irp->IoStatus.Status = STATUS_SUCCESS;
70 return STATUS_SUCCESS;
71}

Referenced by StreamClassRegisterAdapter().

◆ StreamClassFlushBuffers()

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

Definition at line 51 of file control.c.

54{
55 Irp->IoStatus.Information = 0;
56 Irp->IoStatus.Status = STATUS_SUCCESS;
58 return STATUS_SUCCESS;
59}

Referenced by StreamClassRegisterAdapter().

◆ StreamClassInterruptDpc()

VOID NTAPI StreamClassInterruptDpc ( IN PKDPC  Dpc,
IN PVOID  DeferredContext,
IN PVOID  SystemArgument1,
IN PVOID  SystemArgument2 
)

Definition at line 74 of file pnp.c.

79{
80 //TODO
81 //read/write data
82}

Referenced by StreamClassAddDevice().

◆ StreamClassInterruptRoutine()

BOOLEAN NTAPI StreamClassInterruptRoutine ( IN PKINTERRUPT  Interrupt,
IN PVOID  ServiceContext 
)

Definition at line 87 of file pnp.c.

90{
91 BOOLEAN Ret = FALSE;
93
94 /* Does the driver implement HwInterrupt routine */
95 if (DeviceExtension->DriverExtension->Data.HwInterrupt)
96 {
97 /* Check if the interrupt was coming from this device */
98 Ret = DeviceExtension->DriverExtension->Data.HwInterrupt(DeviceExtension->DeviceExtension);
99 if (Ret)
100 {
101 /* Interrupt has from this device, schedule a Dpc for us */
102 KeInsertQueueDpc(&DeviceExtension->InterruptDpc, NULL, NULL);
103 }
104 }
105 /* Return result */
106 return Ret;
107}
unsigned char BOOLEAN
#define FALSE
Definition: types.h:117
BOOLEAN NTAPI KeInsertQueueDpc(IN PKDPC Dpc, IN PVOID SystemArgument1, IN PVOID SystemArgument2)
Definition: dpc.c:725
PHW_INTERRUPT HwInterrupt
Definition: srb.h:569
_In_ PKSERVICE_ROUTINE _In_opt_ PVOID ServiceContext
Definition: iofuncs.h:801

Referenced by StreamClassStartDevice().

◆ StreamClassPnp()

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

Definition at line 456 of file pnp.c.

459{
460 PIO_STACK_LOCATION IoStack;
461
462 /* Get current irp stack location */
464
465 switch (IoStack->MinorFunction)
466 {
468 {
470 }
471 }
472
475}
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
#define STATUS_NOT_SUPPORTED
Definition: d3dkmdt.h:48
NTSTATUS NTAPI StreamClassStartDevice(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: pnp.c:113
#define IRP_MN_START_DEVICE

Referenced by StreamClassRegisterAdapter().

◆ StreamClassPower()

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

Definition at line 15 of file control.c.

18{
19 Irp->IoStatus.Information = 0;
20 Irp->IoStatus.Status = STATUS_SUCCESS;
22 return STATUS_SUCCESS;
23}

Referenced by StreamClassRegisterAdapter().

◆ StreamClassSynchronize()

BOOLEAN NTAPI StreamClassSynchronize ( IN PKINTERRUPT  Interrupt,
IN PKSYNCHRONIZE_ROUTINE  SynchronizeRoutine,
IN PVOID  SynchronizeContext 
)

Definition at line 61 of file pnp.c.

65{
66 /* This function is used when the driver either implements synchronization on its own
67 * or if there is no interrupt assigned
68 */
70}
static KSYNCHRONIZE_ROUTINE SynchronizeRoutine
Definition: IoInterrupt.c:30
_In_ PKSYNCHRONIZE_ROUTINE _In_opt_ __drv_aliasesMem PVOID SynchronizeContext
Definition: kefuncs.h:525

Referenced by StreamClassStartDevice().

◆ StreamClassSystemControl()

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

Definition at line 27 of file control.c.

30{
31 Irp->IoStatus.Information = 0;
32 Irp->IoStatus.Status = STATUS_SUCCESS;
34 return STATUS_SUCCESS;
35}

Referenced by StreamClassRegisterAdapter().