wine  6.0.1
About: Wine is an Open Source implementation of the MS Windows API on top of X, OpenGL, and Unix. Think of Wine as a compatibility layer for running Windows programs.
  Fossies Dox: wine-6.0.1.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

main.c
Go to the documentation of this file.
1 /*
2  * WINE Platform native bus driver
3  *
4  * Copyright 2016 Aric Stewart
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19  */
20 #include "config.h"
21 #include <stdarg.h>
22 
23 #define NONAMELESSUNION
24 #define NONAMELESSSTRUCT
25 
26 #include "ntstatus.h"
27 #define WIN32_NO_STATUS
28 #include "winternl.h"
29 #include "winioctl.h"
30 #include "hidusage.h"
31 #include "ddk/wdm.h"
32 #include "ddk/hidport.h"
33 #include "ddk/hidtypes.h"
34 #include "wine/asm.h"
35 #include "wine/debug.h"
36 #include "wine/unicode.h"
37 #include "wine/list.h"
38 
39 #include "bus.h"
40 #include "controller.h"
41 
43 WINE_DECLARE_DEBUG_CHANNEL(hid_report);
44 
45 #if defined(__i386__) && !defined(_WIN32)
46 
47 extern void * WINAPI wrap_fastcall_func1( void *func, const void *a );
48 __ASM_STDCALL_FUNC( wrap_fastcall_func1, 8,
49  "popl %ecx\n\t"
50  "popl %eax\n\t"
51  "xchgl (%esp),%ecx\n\t"
52  "jmp *%eax" );
53 
54 #define call_fastcall_func1(func,a) wrap_fastcall_func1(func,a)
55 
56 #else
57 
58 #define call_fastcall_func1(func,a) func(a)
59 
60 #endif
61 
63 {
67  const WCHAR* product;
69 };
70 
71 #define VID_MICROSOFT 0x045e
72 
73 static const WCHAR xbox360_product_string[] = {
74  'C','o','n','t','r','o','l','l','e','r',' ','(','X','B','O','X',' ','3','6','0',' ','F','o','r',' ','W','i','n','d','o','w','s',')',0
75 };
76 
77 static const WCHAR xboxone_product_string[] = {
78  'C','o','n','t','r','o','l','l','e','r',' ','(','X','B','O','X',' ','O','n','e',' ','F','o','r',' ','W','i','n','d','o','w','s',')',0
79 };
80 
81 static const struct product_desc XBOX_CONTROLLERS[] = {
82  {VID_MICROSOFT, 0x0202, NULL, NULL, NULL}, /* Xbox Controller */
83  {VID_MICROSOFT, 0x0285, NULL, NULL, NULL}, /* Xbox Controller S */
84  {VID_MICROSOFT, 0x0289, NULL, NULL, NULL}, /* Xbox Controller S */
85  {VID_MICROSOFT, 0x028e, NULL, xbox360_product_string, NULL}, /* Xbox360 Controller */
86  {VID_MICROSOFT, 0x028f, NULL, xbox360_product_string, NULL}, /* Xbox360 Wireless Controller */
87  {VID_MICROSOFT, 0x02d1, NULL, xboxone_product_string, NULL}, /* Xbox One Controller */
88  {VID_MICROSOFT, 0x02dd, NULL, xboxone_product_string, NULL}, /* Xbox One Controller (Covert Forces/Firmware 2015) */
89  {VID_MICROSOFT, 0x02e0, NULL, NULL, NULL}, /* Xbox One X Controller */
90  {VID_MICROSOFT, 0x02e3, NULL, xboxone_product_string, NULL}, /* Xbox One Elite Controller */
91  {VID_MICROSOFT, 0x02e6, NULL, NULL, NULL}, /* Wireless XBox Controller Dongle */
92  {VID_MICROSOFT, 0x02ea, NULL, xboxone_product_string, NULL}, /* Xbox One S Controller */
93  {VID_MICROSOFT, 0x02fd, NULL, xboxone_product_string, NULL}, /* Xbox One S Controller (Firmware 2017) */
94  {VID_MICROSOFT, 0x0719, NULL, xbox360_product_string, NULL}, /* Xbox 360 Wireless Adapter */
95 };
96 
98 
100 
101 /* The root-enumerated device stack. */
104 
106 
108 {
109  struct list entry;
111 };
112 
114 {
116 
121  const WCHAR *busid; /* Expected to be a static constant */
122 
124 
131 
133 };
134 
137 {
138  0, 0, &device_list_cs,
140  0, 0, { (DWORD_PTR)(__FILE__ ": device_list_cs") }
141 };
142 static CRITICAL_SECTION device_list_cs = { &critsect_debug, -1, 0, 0, 0, 0 };
143 
144 static struct list pnp_devset = LIST_INIT(pnp_devset);
145 
146 static const WCHAR zero_serialW[]= {'0','0','0','0',0};
147 static const WCHAR miW[] = {'M','I',0};
148 static const WCHAR igW[] = {'I','G',0};
149 
150 static inline WCHAR *strdupW(const WCHAR *src)
151 {
152  WCHAR *dst;
153  if (!src) return NULL;
154  dst = HeapAlloc(GetProcessHeap(), 0, (strlenW(src) + 1)*sizeof(WCHAR));
155  if (dst) strcpyW(dst, src);
156  return dst;
157 }
158 
160 {
161  struct device_extension *ext = (struct device_extension *)device->DeviceExtension;
162  return ext->platform_private;
163 }
164 
166 {
167  struct pnp_device *ptr;
168  DWORD index = 0;
169 
171  {
172  struct device_extension *ext = (struct device_extension *)ptr->device->DeviceExtension;
173  if (ext->vid == vid && ext->pid == pid && ext->input == input)
174  index = max(ext->index + 1, index);
175  }
176 
177  return index;
178 }
179 
181 {
182  static const WCHAR formatW[] = {'%','i','&','%','s','&','%','x','&','%','i',0};
183  struct device_extension *ext = (struct device_extension *)device->DeviceExtension;
184  const WCHAR *serial = ext->serial ? ext->serial : zero_serialW;
185  DWORD len = strlenW(serial) + 33;
186  WCHAR *dst;
187 
188  if ((dst = ExAllocatePool(PagedPool, len * sizeof(WCHAR))))
189  sprintfW(dst, formatW, ext->version, serial, ext->uid, ext->index);
190 
191  return dst;
192 }
193 
195 {
196  static const WCHAR formatW[] = {'%','s','\\','v','i','d','_','%','0','4','x',
197  '&','p','i','d','_','%','0','4','x',0};
198  static const WCHAR format_inputW[] = {'%','s','\\','v','i','d','_','%','0','4','x',
199  '&','p','i','d','_','%','0','4','x','&','%','s','_','%','0','2','i',0};
200  struct device_extension *ext = (struct device_extension *)device->DeviceExtension;
201  DWORD len = strlenW(ext->busid) + 34;
202  WCHAR *dst;
203 
204  if ((dst = ExAllocatePool(PagedPool, len * sizeof(WCHAR))))
205  {
206  if (ext->input == (WORD)-1)
207  {
208  sprintfW(dst, formatW, ext->busid, ext->vid, ext->pid);
209  }
210  else
211  {
212  sprintfW(dst, format_inputW, ext->busid, ext->vid, ext->pid,
213  ext->is_gamepad ? igW : miW, ext->input);
214  }
215  }
216 
217  return dst;
218 }
219 
221 {
222  struct device_extension *ext = (struct device_extension *)device->DeviceExtension;
223  WCHAR *dst;
224 
225  if ((dst = ExAllocatePool(PagedPool, (strlenW(ext->busid) + 2) * sizeof(WCHAR))))
226  {
227  strcpyW(dst, ext->busid);
228  dst[strlenW(dst) + 1] = 0;
229  }
230 
231  return dst;
232 }
233 
235  WORD input, DWORD version, DWORD uid, const WCHAR *serialW, BOOL is_gamepad,
236  const platform_vtbl *vtbl, DWORD platform_data_size)
237 {
238  static const WCHAR device_name_fmtW[] = {'\\','D','e','v','i','c','e','\\','%','s','#','%','p',0};
239  struct device_extension *ext;
240  struct pnp_device *pnp_dev;
242  UNICODE_STRING nameW;
243  WCHAR dev_name[256];
245  DWORD length;
246 
247  TRACE("(%s, %04x, %04x, %04x, %u, %u, %s, %u, %p, %u)\n",
248  debugstr_w(busidW), vid, pid, input, version, uid, debugstr_w(serialW),
249  is_gamepad, vtbl, platform_data_size);
250 
251  if (!(pnp_dev = HeapAlloc(GetProcessHeap(), 0, sizeof(*pnp_dev))))
252  return NULL;
253 
254  sprintfW(dev_name, device_name_fmtW, busidW, pnp_dev);
255  RtlInitUnicodeString(&nameW, dev_name);
256  length = FIELD_OFFSET(struct device_extension, platform_private[platform_data_size]);
257  status = IoCreateDevice(driver_obj, length, &nameW, 0, 0, FALSE, &device);
258  if (status)
259  {
260  FIXME("failed to create device error %x\n", status);
261  HeapFree(GetProcessHeap(), 0, pnp_dev);
262  return NULL;
263  }
264 
266 
267  /* fill out device_extension struct */
268  ext = (struct device_extension *)device->DeviceExtension;
269  ext->pnp_device = pnp_dev;
270  ext->vid = vid;
271  ext->pid = pid;
272  ext->input = input;
273  ext->uid = uid;
274  ext->version = version;
275  ext->index = get_device_index(vid, pid, input);
276  ext->is_gamepad = is_gamepad;
277  ext->serial = strdupW(serialW);
278  ext->busid = busidW;
279  ext->vtbl = vtbl;
280  ext->last_report = NULL;
281  ext->last_report_size = 0;
282  ext->last_report_read = TRUE;
283  ext->buffer_size = 0;
284 
285  memset(ext->platform_private, 0, platform_data_size);
286 
287  InitializeListHead(&ext->irp_queue);
288  InitializeCriticalSection(&ext->report_cs);
289  ext->report_cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": report_cs");
290 
291  /* add to list of pnp devices */
292  pnp_dev->device = device;
293  list_add_tail(&pnp_devset, &pnp_dev->entry);
294 
296  return device;
297 }
298 
300 {
301  struct pnp_device *dev;
302  DEVICE_OBJECT *ret = NULL;
303 
304  TRACE("(%p, %p)\n", vtbl, platform_dev);
305 
308  {
309  struct device_extension *ext = (struct device_extension *)dev->device->DeviceExtension;
310  if (ext->vtbl != vtbl) continue;
311  if (ext->vtbl->compare_platform_device(dev->device, platform_dev) == 0)
312  {
313  ret = dev->device;
314  break;
315  }
316  }
318 
319  TRACE("returning %p\n", ret);
320  return ret;
321 }
322 
324 {
325  struct pnp_device *dev, *dev_next;
326  DEVICE_OBJECT *ret = NULL;
327  int cont;
328 
329  TRACE("(%p)\n", vtbl);
330 
332  LIST_FOR_EACH_ENTRY_SAFE(dev, dev_next, &pnp_devset, struct pnp_device, entry)
333  {
334  struct device_extension *ext = (struct device_extension *)dev->device->DeviceExtension;
335  if (ext->vtbl != vtbl) continue;
337  cont = function(dev->device, context);
339  if (!cont)
340  {
341  ret = dev->device;
342  break;
343  }
344  }
346  return ret;
347 }
348 
350 {
351  struct device_extension *ext = (struct device_extension *)device->DeviceExtension;
352  struct pnp_device *pnp_device = ext->pnp_device;
353 
357 }
358 
360 {
361  struct device_extension *ext = (struct device_extension *)device->DeviceExtension;
362  struct pnp_device *pnp_device = ext->pnp_device;
363  LIST_ENTRY *entry;
364  IRP *irp;
365 
366  TRACE("(%p)\n", device);
367 
368  /* Cancel pending IRPs */
369  EnterCriticalSection(&ext->report_cs);
370  while ((entry = RemoveHeadList(&ext->irp_queue)) != &ext->irp_queue)
371  {
372  irp = CONTAINING_RECORD(entry, IRP, Tail.Overlay.s.ListEntry);
373  irp->IoStatus.u.Status = STATUS_CANCELLED;
374  irp->IoStatus.Information = 0;
376  }
377  LeaveCriticalSection(&ext->report_cs);
378 
379  ext->report_cs.DebugInfo->Spare[0] = 0;
380  DeleteCriticalSection(&ext->report_cs);
381 
382  HeapFree(GetProcessHeap(), 0, ext->serial);
383  HeapFree(GetProcessHeap(), 0, ext->last_report);
385 
386  /* pnp_device must be released after the device is gone */
388 }
389 
391 {
392  int i;
393  struct pnp_device *ptr;
394 
397 
398  if (!*devices)
399  {
402  }
403 
404  i = 0;
406  {
407  (*devices)->Objects[i] = ptr->device;
409  i++;
410  }
412  (*devices)->Count = i;
413  return STATUS_SUCCESS;
414 }
415 
417 {
418  NTSTATUS status = irp->IoStatus.u.Status;
420 
421  TRACE("IRP_MN_QUERY_DEVICE_RELATIONS\n");
422  switch (irpsp->Parameters.QueryDeviceRelations.Type)
423  {
424  case EjectionRelations:
425  case RemovalRelations:
427  case PowerRelations:
428  FIXME("Unhandled Device Relation %x\n",irpsp->Parameters.QueryDeviceRelations.Type);
429  break;
430  case BusRelations:
432  break;
433  default:
434  FIXME("Unknown Device Relation %x\n",irpsp->Parameters.QueryDeviceRelations.Type);
435  break;
436  }
437 
438  return status;
439 }
440 
442 {
443  NTSTATUS status = irp->IoStatus.u.Status;
445  BUS_QUERY_ID_TYPE type = irpsp->Parameters.QueryId.IdType;
446 
447  TRACE("(%p, %p)\n", device, irp);
448 
449  switch (type)
450  {
451  case BusQueryHardwareIDs:
452  TRACE("BusQueryHardwareIDs\n");
454  break;
456  TRACE("BusQueryCompatibleIDs\n");
458  break;
459  case BusQueryDeviceID:
460  TRACE("BusQueryDeviceID\n");
462  break;
463  case BusQueryInstanceID:
464  TRACE("BusQueryInstanceID\n");
466  break;
467  default:
468  FIXME("Unhandled type %08x\n", type);
469  return status;
470  }
471 
473  return status;
474 }
475 
477 {
478  TRACE("buffer %p, length %u.\n", buffer, length);
479 
480  *ret_length = sizeof(REPORT_HEADER) + sizeof(REPORT_TAIL);
481  if (length < sizeof(REPORT_HEADER) + sizeof(REPORT_TAIL))
483 
485  memcpy(buffer + sizeof(REPORT_HEADER), REPORT_TAIL, sizeof(REPORT_TAIL));
488 
489  return STATUS_SUCCESS;
490 }
491 
493 {
494  static const WCHAR nameW[] = {'W','i','n','e',' ','H','I','D',' ','m','o','u','s','e',0};
495  if (index != HID_STRING_ID_IPRODUCT)
496  return STATUS_NOT_IMPLEMENTED;
497  if (length < ARRAY_SIZE(nameW))
499  strcpyW(buffer, nameW);
500  return STATUS_SUCCESS;
501 }
502 
504 {
505  return STATUS_SUCCESS;
506 }
507 
509 {
510  FIXME("id %u, stub!\n", id);
511  return STATUS_NOT_IMPLEMENTED;
512 }
513 
515 {
516  FIXME("id %u, stub!\n", id);
517  return STATUS_NOT_IMPLEMENTED;
518 }
519 
521 {
522  FIXME("id %u, stub!\n", id);
523  return STATUS_NOT_IMPLEMENTED;
524 }
525 
526 static const platform_vtbl mouse_vtbl =
527 {
529  .get_string = mouse_get_string,
530  .begin_report_processing = mouse_begin_report_processing,
531  .set_output_report = mouse_set_output_report,
532  .get_feature_report = mouse_get_feature_report,
533  .set_feature_report = mouse_set_feature_report,
534 };
535 
536 static void mouse_device_create(void)
537 {
538  static const WCHAR busidW[] = {'W','I','N','E','M','O','U','S','E',0};
539 
540  mouse_obj = bus_create_hid_device(busidW, 0, 0, -1, 0, 0, busidW, FALSE, &mouse_vtbl, 0);
542 }
543 
545 {
546  static const WCHAR SDL_enabledW[] = {'E','n','a','b','l','e',' ','S','D','L',0};
547  static const UNICODE_STRING SDL_enabled = {sizeof(SDL_enabledW) - sizeof(WCHAR), sizeof(SDL_enabledW), (WCHAR*)SDL_enabledW};
549  NTSTATUS ret;
550 
551  switch (irpsp->MinorFunction)
552  {
555  break;
556  case IRP_MN_START_DEVICE:
558 
559  if (check_bus_option(&SDL_enabled, 1))
560  {
562  {
563  irp->IoStatus.u.Status = STATUS_SUCCESS;
564  break;
565  }
566  }
569  irp->IoStatus.u.Status = STATUS_SUCCESS;
570  break;
572  irp->IoStatus.u.Status = STATUS_SUCCESS;
573  break;
578 
579  irp->IoStatus.u.Status = STATUS_SUCCESS;
581  ret = IoCallDriver(bus_pdo, irp);
584  return ret;
585  default:
586  FIXME("Unhandled minor function %#x.\n", irpsp->MinorFunction);
587  }
588 
590  return IoCallDriver(bus_pdo, irp);
591 }
592 
594 {
595  NTSTATUS status = irp->IoStatus.u.Status;
597 
598  switch (irpsp->MinorFunction)
599  {
600  case IRP_MN_QUERY_ID:
601  TRACE("IRP_MN_QUERY_ID\n");
603  irp->IoStatus.u.Status = status;
604  break;
606  TRACE("IRP_MN_QUERY_CAPABILITIES\n");
607  break;
608  default:
609  FIXME("Unhandled function %08x\n", irpsp->MinorFunction);
610  break;
611  }
612 
614  return status;
615 }
616 
618 {
619  if (device == bus_fdo)
620  return fdo_pnp_dispatch(device, irp);
621  return pdo_pnp_dispatch(device, irp);
622 }
623 
624 static NTSTATUS deliver_last_report(struct device_extension *ext, DWORD buffer_length, BYTE* buffer, ULONG_PTR *out_length)
625 {
626  if (buffer_length < ext->last_report_size)
627  {
628  *out_length = 0;
630  }
631  else
632  {
633  if (ext->last_report)
634  memcpy(buffer, ext->last_report, ext->last_report_size);
635  *out_length = ext->last_report_size;
636  return STATUS_SUCCESS;
637  }
638 }
639 
641 {
642  struct device_extension *ext = (struct device_extension *)device->DeviceExtension;
643  const struct product_desc *vendor_products;
644  unsigned int i, vendor_products_size = 0;
645 
646  if (ext->vid == VID_MICROSOFT)
647  {
648  vendor_products = XBOX_CONTROLLERS;
649  vendor_products_size = ARRAY_SIZE(XBOX_CONTROLLERS);
650  }
651 
652  for (i = 0; i < vendor_products_size; i++)
653  {
654  if (ext->pid == vendor_products[i].pid)
655  break;
656  }
657 
658  if (i >= vendor_products_size)
659  return STATUS_UNSUCCESSFUL;
660 
661  switch (index)
662  {
664  if (vendor_products[i].product)
665  {
666  strcpyW(buffer, vendor_products[i].product);
667  return STATUS_SUCCESS;
668  }
669  break;
671  if (vendor_products[i].manufacturer)
672  {
673  strcpyW(buffer, vendor_products[i].manufacturer);
674  return STATUS_SUCCESS;
675  }
676  break;
678  if (vendor_products[i].serialnumber)
679  {
680  strcpyW(buffer, vendor_products[i].serialnumber);
681  return STATUS_SUCCESS;
682  }
683  break;
684  }
685 
686  return STATUS_UNSUCCESSFUL;
687 }
688 
690 {
691  NTSTATUS status = irp->IoStatus.u.Status;
693  struct device_extension *ext = (struct device_extension *)device->DeviceExtension;
694 
695  TRACE("(%p, %p)\n", device, irp);
696 
697  if (device == bus_fdo)
698  {
700  return IoCallDriver(bus_pdo, irp);
701  }
702 
703  switch (irpsp->Parameters.DeviceIoControl.IoControlCode)
704  {
706  {
708  TRACE("IOCTL_HID_GET_DEVICE_ATTRIBUTES\n");
709 
710  if (irpsp->Parameters.DeviceIoControl.OutputBufferLength < sizeof(*attr))
711  {
713  break;
714  }
715 
716  memset(attr, 0, sizeof(*attr));
717  attr->Size = sizeof(*attr);
718  attr->VendorID = ext->vid;
719  attr->ProductID = ext->pid;
720  attr->VersionNumber = ext->version;
721 
723  irp->IoStatus.Information = sizeof(*attr);
724  break;
725  }
727  {
728  HID_DESCRIPTOR *descriptor = (HID_DESCRIPTOR *)irp->UserBuffer;
729  DWORD length;
730  TRACE("IOCTL_HID_GET_DEVICE_DESCRIPTOR\n");
731 
732  if (irpsp->Parameters.DeviceIoControl.OutputBufferLength < sizeof(*descriptor))
733  {
735  break;
736  }
737 
738  status = ext->vtbl->get_reportdescriptor(device, NULL, 0, &length);
740  {
741  WARN("Failed to get platform report descriptor length\n");
742  irp->IoStatus.u.Status = status;
743  break;
744  }
745 
746  memset(descriptor, 0, sizeof(*descriptor));
747  descriptor->bLength = sizeof(*descriptor);
749  descriptor->bcdHID = HID_REVISION;
750  descriptor->bCountry = 0;
751  descriptor->bNumDescriptors = 1;
752  descriptor->DescriptorList[0].bReportType = HID_REPORT_DESCRIPTOR_TYPE;
753  descriptor->DescriptorList[0].wReportLength = length;
754 
756  irp->IoStatus.Information = sizeof(*descriptor);
757  break;
758  }
760  {
761  DWORD length = irpsp->Parameters.DeviceIoControl.OutputBufferLength;
762  TRACE("IOCTL_HID_GET_REPORT_DESCRIPTOR\n");
763 
764  irp->IoStatus.u.Status = status = ext->vtbl->get_reportdescriptor(device, irp->UserBuffer, length, &length);
765  irp->IoStatus.Information = length;
766  break;
767  }
769  {
770  DWORD length = irpsp->Parameters.DeviceIoControl.OutputBufferLength / sizeof(WCHAR);
771  DWORD index = (ULONG_PTR)irpsp->Parameters.DeviceIoControl.Type3InputBuffer;
772  TRACE("IOCTL_HID_GET_STRING[%08x]\n", index);
773 
774  irp->IoStatus.u.Status = status = hid_get_native_string(device, index, (WCHAR *)irp->UserBuffer, length);
775  if (status != STATUS_SUCCESS)
776  irp->IoStatus.u.Status = status = ext->vtbl->get_string(device, index, (WCHAR *)irp->UserBuffer, length);
777  if (status == STATUS_SUCCESS)
778  irp->IoStatus.Information = (strlenW((WCHAR *)irp->UserBuffer) + 1) * sizeof(WCHAR);
779  break;
780  }
782  {
783  HID_XFER_PACKET *packet = (HID_XFER_PACKET*)(irp->UserBuffer);
784  TRACE_(hid_report)("IOCTL_HID_GET_INPUT_REPORT\n");
785  EnterCriticalSection(&ext->report_cs);
786  status = ext->vtbl->begin_report_processing(device);
787  if (status != STATUS_SUCCESS)
788  {
789  irp->IoStatus.u.Status = status;
790  LeaveCriticalSection(&ext->report_cs);
791  break;
792  }
793 
795  packet->reportBufferLen, packet->reportBuffer,
796  &irp->IoStatus.Information);
797 
798  if (status == STATUS_SUCCESS)
799  packet->reportBufferLen = irp->IoStatus.Information;
800  LeaveCriticalSection(&ext->report_cs);
801  break;
802  }
804  {
805  TRACE_(hid_report)("IOCTL_HID_READ_REPORT\n");
806  EnterCriticalSection(&ext->report_cs);
807  status = ext->vtbl->begin_report_processing(device);
808  if (status != STATUS_SUCCESS)
809  {
810  irp->IoStatus.u.Status = status;
811  LeaveCriticalSection(&ext->report_cs);
812  break;
813  }
814  if (!ext->last_report_read)
815  {
817  irpsp->Parameters.DeviceIoControl.OutputBufferLength,
818  irp->UserBuffer, &irp->IoStatus.Information);
819  ext->last_report_read = TRUE;
820  }
821  else
822  {
823  InsertTailList(&ext->irp_queue, &irp->Tail.Overlay.s.ListEntry);
825  }
826  LeaveCriticalSection(&ext->report_cs);
827  break;
828  }
831  {
832  HID_XFER_PACKET *packet = (HID_XFER_PACKET*)(irp->UserBuffer);
833  TRACE_(hid_report)("IOCTL_HID_WRITE_REPORT / IOCTL_HID_SET_OUTPUT_REPORT\n");
834  irp->IoStatus.u.Status = status = ext->vtbl->set_output_report(
835  device, packet->reportId, packet->reportBuffer,
836  packet->reportBufferLen, &irp->IoStatus.Information);
837  break;
838  }
840  {
841  HID_XFER_PACKET *packet = (HID_XFER_PACKET*)(irp->UserBuffer);
842  TRACE_(hid_report)("IOCTL_HID_GET_FEATURE\n");
843  irp->IoStatus.u.Status = status = ext->vtbl->get_feature_report(
844  device, packet->reportId, packet->reportBuffer,
845  packet->reportBufferLen, &irp->IoStatus.Information);
846  packet->reportBufferLen = irp->IoStatus.Information;
847  break;
848  }
850  {
851  HID_XFER_PACKET *packet = (HID_XFER_PACKET*)(irp->UserBuffer);
852  TRACE_(hid_report)("IOCTL_HID_SET_FEATURE\n");
853  irp->IoStatus.u.Status = status = ext->vtbl->set_feature_report(
854  device, packet->reportId, packet->reportBuffer,
855  packet->reportBufferLen, &irp->IoStatus.Information);
856  break;
857  }
858  default:
859  {
860  ULONG code = irpsp->Parameters.DeviceIoControl.IoControlCode;
861  FIXME("Unsupported ioctl %x (device=%x access=%x func=%x method=%x)\n",
862  code, code >> 16, (code >> 14) & 3, (code >> 2) & 0xfff, code & 3);
863  break;
864  }
865  }
866 
867  if (status != STATUS_PENDING)
869 
870  return status;
871 }
872 
874 {
875  struct device_extension *ext = (struct device_extension*)device->DeviceExtension;
876  IRP *irp;
877  LIST_ENTRY *entry;
878 
879  if (!length || !report)
880  return;
881 
882  EnterCriticalSection(&ext->report_cs);
883  if (length > ext->buffer_size)
884  {
885  HeapFree(GetProcessHeap(), 0, ext->last_report);
886  ext->last_report = HeapAlloc(GetProcessHeap(), 0, length);
887  if (!ext->last_report)
888  {
889  ERR_(hid_report)("Failed to alloc last report\n");
890  ext->buffer_size = 0;
891  ext->last_report_size = 0;
892  ext->last_report_read = TRUE;
893  LeaveCriticalSection(&ext->report_cs);
894  return;
895  }
896  else
897  ext->buffer_size = length;
898  }
899 
900  memcpy(ext->last_report, report, length);
901  ext->last_report_size = length;
902  ext->last_report_read = FALSE;
903 
904  while ((entry = RemoveHeadList(&ext->irp_queue)) != &ext->irp_queue)
905  {
906  IO_STACK_LOCATION *irpsp;
907  TRACE_(hid_report)("Processing Request\n");
908  irp = CONTAINING_RECORD(entry, IRP, Tail.Overlay.s.ListEntry);
909  irpsp = IoGetCurrentIrpStackLocation(irp);
910  irp->IoStatus.u.Status = deliver_last_report(ext,
911  irpsp->Parameters.DeviceIoControl.OutputBufferLength,
912  irp->UserBuffer, &irp->IoStatus.Information);
913  ext->last_report_read = TRUE;
915  }
916  LeaveCriticalSection(&ext->report_cs);
917 }
918 
920 {
923  DWORD size;
924 
926  {
927  if (info->Type == REG_DWORD)
928  return *(DWORD*)info->Data;
929  }
930 
931  return default_value;
932 }
933 
935 {
936  int i;
937 
938  if (vid != VID_MICROSOFT)
939  return FALSE;
940 
941  for (i = 0; i < ARRAY_SIZE(XBOX_CONTROLLERS); i++)
942  if (pid == XBOX_CONTROLLERS[i].pid) return TRUE;
943 
944  return FALSE;
945 }
946 
948 {
949  NTSTATUS ret;
950 
951  TRACE("driver %p, pdo %p.\n", driver, pdo);
952 
954  {
955  ERR("Failed to create FDO, status %#x.\n", ret);
956  return ret;
957  }
958 
960  bus_pdo = pdo;
961 
962  bus_fdo->Flags &= ~~DO_DEVICE_INITIALIZING;
963 
964  return STATUS_SUCCESS;
965 }
966 
968 {
970 }
971 
973 {
974  OBJECT_ATTRIBUTES attr = {0};
975  NTSTATUS ret;
976 
977  TRACE( "(%p, %s)\n", driver, debugstr_w(path->Buffer) );
978 
979  attr.Length = sizeof(attr);
980  attr.ObjectName = path;
983  ERR("Failed to open driver key, status %#x.\n", ret);
984 
985  driver_obj = driver;
986 
987  driver->MajorFunction[IRP_MJ_PNP] = common_pnp_dispatch;
989  driver->DriverExtension->AddDevice = driver_add_device;
990  driver->DriverUnload = driver_unload;
991 
992  return STATUS_SUCCESS;
993 }
#define __ASM_STDCALL_FUNC(name, args, code)
Definition: asm.h:91
static const WCHAR version[]
Definition: asmname.c:63
ULONG_PTR DWORD_PTR
Definition: basetsd.h:131
unsigned long ULONG_PTR
Definition: basetsd.h:130
LONG NTSTATUS
Definition: bcrypt.h:40
#define WINAPI
Definition: bcrypt.h:23
void iohid_driver_unload(void) DECLSPEC_HIDDEN
Definition: bus_iohid.c:440
NTSTATUS iohid_driver_init(void) DECLSPEC_HIDDEN
Definition: bus_iohid.c:435
NTSTATUS udev_driver_init(void) DECLSPEC_HIDDEN
Definition: bus_udev.c:1567
NTSTATUS sdl_driver_init(void) DECLSPEC_HIDDEN
Definition: bus_sdl.c:1204
int(* enum_func)(DEVICE_OBJECT *device, void *context)
Definition: bus.h:19
void udev_driver_unload(void) DECLSPEC_HIDDEN
Definition: bus_udev.c:1572
void sdl_driver_unload(void) DECLSPEC_HIDDEN
Definition: bus_sdl.c:1209
Definition: type.pm:7
#define ERR(...)
Definition: cocoa_app.h:61
static const BYTE REPORT_TAIL[]
Definition: controller.h:88
#define IDX_HEADER_USAGE
Definition: controller.h:31
#define IDX_HEADER_PAGE
Definition: controller.h:30
static const BYTE REPORT_HEADER[]
Definition: controller.h:23
NTSTATUS DriverEntry(DRIVER_OBJECT *driver, UNICODE_STRING *path)
Definition: main.c:34
void * memcpy(void *dst, const void *src, size_t n)
Definition: string.c:2580
void * memset(void *dst, int c, size_t n)
Definition: string.c:2588
NTSTATUS NtOpenKey(HANDLE *key, ACCESS_MASK access, const OBJECT_ATTRIBUTES *attr)
Definition: registry.c:124
NTSTATUS NtQueryValueKey(HANDLE handle, const UNICODE_STRING *name, KEY_VALUE_INFORMATION_CLASS info_class, void *info, DWORD length, DWORD *result_len)
Definition: registry.c:428
NTSTATUS NtClose(HANDLE handle)
Definition: server.c:1666
static const WCHAR zero_serialW[]
Definition: main.c:146
static NTSTATUS deliver_last_report(struct device_extension *ext, DWORD buffer_length, BYTE *buffer, ULONG_PTR *out_length)
Definition: main.c:624
static struct list pnp_devset
Definition: main.c:144
void process_hid_report(DEVICE_OBJECT *device, BYTE *report, DWORD length)
Definition: main.c:873
static const WCHAR xbox360_product_string[]
Definition: main.c:73
static void mouse_device_create(void)
Definition: main.c:536
DEVICE_OBJECT * bus_create_hid_device(const WCHAR *busidW, WORD vid, WORD pid, WORD input, DWORD version, DWORD uid, const WCHAR *serialW, BOOL is_gamepad, const platform_vtbl *vtbl, DWORD platform_data_size)
Definition: main.c:234
DEVICE_OBJECT * bus_enumerate_hid_devices(const platform_vtbl *vtbl, enum_func function, void *context)
Definition: main.c:323
#define VID_MICROSOFT
Definition: main.c:71
static NTSTATUS mouse_get_string(DEVICE_OBJECT *device, DWORD index, WCHAR *buffer, DWORD length)
Definition: main.c:492
static const WCHAR igW[]
Definition: main.c:148
static const struct product_desc XBOX_CONTROLLERS[]
Definition: main.c:81
static DEVICE_OBJECT * bus_fdo
Definition: main.c:103
static CRITICAL_SECTION_DEBUG critsect_debug
Definition: main.c:136
static NTSTATUS mouse_set_output_report(DEVICE_OBJECT *device, UCHAR id, BYTE *report, DWORD length, ULONG_PTR *ret_length)
Definition: main.c:508
static WCHAR * get_instance_id(DEVICE_OBJECT *device)
Definition: main.c:180
void bus_remove_hid_device(DEVICE_OBJECT *device)
Definition: main.c:359
static DRIVER_OBJECT * driver_obj
Definition: main.c:97
DEVICE_OBJECT * bus_pdo
Definition: main.c:102
static CRITICAL_SECTION device_list_cs
Definition: main.c:135
BOOL is_xbox_gamepad(WORD vid, WORD pid)
Definition: main.c:934
static WCHAR * get_compatible_ids(DEVICE_OBJECT *device)
Definition: main.c:220
static WCHAR * strdupW(const WCHAR *src)
Definition: main.c:150
static NTSTATUS mouse_get_feature_report(DEVICE_OBJECT *device, UCHAR id, BYTE *report, DWORD length, ULONG_PTR *ret_length)
Definition: main.c:514
static NTSTATUS hid_internal_dispatch(DEVICE_OBJECT *device, IRP *irp)
Definition: main.c:689
static NTSTATUS handle_IRP_MN_QUERY_DEVICE_RELATIONS(IRP *irp)
Definition: main.c:416
DEVICE_OBJECT * bus_find_hid_device(const platform_vtbl *vtbl, void *platform_dev)
Definition: main.c:299
static void driver_unload(DRIVER_OBJECT *driver)
Definition: main.c:967
static const WCHAR miW[]
Definition: main.c:147
#define call_fastcall_func1(func, a)
Definition: main.c:58
HANDLE driver_key
Definition: main.c:105
static const platform_vtbl mouse_vtbl
Definition: main.c:526
static NTSTATUS fdo_pnp_dispatch(DEVICE_OBJECT *device, IRP *irp)
Definition: main.c:544
static NTSTATUS handle_IRP_MN_QUERY_ID(DEVICE_OBJECT *device, IRP *irp)
Definition: main.c:441
static NTSTATUS hid_get_native_string(DEVICE_OBJECT *device, DWORD index, WCHAR *buffer, DWORD length)
Definition: main.c:640
static DWORD get_device_index(WORD vid, WORD pid, WORD input)
Definition: main.c:165
static NTSTATUS mouse_set_feature_report(DEVICE_OBJECT *device, UCHAR id, BYTE *report, DWORD length, ULONG_PTR *ret_length)
Definition: main.c:520
static NTSTATUS mouse_begin_report_processing(DEVICE_OBJECT *device)
Definition: main.c:503
void * get_platform_private(DEVICE_OBJECT *device)
Definition: main.c:159
void bus_unlink_hid_device(DEVICE_OBJECT *device)
Definition: main.c:349
static DEVICE_OBJECT * mouse_obj
Definition: main.c:99
static NTSTATUS build_device_relations(DEVICE_RELATIONS **devices)
Definition: main.c:390
static WCHAR * get_device_id(DEVICE_OBJECT *device)
Definition: main.c:194
static NTSTATUS common_pnp_dispatch(DEVICE_OBJECT *device, IRP *irp)
Definition: main.c:617
DWORD check_bus_option(const UNICODE_STRING *option, DWORD default_value)
Definition: main.c:919
static NTSTATUS driver_add_device(DRIVER_OBJECT *driver, DEVICE_OBJECT *pdo)
Definition: main.c:947
static NTSTATUS pdo_pnp_dispatch(DEVICE_OBJECT *device, IRP *irp)
Definition: main.c:593
static const WCHAR xboxone_product_string[]
Definition: main.c:77
static NTSTATUS mouse_get_reportdescriptor(DEVICE_OBJECT *device, BYTE *buffer, DWORD length, DWORD *ret_length)
Definition: main.c:476
static struct all_devices * devices
Definition: dsm_ctrl.c:48
long BOOL
Definition: dxgitype.idl:24
NTSTATUS status
Definition: except.c:81
#define IOCTL_HID_SET_OUTPUT_REPORT
Definition: hidclass.h:54
#define HID_REVISION
Definition: hidclass.h:25
#define IOCTL_HID_GET_INPUT_REPORT
Definition: hidclass.h:46
#define IOCTL_HID_SET_FEATURE
Definition: hidclass.h:52
#define IOCTL_HID_GET_FEATURE
Definition: hidclass.h:43
#define IOCTL_HID_GET_DEVICE_DESCRIPTOR
Definition: hidport.h:69
#define HID_HID_DESCRIPTOR_TYPE
Definition: hidport.h:66
#define IOCTL_HID_READ_REPORT
Definition: hidport.h:71
#define IOCTL_HID_GET_STRING
Definition: hidport.h:73
#define IOCTL_HID_WRITE_REPORT
Definition: hidport.h:72
#define IOCTL_HID_GET_DEVICE_ATTRIBUTES
Definition: hidport.h:76
#define HID_REPORT_DESCRIPTOR_TYPE
Definition: hidport.h:67
#define IOCTL_HID_GET_REPORT_DESCRIPTOR
Definition: hidport.h:70
@ HID_STRING_ID_ISERIALNUMBER
Definition: hidtypes.h:25
@ HID_STRING_ID_IPRODUCT
Definition: hidtypes.h:24
@ HID_STRING_ID_IMANUFACTURER
Definition: hidtypes.h:23
#define HID_USAGE_GENERIC_MOUSE
Definition: hidusage.h:43
#define HID_USAGE_PAGE_GENERIC
Definition: hidusage.h:186
#define WINE_DECLARE_DEBUG_CHANNEL(ch)
Definition: debug.h:497
#define WINE_DEFAULT_DEBUG_CHANNEL(ch)
Definition: debug.h:499
static int sprintfW(WCHAR *str, const WCHAR *format,...)
Definition: unicode.h:263
static unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:56
static WCHAR * strcpyW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:63
struct version_info info
Definition: version.c:140
static void list_remove(struct list *elem)
Definition: list.h:98
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:188
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
Definition: list.h:194
#define LIST_INIT(list)
Definition: list.h:227
static void list_add_tail(struct list *list, struct list *elem)
Definition: list.h:92
static unsigned int list_count(const struct list *list)
Definition: list.h:145
const char * ext
Definition: makedep.c:116
#define max(a, b)
Definition: minmax.h:25
static void size_t len
void IoCompleteRequest(IRP *irp, UCHAR priority_boost)
Definition: ntoskrnl.c:1901
void ObfReferenceObject(void *obj)
Definition: ntoskrnl.c:2858
NTSTATUS IoCreateDevice(DRIVER_OBJECT *driver, ULONG ext_size, UNICODE_STRING *name, DWORD type, ULONG characteristics, BOOLEAN exclusive, DEVICE_OBJECT **ret_device)
Definition: ntoskrnl.c:1490
void IoDeleteDevice(DEVICE_OBJECT *device)
Definition: ntoskrnl.c:1561
NTSTATUS IoCallDriver(DEVICE_OBJECT *device, IRP *irp)
Definition: ntoskrnl.c:1692
PVOID ExAllocatePool(POOL_TYPE type, SIZE_T size)
Definition: ntoskrnl.c:2039
void IoDetachDevice(DEVICE_OBJECT *device)
Definition: ntoskrnl.c:1205
PDEVICE_OBJECT IoAttachDeviceToDeviceStack(DEVICE_OBJECT *source, DEVICE_OBJECT *target)
Definition: ntoskrnl.c:1213
void IoInvalidateDeviceRelations(DEVICE_OBJECT *device_object, DEVICE_RELATION_TYPE type)
Definition: pnp.c:464
PSecurityUserData *typedef PSECPKG_EXTENDED_INFORMATION *typedef ULONG
Definition: ntsecpkg.h:377
#define STATUS_PENDING
Definition: ntstatus.h:48
#define STATUS_NO_MEMORY
Definition: ntstatus.h:233
#define STATUS_UNSUCCESSFUL
Definition: ntstatus.h:211
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:212
#define STATUS_BUFFER_TOO_SMALL
Definition: ntstatus.h:245
#define STATUS_SUCCESS
Definition: ntstatus.h:30
#define STATUS_INSUFFICIENT_RESOURCES
Definition: ntstatus.h:364
#define STATUS_CANCELLED
Definition: ntstatus.h:498
HRESULT(* func)(HTMLDocumentNode *, DWORD, VARIANT *, VARIANT *)
Definition: olecmd.c:734
static void size_t size
Definition: oledb_private.h:32
static void report(const DATA_BLOB *pDataIn, const DATA_BLOB *pOptionalEntropy, CRYPTPROTECT_PROMPTSTRUCT *pPromptStruct, DWORD dwFlags)
Definition: protectdata.c:769
void RtlInitUnicodeString(PUNICODE_STRING target, PCWSTR source)
Definition: rtlstr.c:171
#define offsetof(s, m)
Definition: stddef.h:28
ULONG Flags
Definition: wdm.h:409
PVOID DeviceExtension
Definition: wdm.h:412
UCHAR bCountry
Definition: hidport.h:57
UCHAR bNumDescriptors
Definition: hidport.h:58
struct _HID_DESCRIPTOR::_HID_DESCRIPTOR_DESC_LIST DescriptorList[1]
UCHAR bDescriptorType
Definition: hidport.h:55
UCHAR bLength
Definition: hidport.h:54
USHORT bcdHID
Definition: hidport.h:56
ULONG reportBufferLen
Definition: hidclass.h:72
UCHAR reportId
Definition: hidclass.h:73
PUCHAR reportBuffer
Definition: hidclass.h:71
union _IO_STACK_LOCATION::@1029 Parameters
struct _IO_STACK_LOCATION::@1029::@1048 QueryId
struct _IO_STACK_LOCATION::@1029::@1042 QueryDeviceRelations
struct _IO_STACK_LOCATION::@1029::@1036 DeviceIoControl
UCHAR MinorFunction
Definition: wdm.h:970
NTSTATUS Status
Definition: winternl.h:1470
ULONG_PTR Information
Definition: winternl.h:1474
Definition: wdm.h:511
LIST_ENTRY ListEntry
Definition: wdm.h:553
PVOID UserBuffer
Definition: wdm.h:541
union _IRP::@1003 Tail
IO_STATUS_BLOCK IoStatus
Definition: wdm.h:522
union _IRP::@1002 Overlay
Definition: winnt.h:836
LIST_ENTRY ProcessLocksList
Definition: winnt.h:6198
Definition: cookie.c:202
Definition: inflate.c:134
WORD input
Definition: main.c:117
DWORD version
Definition: main.c:118
const platform_vtbl * vtbl
Definition: main.c:123
DWORD uid
Definition: main.c:118
DWORD buffer_size
Definition: main.c:128
DWORD index
Definition: main.c:118
BYTE * last_report
Definition: main.c:125
BOOL is_gamepad
Definition: main.c:119
DWORD last_report_size
Definition: main.c:126
BOOL last_report_read
Definition: main.c:127
LIST_ENTRY irp_queue
Definition: main.c:129
WCHAR * serial
Definition: main.c:120
const WCHAR * busid
Definition: main.c:121
BYTE platform_private[1]
Definition: main.c:132
struct pnp_device * pnp_device
Definition: main.c:115
CRITICAL_SECTION report_cs
Definition: main.c:130
Definition: list.h:27
Definition: port.h:177
NTSTATUS(* get_reportdescriptor)(DEVICE_OBJECT *device, BYTE *buffer, DWORD length, DWORD *out_length)
Definition: bus.h:33
DEVICE_OBJECT * device
Definition: main.c:110
struct list entry
Definition: main.c:109
const WCHAR * manufacturer
Definition: main.c:66
const WCHAR * product
Definition: main.c:67
WORD pid
Definition: main.c:65
WORD vid
Definition: main.c:64
const WCHAR * serialnumber
Definition: main.c:68
Definition: serial.c:71
Definition: ticket.c:41
#define NULL
Definition: ungif.h:66
#define TRUE
Definition: ungif.h:59
#define FALSE
Definition: ungif.h:62
BATCH_CONTEXT * context
Definition: wcmdmain.c:38
@ EjectionRelations
Definition: wdm.h:611
@ RemovalRelations
Definition: wdm.h:613
@ BusRelations
Definition: wdm.h:610
@ TargetDeviceRelation
Definition: wdm.h:614
@ PowerRelations
Definition: wdm.h:612
@ PagedPool
Definition: wdm.h:276
enum _BUS_QUERY_ID_TYPE BUS_QUERY_ID_TYPE
#define IO_NO_INCREMENT
Definition: wdm.h:305
#define IoGetCurrentIrpStackLocation(_Irp)
Definition: wdm.h:1586
#define IRP_MN_START_DEVICE
Definition: wdm.h:351
#define IRP_MN_QUERY_ID
Definition: wdm.h:369
#define IRP_MN_REMOVE_DEVICE
Definition: wdm.h:353
#define IRP_MN_SURPRISE_REMOVAL
Definition: wdm.h:373
#define IRP_MN_QUERY_DEVICE_RELATIONS
Definition: wdm.h:358
#define IRP_MN_QUERY_CAPABILITIES
Definition: wdm.h:360
#define IRP_MJ_PNP
Definition: wdm.h:349
#define IRP_MJ_INTERNAL_DEVICE_CONTROL
Definition: wdm.h:337
@ BusQueryCompatibleIDs
Definition: wdm.h:832
@ BusQueryInstanceID
Definition: wdm.h:833
@ BusQueryDeviceID
Definition: wdm.h:830
@ BusQueryHardwareIDs
Definition: wdm.h:831
static void IoSkipCurrentIrpStackLocation(IRP *irp)
Definition: wdm.h:1588
#define ARRAY_SIZE(x)
Definition: utils.h:37
DECLSPEC_IMPORT void WINAPI LeaveCriticalSection(CRITICAL_SECTION *lpCrit)
DECLSPEC_IMPORT BOOL WINAPI HeapFree(HANDLE, DWORD, LPVOID)
DECLSPEC_IMPORT void WINAPI DeleteCriticalSection(CRITICAL_SECTION *lpCrit)
DECLSPEC_IMPORT void WINAPI InitializeCriticalSection(CRITICAL_SECTION *lpCrit)
DECLSPEC_IMPORT HANDLE WINAPI GetProcessHeap(void)
DECLSPEC_IMPORT void WINAPI EnterCriticalSection(CRITICAL_SECTION *lpCrit)
DECLSPEC_IMPORT LPVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T) __WINE_ALLOC_SIZE(3)
unsigned short WORD
Definition: windef.h:251
unsigned char BYTE
Definition: windef.h:250
unsigned char UCHAR
Definition: windef.h:238
unsigned int DWORD
Definition: windef.h:261
#define FILE_DEVICE_BUS_EXTENDER
Definition: winioctl.h:69
#define KEY_ALL_ACCESS
Definition: winnt.h:6068
unsigned short WCHAR
Definition: winnt.h:468
#define FIELD_OFFSET(type, field)
Definition: winnt.h:822
#define CONTAINING_RECORD(address, type, field)
Definition: winnt.h:826
#define REG_DWORD
Definition: winnt.h:5633
#define OBJ_KERNEL_HANDLE
Definition: winternl.h:2273
#define InsertTailList(le, e)
Definition: winternl.h:3819
@ KeyValuePartialInformation
Definition: winternl.h:1149
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:2270
#define InitializeListHead(le)
Definition: winternl.h:3817
static PLIST_ENTRY RemoveHeadList(PLIST_ENTRY le)
Definition: winternl.h:3822