ReactOS  0.4.14-dev-49-gfb4591c
dispatch.c
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS Drivers
3  * LICENSE: BSD - See COPYING.ARM in the top level directory
4  * FILE: drivers/sac/driver/dispatch.c
5  * PURPOSE: Driver for the Server Administration Console (SAC) for EMS
6  * PROGRAMMERS: ReactOS Portable Systems Group
7  */
8 
9 /* INCLUDES *******************************************************************/
10 
11 #include "sacdrv.h"
12 
13 /* GLOBALS ********************************************************************/
14 
16 
17 /* FUNCTIONS ******************************************************************/
18 
20 NTAPI
22  IN PIRP Irp)
23 {
25 }
26 
28 NTAPI
30  IN PIRP Irp)
31 {
33 }
34 
36 NTAPI
38  IN PIRP Irp)
39 {
41 }
42 
44 NTAPI
46  IN PIRP Irp)
47 {
49 }
50 
52 NTAPI
54  IN PIRP Irp)
55 {
57 }
58 
59 VOID
60 NTAPI
65 {
66  HEADLESS_RSP_GET_BYTE ByteValue;
67  SIZE_T ValueSize;
68  BOOLEAN GotChar;
70  PSAC_DEVICE_EXTENSION SacExtension;
71 
72  /* Update our counter */
74 
75  /* Set defaults and loop for new characters */
76  GotChar = FALSE;
77  ValueSize = sizeof(ByteValue);
78  do
79  {
80  /* Ask the kernel for a byte */
82  NULL,
83  0,
84  &ByteValue,
85  &ValueSize);
86 
87  /* Break out if there's nothing interesting */
88  if (!NT_SUCCESS(Status)) break;
89  if (!ByteValue.Value) break;
90 
91  /* Update the serial port buffer */
93  GotChar = TRUE;
94 
95  /* Update the index, let it roll-over if needed */
99  } while (ByteValue.Value);
100 
101  /* Did we get anything */
102  if (GotChar)
103  {
104  /* Signal the worker thread that there is work to do */
105  SacExtension = DeferredContext;
106  KeSetEvent(&SacExtension->Event, SacExtension->PriorityBoost, FALSE);
107  }
108 }
109 
110 VOID
111 NTAPI
113 {
114  PDEVICE_OBJECT DeviceObject, NextDevice;
115  SAC_DBG(SAC_DBG_ENTRY_EXIT, "SAC UnloadHandler: Entering.\n");
116 
117  /* Go over every device part of the driver */
119  while (DeviceObject)
120  {
121  /* Free and delete the information about this device */
122  NextDevice = DeviceObject->NextDevice;
125 
126  /* Move on to the next one */
127  DeviceObject = NextDevice;
128  }
129 
130  /* Free the driver data and exit */
131  FreeGlobalData();
132  SAC_DBG(SAC_DBG_ENTRY_EXIT, "SAC UnloadHandler: Exiting.\n");
133 }
NTSTATUS NTAPI DispatchDeviceControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: dispatch.c:21
#define IN
Definition: typedefs.h:38
#define TRUE
Definition: types.h:120
PCHAR SerialPortBuffer
Definition: util.c:35
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
_In_ PIRP Irp
Definition: csq.h:116
long __cdecl _InterlockedExchange(_Interlocked_operand_ long volatile *_Target, long _Value)
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS NTAPI Dispatch(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: dispatch.c:53
LONG NTAPI KeSetEvent(IN PKEVENT Event, IN KPRIORITY Increment, IN BOOLEAN Wait)
Definition: eventobj.c:159
NTSTATUS NTAPI HeadlessDispatch(IN HEADLESS_CMD Command, IN PVOID InputBuffer, IN SIZE_T InputBufferSize, OUT PVOID OutputBuffer, OUT PSIZE_T OutputBufferSize)
Definition: hdlsterm.c:570
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
long LONG
Definition: pedump.c:60
VOID NTAPI FreeDeviceData(IN PDEVICE_OBJECT DeviceObject)
Definition: data.c:147
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
static PDRIVER_OBJECT DriverObject
Definition: template.c:42
NTSTATUS NTAPI DispatchClose(IN PSAC_DEVICE_EXTENSION DeviceExtension, IN PIRP Irp)
Definition: dispatch.c:45
LONG TimerDpcCount
Definition: dispatch.c:15
_In_opt_ PVOID _In_opt_ PVOID SystemArgument1
Definition: ketypes.h:675
_In_ LARGE_INTEGER _In_opt_ PKDPC Dpc
Definition: kefuncs.h:524
KPRIORITY PriorityBoost
Definition: sacdrv.h:512
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
NTSTATUS NTAPI DispatchCreate(IN PSAC_DEVICE_EXTENSION DeviceExtension, IN PIRP Irp)
Definition: dispatch.c:37
VOID NTAPI TimerDpcRoutine(IN PKDPC Dpc, IN PVOID DeferredContext, IN PVOID SystemArgument1, IN PVOID SystemArgument2)
Definition: dispatch.c:61
VOID NTAPI FreeGlobalData(VOID)
Definition: data.c:100
Definition: ketypes.h:687
#define SAC_DBG(x,...)
Definition: sacdrv.h:37
Status
Definition: gdiplustypes.h:24
_In_opt_ PVOID _In_opt_ PVOID _In_opt_ PVOID SystemArgument2
Definition: ketypes.h:675
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
ULONG_PTR SIZE_T
Definition: typedefs.h:78
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1251
NTSTATUS NTAPI DispatchShutdownControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: dispatch.c:29
#define SAC_SERIAL_PORT_BUFFER_SIZE
Definition: sacdrv.h:154
#define SAC_DBG_ENTRY_EXIT
Definition: sacdrv.h:32
VOID NTAPI UnloadHandler(IN PDRIVER_OBJECT DriverObject)
Definition: dispatch.c:112
long __cdecl _InterlockedExchangeAdd(_Interlocked_operand_ long volatile *_Addend, long _Value)
LONG SerialPortProducerIndex
Definition: util.c:34
PDEVICE_OBJECT DeviceObject
Definition: iotypes.h:2169
_In_opt_ PVOID DeferredContext
Definition: ketypes.h:675