ReactOS 0.4.16-dev-338-g34e76ad
misc.c File Reference
#include "usbccgp.h"
#include <debug.h>
Include dependency graph for misc.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

NTSTATUS NTAPI USBSTOR_SyncForwardIrpCompletionRoutine (PDEVICE_OBJECT DeviceObject, PIRP Irp, PVOID Context)
 
NTSTATUS USBCCGP_SyncUrbRequest (IN PDEVICE_OBJECT DeviceObject, OUT PURB UrbRequest)
 
PVOID AllocateItem (IN POOL_TYPE PoolType, IN ULONG ItemSize)
 
VOID FreeItem (IN PVOID Item)
 
VOID DumpFunctionDescriptor (IN PUSBC_FUNCTION_DESCRIPTOR FunctionDescriptor, IN ULONG FunctionDescriptorCount)
 

Variables

IO_COMPLETION_ROUTINE SyncForwardIrpCompletionRoutine
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 14 of file misc.c.

Function Documentation

◆ AllocateItem()

PVOID AllocateItem ( IN POOL_TYPE  PoolType,
IN ULONG  ItemSize 
)

Definition at line 94 of file misc.c.

97{
98 /* Allocate, zero and return item */
100}
FORCEINLINE PVOID ExAllocatePoolZero(ULONG PoolType, SIZE_T NumberOfBytes, ULONG Tag)
Definition: precomp.h:45
static UCHAR ItemSize[4]
Definition: parser.c:16
#define USBCCPG_TAG
Definition: usbccgp.h:39
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ _Strict_type_match_ POOL_TYPE PoolType
Definition: wdfdevice.h:3815

◆ DumpFunctionDescriptor()

VOID DumpFunctionDescriptor ( IN PUSBC_FUNCTION_DESCRIPTOR  FunctionDescriptor,
IN ULONG  FunctionDescriptorCount 
)

Definition at line 111 of file misc.c.

114{
115 ULONG Index, SubIndex;
116
117 DPRINT("FunctionCount %lu\n", FunctionDescriptorCount);
118 for (Index = 0; Index < FunctionDescriptorCount; Index++)
119 {
120 DPRINT("Function %lu\n", Index);
121 DPRINT("FunctionNumber %lu\n", FunctionDescriptor[Index].FunctionNumber);
122 DPRINT("HardwareId %S\n", FunctionDescriptor[Index].HardwareId.Buffer);
123 DPRINT("CompatibleId %S\n", FunctionDescriptor[Index].CompatibleId.Buffer);
124 DPRINT("FunctionDescription %wZ\n", &FunctionDescriptor[Index].FunctionDescription);
125 DPRINT("NumInterfaces %lu\n", FunctionDescriptor[Index].NumberOfInterfaces);
126
127 for(SubIndex = 0; SubIndex < FunctionDescriptor[Index].NumberOfInterfaces; SubIndex++)
128 {
129 DPRINT(" Index %lu Interface %p\n", SubIndex, FunctionDescriptor[Index].InterfaceDescriptorList[SubIndex]);
130 DPRINT(" Index %lu Interface InterfaceNumber %x\n", SubIndex, FunctionDescriptor[Index].InterfaceDescriptorList[SubIndex]->bInterfaceNumber);
131 DPRINT(" Index %lu Interface Alternate %x\n", SubIndex, FunctionDescriptor[Index].InterfaceDescriptorList[SubIndex]->bAlternateSetting );
132 DPRINT(" Index %lu bLength %x\n", SubIndex, FunctionDescriptor[Index].InterfaceDescriptorList[SubIndex]->bLength);
133 DPRINT(" Index %lu bDescriptorType %x\n", SubIndex, FunctionDescriptor[Index].InterfaceDescriptorList[SubIndex]->bDescriptorType);
134 DPRINT(" Index %lu bInterfaceNumber %x\n", SubIndex, FunctionDescriptor[Index].InterfaceDescriptorList[SubIndex]->bInterfaceNumber);
135 DPRINT(" Index %lu bAlternateSetting %x\n", SubIndex, FunctionDescriptor[Index].InterfaceDescriptorList[SubIndex]->bAlternateSetting);
136 DPRINT(" Index %lu bNumEndpoints %x\n", SubIndex, FunctionDescriptor[Index].InterfaceDescriptorList[SubIndex]->bNumEndpoints);
137 DPRINT(" Index %lu bInterfaceClass %x\n", SubIndex, FunctionDescriptor[Index].InterfaceDescriptorList[SubIndex]->bInterfaceClass);
138 DPRINT(" Index %lu bInterfaceSubClass %x\n", SubIndex, FunctionDescriptor[Index].InterfaceDescriptorList[SubIndex]->bInterfaceSubClass);
139 DPRINT(" Index %lu bInterfaceProtocol %x\n", SubIndex, FunctionDescriptor[Index].InterfaceDescriptorList[SubIndex]->bInterfaceProtocol);
140 DPRINT(" Index %lu iInterface %x\n", SubIndex, FunctionDescriptor[Index].InterfaceDescriptorList[SubIndex]->iInterface);
141 }
142 }
143}
#define DPRINT
Definition: sndvol32.h:73
uint32_t ULONG
Definition: typedefs.h:59
_In_ WDFCOLLECTION _In_ ULONG Index

Referenced by FDO_StartDevice().

◆ FreeItem()

VOID FreeItem ( IN PVOID  Item)

Definition at line 103 of file misc.c.

105{
106 /* Free item */
108}
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
_In_ WDFCOLLECTION _In_ WDFOBJECT Item

◆ USBCCGP_SyncUrbRequest()

NTSTATUS USBCCGP_SyncUrbRequest ( IN PDEVICE_OBJECT  DeviceObject,
OUT PURB  UrbRequest 
)

Definition at line 35 of file misc.c.

38{
39 PIRP Irp;
40 PIO_STACK_LOCATION IoStack;
43
44 /* Allocate irp */
45 Irp = IoAllocateIrp(DeviceObject->StackSize, FALSE);
46 if (!Irp)
47 {
48 /* No memory */
50 }
51
52 /* Initialize event */
54
55 /* Get next stack location */
57
58 /* Initialize stack location */
61 IoStack->Parameters.Others.Argument1 = (PVOID)UrbRequest;
62 IoStack->Parameters.DeviceIoControl.InputBufferLength = UrbRequest->UrbHeader.Length;
63 Irp->IoStatus.Status = STATUS_SUCCESS;
64
65 /* Setup completion routine */
68 &Event,
69 TRUE,
70 TRUE,
71 TRUE);
72
73 /* Call driver */
75
76 /* Check if request is pending */
78 {
79 /* Wait for completion */
81
82 /* Update status */
83 Status = Irp->IoStatus.Status;
84 }
85
86 /* Free irp */
88
89 /* Done */
90 return Status;
91}
LONG NTSTATUS
Definition: precomp.h:26
_In_ PIRP Irp
Definition: csq.h:116
#define STATUS_PENDING
Definition: d3dkmdt.h:43
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
NTSTATUS NTAPI USBSTOR_SyncForwardIrpCompletionRoutine(PDEVICE_OBJECT DeviceObject, PIRP Irp, PVOID Context)
Definition: misc.c:22
#define KeWaitForSingleObject(pEvt, foo, a, b, c)
Definition: env_spec_w32.h:478
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
Status
Definition: gdiplustypes.h:25
#define IoSetCompletionRoutine(_Irp, _CompletionRoutine, _Context, _InvokeOnSuccess, _InvokeOnError, _InvokeOnCancel)
Definition: irp.cpp:490
#define KernelMode
Definition: asm.h:34
@ NotificationEvent
PIRP NTAPI IoAllocateIrp(IN CCHAR StackSize, IN BOOLEAN ChargeQuota)
Definition: irp.c:615
#define IoCallDriver
Definition: irp.c:1225
VOID NTAPI IoFreeIrp(IN PIRP Irp)
Definition: irp.c:1666
#define STATUS_SUCCESS
Definition: shellext.h:65
union _IO_STACK_LOCATION::@1581 Parameters
struct _IO_STACK_LOCATION::@3980::@4019 Others
struct _IO_STACK_LOCATION::@1581::@1582 DeviceIoControl
void * PVOID
Definition: typedefs.h:50
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define IOCTL_INTERNAL_USB_SUBMIT_URB
Definition: usbioctl.h:32
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetNextIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2695
#define IRP_MJ_INTERNAL_DEVICE_CONTROL
@ Executive
Definition: ketypes.h:415

Referenced by FDO_CloseConfiguration(), USBCCGP_GetDescriptor(), USBCCGP_PDOSelectConfiguration(), USBCCGP_SelectConfiguration(), and USBCCGP_SelectInterface().

◆ USBSTOR_SyncForwardIrpCompletionRoutine()

NTSTATUS NTAPI USBSTOR_SyncForwardIrpCompletionRoutine ( PDEVICE_OBJECT  DeviceObject,
PIRP  Irp,
PVOID  Context 
)

Definition at line 22 of file misc.c.

26{
27 if (Irp->PendingReturned)
28 {
30 }
32}
#define KeSetEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:476
#define STATUS_MORE_PROCESSING_REQUIRED
Definition: shellext.h:68
#define IO_NO_INCREMENT
Definition: iotypes.h:598

Referenced by USBCCGP_SyncUrbRequest(), USBSTOR_SyncForwardIrp(), and USBSTOR_SyncUrbRequest().

Variable Documentation

◆ SyncForwardIrpCompletionRoutine

IO_COMPLETION_ROUTINE SyncForwardIrpCompletionRoutine

Definition at line 18 of file misc.c.