reactos/drivers/hid/hidclass/precomp.h

222 lines
3.8 KiB
C
Raw Normal View History

#ifndef _HIDCLASS_PCH_
#define _HIDCLASS_PCH_
#define _HIDPI_NO_FUNCTION_MACROS_
#include <wdm.h>
#include <hidpddi.h>
#include <stdio.h>
#include <hidport.h>
#define HIDCLASS_TAG 'CdiH'
typedef struct
{
PDRIVER_OBJECT DriverObject;
ULONG DeviceExtensionSize;
BOOLEAN DevicesArePolled;
PDRIVER_DISPATCH MajorFunction[IRP_MJ_MAXIMUM_FUNCTION + 1];
PDRIVER_ADD_DEVICE AddDevice;
PDRIVER_UNLOAD DriverUnload;
KSPIN_LOCK Lock;
} HIDCLASS_DRIVER_EXTENSION, *PHIDCLASS_DRIVER_EXTENSION;
typedef struct
{
//
// hid device extension
//
HID_DEVICE_EXTENSION HidDeviceExtension;
//
// if it is a pdo
//
BOOLEAN IsFDO;
//
// driver extension
//
PHIDCLASS_DRIVER_EXTENSION DriverExtension;
//
// device description
//
HIDP_DEVICE_DESC DeviceDescription;
//
// hid attributes
//
HID_DEVICE_ATTRIBUTES Attributes;
} HIDCLASS_COMMON_DEVICE_EXTENSION, *PHIDCLASS_COMMON_DEVICE_EXTENSION;
typedef struct
{
//
// parts shared by fdo and pdo
//
HIDCLASS_COMMON_DEVICE_EXTENSION Common;
//
// device capabilities
//
DEVICE_CAPABILITIES Capabilities;
//
// hid descriptor
//
HID_DESCRIPTOR HidDescriptor;
//
// report descriptor
//
PUCHAR ReportDescriptor;
//
// device relations
//
PDEVICE_RELATIONS DeviceRelations;
} HIDCLASS_FDO_EXTENSION, *PHIDCLASS_FDO_EXTENSION;
typedef struct
{
//
// parts shared by fdo and pdo
//
HIDCLASS_COMMON_DEVICE_EXTENSION Common;
//
// device capabilities
//
DEVICE_CAPABILITIES Capabilities;
//
// collection index
//
ULONG CollectionNumber;
//
// device interface
//
UNICODE_STRING DeviceInterface;
//
// FDO device object
//
PDEVICE_OBJECT FDODeviceObject;
//
// fdo device extension
//
PHIDCLASS_FDO_EXTENSION FDODeviceExtension;
} HIDCLASS_PDO_DEVICE_EXTENSION, *PHIDCLASS_PDO_DEVICE_EXTENSION;
typedef struct __HIDCLASS_FILEOP_CONTEXT__
{
//
// device extension
//
PHIDCLASS_PDO_DEVICE_EXTENSION DeviceExtension;
//
// spin lock
//
KSPIN_LOCK Lock;
//
// read irp pending list
//
LIST_ENTRY ReadPendingIrpListHead;
//
// completed irp list
//
LIST_ENTRY IrpCompletedListHead;
//
// stop in progress indicator
//
BOOLEAN StopInProgress;
//
// read complete event
//
KEVENT IrpReadComplete;
} HIDCLASS_FILEOP_CONTEXT, *PHIDCLASS_FILEOP_CONTEXT;
typedef struct
{
//
// original request
//
PIRP OriginalIrp;
//
// file op
//
PHIDCLASS_FILEOP_CONTEXT FileOp;
//
// buffer for reading report
//
PVOID InputReportBuffer;
//
// buffer length
//
ULONG InputReportBufferLength;
//
// work item
//
PIO_WORKITEM CompletionWorkItem;
} HIDCLASS_IRP_CONTEXT, *PHIDCLASS_IRP_CONTEXT;
/* fdo.c */
NTSTATUS
HidClassFDO_PnP(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp);
NTSTATUS
HidClassFDO_DispatchRequest(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp);
NTSTATUS
HidClassFDO_DispatchRequestSynchronous(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp);
/* pdo.c */
NTSTATUS
HidClassPDO_CreatePDO(
IN PDEVICE_OBJECT DeviceObject,
OUT PDEVICE_RELATIONS *OutDeviceRelations);
NTSTATUS
HidClassPDO_PnP(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp);
PHIDP_COLLECTION_DESC
HidClassPDO_GetCollectionDescription(
PHIDP_DEVICE_DESC DeviceDescription,
ULONG CollectionNumber);
PHIDP_REPORT_IDS
HidClassPDO_GetReportDescription(
PHIDP_DEVICE_DESC DeviceDescription,
ULONG CollectionNumber);
PHIDP_REPORT_IDS
HidClassPDO_GetReportDescriptionByReportID(
PHIDP_DEVICE_DESC DeviceDescription,
UCHAR ReportID);
#endif /* _HIDCLASS_PCH_ */