makefiles: Don't use standard libs for programs that specify -nodefaultlibs.
[wine/zf.git] / dlls / hidclass.sys / hid.h
blob36d13c009d7c6ed41b2dfa706e101e91a68efd31
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 {
41 HID_DEVICE_EXTENSION deviceExtension;
43 HID_COLLECTION_INFORMATION information;
44 WINE_HIDP_PREPARSED_DATA *preparseData;
46 ULONG poll_interval;
47 WCHAR *device_name;
48 UNICODE_STRING link_name;
49 WCHAR device_id[MAX_DEVICE_ID_LEN];
50 WCHAR instance_id[MAX_DEVICE_ID_LEN];
51 struct ReportRingBuffer *ring_buffer;
52 HANDLE halt_event;
53 HANDLE thread;
55 KSPIN_LOCK irp_queue_lock;
56 LIST_ENTRY irp_queue;
58 BOOL is_mouse;
59 UNICODE_STRING mouse_link_name;
61 /* Minidriver Specific stuff will end up here */
62 } BASE_DEVICE_EXTENSION;
64 void RingBuffer_Write(struct ReportRingBuffer *buffer, void *data) DECLSPEC_HIDDEN;
65 UINT RingBuffer_AddPointer(struct ReportRingBuffer *buffer) DECLSPEC_HIDDEN;
66 void RingBuffer_RemovePointer(struct ReportRingBuffer *ring, UINT index) DECLSPEC_HIDDEN;
67 void RingBuffer_Read(struct ReportRingBuffer *ring, UINT index, void *output, UINT *size) DECLSPEC_HIDDEN;
68 void RingBuffer_ReadNew(struct ReportRingBuffer *buffer, UINT index, void *output, UINT *size) DECLSPEC_HIDDEN;
69 UINT RingBuffer_GetBufferSize(struct ReportRingBuffer *buffer) DECLSPEC_HIDDEN;
70 UINT RingBuffer_GetSize(struct ReportRingBuffer *buffer) DECLSPEC_HIDDEN;
71 void RingBuffer_Destroy(struct ReportRingBuffer *buffer) DECLSPEC_HIDDEN;
72 struct ReportRingBuffer* RingBuffer_Create(UINT buffer_size) DECLSPEC_HIDDEN;
73 NTSTATUS RingBuffer_SetSize(struct ReportRingBuffer *buffer, UINT size) DECLSPEC_HIDDEN;
75 typedef struct _hiddevice
77 struct list entry;
78 DEVICE_OBJECT *device;
79 } hid_device;
81 typedef struct _minidriver
83 struct list entry;
85 HID_MINIDRIVER_REGISTRATION minidriver;
87 PDRIVER_UNLOAD DriverUnload;
89 PDRIVER_ADD_DEVICE AddDevice;
90 PDRIVER_DISPATCH PNPDispatch;
91 struct list device_list;
92 } minidriver;
94 NTSTATUS call_minidriver(ULONG code, DEVICE_OBJECT *device, void *in_buff, ULONG in_size, void *out_buff, ULONG out_size) DECLSPEC_HIDDEN;
95 minidriver* find_minidriver(DRIVER_OBJECT* driver) DECLSPEC_HIDDEN;
97 /* Internal device functions */
98 NTSTATUS HID_CreateDevice(DEVICE_OBJECT *native_device, HID_MINIDRIVER_REGISTRATION *driver, DEVICE_OBJECT **device) DECLSPEC_HIDDEN;
99 NTSTATUS HID_LinkDevice(DEVICE_OBJECT *device) DECLSPEC_HIDDEN;
100 void HID_DeleteDevice(DEVICE_OBJECT *device) DECLSPEC_HIDDEN;
101 void HID_StartDeviceThread(DEVICE_OBJECT *device) DECLSPEC_HIDDEN;
103 NTSTATUS WINAPI HID_Device_ioctl(DEVICE_OBJECT *device, IRP *irp) DECLSPEC_HIDDEN;
104 NTSTATUS WINAPI HID_Device_read(DEVICE_OBJECT *device, IRP *irp) DECLSPEC_HIDDEN;
105 NTSTATUS WINAPI HID_Device_write(DEVICE_OBJECT *device, IRP *irp) DECLSPEC_HIDDEN;
106 NTSTATUS WINAPI HID_Device_create(DEVICE_OBJECT *device, IRP *irp) DECLSPEC_HIDDEN;
107 NTSTATUS WINAPI HID_Device_close(DEVICE_OBJECT *device, IRP *irp) DECLSPEC_HIDDEN;
108 NTSTATUS WINAPI HID_PNP_Dispatch(DEVICE_OBJECT *device, IRP *irp) DECLSPEC_HIDDEN;
110 /* Pseudo-Plug and Play support*/
111 NTSTATUS WINAPI PNP_AddDevice(DRIVER_OBJECT *driver, DEVICE_OBJECT* PDO) DECLSPEC_HIDDEN;
112 NTSTATUS PNP_RemoveDevice(minidriver *minidriver, DEVICE_OBJECT* device, IRP* irp) DECLSPEC_HIDDEN;
114 /* Parsing HID Report Descriptors into preparsed data */
115 WINE_HIDP_PREPARSED_DATA* ParseDescriptor(BYTE *descriptor, unsigned int length) DECLSPEC_HIDDEN;