ReactOS  0.4.15-dev-2947-g59e1b78
fxrequestcontext.cpp
Go to the documentation of this file.
1 /*++
2 
3 Copyright (c) Microsoft Corporation
4 
5 Module Name:
6 
7  FxRequestContext.cpp
8 
9 Abstract:
10 
11  This module implements FxRequest object
12 
13 Author:
14 
15 
16 
17 Environment:
18 
19  Both kernel and user mode
20 
21 Revision History:
22 
23 
24 
25 --*/
26 
27 #include "coreprivshared.hpp"
28 
29 // Tracing support
30 extern "C" {
31 // #include "FxRequestContext.tmh"
32 }
33 
36  ) :
37  m_RequestType(Type),
38  m_RequestMemory(NULL)
39 
40 /*++
41 
42 Routine Description:
43  Constructs an FxRequestContext and initialized the m_RequestType field
44 
45 Arguments:
46  Type - The type of this request.
47 
48 
49 
50 
51 
52 Return Value:
53  None.
54 
55  --*/
56 {
58 }
59 
61 /*++
62 
63 Routine Description:
64  Destruct for an FxRequestContext. Releases all outstanding references.
65 
66 Arguments:
67  None
68 
69 Return Value:
70  None
71 
72  --*/
73 {
75 }
76 
77 VOID
80  )
81 {
83 }
84 
85 VOID
88  )
89 /*++
90 
91 Routine 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 
96 Arguments:
97  Irp
98 
99 Return 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 
119 VOID
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 
144 VOID
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 
165 VOID
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 
186 VOID
189  )
190 {
195 }
IFxMemory * m_RequestMemory
FxRequestContext(__in FX_REQUEST_CONTEXT_TYPE Type)
_Must_inspect_result_ __in WDFUSBPIPE __in WDFREQUEST __in_opt WDFMEMORY __in_opt PWDFMEMORY_OFFSET ReadOffsets
struct _WDF_REQUEST_COMPLETION_PARAMS::@3670::@3672 Read
#define __in_opt
Definition: dbghelp.h:38
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
_In_ WDFREQUEST Request
Definition: wdfdevice.h:547
_Must_inspect_result_ __in WDFUSBPIPE __in WDFREQUEST __in_opt WDFMEMORY __in_opt PWDFMEMORY_OFFSET WriteOffsets
VOID FormatWriteParams(__in_opt IFxMemory *WriteMemory, __in_opt PWDFMEMORY_OFFSET WriteOffsets)
struct _WDF_REQUEST_COMPLETION_PARAMS::@3670::@3674 Others
VOID __inline InitCompletionParams(VOID)
size_t BufferOffset
Definition: wdfmemory.h:65
union _WDF_REQUEST_COMPLETION_PARAMS::@3670 Parameters
virtual VOID ReleaseAndRestore(__in FxRequestBase *Request)
VOID FormatReadParams(__in_opt IFxMemory *ReadMemory, __in_opt PWDFMEMORY_OFFSET ReadOffsets)
virtual ~FxRequestContext(VOID)
Definition: bufpool.h:45
VOID FormatOtherParams(__in FxInternalIoctlParams *InternalIoctlParams)
struct _WDF_REQUEST_COMPLETION_PARAMS::@3670::@3671 Write
#define ASSERT(a)
Definition: mode.c:44
Type
Definition: Type.h:6
_Must_inspect_result_ _In_ WDFUSBPIPE _In_ WDFREQUEST _In_opt_ WDFMEMORY ReadMemory
Definition: wdfusb.h:1996
virtual VOID StoreAndReferenceMemory(__in FxRequestBuffer *Buffer)
_Must_inspect_result_ _In_ WDFDEVICE _In_ BOOLEAN _In_opt_ PVOID Tag
Definition: wdfdevice.h:4061
FxInternalIoctlParams InternalIoctlParams
UCHAR FX_REQUEST_CONTEXT_TYPE
WDF_REQUEST_COMPLETION_PARAMS m_CompletionParams
#define NULL
Definition: types.h:112
static VOID _StoreAndReferenceMemoryWorker(__in PVOID Tag, __deref_out_opt IFxMemory **PPMemory, __in FxRequestBuffer *Buffer)
#define __deref_out_opt
Definition: dbghelp.h:29
_Must_inspect_result_ _In_ WDFUSBPIPE _In_ WDFREQUEST _In_opt_ WDFMEMORY WriteMemory
Definition: wdfusb.h:1914
#define __in
Definition: dbghelp.h:35