ReactOS 0.4.17-dev-1281-g065abb3
UcxUserRequest Class Reference

Public Member Functions

 UcxUserRequest (_In_ PUSBUSER_REQUEST_HEADER Header, _In_ ULONG BufferLength)
 
template<typename T >
T * Payload () const
 
PUSBUSER_REQUEST_HEADER Header () const
 
ULONG NameSpace () const
 
VOID SetStatus (_In_ USB_USER_ERROR_CODE Status)
 
BOOLEAN CheckParameterLength (_In_ ULONG ParameterLength)
 

Private Attributes

PUSBUSER_REQUEST_HEADER m_Header
 
ULONG m_BufferLength
 

Detailed Description

One IOCTL_USB_USER_REQUEST: the header and the payload right after it.

Definition at line 34 of file userreq.cpp.

Constructor & Destructor Documentation

◆ UcxUserRequest()

UcxUserRequest::UcxUserRequest ( _In_ PUSBUSER_REQUEST_HEADER  Header,
_In_ ULONG  BufferLength 
)
inline

Definition at line 37 of file userreq.cpp.

42 {
43 }
Definition: Header.h:9
ULONG m_BufferLength
Definition: userreq.cpp:91
PUSBUSER_REQUEST_HEADER m_Header
Definition: userreq.cpp:90
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG BufferLength
Definition: wdfdevice.h:3777

Member Function Documentation

◆ CheckParameterLength()

BOOLEAN UcxUserRequest::CheckParameterLength ( _In_ ULONG  ParameterLength)
inline

The total size is reported even when it does not fit.

Definition at line 73 of file userreq.cpp.

75 {
76 m_Header->ActualBufferLength = UCX_USER_HEADER_SIZE + ParameterLength;
77
78 if (m_Header->ActualBufferLength > m_Header->RequestBufferLength)
79 {
80 DPRINT1("USBUSER request 0x%lx needs %lu bytes, got %lu\n",
81 m_Header->UsbUserRequest, m_Header->ActualBufferLength, m_Header->RequestBufferLength);
82 SetStatus(UsbUserBufferTooSmall);
83 return FALSE;
84 }
85
86 return TRUE;
87 }
#define DPRINT1
Definition: precomp.h:8
VOID SetStatus(_In_ USB_USER_ERROR_CODE Status)
Definition: userreq.cpp:65
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
_In_ ULONG ParameterLength
Definition: usbdlib.h:233
#define UCX_USER_HEADER_SIZE
Definition: userreq.cpp:26

◆ Header()

PUSBUSER_REQUEST_HEADER UcxUserRequest::Header ( ) const
inline

Definition at line 53 of file userreq.cpp.

54 {
55 return m_Header;
56 }

◆ NameSpace()

ULONG UcxUserRequest::NameSpace ( ) const
inline

Definition at line 59 of file userreq.cpp.

60 {
62 }

◆ Payload()

template<typename T >
T * UcxUserRequest::Payload ( ) const
inline

Definition at line 47 of file userreq.cpp.

48 {
49 return (T*)(m_Header + 1);
50 }
#define T(num)
Definition: thunks.c:311

◆ SetStatus()

VOID UcxUserRequest::SetStatus ( _In_ USB_USER_ERROR_CODE  Status)
inline

Definition at line 65 of file userreq.cpp.

67 {
68 m_Header->UsbUserStatusCode = Status;
69 }
NTSTATUS Status
Definition: userreq.cpp:157

Referenced by CheckParameterLength().

Member Data Documentation

◆ m_BufferLength

ULONG UcxUserRequest::m_BufferLength
private

Definition at line 91 of file userreq.cpp.

Referenced by NameSpace().

◆ m_Header

PUSBUSER_REQUEST_HEADER UcxUserRequest::m_Header
private

Definition at line 90 of file userreq.cpp.

Referenced by CheckParameterLength(), Header(), Payload(), and SetStatus().


The documentation for this class was generated from the following file: