Release 9.12.
[wine.git] / dlls / hidclass.sys / hid.h
blob7b5d5f19298397dbfaea79f5d082d7304b42b088
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 "winreg.h"
26 #include "ddk/wdm.h"
27 #include "hidusage.h"
28 #include "ddk/hidport.h"
29 #include "ddk/hidclass.h"
30 #include "ddk/hidpi.h"
31 #include "ddk/hidpddi.h"
32 #include "cfgmgr32.h"
33 #include "wine/list.h"
34 #include "wine/hid.h"
36 #define DEFAULT_POLL_INTERVAL 200
37 #define MAX_POLL_INTERVAL_MSEC 10000
39 /* Ring buffer functions */
40 struct ReportRingBuffer;
42 typedef struct _BASE_DEVICE_EXTENSION
44 union
46 struct
48 /* this must be the first member */
49 HID_DEVICE_EXTENSION hid_ext;
51 DEVICE_OBJECT *child_pdo;
52 } fdo;
54 struct
56 DEVICE_OBJECT *parent_fdo;
58 HID_COLLECTION_INFORMATION information;
59 HIDP_DEVICE_DESC device_desc;
61 ULONG poll_interval;
62 HANDLE halt_event;
63 HANDLE thread;
64 UINT32 rawinput_handle;
66 KSPIN_LOCK queues_lock;
67 struct list queues;
69 UNICODE_STRING link_name;
71 KSPIN_LOCK lock;
72 BOOL removed;
74 BOOL is_mouse;
75 UNICODE_STRING mouse_link_name;
76 BOOL is_keyboard;
77 UNICODE_STRING keyboard_link_name;
78 } pdo;
79 } u;
81 /* These are unique to the parent FDO, but stored in the children as well
82 * for convenience. */
83 WCHAR device_id[MAX_DEVICE_ID_LEN];
84 WCHAR instance_id[MAX_DEVICE_ID_LEN];
85 WCHAR container_id[MAX_GUID_STRING_LEN];
86 const GUID *class_guid;
88 BOOL is_fdo;
89 } BASE_DEVICE_EXTENSION;
91 struct hid_report
93 LONG ref;
94 ULONG length;
95 BYTE buffer[1];
98 struct hid_queue
100 struct list entry;
101 KSPIN_LOCK lock;
102 ULONG length;
103 ULONG read_idx;
104 ULONG write_idx;
105 struct hid_report *reports[512];
106 LIST_ENTRY irp_queue;
109 typedef struct _minidriver
111 struct list entry;
113 HID_MINIDRIVER_REGISTRATION minidriver;
115 PDRIVER_UNLOAD DriverUnload;
117 PDRIVER_ADD_DEVICE AddDevice;
118 PDRIVER_DISPATCH PNPDispatch;
119 } minidriver;
121 void call_minidriver( ULONG code, DEVICE_OBJECT *device, void *in_buff, ULONG in_size,
122 void *out_buff, ULONG out_size, IO_STATUS_BLOCK *io );
124 /* Internal device functions */
125 void HID_StartDeviceThread( DEVICE_OBJECT *device );
126 void hid_queue_remove_pending_irps( struct hid_queue *queue );
127 void hid_queue_destroy( struct hid_queue *queue );
129 NTSTATUS WINAPI pdo_ioctl( DEVICE_OBJECT *device, IRP *irp );
130 NTSTATUS WINAPI pdo_read( DEVICE_OBJECT *device, IRP *irp );
131 NTSTATUS WINAPI pdo_write( DEVICE_OBJECT *device, IRP *irp );
132 NTSTATUS WINAPI pdo_create( DEVICE_OBJECT *device, IRP *irp );
133 NTSTATUS WINAPI pdo_close( DEVICE_OBJECT *device, IRP *irp );