kernel32: Update version to Win 10.
[wine.git] / dlls / hidclass.sys / hid.h
blob9e829332bdcf2ea4ea03e859ef7b9879fb21ae0c
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 "cfgmgr32.h"
31 #include "wine/list.h"
32 #include "wine/hid.h"
34 #define DEFAULT_POLL_INTERVAL 200
35 #define MAX_POLL_INTERVAL_MSEC 10000
37 /* Ring buffer functions */
38 struct ReportRingBuffer;
40 typedef struct _BASE_DEVICE_EXTENSION
42 union
44 struct
46 /* this must be the first member */
47 HID_DEVICE_EXTENSION hid_ext;
49 DEVICE_OBJECT *child_pdo;
50 } fdo;
52 struct
54 DEVICE_OBJECT *parent_fdo;
56 HID_COLLECTION_INFORMATION information;
57 WINE_HIDP_PREPARSED_DATA *preparsed_data;
59 ULONG poll_interval;
60 struct ReportRingBuffer *ring_buffer;
61 HANDLE halt_event;
62 HANDLE thread;
63 UINT32 rawinput_handle;
65 UNICODE_STRING link_name;
67 KSPIN_LOCK irp_queue_lock;
68 LIST_ENTRY irp_queue;
70 BOOL is_mouse;
71 UNICODE_STRING mouse_link_name;
72 } pdo;
73 } u;
75 /* These are unique to the parent FDO, but stored in the children as well
76 * for convenience. */
77 WCHAR device_id[MAX_DEVICE_ID_LEN];
78 WCHAR instance_id[MAX_DEVICE_ID_LEN];
80 BOOL is_fdo;
81 } BASE_DEVICE_EXTENSION;
83 void RingBuffer_Write(struct ReportRingBuffer *buffer, void *data) DECLSPEC_HIDDEN;
84 UINT RingBuffer_AddPointer(struct ReportRingBuffer *buffer) DECLSPEC_HIDDEN;
85 void RingBuffer_RemovePointer(struct ReportRingBuffer *ring, UINT index) DECLSPEC_HIDDEN;
86 void RingBuffer_Read(struct ReportRingBuffer *ring, UINT index, void *output, UINT *size) DECLSPEC_HIDDEN;
87 void RingBuffer_ReadNew(struct ReportRingBuffer *buffer, UINT index, void *output, UINT *size) DECLSPEC_HIDDEN;
88 UINT RingBuffer_GetBufferSize(struct ReportRingBuffer *buffer) DECLSPEC_HIDDEN;
89 UINT RingBuffer_GetSize(struct ReportRingBuffer *buffer) DECLSPEC_HIDDEN;
90 void RingBuffer_Destroy(struct ReportRingBuffer *buffer) DECLSPEC_HIDDEN;
91 struct ReportRingBuffer* RingBuffer_Create(UINT buffer_size) DECLSPEC_HIDDEN;
92 NTSTATUS RingBuffer_SetSize(struct ReportRingBuffer *buffer, UINT size) DECLSPEC_HIDDEN;
94 typedef struct _minidriver
96 struct list entry;
98 HID_MINIDRIVER_REGISTRATION minidriver;
100 PDRIVER_UNLOAD DriverUnload;
102 PDRIVER_ADD_DEVICE AddDevice;
103 PDRIVER_DISPATCH PNPDispatch;
104 } minidriver;
106 NTSTATUS call_minidriver(ULONG code, DEVICE_OBJECT *device, void *in_buff, ULONG in_size, void *out_buff, ULONG out_size) DECLSPEC_HIDDEN;
108 /* Internal device functions */
109 void HID_StartDeviceThread(DEVICE_OBJECT *device) DECLSPEC_HIDDEN;
111 IRP *pop_irp_from_queue(BASE_DEVICE_EXTENSION *ext) DECLSPEC_HIDDEN;
113 NTSTATUS WINAPI pdo_ioctl(DEVICE_OBJECT *device, IRP *irp) DECLSPEC_HIDDEN;
114 NTSTATUS WINAPI pdo_read(DEVICE_OBJECT *device, IRP *irp) DECLSPEC_HIDDEN;
115 NTSTATUS WINAPI pdo_write(DEVICE_OBJECT *device, IRP *irp) DECLSPEC_HIDDEN;
116 NTSTATUS WINAPI pdo_create(DEVICE_OBJECT *device, IRP *irp) DECLSPEC_HIDDEN;
117 NTSTATUS WINAPI pdo_close(DEVICE_OBJECT *device, IRP *irp) DECLSPEC_HIDDEN;
119 /* Parsing HID Report Descriptors into preparsed data */
120 WINE_HIDP_PREPARSED_DATA* ParseDescriptor(BYTE *descriptor, unsigned int length) DECLSPEC_HIDDEN;