ReactOS  0.4.14-dev-49-gfb4591c
dispatch.c
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS VT100 emulator
3  * LICENSE: GPL - See COPYING in the top level directory
4  * FILE: drivers/base/green/dispatch.c
5  * PURPOSE: Dispatch routines
6  * PROGRAMMERS: Copyright 2005-2006 Hervé Poussineau (hpoussin@reactos.org)
7  */
8 
9 #include "green.h"
10 
11 #define NDEBUG
12 #include <debug.h>
13 
17  IN PIRP Irp)
18 {
19  ULONG MajorFunction;
23 
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  {
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  {
47  }
48  else if (MajorFunction == IRP_MJ_INTERNAL_DEVICE_CONTROL && DeviceType == GreenFDO)
49  {
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(
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  {
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  {
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 IN
Definition: typedefs.h:38
#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
uint32_t ULONG_PTR
Definition: typedefs.h:63
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
PVOID DeviceExtension
Definition: env_spec_w32.h:418
static PDRIVER_OBJECT DriverObject
Definition: template.c:42
#define IoCompleteRequest
Definition: irp.c:1240
NTSTATUS NTAPI GreenDispatch(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: dispatch.c:15
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
PVOID NTAPI IoGetDriverObjectExtension(IN PDRIVER_OBJECT DriverObject, IN PVOID ClientIdentificationAddress)
Definition: driver.c:1842
PPCI_DRIVER_EXTENSION DriverExtension
Definition: pci.c:41
NTSTATUS ScreenDeviceControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: screen.c:408
Status
Definition: gdiplustypes.h:24
NTSTATUS GreenPower(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: power.c:15
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
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
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:566
#define IRP_MJ_WRITE
Definition: rdpdr.c:47
Iosb Information
Definition: create.c:4377
#define IRP_MJ_DEVICE_CONTROL
Definition: rdpdr.c:52