ReactOS  0.4.15-dev-1206-g731eddf
dispatch.c File Reference
#include "green.h"
#include <debug.h>
Include dependency graph for dispatch.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

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

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 11 of file dispatch.c.

Function Documentation

◆ GreenDispatch()

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

Definition at line 15 of file dispatch.c.

18 {
19  ULONG MajorFunction;
23 
25  DeviceType = ((PCOMMON_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->Type;
26 
27  Information = Irp->IoStatus.Information;
28  Status = Irp->IoStatus.Status;
29 
30  DPRINT("Dispatching major function 0x%lx, DeviceType %u\n",
31  MajorFunction, DeviceType);
32 
34  {
36  return IoCallDriver(((PCOMMON_FDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->LowerDevice, Irp);
37  }
38  else if (MajorFunction == IRP_MJ_CREATE && (DeviceType == GreenFDO || DeviceType == KeyboardPDO || DeviceType == ScreenPDO))
39  return GreenCreate(DeviceObject, Irp);
40  else if (MajorFunction == IRP_MJ_CLOSE && (DeviceType == GreenFDO || DeviceType == KeyboardPDO || DeviceType == ScreenPDO))
41  return GreenClose(DeviceObject, Irp);
42  else if ((MajorFunction == IRP_MJ_CREATE || MajorFunction == IRP_MJ_CLOSE || MajorFunction == IRP_MJ_CLEANUP)
44  {
46  return IoCallDriver(((PCOMMON_FDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->LowerDevice, Irp);
47  }
48  else if (MajorFunction == IRP_MJ_INTERNAL_DEVICE_CONTROL && DeviceType == GreenFDO)
49  {
51  ((PGREEN_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->KeyboardFdo,
52  Irp);
53  }
54  else if (MajorFunction == IRP_MJ_INTERNAL_DEVICE_CONTROL && DeviceType == KeyboardFDO)
56  else if (MajorFunction == IRP_MJ_DEVICE_CONTROL && DeviceType == GreenFDO)
57  {
58  return ScreenDeviceControl(
59  ((PGREEN_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->ScreenFdo,
60  Irp);
61  }
62  else if (MajorFunction == IRP_MJ_DEVICE_CONTROL && DeviceType == ScreenFDO)
64  else if (MajorFunction == IRP_MJ_WRITE && DeviceType == ScreenFDO)
65  return ScreenWrite(DeviceObject, Irp);
66  else if (MajorFunction == IRP_MJ_PNP && (DeviceType == KeyboardFDO || DeviceType == ScreenFDO))
67  {
69  return IoCallDriver(((PCOMMON_FDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->LowerDevice, Irp);
70  }
71  else if (MajorFunction == IRP_MJ_PNP && (DeviceType == GreenFDO || DeviceType == KeyboardPDO || DeviceType == ScreenPDO))
72  return GreenPnp(DeviceObject, Irp);
73  else if (MajorFunction == IRP_MJ_POWER && DeviceType == GreenFDO)
74  return GreenPower(DeviceObject, Irp);
75  else
76  {
77  DPRINT1("Unknown combination: MajorFunction 0x%lx, DeviceType %d\n",
78  MajorFunction, DeviceType);
79  switch (DeviceType)
80  {
81  case KeyboardFDO:
82  case ScreenFDO:
83  {
85  return IoCallDriver(((PCOMMON_FDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->LowerDevice, Irp);
86  }
87  case GreenFDO:
88  {
91  DriverObject = DeviceObject->DriverObject;
94  return IoCallDriver(DriverExtension->LowerDevice, Irp);
95  }
96  default:
97  ASSERT(FALSE);
98  }
99  }
100 
101  Irp->IoStatus.Information = Information;
102  Irp->IoStatus.Status = Status;
104  return Status;
105 }
#define IRP_MJ_CREATE
Definition: rdpdr.c:44
_In_ PIRP Irp
Definition: csq.h:116
DeviceType
Definition: mmdrv.h:41
#define IRP_MJ_PNP
Definition: cdrw_usr.h:52
LONG NTSTATUS
Definition: precomp.h:26
Iosb Information
Definition: create.c:4353
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define FALSE
Definition: types.h:117
static PDRIVER_OBJECT DriverObject
Definition: template.c:42
#define IoCompleteRequest
Definition: irp.c:1240
void DPRINT(...)
Definition: polytest.cpp:61
NTSTATUS GreenClose(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: createclose.c:28
struct _COMMON_DEVICE_EXTENSION * PCOMMON_DEVICE_EXTENSION
Definition: green.h:26
#define IRP_MJ_INTERNAL_DEVICE_CONTROL
NTSTATUS ScreenWrite(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: screen.c:265
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define IRP_MJ_POWER
#define IRP_MJ_CLOSE
Definition: rdpdr.c:45
Status
Definition: gdiplustypes.h:24
PVOID NTAPI IoGetDriverObjectExtension(IN PDRIVER_OBJECT DriverObject, IN PVOID ClientIdentificationAddress)
Definition: driver.c:1866
PPCI_DRIVER_EXTENSION DriverExtension
Definition: pci.c:41
NTSTATUS ScreenDeviceControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: screen.c:408
NTSTATUS GreenPower(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: power.c:15
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2789
GREEN_DEVICE_TYPE
Definition: green.h:21
NTSTATUS KeyboardInternalDeviceControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: keyboard.c:272
NTSTATUS GreenPnp(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: pnp.c:408
_In_ PDEVICE_OBJECT DeviceObject
Definition: iotypes.h:2464
NTSTATUS NTAPI IoCallDriver(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:1218
#define IoSkipCurrentIrpStackLocation(Irp)
Definition: ntifs_ex.h:421
NTSTATUS GreenCreate(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: createclose.c:15
#define DPRINT1
Definition: precomp.h:8
#define IRP_MJ_CLEANUP
unsigned int ULONG
Definition: retypes.h:1
#define IO_NO_INCREMENT
Definition: iotypes.h:581
#define IRP_MJ_WRITE
Definition: rdpdr.c:47
#define IRP_MJ_DEVICE_CONTROL
Definition: rdpdr.c:52

Referenced by DriverEntry().