ReactOS 0.4.15-dev-7924-g5949c20
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
22 IN PIRP Irp)
23{
25}
26
30 IN PIRP Irp)
31{
33}
34
38 IN PIRP Irp)
39{
41}
42
46 IN PIRP Irp)
47{
49}
50
54 IN PIRP Irp)
55{
57}
58
59VOID
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
110VOID
111NTAPI
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 */
118 DeviceObject = DriverObject->DeviceObject;
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 */
132 SAC_DBG(SAC_DBG_ENTRY_EXIT, "SAC UnloadHandler: Exiting.\n");
133}
unsigned char BOOLEAN
LONG NTSTATUS
Definition: precomp.h:26
_In_ PIRP Irp
Definition: csq.h:116
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
VOID NTAPI FreeGlobalData(VOID)
Definition: data.c:100
VOID NTAPI FreeDeviceData(IN PDEVICE_OBJECT DeviceObject)
Definition: data.c:147
NTSTATUS NTAPI DispatchDeviceControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: dispatch.c:21
VOID NTAPI TimerDpcRoutine(IN PKDPC Dpc, IN PVOID DeferredContext, IN PVOID SystemArgument1, IN PVOID SystemArgument2)
Definition: dispatch.c:61
LONG TimerDpcCount
Definition: dispatch.c:15
NTSTATUS NTAPI DispatchShutdownControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: dispatch.c:29
#define KeSetEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:476
Status
Definition: gdiplustypes.h:25
@ HeadlessCmdGetByte
Definition: hdl.h:140
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
long __cdecl _InterlockedExchangeAdd(_Interlocked_operand_ long volatile *_Addend, long _Value)
long __cdecl _InterlockedExchange(_Interlocked_operand_ long volatile *_Target, long _Value)
_In_ PDRIVER_UNLOAD UnloadHandler
Definition: ndis.h:4688
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1251
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:239
static DRIVER_DISPATCH DispatchCreate
Definition: parport.c:10
static DRIVER_DISPATCH DispatchClose
Definition: parport.c:11
long LONG
Definition: pedump.c:60
#define SAC_DBG(x,...)
Definition: sacdrv.h:37
LONG SerialPortProducerIndex
Definition: sacdrv.h:1241
PCHAR SerialPortBuffer
Definition: util.c:35
#define SAC_DBG_ENTRY_EXIT
Definition: sacdrv.h:32
#define SAC_SERIAL_PORT_BUFFER_SIZE
Definition: sacdrv.h:155
Definition: ketypes.h:699
KPRIORITY PriorityBoost
Definition: sacdrv.h:513
#define NTAPI
Definition: typedefs.h:36
ULONG_PTR SIZE_T
Definition: typedefs.h:80
#define IN
Definition: typedefs.h:39
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
_Must_inspect_result_ _In_ PWDF_DPC_CONFIG _In_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFDPC * Dpc
Definition: wdfdpc.h:112
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
Definition: wdfdriver.h:213
_In_ USHORT _In_ ULONG _In_ PSOCKADDR _In_ PSOCKADDR _Reserved_ ULONG _In_opt_ PVOID _In_opt_ const WSK_CLIENT_CONNECTION_DISPATCH * Dispatch
Definition: wsk.h:188
_In_opt_ PVOID _In_opt_ PVOID SystemArgument1
Definition: ketypes.h:688
_In_opt_ PVOID DeferredContext
Definition: ketypes.h:687
_In_opt_ PVOID _In_opt_ PVOID _In_opt_ PVOID SystemArgument2
Definition: ketypes.h:689