ReactOS 0.4.15-dev-8393-g61b7fb9
fxusbdeviceapikm.cpp File Reference
#include "fxusbpch.hpp"
#include "FxUsbDeviceApiKm.tmh"
Include dependency graph for fxusbdeviceapikm.cpp:

Go to the source code of this file.

Functions

_Must_inspect_result_ __drv_maxIRQL (DISPATCH_LEVEL) NTSTATUS WDFAPI WDFEXPORT(WdfUsbTargetDeviceRetrieveCurrentFrameNumber)(__in PWDF_DRIVER_GLOBALS DriverGlobals
 
 FxObjectHandleGetPtrAndGlobals (GetFxDriverGlobals(DriverGlobals), UsbDevice, FX_TYPE_IO_TARGET_USB_DEVICE,(PVOID *) &pUsbDevice, &pFxDriverGlobals)
 
 FxPointerNotNull (pFxDriverGlobals, CurrentFrameNumber)
 
return pUsbDevice GetCurrentFrameNumber (CurrentFrameNumber)
 
_Must_inspect_result_ __drv_maxIRQL (PASSIVE_LEVEL) NTSTATUS WDFAPI WDFEXPORT(WdfUsbTargetDeviceSendUrbSynchronously)(__in PWDF_DRIVER_GLOBALS DriverGlobals
 
_Must_inspect_result_ __in WDFUSBDEVICE __in_opt WDFREQUEST __in_opt PWDF_REQUEST_SEND_OPTIONS __in_xcount ("union bug in SAL") PURB Urb)
 
 DoTraceLevelMessage (pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGIOTARGET, "WDFUSBDEVICE %p, Request %p, Memory %p", UsbDevice, Request, UrbMemory)
 
 FxPointerNotNull (pFxDriverGlobals, UrbMemory)
 
 FxObjectHandleGetPtr (pFxDriverGlobals, UrbMemory, IFX_TYPE_MEMORY,(PVOID *) &pMemory)
 
 FxObjectHandleGetPtr (pFxDriverGlobals, Request, FX_TYPE_REQUEST,(PVOID *) &pRequest)
 
 if (!NT_SUCCESS(status))
 
 if (UrbOffsets !=NULL &&UrbOffsets->BufferOffset > 0)
 
 if (bufferSize< sizeof(_URB_HEADER))
 
buf SetMemory (pMemory, UrbOffsets)
 
 if (NT_SUCCESS(status))
 
 DoTraceLevelMessage (pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGIOTARGET, "WDFUSBDEVICE %p, Request %p, Memory %p, %!STATUS!", UsbDevice, Request, UrbMemory, status)
 
__checkReturn __in WDFUSBDEVICE __in_opt PWDF_OBJECT_ATTRIBUTES __out WDFMEMORY __deref_opt_out_bcount (sizeof(URB)) PURB *Urb)
 

Variables

_Must_inspect_result_ __in WDFUSBDEVICE UsbDevice
 
_Must_inspect_result_ __in WDFUSBDEVICE __out PULONG CurrentFrameNumber
 
PFX_DRIVER_GLOBALS pFxDriverGlobals
 
FxUsbDevicepUsbDevice
 
_Must_inspect_result_ __in WDFUSBDEVICE __in_opt WDFREQUEST Request
 
_Must_inspect_result_ __in WDFUSBDEVICE __in_opt WDFREQUEST __in_opt PWDF_REQUEST_SEND_OPTIONS RequestOptions
 
_Must_inspect_result_ __in WDFUSBDEVICE __in WDFREQUEST __in WDFMEMORY UrbMemory
 
_Must_inspect_result_ __in WDFUSBDEVICE __in WDFREQUEST __in WDFMEMORY __in_opt PWDFMEMORY_OFFSET UrbOffsets
 
IFxMemorypMemory
 
FxRequestBuffer buf
 
FxRequestpRequest
 
NTSTATUS status = pMemory->ValidateMemoryOffsets(UrbOffsets)
 
size_t bufferSize = pMemory->GetBufferSize()
 
__checkReturn __in WDFUSBDEVICE __in_opt PWDF_OBJECT_ATTRIBUTES Attributes
 

Function Documentation

◆ __deref_opt_out_bcount()

__checkReturn __in WDFUSBDEVICE __in_opt PWDF_OBJECT_ATTRIBUTES __out WDFMEMORY __deref_opt_out_bcount ( sizeof(URB )

Definition at line 382 of file fxusbdeviceapikm.cpp.

411{
412 DDI_ENTRY();
413
417
419 UsbDevice,
421 (PVOID*) &pUsbDevice,
423
424 //
425 // Basic parameter validation
426 //
428
429 if (pUsbDevice->GetUSBDHandle() == NULL) {
431
434 "USBDEVICE Must have been created with Client Contract Verion Info, %!STATUS!",
435 status);
436
437 return status;
438 }
439
441
442 return status;
443}
LONG NTSTATUS
Definition: precomp.h:26
__checkReturn NTSTATUS CreateUrb(__in_opt PWDF_OBJECT_ATTRIBUTES Attributes, __out WDFMEMORY *UrbMemory, __deref_opt_out_bcount(sizeof(URB)) PURB *Urb)
USBD_HANDLE GetUSBDHandle(VOID)
#define TRACINGIOTARGET
Definition: dbgtrace.h:72
#define NULL
Definition: types.h:112
DriverGlobals
__inline PFX_DRIVER_GLOBALS GetFxDriverGlobals(__in PWDF_DRIVER_GLOBALS DriverGlobals)
Definition: fxglobals.h:597
#define DDI_ENTRY()
Definition: fxglobalskm.h:56
#define FxPointerNotNull(FxDriverGlobals, Ptr)
Definition: fxmacros.hpp:253
@ FX_TYPE_IO_TARGET_USB_DEVICE
Definition: fxtypes.h:102
FxUsbDevice * pUsbDevice
NTSTATUS status
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGIOTARGET, "WDFUSBDEVICE %p, Request %p, Memory %p", UsbDevice, Request, UrbMemory)
FxObjectHandleGetPtrAndGlobals(GetFxDriverGlobals(DriverGlobals), UsbDevice, FX_TYPE_IO_TARGET_USB_DEVICE,(PVOID *) &pUsbDevice, &pFxDriverGlobals)
PFX_DRIVER_GLOBALS pFxDriverGlobals
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
Definition: ps.c:97
#define STATUS_INVALID_DEVICE_STATE
Definition: udferr_usr.h:178
_Must_inspect_result_ _In_ WDFDMAENABLER _In_ _In_opt_ PWDF_OBJECT_ATTRIBUTES Attributes
_Must_inspect_result_ _In_ WDFUSBDEVICE _In_ WDFREQUEST _In_ WDFMEMORY UrbMemory
Definition: wdfusb.h:1576
_Must_inspect_result_ _In_ WDFDEVICE _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFUSBDEVICE * UsbDevice
Definition: wdfusb.h:906

◆ __drv_maxIRQL() [1/2]

◆ __drv_maxIRQL() [2/2]

_Must_inspect_result_ __drv_maxIRQL ( PASSIVE_LEVEL  )

◆ __in_xcount()

_Must_inspect_result_ __in WDFUSBDEVICE __in_opt WDFREQUEST __in_opt PWDF_REQUEST_SEND_OPTIONS __in_xcount ( "union bug in SAL"  )

Definition at line 75 of file fxusbdeviceapikm.cpp.

78{
83
87 (PVOID*) &pUsbDevice,
89
91 FxSyncRequest request(pFxDriverGlobals, &context, Request);
92
93 //
94 // FxSyncRequest always succeesds for KM but can fail for UM.
95 //
96 status = request.Initialize();
97 if (!NT_SUCCESS(status)) {
99 "Failed to initialize FxSyncRequest");
100 return status;
101 }
102
104 "WDFUSBDEVICE %p, Urb %p", UsbDevice, Urb);
105
107
109 if (!NT_SUCCESS(status)) {
110 return status;
111 }
112
114 if (!NT_SUCCESS(status)) {
115 return status;
116 }
117
118 buf.SetBuffer(Urb, 0);
119
122 request.m_TrueRequest,
123 &buf,
126
127 if (NT_SUCCESS(status)) {
130 "WDFUSBDEVICE %p, WDFREQUEST %p being submitted",
131 UsbDevice, request.m_TrueRequest->GetTraceObjectHandle());
132
134 }
135
137 "Device %p, Urb %p, %!STATUS!",
138 UsbDevice, Urb, status);
139
140 return status;
141}
_Must_inspect_result_ NTSTATUS SubmitSync(__in FxRequestBase *Request, __in_opt PWDF_REQUEST_SEND_OPTIONS Options=NULL, __out_opt PULONG Action=NULL)
FX_URB_TYPE GetUrbType(VOID)
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
NTSTATUS __inline FxValidateRequestOptions(_In_ PFX_DRIVER_GLOBALS FxDriverGlobals, _In_ PWDF_REQUEST_SEND_OPTIONS Options, _In_opt_ FxRequestBase *Request=NULL)
FxRequestBuffer buf
__inline NTSTATUS FxVerifierCheckIrqlLevel(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in KIRQL Irql)
Definition: fxverifier.h:158
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define TRACE_LEVEL_VERBOSE
Definition: storswtr.h:30
Definition: http.c:7252
Definition: tftpd.h:86
NTSTATUS FxFormatUrbRequest(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in FxIoTarget *Target, __in FxRequestBase *Request, __in FxRequestBuffer *Buffer, __in FX_URB_TYPE FxUrbType, __drv_when(FxUrbType==FxUrbTypeUsbdAllocated, __in) __drv_when(FxUrbType !=FxUrbTypeUsbdAllocated, __in_opt) USBD_HANDLE UsbdHandle)
Definition: usbutil.cpp:62
_In_ WDFREQUEST Request
Definition: wdfdevice.h:547
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR _In_opt_ PLONGLONG _In_opt_ PWDF_REQUEST_SEND_OPTIONS RequestOptions
Definition: wdfiotarget.h:867

◆ DoTraceLevelMessage() [1/2]

DoTraceLevelMessage ( pFxDriverGlobals  ,
TRACE_LEVEL_VERBOSE  ,
TRACINGIOTARGET  ,
"WDFUSBDEVICE %  p,
Request p,
Memory %p"  ,
UsbDevice  ,
Request  ,
UrbMemory   
)

◆ DoTraceLevelMessage() [2/2]

DoTraceLevelMessage ( pFxDriverGlobals  ,
TRACE_LEVEL_VERBOSE  ,
TRACINGIOTARGET  ,
"WDFUSBDEVICE %  p,
Request p,
Memory p,
%!STATUS!"  ,
UsbDevice  ,
Request  ,
UrbMemory  ,
status   
)

◆ FxObjectHandleGetPtr() [1/2]

FxObjectHandleGetPtr ( pFxDriverGlobals  ,
Request  ,
FX_TYPE_REQUEST  ,
(PVOID *) &  pRequest 
)

◆ FxObjectHandleGetPtr() [2/2]

FxObjectHandleGetPtr ( pFxDriverGlobals  ,
UrbMemory  ,
IFX_TYPE_MEMORY  ,
(PVOID *) &  pMemory 
)

◆ FxObjectHandleGetPtrAndGlobals()

FxObjectHandleGetPtrAndGlobals ( GetFxDriverGlobals(DriverGlobals ,
UsbDevice  ,
FX_TYPE_IO_TARGET_USB_DEVICE  ,
(PVOID *) &  pUsbDevice,
pFxDriverGlobals 
)

◆ FxPointerNotNull() [1/2]

FxPointerNotNull ( pFxDriverGlobals  ,
CurrentFrameNumber   
)

◆ FxPointerNotNull() [2/2]

FxPointerNotNull ( pFxDriverGlobals  ,
UrbMemory   
)

◆ GetCurrentFrameNumber()

return pUsbDevice GetCurrentFrameNumber ( CurrentFrameNumber  )

◆ if() [1/4]

if ( NT_SUCCESSstatus)

Definition at line 193 of file fxusbdeviceapikm.cpp.

193 {
194 return status;
195 }

◆ if() [2/4]

if ( )

Definition at line 202 of file fxusbdeviceapikm.cpp.

202 {
205 "UrbMemory %p buffer size, %I64d, smaller then"
206 "_URB_HEADER, %!STATUS!",
208 return status;
209 }
virtual size_t GetBufferSize(VOID)=0
IFxMemory * pMemory
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135

◆ if() [3/4]

if ( NT_SUCCESS(status )

Definition at line 220 of file fxusbdeviceapikm.cpp.

220 {
221 FxUsbUrbContext* pContext;
222 pContext = (FxUsbUrbContext*) pRequest->GetContext();
223
226 }
__inline FxRequestContext * GetContext(VOID)
_Must_inspect_result_ __in WDFUSBDEVICE __in WDFREQUEST __in WDFMEMORY UrbMemory
FxRequest * pRequest
VOID SetUsbType(__in WDF_USB_REQUEST_TYPE Type)
WDF_USB_REQUEST_COMPLETION_PARAMS m_UsbParameters
struct _WDF_USB_REQUEST_COMPLETION_PARAMS::@3903::@3906 DeviceUrb
union _WDF_USB_REQUEST_COMPLETION_PARAMS::@3903 Parameters
@ WdfUsbRequestTypeDeviceUrb
Definition: wdfusb.h:91

◆ if() [4/4]

if ( UrbOffsets = NULL && UrbOffsets->BufferOffset,
 
)

Definition at line 198 of file fxusbdeviceapikm.cpp.

198 {
200 }
size_t bufferSize
_Must_inspect_result_ __in WDFUSBDEVICE __in WDFREQUEST __in WDFMEMORY __in_opt PWDFMEMORY_OFFSET UrbOffsets
size_t BufferOffset
Definition: wdfmemory.h:65

◆ SetMemory()

buf SetMemory ( pMemory  ,
UrbOffsets   
)

Variable Documentation

◆ Attributes

◆ buf

Definition at line 165 of file fxusbdeviceapikm.cpp.

Referenced by __in_xcount().

◆ bufferSize

bufferSize = pMemory->GetBufferSize()

Definition at line 168 of file fxusbdeviceapikm.cpp.

Referenced by if().

◆ CurrentFrameNumber

Initial value:

Definition at line 43 of file fxusbdeviceapikm.cpp.

◆ pFxDriverGlobals

PFX_DRIVER_GLOBALS pFxDriverGlobals

Definition at line 48 of file fxusbdeviceapikm.cpp.

Referenced by __deref_opt_out_bcount(), __in_xcount(), and if().

◆ pMemory

IFxMemory* pMemory

Definition at line 163 of file fxusbdeviceapikm.cpp.

Referenced by if().

◆ pRequest

FxRequest* pRequest

Definition at line 166 of file fxusbdeviceapikm.cpp.

Referenced by if().

◆ pUsbDevice

FxUsbDevice* pUsbDevice

Definition at line 49 of file fxusbdeviceapikm.cpp.

Referenced by __deref_opt_out_bcount(), and __in_xcount().

◆ Request

_Must_inspect_result_ __in WDFUSBDEVICE __in WDFREQUEST Request
Initial value:

Definition at line 72 of file fxusbdeviceapikm.cpp.

◆ RequestOptions

◆ status

return status = pMemory->ValidateMemoryOffsets(UrbOffsets)

Definition at line 167 of file fxusbdeviceapikm.cpp.

Referenced by __deref_opt_out_bcount(), __in_xcount(), and if().

◆ UrbMemory

Definition at line 155 of file fxusbdeviceapikm.cpp.

Referenced by if().

◆ UrbOffsets

_Must_inspect_result_ __in WDFUSBDEVICE __in WDFREQUEST __in WDFMEMORY __in_opt PWDFMEMORY_OFFSET UrbOffsets
Initial value:

Definition at line 157 of file fxusbdeviceapikm.cpp.

Referenced by if().

◆ UsbDevice

Initial value:

Definition at line 41 of file fxusbdeviceapikm.cpp.