imagehlp: Use the IMAGE_FIRST_SECTION helper macro.
[wine.git] / dlls / hidclass.sys / hid.h
blob3eefbf87f6376014ee095c3307f3bfa8e9d1f0b7
1 /*
2 * Copyright 2015 Aric Stewart
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #include "ntstatus.h"
20 #define WIN32_NO_STATUS
21 #include "windef.h"
22 #include "winbase.h"
23 #include "winternl.h"
24 #include "winioctl.h"
25 #include "ddk/wdm.h"
26 #include "hidusage.h"
27 #include "ddk/hidport.h"
28 #include "ddk/hidclass.h"
29 #include "ddk/hidpi.h"
30 #include "ddk/hidpddi.h"
31 #include "cfgmgr32.h"
32 #include "wine/list.h"
33 #include "wine/hid.h"
35 #define DEFAULT_POLL_INTERVAL 200
36 #define MAX_POLL_INTERVAL_MSEC 10000
38 /* Ring buffer functions */
39 struct ReportRingBuffer;
41 typedef struct _BASE_DEVICE_EXTENSION
43 union
45 struct
47 /* this must be the first member */
48 HID_DEVICE_EXTENSION hid_ext;
50 DEVICE_OBJECT *child_pdo;
51 } fdo;
53 struct
55 DEVICE_OBJECT *parent_fdo;
57 HID_COLLECTION_INFORMATION information;
58 HIDP_DEVICE_DESC device_desc;
60 ULONG poll_interval;
61 HANDLE halt_event;
62 HANDLE thread;
63 UINT32 rawinput_handle;
65 KSPIN_LOCK queues_lock;
66 struct list queues;
68 UNICODE_STRING link_name;
70 KSPIN_LOCK lock;
71 BOOL removed;
73 BOOL is_mouse;
74 UNICODE_STRING mouse_link_name;
75 BOOL is_keyboard;
76 UNICODE_STRING keyboard_link_name;
77 } pdo;
78 } u;
80 /* These are unique to the parent FDO, but stored in the children as well
81 * for convenience. */
82 WCHAR device_id[MAX_DEVICE_ID_LEN];
83 WCHAR instance_id[MAX_DEVICE_ID_LEN];
84 WCHAR container_id[MAX_GUID_STRING_LEN];
85 const GUID *class_guid;
87 BOOL is_fdo;
88 } BASE_DEVICE_EXTENSION;
90 struct hid_report
92 LONG ref;
93 ULONG length;
94 BYTE buffer[1];
97 struct hid_queue
99 struct list entry;
100 KSPIN_LOCK lock;
101 ULONG length;
102 ULONG read_idx;
103 ULONG write_idx;
104 struct hid_report *reports[512];
105 LIST_ENTRY irp_queue;
108 typedef struct _minidriver
110 struct list entry;
112 HID_MINIDRIVER_REGISTRATION minidriver;
114 PDRIVER_UNLOAD DriverUnload;
116 PDRIVER_ADD_DEVICE AddDevice;
117 PDRIVER_DISPATCH PNPDispatch;
118 } minidriver;
120 void call_minidriver( ULONG code, DEVICE_OBJECT *device, void *in_buff, ULONG in_size,
121 void *out_buff, ULONG out_size, IO_STATUS_BLOCK *io );
123 /* Internal device functions */
124 void HID_StartDeviceThread( DEVICE_OBJECT *device );
125 void hid_queue_remove_pending_irps( struct hid_queue *queue );
126 void hid_queue_destroy( struct hid_queue *queue );
128 NTSTATUS WINAPI pdo_ioctl( DEVICE_OBJECT *device, IRP *irp );
129 NTSTATUS WINAPI pdo_read( DEVICE_OBJECT *device, IRP *irp );
130 NTSTATUS WINAPI pdo_write( DEVICE_OBJECT *device, IRP *irp );
131 NTSTATUS WINAPI pdo_create( DEVICE_OBJECT *device, IRP *irp );
132 NTSTATUS WINAPI pdo_close( DEVICE_OBJECT *device, IRP *irp );