ReactOS 0.4.15-dev-8127-g6338913
FxUsbDeviceStringContext Struct Reference

#include <fxusbdevice.hpp>

Inheritance diagram for FxUsbDeviceStringContext:
Collaboration diagram for FxUsbDeviceStringContext:

Public Member Functions

 FxUsbDeviceStringContext (__in FX_URB_TYPE FxUrbType)
 
 ~FxUsbDeviceStringContext (VOID)
 
__checkReturn NTSTATUS AllocateUrb (__in USBD_HANDLE USBDHandle)
 
virtual VOID Dispose (VOID)
 
virtual VOID CopyParameters (__in FxRequestBase *Request)
 
VOID SetUrbInfo (__in UCHAR StringIndex, __in USHORT LangID)
 
USBD_STATUS GetUsbdStatus (VOID)
 
_Must_inspect_result_ NTSTATUS AllocateDescriptor (__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in size_t BufferSize)
 
- Public Member Functions inherited from FxUsbRequestContext
 FxUsbRequestContext (__in FX_REQUEST_CONTEXT_TYPE Type)
 
virtual USBD_STATUS GetUsbdStatus (VOID)=0
 
virtual VOID CopyParameters (__in FxRequestBase *Request)
 
VOID SetUsbType (__in WDF_USB_REQUEST_TYPE Type)
 
VOID __inline InitUsbParameters (VOID)
 
- Public Member Functions inherited from FxRequestContext
 FxRequestContext (__in FX_REQUEST_CONTEXT_TYPE Type)
 
virtual ~FxRequestContext (VOID)
 
virtual VOID Dispose (VOID)
 
virtual VOID StoreAndReferenceMemory (__in FxRequestBuffer *Buffer)
 
virtual VOID ReleaseAndRestore (__in FxRequestBase *Request)
 
__inline BOOLEAN IsType (__in FX_REQUEST_CONTEXT_TYPE Type)
 
virtual VOID CopyParameters (__in FxRequestBase *Request)
 
VOID FormatWriteParams (__in_opt IFxMemory *WriteMemory, __in_opt PWDFMEMORY_OFFSET WriteOffsets)
 
VOID FormatReadParams (__in_opt IFxMemory *ReadMemory, __in_opt PWDFMEMORY_OFFSET ReadOffsets)
 
VOID FormatOtherParams (__in FxInternalIoctlParams *InternalIoctlParams)
 
- Public Member Functions inherited from FxStump
PVOID operator new (__in size_t Size, __in PFX_DRIVER_GLOBALS FxDriverGlobals)
 
PVOID operator new (__in size_t Size, __in PFX_DRIVER_GLOBALS FxDriverGlobals, __in POOL_TYPE PoolType)
 
VOID operator delete (__in PVOID pointer)
 
PVOID operator new[] (__in size_t Size, __in PFX_DRIVER_GLOBALS FxDriverGlobals)
 
VOID operator delete[] (__in PVOID pointer)
 

Public Attributes

_URB_CONTROL_DESCRIPTOR_REQUEST m_UrbLegacy
 
_URB_CONTROL_DESCRIPTOR_REQUESTm_Urb
 
PUSB_STRING_DESCRIPTOR m_StringDescriptor
 
ULONG m_StringDescriptorLength
 
- Public Attributes inherited from FxUsbRequestContext
WDF_USB_REQUEST_COMPLETION_PARAMS m_UsbParameters
 
UMURB m_UmUrb
 
- Public Attributes inherited from FxRequestContext
WDF_REQUEST_COMPLETION_PARAMS m_CompletionParams
 
IFxMemorym_RequestMemory
 
FX_REQUEST_CONTEXT_TYPE m_RequestType
 

Private Attributes

USBD_HANDLE m_USBDHandle
 

Additional Inherited Members

- Protected Member Functions inherited from FxRequestContext
VOID __inline InitCompletionParams (VOID)
 
- Protected Member Functions inherited from FxStump
 FxStump (VOID)
 
- Static Protected Member Functions inherited from FxRequestContext
static VOID _StoreAndReferenceMemoryWorker (__in PVOID Tag, __deref_out_opt IFxMemory **PPMemory, __in FxRequestBuffer *Buffer)
 

Detailed Description

Definition at line 93 of file fxusbdevice.hpp.

Constructor & Destructor Documentation

◆ FxUsbDeviceStringContext()

FxUsbDeviceStringContext::FxUsbDeviceStringContext ( __in FX_URB_TYPE  FxUrbType)

Definition at line 145 of file fxusbdevice.cpp.

147 :
149{
154
155 if (FxUrbType == FxUrbTypeLegacy) {
158 m_Urb->Hdr.Length = sizeof(*m_Urb);
160 }
161 else {
162 m_Urb = NULL;
163 }
164}
#define NULL
Definition: types.h:112
@ FX_RCT_USB_STRING_REQUEST
@ FxUrbTypeLegacy
Definition: fxusbdevice.hpp:27
PUSB_STRING_DESCRIPTOR m_StringDescriptor
_URB_CONTROL_DESCRIPTOR_REQUEST m_UrbLegacy
_URB_CONTROL_DESCRIPTOR_REQUEST * m_Urb
struct _URB_HEADER Hdr
Definition: usb.h:341
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define USB_STRING_DESCRIPTOR_TYPE
Definition: usb100.h:51
#define URB_FUNCTION_GET_DESCRIPTOR_FROM_DEVICE
Definition: usb.h:97

◆ ~FxUsbDeviceStringContext()

FxUsbDeviceStringContext::~FxUsbDeviceStringContext ( VOID  )

Definition at line 166 of file fxusbdevice.cpp.

169{
170 if (m_StringDescriptor != NULL) {
173 }
174
175 if (m_Urb && (m_Urb != &m_UrbLegacy)){
177 }
178 m_Urb = NULL;
180}
void FxPoolFree(__in_xcount(ptr is at an offset from AllocationStart) PVOID ptr)
Definition: wdfpool.cpp:361
Definition: usb.h:529
VOID USBD_UrbFree(_In_ USBD_HANDLE USBDHandle, _In_ PURB Urb)
Definition: usbstubum.cpp:33

Member Function Documentation

◆ AllocateDescriptor()

_Must_inspect_result_ NTSTATUS FxUsbDeviceStringContext::AllocateDescriptor ( __in PFX_DRIVER_GLOBALS  FxDriverGlobals,
__in size_t  BufferSize 
)

Definition at line 303 of file fxusbdevice.cpp.

307{
308 PUSB_STRING_DESCRIPTOR pDescriptor;
309 size_t length;
311
313 return STATUS_SUCCESS;
314 }
315
316 length = sizeof(USB_STRING_DESCRIPTOR) - sizeof(pDescriptor->bString[0]) +
318
319 pDescriptor = (PUSB_STRING_DESCRIPTOR) FxPoolAllocate(
320 FxDriverGlobals,
322 length);
323
324 if (pDescriptor == NULL) {
326 }
327
328 if (m_StringDescriptor != NULL) {
330 }
331
332 RtlZeroMemory(pDescriptor, length);
333
334 m_StringDescriptor = pDescriptor;
335
337
338 return status;
339}
LONG NTSTATUS
Definition: precomp.h:26
#define BufferSize
Definition: mmc.h:75
#define NonPagedPool
Definition: env_spec_w32.h:307
#define RtlSizeTToULong
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
#define STATUS_SUCCESS
Definition: shellext.h:65
Definition: ps.c:97
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
struct _USB_STRING_DESCRIPTOR * PUSB_STRING_DESCRIPTOR
struct _USB_STRING_DESCRIPTOR USB_STRING_DESCRIPTOR
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
Definition: wdfmemory.h:254

Referenced by FxUsbDevice::FormatStringRequest().

◆ AllocateUrb()

__checkReturn NTSTATUS FxUsbDeviceStringContext::AllocateUrb ( __in USBD_HANDLE  USBDHandle)

Definition at line 184 of file fxusbdevice.cpp.

187{
189
190 ASSERT(USBDHandle != NULL);
191 ASSERT(m_Urb == NULL);
192
193 status = USBD_UrbAllocate(USBDHandle, (PURB*)&m_Urb);
194
195 if (!NT_SUCCESS(status)) {
196 goto Done;
197 }
198
199 m_USBDHandle = USBDHandle;
200
202 m_Urb->Hdr.Length = sizeof(*m_Urb);
204
205Done:
206 return status;
207}
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ASSERT(a)
Definition: mode.c:44
NTSTATUS USBD_UrbAllocate(_In_ USBD_HANDLE USBDHandle, _Outptr_result_bytebuffer_(sizeof(URB)) PURB *Urb)
Definition: usbstubum.cpp:46

Referenced by FxUsbDevice::FormatStringRequest().

◆ CopyParameters()

VOID FxUsbDeviceStringContext::CopyParameters ( __in FxRequestBase Request)
virtual

Reimplemented from FxUsbRequestContext.

Definition at line 223 of file fxusbdevice.cpp.

226{
227 //
228 // Make sure we got an even number of bytes and that we got a header
229 //
230 if ((m_StringDescriptor->bLength & 0x1) ||
233 }
234 else if (NT_SUCCESS(Request->GetSubmitFxIrp()->GetStatus())) {
235 //
236 // No matter what, indicate the required size to the caller
237 //
240
241 if (m_UsbParameters.Parameters.DeviceString.RequiredSize >
243 //
244 // Too much string to fit into the buffer supplied by the client.
245 // Morph the status into a warning. Copy as much as we can.
246 //
251 }
252 else {
253 //
254 // Everything fits, copy it over
255 //
258
262 }
263 }
264
266}
virtual size_t GetBufferSize(VOID)=0
virtual PVOID GetBuffer(VOID)=0
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
WDF_REQUEST_COMPLETION_PARAMS m_CompletionParams
IFxMemory * m_RequestMemory
WDF_USB_REQUEST_COMPLETION_PARAMS m_UsbParameters
virtual VOID CopyParameters(__in FxRequestBase *Request)
union _WDF_USB_REQUEST_COMPLETION_PARAMS::@3912 Parameters
struct _WDF_USB_REQUEST_COMPLETION_PARAMS::@3912::@3913 DeviceString
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define STATUS_DEVICE_DATA_ERROR
Definition: udferr_usr.h:159
struct _USB_COMMON_DESCRIPTOR USB_COMMON_DESCRIPTOR
_In_ WDFREQUEST Request
Definition: wdfdevice.h:547

◆ Dispose()

VOID FxUsbDeviceStringContext::Dispose ( VOID  )
virtual

Reimplemented from FxRequestContext.

Definition at line 210 of file fxusbdevice.cpp.

213{
214 if (m_Urb && (m_Urb != &m_UrbLegacy)){
216 m_Urb = NULL;
218 }
219
220}

◆ GetUsbdStatus()

USBD_STATUS FxUsbDeviceStringContext::GetUsbdStatus ( VOID  )
virtual

Implements FxUsbRequestContext.

Definition at line 294 of file fxusbdevice.cpp.

297{
298 return m_Urb->Hdr.Status;
299}

◆ SetUrbInfo()

VOID FxUsbDeviceStringContext::SetUrbInfo ( __in UCHAR  StringIndex,
__in USHORT  LangID 
)

Definition at line 269 of file fxusbdevice.cpp.

273{
275
277
278#if (FX_CORE_MODE == FX_CORE_KERNEL_MODE)
281
284#elif (FX_CORE_MODE == FX_CORE_USER_MODE)
287
290#endif
291}
VOID SetUsbType(__in WDF_USB_REQUEST_TYPE Type)
struct _UMURB_DESCRIPTOR_REQUEST UmUrbDescriptorRequest
Definition: umusb.h:245
_Must_inspect_result_ _In_ WDFUSBDEVICE _In_opt_ WDFREQUEST _In_opt_ PWDF_REQUEST_SEND_OPTIONS _Out_writes_opt_ NumCharacters PUSHORT _Inout_ PUSHORT _In_ UCHAR StringIndex
Definition: wdfusb.h:1080
@ WdfUsbRequestTypeDeviceString
Definition: wdfusb.h:89
_Must_inspect_result_ _In_ WDFUSBDEVICE _In_opt_ WDFREQUEST _In_opt_ PWDF_REQUEST_SEND_OPTIONS _Out_writes_opt_ NumCharacters PUSHORT _Inout_ PUSHORT _In_ UCHAR _In_opt_ USHORT LangID
Definition: wdfusb.h:1083

Referenced by FxUsbDevice::FormatStringRequest().

Member Data Documentation

◆ m_StringDescriptor

PUSB_STRING_DESCRIPTOR FxUsbDeviceStringContext::m_StringDescriptor

◆ m_StringDescriptorLength

ULONG FxUsbDeviceStringContext::m_StringDescriptorLength

Definition at line 152 of file fxusbdevice.hpp.

Referenced by AllocateDescriptor(), FxUsbDeviceStringContext(), and SetUrbInfo().

◆ m_Urb

◆ m_UrbLegacy

◆ m_USBDHandle

USBD_HANDLE FxUsbDeviceStringContext::m_USBDHandle
private

The documentation for this struct was generated from the following files: