ReactOS  0.4.13-dev-464-g6b95727
hcd_controller.cpp
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS Universal Serial Bus Bulk Driver Library
3  * LICENSE: GPL - See COPYING in the top level directory
4  * FILE: lib/drivers/libusb/hcd_controller.cpp
5  * PURPOSE: USB Common Driver Library.
6  * PROGRAMMERS:
7  * Michael Martin (michael.martin@reactos.org)
8  * Johannes Anderwald (johannes.anderwald@reactos.org)
9  */
10 
11 #include "libusb.h"
12 
13 #define NDEBUG
14 #include <debug.h>
15 
16 class CHCDController : public IHCDController,
17  public IDispatchIrp
18 {
19 public:
21 
23  {
25  return m_Ref;
26  }
28  {
30 
31  if (!m_Ref)
32  {
33  delete this;
34  return 0;
35  }
36  return m_Ref;
37  }
38 
39  // IHCDController interface functions
41 
42  // IDispatchIrp interface functions
47 
48  // local functions
51 
52  // constructor / destructor
53  CHCDController(IUnknown *OuterUnknown){}
54  virtual ~CHCDController(){}
55 
56 protected:
67 };
68 
69 //=================================================================================================
70 // COM
71 //
75  IN REFIID refiid,
76  OUT PVOID* Output)
77 {
78  return STATUS_UNSUCCESSFUL;
79 }
80 
81 //-------------------------------------------------------------------------------------------------
84  IN PROOTHDCCONTROLLER RootHCDController,
87 {
89  PCOMMON_DEVICE_EXTENSION DeviceExtension;
90 
91  //
92  // create usb hardware
93  //
95  if (!NT_SUCCESS(Status))
96  {
97  //
98  // failed to create hardware object
99  //
100  DPRINT1("Failed to create hardware object\n");
102  }
103 
104  //
105  // initialize members
106  //
109  m_RootController = RootHCDController;
110 
111  //
112  // create FDO
113  //
115  if (!NT_SUCCESS(Status))
116  {
117  //
118  // failed to create PDO
119  //
120  return Status;
121  }
122 
123  //
124  // now attach to device stack
125  //
127  if (!m_NextDeviceObject)
128  {
129  //
130  // failed to attach to device stack
131  //
134 
135  return STATUS_NO_SUCH_DEVICE;
136  }
137 
138  //
139  // initialize hardware object
140  //
142  if (!NT_SUCCESS(Status))
143  {
144  DPRINT1("[%s] Failed to initialize hardware object %x\n", m_Hardware->GetUSBType(), Status);
145 
146  //
147  // failed to initialize hardware object, detach from device stack
148  //
150 
151  //
152  // now delete the device
153  //
155 
156  //
157  // nullify pointers :)
158  //
160  m_NextDeviceObject = 0;
161 
162  return Status;
163  }
164 
165  //
166  // get usb controller type
167  //
168  m_USBType = m_Hardware->GetUSBType();
169 
170 
171  //
172  // set device flags
173  //
175 
176 
177  //
178  // get device extension
179  //
181  PC_ASSERT(DeviceExtension);
182 
183  //
184  // initialize device extension
185  //
186  DeviceExtension->IsFDO = TRUE;
187  DeviceExtension->IsHub = FALSE;
188  DeviceExtension->Dispatcher = PDISPATCHIRP(this);
189 
190  //
191  // device is initialized
192  //
194 
195 
196  //
197  // is there a root controller
198  //
199  if (m_RootController)
200  {
201  //
202  // add reference
203  //
204  m_RootController->AddRef();
205 
206  //
207  // register with controller
208  //
209  m_RootController->RegisterHCD(this);
210  }
211 
212 
213  //
214  // done
215  //
216  return STATUS_SUCCESS;
217 }
218 
219 //-------------------------------------------------------------------------------------------------
220 NTSTATUS
223  IN PIRP Irp)
224 {
225  PIO_STACK_LOCATION IoStack;
226  PCOMMON_DEVICE_EXTENSION DeviceExtension;
228  PUSB_HCD_DRIVERKEY_NAME DriverKey;
230 
231  //
232  // get current stack location
233  //
235 
236  //
237  // get device extension
238  //
240 
241  //
242  // sanity check
243  //
244  PC_ASSERT(DeviceExtension->IsFDO);
245 
246  DPRINT1("[%s] HandleDeviceControl>Type: IoCtl %x InputBufferLength %lu OutputBufferLength %lu\n", m_USBType,
247  IoStack->Parameters.DeviceIoControl.IoControlCode,
248  IoStack->Parameters.DeviceIoControl.InputBufferLength,
249  IoStack->Parameters.DeviceIoControl.OutputBufferLength);
250 
251  //
252  // perform ioctl for FDO
253  //
254  if (IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_GET_HCD_DRIVERKEY_NAME)
255  {
256  //
257  // check if sizee is at least >= USB_HCD_DRIVERKEY_NAME
258  //
259  if(IoStack->Parameters.DeviceIoControl.OutputBufferLength >= sizeof(USB_HCD_DRIVERKEY_NAME))
260  {
261  //
262  // get device property size
263  //
265 
266  //
267  // get input buffer
268  //
269  DriverKey = (PUSB_HCD_DRIVERKEY_NAME)Irp->AssociatedIrp.SystemBuffer;
270 
271  //
272  // check result
273  //
275  {
276  //
277  // does the caller provide enough buffer space
278  //
279  if (IoStack->Parameters.DeviceIoControl.OutputBufferLength >= ResultLength)
280  {
281  //
282  // it does
283  //
284  Status = IoGetDeviceProperty(m_PhysicalDeviceObject, DevicePropertyDriverKeyName, IoStack->Parameters.DeviceIoControl.OutputBufferLength - sizeof(ULONG), DriverKey->DriverKeyName, &ResultLength);
285  }
286 
287  //
288  // store result
289  //
290  DriverKey->ActualLength = ResultLength + FIELD_OFFSET(USB_HCD_DRIVERKEY_NAME, DriverKeyName) + sizeof(WCHAR);
291  Irp->IoStatus.Information = IoStack->Parameters.DeviceIoControl.OutputBufferLength;
293  }
294  }
295  else
296  {
297  //
298  // buffer is certainly too small
299  //
301  Irp->IoStatus.Information = sizeof(USB_HCD_DRIVERKEY_NAME);
302  }
303  }
304  else if (IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_USB_GET_ROOT_HUB_NAME)
305  {
306  //
307  // check if sizee is at least >= USB_HCD_DRIVERKEY_NAME
308  //
309  if(IoStack->Parameters.DeviceIoControl.OutputBufferLength >= sizeof(USB_HCD_DRIVERKEY_NAME))
310  {
311  //
312  // sanity check
313  //
315 
316  //
317  // get input buffer
318  //
319  DriverKey = (PUSB_HCD_DRIVERKEY_NAME)Irp->AssociatedIrp.SystemBuffer;
320 
321  //
322  // get symbolic link
323  //
324  Status = m_HubController->GetHubControllerSymbolicLink(IoStack->Parameters.DeviceIoControl.OutputBufferLength - sizeof(ULONG), DriverKey->DriverKeyName, &ResultLength);
325 
326 
327  if (NT_SUCCESS(Status))
328  {
329  //
330  // null terminate it
331  //
332  PC_ASSERT(IoStack->Parameters.DeviceIoControl.OutputBufferLength - sizeof(ULONG) - sizeof(WCHAR) >= ResultLength);
333 
334  DriverKey->DriverKeyName[ResultLength / sizeof(WCHAR)] = L'\0';
335  }
336 
337  //
338  // store result
339  //
340  DriverKey->ActualLength = ResultLength + FIELD_OFFSET(USB_HCD_DRIVERKEY_NAME, DriverKeyName) + sizeof(WCHAR);
341  Irp->IoStatus.Information = IoStack->Parameters.DeviceIoControl.OutputBufferLength;
343  }
344  else
345  {
346  //
347  // buffer is certainly too small
348  //
350  Irp->IoStatus.Information = sizeof(USB_HCD_DRIVERKEY_NAME);
351  }
352  }
353 
354  //
355  // complete the request
356  //
357  Irp->IoStatus.Status = Status;
359 
360  //
361  // done
362  //
363  return Status;
364 }
365 
366 NTSTATUS
369  IN PIRP Irp)
370 {
371  PIO_STACK_LOCATION IoStack;
372  PCOMMON_DEVICE_EXTENSION DeviceExtension;
373  PCM_RESOURCE_LIST RawResourceList;
374  PCM_RESOURCE_LIST TranslatedResourceList;
375  PDEVICE_RELATIONS DeviceRelations;
377 
378  //
379  // get device extension
380  //
382 
383  //
384  // sanity check
385  //
386  PC_ASSERT(DeviceExtension->IsFDO);
387 
388  //
389  // get current stack location
390  //
392 
393  switch(IoStack->MinorFunction)
394  {
395  case IRP_MN_START_DEVICE:
396  {
397  DPRINT("[%s] HandlePnp IRP_MN_START FDO\n", m_USBType);
398 
399  //
400  // first start lower device object
401  //
403 
404  if (NT_SUCCESS(Status))
405  {
406  //
407  // operation succeeded, lets start the device
408  //
409  RawResourceList = IoStack->Parameters.StartDevice.AllocatedResources;
410  TranslatedResourceList = IoStack->Parameters.StartDevice.AllocatedResourcesTranslated;
411 
412  if (m_Hardware)
413  {
414  //
415  // start the hardware
416  //
417  Status = m_Hardware->PnpStart(RawResourceList, TranslatedResourceList);
418  }
419 
420  if (NT_SUCCESS(Status))
421  {
422  //
423  // enable symbolic link
424  //
426  }
427  }
428 
429  DPRINT("[%s] HandlePnp IRP_MN_START FDO: Status %x\n", m_USBType ,Status);
430  break;
431  }
433  {
434  DPRINT("[%s] HandlePnp IRP_MN_QUERY_DEVICE_RELATIONS Type %lx\n", m_USBType, IoStack->Parameters.QueryDeviceRelations.Type);
435 
436  if (m_HubController == NULL)
437  {
438  //
439  // create hub controller
440  //
442  if (!NT_SUCCESS(Status))
443  {
444  //
445  // failed to create hub controller
446  //
447  break;
448  }
449 
450  //
451  // initialize hub controller
452  //
453  Status = m_HubController->Initialize(m_DriverObject, PHCDCONTROLLER(this), m_Hardware, TRUE, 0 /* FIXME*/);
454  if (!NT_SUCCESS(Status))
455  {
456  //
457  // failed to initialize hub controller
458  //
459  break;
460  }
461 
462  //
463  // add reference to prevent it from getting deleting while hub driver adds / removes references
464  //
465  m_HubController->AddRef();
466  }
467 
468  if (IoStack->Parameters.QueryDeviceRelations.Type == BusRelations)
469  {
470  //
471  // allocate device relations
472  //
473  DeviceRelations = (PDEVICE_RELATIONS)ExAllocatePool(PagedPool, sizeof(DEVICE_RELATIONS));
474 
475  if (!DeviceRelations)
476  {
477  //
478  // no memory
479  //
481  break;
482  }
483 
484  //
485  // init device relations
486  //
487  DeviceRelations->Count = 1;
488  Status = m_HubController->GetHubControllerDeviceObject(&DeviceRelations->Objects [0]);
489 
490  //
491  // sanity check
492  //
494 
495  ObReferenceObject(DeviceRelations->Objects [0]);
496 
497  //
498  // store result
499  //
500  Irp->IoStatus.Information = (ULONG_PTR)DeviceRelations;
502  }
503  else
504  {
505  //
506  // not supported
507  //
509  }
510  break;
511  }
512  case IRP_MN_STOP_DEVICE:
513  {
514  DPRINT("[%s] HandlePnp IRP_MN_STOP_DEVICE\n", m_USBType);
515 
516  if (m_Hardware)
517  {
518  //
519  // stop the hardware
520  //
521  Status = m_Hardware->PnpStop();
522  }
523  else
524  {
525  //
526  // fake success
527  //
529  }
530 
531  if (NT_SUCCESS(Status))
532  {
533  //
534  // stop lower device
535  //
537  }
538  break;
539  }
542  {
543 #if 0
544  //
545  // sure
546  //
547  Irp->IoStatus.Status = STATUS_SUCCESS;
548 
549  //
550  // forward irp to next device object
551  //
554 #else
555  DPRINT1("[%s] Denying controller removal due to reinitialization bugs\n", m_USBType);
556  Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
558  return STATUS_UNSUCCESSFUL;
559 #endif
560  }
562  {
563  DPRINT("[%s] HandlePnp IRP_MN_REMOVE_DEVICE FDO\n", m_USBType);
564 
565  //
566  // delete the symbolic link
567  //
569 
570  //
571  // forward irp to next device object
572  //
575 
576  //
577  // detach device from device stack
578  //
580 
581  //
582  // delete device
583  //
585 
586  return STATUS_SUCCESS;
587  }
588  default:
589  {
590  //
591  // forward irp to next device object
592  //
595  }
596  }
597 
598  //
599  // store result and complete request
600  //
601  Irp->IoStatus.Status = Status;
603 
604  return Status;
605 }
606 
607 NTSTATUS
610  IN PIRP Irp)
611 {
615 }
616 
617 NTSTATUS
620  IN PIRP Irp)
621 {
624 }
625 
626 NTSTATUS
629  PDEVICE_OBJECT * OutDeviceObject)
630 {
631  WCHAR CharDeviceName[64];
633  ULONG UsbDeviceNumber = 0;
635 
636  while (TRUE)
637  {
638  //
639  // construct device name
640  //
641  swprintf(CharDeviceName, L"\\Device\\USBFDO-%d", UsbDeviceNumber);
642 
643  //
644  // initialize device name
645  //
646  RtlInitUnicodeString(&DeviceName, CharDeviceName);
647 
648  //
649  // create device
650  //
652  sizeof(COMMON_DEVICE_EXTENSION),
653  &DeviceName,
655  0,
656  FALSE,
657  OutDeviceObject);
658 
659  //
660  // check for success
661  //
662  if (NT_SUCCESS(Status))
663  break;
664 
665  //
666  // is there a device object with that same name
667  //
669  {
670  //
671  // Try the next name
672  //
673  UsbDeviceNumber++;
674  continue;
675  }
676 
677  //
678  // bail out on other errors
679  //
680  if (!NT_SUCCESS(Status))
681  {
682  DPRINT1("[%s] CreateFDO: Failed to create %wZ, Status %x\n", m_USBType, &DeviceName, Status);
683  return Status;
684  }
685  }
686 
687  //
688  // store FDO number
689  //
690  m_FDODeviceNumber = UsbDeviceNumber;
691 
692  DPRINT("[%s] CreateFDO: DeviceName %wZ\n", m_USBType, &DeviceName);
693 
694  /* done */
695  return Status;
696 }
697 
698 NTSTATUS
700  BOOLEAN Enable)
701 {
703  WCHAR LinkName[32];
704  WCHAR FDOName[32];
705  UNICODE_STRING Link, FDO;
706 
707  if (Enable)
708  {
709  //
710  // create legacy link
711  //
712  swprintf(LinkName, L"\\DosDevices\\HCD%d", m_FDODeviceNumber);
713  swprintf(FDOName, L"\\Device\\USBFDO-%d", m_FDODeviceNumber);
714  RtlInitUnicodeString(&Link, LinkName);
715  RtlInitUnicodeString(&FDO, FDOName);
716 
717  //
718  // create symbolic link
719  //
720  Status = IoCreateSymbolicLink(&Link, &FDO);
721 
722  if (!NT_SUCCESS(Status))
723  {
724  //
725  // FIXME: handle me
726  //
727  ASSERT(0);
728  }
729  }
730  else
731  {
732  //
733  // create legacy link
734  //
735  swprintf(LinkName, L"\\DosDevices\\HCD%d", m_FDODeviceNumber);
736  RtlInitUnicodeString(&Link, LinkName);
737 
738  //
739  // now delete the symbolic link
740  //
742 
743  if (!NT_SUCCESS(Status))
744  {
745  //
746  // FIXME: handle me
747  //
748  ASSERT(0);
749  }
750  }
751 
752  //
753  // done
754  //
755  return Status;
756 }
757 
758 NTSTATUS
759 NTAPI
761  PHCDCONTROLLER *OutHcdController)
762 {
764 
765  //
766  // allocate controller
767  //
769  if (!This)
770  {
771  //
772  // failed to allocate
773  //
775  }
776 
777  //
778  // add reference count
779  //
780  This->AddRef();
781 
782  //
783  // return result
784  //
785  *OutHcdController = (PHCDCONTROLLER)This;
786 
787  //
788  // done
789  //
790  return STATUS_SUCCESS;
791 }
#define DO_DEVICE_INITIALIZING
Definition: env_spec_w32.h:399
IN CINT OUT PVOID IN ULONG OUT PULONG ResultLength
Definition: conport.c:47
#define STATUS_OBJECT_NAME_COLLISION
Definition: udferr_usr.h:150
#define DO_POWER_PAGABLE
#define IN
Definition: typedefs.h:38
#define REFIID
Definition: guiddef.h:113
#define TRUE
Definition: types.h:120
#define IRP_MN_REMOVE_DEVICE
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define PC_ASSERT(exp)
Definition: usbehci.h:17
IUSBHardwareDevice * PUSBHARDWAREDEVICE
_In_ BOOLEAN Release
Definition: classpnp.h:929
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
NTSTATUS NTAPI PoCallDriver(IN PDEVICE_OBJECT DeviceObject, IN OUT PIRP Irp)
Definition: power.c:485
PDEVICE_OBJECT m_FunctionalDeviceObject
#define IOCTL_GET_HCD_DRIVERKEY_NAME
Definition: usbioctl.h:165
_In_ PIRP Irp
Definition: csq.h:116
PDEVICE_OBJECT Objects[1]
Definition: iotypes.h:2054
#define STATUS_OBJECT_NAME_EXISTS
Definition: ntstatus.h:114
LONG NTSTATUS
Definition: precomp.h:26
_In_ ULONGLONG _In_ ULONGLONG _In_ BOOLEAN Enable
Definition: ntddpcm.h:140
NTSTATUS NTAPI CreateUSBHardware(PUSBHARDWAREDEVICE *OutHardware)
Definition: hardware.cpp:1474
VOID NTAPI IoDetachDevice(IN PDEVICE_OBJECT TargetDevice)
Definition: device.c:1295
STDMETHODIMP_(ULONG) Release()
NTSTATUS HandleDeviceControl(IN PDEVICE_OBJECT DeviceObject, IN OUT PIRP Irp)
WCHAR DeviceName[]
Definition: adapter.cpp:21
PDRIVER_OBJECT m_DriverObject
#define IOCTL_USB_GET_ROOT_HUB_NAME
Definition: usbioctl.h:160
static int Link(const char **args)
Definition: vfdcmd.c:2414
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:64
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
#define FILE_DEVICE_CONTROLLER
Definition: winioctl.h:109
#define IRP_MN_QUERY_REMOVE_DEVICE
CHCDController(IUnknown *OuterUnknown)
long LONG
Definition: pedump.c:60
PDEVICE_OBJECT NTAPI IoAttachDeviceToDeviceStack(IN PDEVICE_OBJECT SourceDevice, IN PDEVICE_OBJECT TargetDevice)
Definition: device.c:966
#define STDMETHODIMP
Definition: basetyps.h:43
PHUBCONTROLLER m_HubController
struct _DEVICE_RELATIONS * PDEVICE_RELATIONS
PVOID DeviceExtension
Definition: env_spec_w32.h:418
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
virtual ~CHCDController()
static PDRIVER_OBJECT DriverObject
Definition: template.c:42
#define IoCompleteRequest
Definition: irp.c:1240
STDMETHODIMP QueryInterface(REFIID InterfaceId, PVOID *Interface)
NTSTATUS NTAPI IoGetDeviceProperty(IN PDEVICE_OBJECT DeviceObject, IN DEVICE_REGISTRY_PROPERTY DeviceProperty, IN ULONG BufferLength, OUT PVOID PropertyBuffer, OUT PULONG ResultLength)
Definition: pnpmgr.c:4210
void DPRINT(...)
Definition: polytest.cpp:61
IDispatchIrp * PDISPATCHIRP
const char * LPCSTR
Definition: xmlstorage.h:183
#define TAG_USBLIB
Definition: libusb.h:70
#define IRP_MN_QUERY_STOP_DEVICE
NTSTATUS NTAPI CreateHubController(PHUBCONTROLLER *OutHcdController)
NTSTATUS NTAPI SyncForwardIrp(PDEVICE_OBJECT DeviceObject, PIRP Irp)
Definition: misc.cpp:37
struct _USB_HCD_DRIVERKEY_NAME USB_HCD_DRIVERKEY_NAME
struct _USB_HCD_DRIVERKEY_NAME * PUSB_HCD_DRIVERKEY_NAME
IN PVOID IN PVOID IN USHORT IN USHORT IN PINTERFACE Interface
Definition: pci.h:359
#define IRP_MN_STOP_DEVICE
if(!(yy_init))
Definition: macro.lex.yy.c:714
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_NO_SUCH_DEVICE
Definition: udferr_usr.h:136
#define DO_BUFFERED_IO
Definition: env_spec_w32.h:394
#define swprintf(buf, format,...)
Definition: sprintf.c:56
#define IRP_MN_START_DEVICE
struct _COMMON_DEVICE_EXTENSION * PCOMMON_DEVICE_EXTENSION
#define STDMETHODCALLTYPE
Definition: bdasup.h:9
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
NTSTATUS SetSymbolicLink(BOOLEAN Enable)
NTSTATUS CreateFDO(PDRIVER_OBJECT DriverObject, PDEVICE_OBJECT *OutDeviceObject)
static const WCHAR L[]
Definition: oid.c:1250
#define InterlockedDecrement
Definition: armddk.h:52
Definition: arc.h:85
#define ExAllocatePool(type, size)
Definition: fbtusb.h:44
WCHAR DriverKeyName[ANYSIZE_ARRAY]
Definition: usbioctl.h:325
Status
Definition: gdiplustypes.h:24
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1250
#define InterlockedIncrement
Definition: armddk.h:53
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:61
VOID NTAPI PoStartNextPowerIrp(IN PIRP Irp)
Definition: power.c:626
NTSTATUS Initialize(IN PROOTHDCCONTROLLER RootHCDController, IN PDRIVER_OBJECT DriverObject, IN PDEVICE_OBJECT PhysicalDeviceObject)
IRootHCDController * PROOTHDCCONTROLLER
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
PDEVICE_OBJECT m_NextDeviceObject
NTSTATUS NTAPI IoCallDriver(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:1218
PROOTHDCCONTROLLER m_RootController
STDMETHODIMP_(ULONG) AddRef()
#define IRP_MN_QUERY_DEVICE_RELATIONS
static ULONG WINAPI AddRef(IStream *iface)
Definition: clist.c:90
#define IoSkipCurrentIrpStackLocation(Irp)
Definition: ntifs_ex.h:421
#define DPRINT1
Definition: precomp.h:8
NTSTATUS NTAPI CreateHCDController(PHCDCONTROLLER *OutHcdController)
NTSTATUS HandlePower(IN PDEVICE_OBJECT DeviceObject, IN OUT PIRP Irp)
#define OUT
Definition: typedefs.h:39
#define ObReferenceObject
Definition: obfuncs.h:204
PUSBHARDWAREDEVICE m_Hardware
#define STATUS_NOT_SUPPORTED
Definition: ntstatus.h:409
unsigned int ULONG
Definition: retypes.h:1
#define IO_NO_INCREMENT
Definition: iotypes.h:565
NTSTATUS NTAPI IoCreateDevice(IN PDRIVER_OBJECT DriverObject, IN ULONG DeviceExtensionSize, IN PUNICODE_STRING DeviceName, IN DEVICE_TYPE DeviceType, IN ULONG DeviceCharacteristics, IN BOOLEAN Exclusive, OUT PDEVICE_OBJECT *DeviceObject)
Definition: device.c:1031
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
IHubController * PHUBCONTROLLER
#define ULONG_PTR
Definition: config.h:101
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:2771
NTSTATUS HandleSystemControl(IN PDEVICE_OBJECT DeviceObject, IN OUT PIRP Irp)
PDEVICE_OBJECT m_PhysicalDeviceObject
return STATUS_SUCCESS
Definition: btrfs.c:2777
NTSTATUS HandlePnp(IN PDEVICE_OBJECT DeviceObject, IN OUT PIRP Irp)
IHCDController * PHCDCONTROLLER