ReactOS 0.4.15-dev-7953-g1f49173
fxrequestcontext.cpp
Go to the documentation of this file.
1/*++
2
3Copyright (c) Microsoft Corporation
4
5Module Name:
6
7 FxRequestContext.cpp
8
9Abstract:
10
11 This module implements FxRequest object
12
13Author:
14
15
16
17Environment:
18
19 Both kernel and user mode
20
21Revision History:
22
23
24
25--*/
26
27#include "coreprivshared.hpp"
28
29// Tracing support
30extern "C" {
31// #include "FxRequestContext.tmh"
32}
33
36 ) :
37 m_RequestType(Type),
38 m_RequestMemory(NULL)
39
40/*++
41
42Routine Description:
43 Constructs an FxRequestContext and initialized the m_RequestType field
44
45Arguments:
46 Type - The type of this request.
47
48
49
50
51
52Return Value:
53 None.
54
55 --*/
56{
58}
59
61/*++
62
63Routine Description:
64 Destruct for an FxRequestContext. Releases all outstanding references.
65
66Arguments:
67 None
68
69Return Value:
70 None
71
72 --*/
73{
75}
76
77VOID
80 )
81{
83}
84
85VOID
88 )
89/*++
90
91Routine Description:
92 This routine releases any outstanding references taken on the previous
93 format call and restores any fields in the PIRP that were overwritten
94 when the formatting occurred.
95
96Arguments:
97 Irp
98
99Return Value:
100
101
102 --*/
103
104{
105#if (FX_CORE_MODE == FX_CORE_KERNEL_MODE)
106 Request->FreeMdls();
107#else
109#endif
110
111 if (m_RequestMemory != NULL) {
112 m_RequestMemory->RELEASE(this);
114 }
115
117}
118
119VOID
121 __in PVOID Tag,
122 __deref_out_opt IFxMemory** PPMemory,
124 )
125{
126 ASSERT(*PPMemory == NULL);
127
128 switch (Buffer->DataType) {
130 Buffer->u.Memory.Memory->ADDREF(Tag);
131 *PPMemory = Buffer->u.Memory.Memory;
132 break;
133
135 Buffer->u.RefMdl.Memory->ADDREF(Tag);
136 *PPMemory = Buffer->u.RefMdl.Memory;
137 break;
138
139 default:
140 *PPMemory = NULL;
141 }
142}
143
144VOID
148 )
149{
151
152 if (WriteMemory != NULL) {
153 m_CompletionParams.Parameters.Write.Buffer = WriteMemory->GetHandle();
154 }
155
156 if (WriteOffsets != NULL) {
159 }
160 else {
162 }
163}
164
165VOID
169 )
170{
172
173 if (ReadMemory != NULL) {
174 m_CompletionParams.Parameters.Read.Buffer = ReadMemory->GetHandle();
175 }
176
177 if (ReadOffsets != NULL) {
180 }
181 else {
183 }
184}
185
186VOID
189 )
190{
195}
Type
Definition: Type.h:7
Definition: bufpool.h:45
#define __in
Definition: dbghelp.h:35
#define __in_opt
Definition: dbghelp.h:38
#define __deref_out_opt
Definition: dbghelp.h:29
#define NULL
Definition: types.h:112
FxInternalIoctlParams InternalIoctlParams
@ FxRequestBufferMemory
@ FxRequestBufferReferencedMdl
UCHAR FX_REQUEST_CONTEXT_TYPE
_Must_inspect_result_ __in WDFUSBPIPE __in WDFREQUEST __in_opt WDFMEMORY __in_opt PWDFMEMORY_OFFSET WriteOffsets
_Must_inspect_result_ __in WDFUSBPIPE __in WDFREQUEST __in_opt WDFMEMORY __in_opt PWDFMEMORY_OFFSET ReadOffsets
#define ASSERT(a)
Definition: mode.c:44
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
virtual VOID ReleaseAndRestore(__in FxRequestBase *Request)
FxRequestContext(__in FX_REQUEST_CONTEXT_TYPE Type)
WDF_REQUEST_COMPLETION_PARAMS m_CompletionParams
virtual VOID StoreAndReferenceMemory(__in FxRequestBuffer *Buffer)
static VOID _StoreAndReferenceMemoryWorker(__in PVOID Tag, __deref_out_opt IFxMemory **PPMemory, __in FxRequestBuffer *Buffer)
IFxMemory * m_RequestMemory
virtual ~FxRequestContext(VOID)
VOID __inline InitCompletionParams(VOID)
VOID FormatReadParams(__in_opt IFxMemory *ReadMemory, __in_opt PWDFMEMORY_OFFSET ReadOffsets)
VOID FormatOtherParams(__in FxInternalIoctlParams *InternalIoctlParams)
VOID FormatWriteParams(__in_opt IFxMemory *WriteMemory, __in_opt PWDFMEMORY_OFFSET WriteOffsets)
size_t BufferOffset
Definition: wdfmemory.h:65
struct _WDF_REQUEST_COMPLETION_PARAMS::@3887::@3889 Read
struct _WDF_REQUEST_COMPLETION_PARAMS::@3887::@3888 Write
union _WDF_REQUEST_COMPLETION_PARAMS::@3887 Parameters
struct _WDF_REQUEST_COMPLETION_PARAMS::@3887::@3891 Others
_Must_inspect_result_ _In_ WDFDEVICE _In_ BOOLEAN _In_opt_ PVOID Tag
Definition: wdfdevice.h:4065
@ WdfRequestTypeOther
Definition: wdfdevice.h:531
@ WdfRequestTypeWrite
Definition: wdfdevice.h:507
@ WdfRequestTypeRead
Definition: wdfdevice.h:506
_In_ WDFREQUEST Request
Definition: wdfdevice.h:547
_Must_inspect_result_ _In_ WDFUSBPIPE _In_ WDFREQUEST _In_opt_ WDFMEMORY ReadMemory
Definition: wdfusb.h:2000
_Must_inspect_result_ _In_ WDFUSBPIPE _In_ WDFREQUEST _In_opt_ WDFMEMORY WriteMemory
Definition: wdfusb.h:1918