Something went wrong. Try again.
Reactos
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134/* * PROJECT: ReactOS Drivers * LICENSE: BSD - See COPYING.ARM in the top level directory * FILE: drivers/sac/driver/dispatch.c * PURPOSE: Driver for the Server Administration Console (SAC) for EMS * PROGRAMMERS: ReactOS Portable Systems Group */
/* INCLUDES *******************************************************************/
#include "sacdrv.h"
/* GLOBALS ********************************************************************/
LONG TimerDpcCount;
/* FUNCTIONS ******************************************************************/
NTSTATUSNTAPIDispatchDeviceControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp){ return STATUS_NOT_IMPLEMENTED;}
NTSTATUSNTAPIDispatchShutdownControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp){ return STATUS_NOT_IMPLEMENTED;}
NTSTATUSNTAPIDispatchCreate(IN PSAC_DEVICE_EXTENSION DeviceExtension, IN PIRP Irp){ return STATUS_NOT_IMPLEMENTED;}
NTSTATUSNTAPIDispatchClose(IN PSAC_DEVICE_EXTENSION DeviceExtension, IN PIRP Irp){ return STATUS_NOT_IMPLEMENTED;}
NTSTATUSNTAPIDispatch(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp){ return STATUS_NOT_IMPLEMENTED;}
VOIDNTAPITimerDpcRoutine(IN PKDPC Dpc, IN PVOID DeferredContext, IN PVOID SystemArgument1, IN PVOID SystemArgument2){ HEADLESS_RSP_GET_BYTE ByteValue; SIZE_T ValueSize; BOOLEAN GotChar; NTSTATUS Status; PSAC_DEVICE_EXTENSION SacExtension;
/* Update our counter */ _InterlockedExchangeAdd(&TimerDpcCount, 1);
/* Set defaults and loop for new characters */ GotChar = FALSE; ValueSize = sizeof(ByteValue); do { /* Ask the kernel for a byte */ Status = HeadlessDispatch(HeadlessCmdGetByte, NULL, 0, &ByteValue, &ValueSize);
/* Break out if there's nothing interesting */ if (!NT_SUCCESS(Status)) break; if (!ByteValue.Value) break;
/* Update the serial port buffer */ SerialPortBuffer[SerialPortProducerIndex] = ByteValue.Value; GotChar = TRUE;
/* Update the index, let it roll-over if needed */ _InterlockedExchange(&SerialPortProducerIndex, (SerialPortProducerIndex + 1) & (SAC_SERIAL_PORT_BUFFER_SIZE - 1)); } while (ByteValue.Value);
/* Did we get anything */ if (GotChar) { /* Signal the worker thread that there is work to do */ SacExtension = DeferredContext; KeSetEvent(&SacExtension->Event, SacExtension->PriorityBoost, FALSE); }}
VOIDNTAPIUnloadHandler(IN PDRIVER_OBJECT DriverObject){ PDEVICE_OBJECT DeviceObject, NextDevice; SAC_DBG(SAC_DBG_ENTRY_EXIT, "SAC UnloadHandler: Entering.\n");
/* Go over every device part of the driver */ DeviceObject = DriverObject->DeviceObject; while (DeviceObject) { /* Free and delete the information about this device */ NextDevice = DeviceObject->NextDevice; FreeDeviceData(DeviceObject); IoDeleteDevice(DeviceObject);
/* Move on to the next one */ DeviceObject = NextDevice; }
/* Free the driver data and exit */ FreeGlobalData(); SAC_DBG(SAC_DBG_ENTRY_EXIT, "SAC UnloadHandler: Exiting.\n");}