ReactOS  0.4.14-dev-297-g23e575c
libusb.cpp File Reference
#include "libusb.h"
#include <debug.h>
Include dependency graph for libusb.cpp:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

PVOID __cdecl operator new (size_t iSize, POOL_TYPE poolType, ULONG tag)
 
void __cdecl operator delete (PVOID pVoid)
 
void __cdecl operator delete (PVOID pVoid, UINT_PTR)
 
NTSTATUS NTAPI USBLIB_AddDevice (PDRIVER_OBJECT DriverObject, PDEVICE_OBJECT PhysicalDeviceObject)
 
NTSTATUS NTAPI USBLIB_Dispatch (PDEVICE_OBJECT DeviceObject, PIRP Irp)
 

Variables

DRIVER_ADD_DEVICE USBLIB_AddDevice
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 13 of file libusb.cpp.

Function Documentation

◆ operator delete() [1/2]

Definition at line 37 of file libusb.cpp.

39 {
40  if (pVoid) ExFreePool(pVoid);
41 }
#define ExFreePool(addr)
Definition: env_spec_w32.h:352

◆ operator delete() [2/2]

Definition at line 45 of file libusb.cpp.

47 {
48  if (pVoid) ExFreePool(pVoid);
49 }
#define ExFreePool(addr)
Definition: env_spec_w32.h:352

◆ operator new()

PVOID __cdecl operator new ( size_t  iSize,
POOL_TYPE  poolType,
ULONG  tag 
)

Definition at line 23 of file libusb.cpp.

27 {
28  PVOID result = ExAllocatePoolWithTag(poolType, iSize, tag);
29  if (result) {
30  RtlZeroMemory(result, iSize);
31  }
32  return result;
33 }
Definition: ecma_167.h:138
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
GLuint64EXT * result
Definition: glext.h:11304

◆ USBLIB_AddDevice()

NTSTATUS NTAPI USBLIB_AddDevice ( PDRIVER_OBJECT  DriverObject,
PDEVICE_OBJECT  PhysicalDeviceObject 
)

Definition at line 56 of file libusb.cpp.

59 {
61  PHCDCONTROLLER HcdController;
62 
63  DPRINT("USBLIB_AddDevice\n");
64 
65  /* first create the controller object */
66  Status = CreateHCDController(&HcdController);
67  if (!NT_SUCCESS(Status))
68  {
69  /* failed to create hcd */
70  DPRINT1("AddDevice: Failed to create hcd with %x\n", Status);
71  return Status;
72  }
73 
74  /* initialize the hcd */
75  Status = HcdController->Initialize(NULL, // FIXME
78 
79  /* check for success */
80  if (!NT_SUCCESS(Status))
81  {
82  /* failed to initialize device */
83  DPRINT1("AddDevice: failed to initialize\n");
84 
85  /* release object */
86  HcdController->Release();
87  }
88 
89  return Status;
90 
91 }
LONG NTSTATUS
Definition: precomp.h:26
PDEVICE_OBJECT PhysicalDeviceObject
Definition: btrfs_drv.h:1114
smooth NULL
Definition: ftsmooth.c:416
static PDRIVER_OBJECT DriverObject
Definition: template.c:42
void DPRINT(...)
Definition: polytest.cpp:61
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:24
#define DPRINT1
Definition: precomp.h:8
NTSTATUS NTAPI CreateHCDController(PHCDCONTROLLER *OutHcdController)
IHCDController * PHCDCONTROLLER

◆ USBLIB_Dispatch()

NTSTATUS NTAPI USBLIB_Dispatch ( PDEVICE_OBJECT  DeviceObject,
PIRP  Irp 
)

Definition at line 99 of file libusb.cpp.

102 {
103  PCOMMON_DEVICE_EXTENSION DeviceExtension;
104  PIO_STACK_LOCATION IoStack;
106 
107  //
108  // get common device extension
109  //
111 
112  //
113  // get current stack location
114  //
116 
117  //
118  // sanity checks
119  //
120  PC_ASSERT(DeviceExtension->Dispatcher);
121 
122  switch(IoStack->MajorFunction)
123  {
124  case IRP_MJ_PNP:
125  {
126  //
127  // dispatch pnp
128  //
129  return DeviceExtension->Dispatcher->HandlePnp(DeviceObject, Irp);
130  }
131 
132  case IRP_MJ_POWER:
133  {
134  //
135  // dispatch power
136  //
137  return DeviceExtension->Dispatcher->HandlePower(DeviceObject, Irp);
138  }
141  {
142  //
143  // dispatch io control
144  //
145  return DeviceExtension->Dispatcher->HandleDeviceControl(DeviceObject, Irp);
146  }
148  {
149  //
150  // dispatch system control
151  //
152  return DeviceExtension->Dispatcher->HandleSystemControl(DeviceObject, Irp);
153  }
154  default:
155  {
156  DPRINT1("USBLIB_Dispatch> Major %lu Minor %lu unhandeled\n", IoStack->MajorFunction, IoStack->MinorFunction);
158  }
159  }
160 
161  //
162  // complete request
163  //
164  Irp->IoStatus.Information = 0;
165  Irp->IoStatus.Status = Status;
167 
168  return Status;
169 }
#define PC_ASSERT(exp)
Definition: usbehci.h:17
_In_ PIRP Irp
Definition: csq.h:116
#define IRP_MJ_PNP
Definition: cdrw_usr.h:52
LONG NTSTATUS
Definition: precomp.h:26
PVOID DeviceExtension
Definition: env_spec_w32.h:418
#define IoCompleteRequest
Definition: irp.c:1240
struct _COMMON_DEVICE_EXTENSION * PCOMMON_DEVICE_EXTENSION
#define IRP_MJ_INTERNAL_DEVICE_CONTROL
#define IRP_MJ_POWER
#define IRP_MJ_SYSTEM_CONTROL
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
#define DPRINT1
Definition: precomp.h:8
#define IO_NO_INCREMENT
Definition: iotypes.h:566
return STATUS_SUCCESS
Definition: btrfs.c:2966
#define IRP_MJ_DEVICE_CONTROL
Definition: rdpdr.c:52

Referenced by DriverEntry().

Variable Documentation

◆ USBLIB_AddDevice

DRIVER_ADD_DEVICE USBLIB_AddDevice

Definition at line 19 of file libusb.cpp.

Referenced by DriverEntry().