ReactOS 0.4.15-dev-7958-gcd0bb1a
fxrequestum.cpp
Go to the documentation of this file.
1/*++
2
3Copyright (c) Microsoft Corporation
4
5Module Name:
6
7 FxRequestUm.cpp
8
9Abstract:
10
11 This module implements KM specific FxRequest object routines
12
13Author:
14
15
16
17Environment:
18
19 User mode only
20
21Revision History:
22
23
24--*/
25
26#include "coreprivshared.hpp"
27
28// Tracing support
29extern "C" {
30#include "FxRequestUm.tmh"
31}
32
33VOID
35 VOID
36 )
37/*++
38
39Routine Description:
40 This routine is never actually called by running code, it just has
41 WDFCASSERTs who upon failure, would not allow this file to be compiled.
42
43 DO NOT REMOVE THIS FUNCTION just because it is not called by any running
44 code.
45
46Arguments:
47 None
48
49Return Value:
50 None
51
52 --*/
53{
54 ASSERTMSG("Not implemented for UMDF\n", FALSE);
55}
56
57
61 __out PMDL *pMdl
62 )
63{
65
66 ASSERTMSG("Not implemented for UMDF\n", FALSE);
67
69}
70
71
75 __out PMDL *pMdl
76 )
77/*++
78
79Routine Description:
80
81 Return the IRP_MJ_DEVICE_CONTROL OutputBuffer as an MDL
82
83 The MDL is automatically released when the request is completed.
84
85 The MDL is not valid for a METHOD_NEITHER IRP_MJ_DEVICE_CONTROL,
86 or for any request other than IRP_MJ_DEVICE_CONTROL.
87
88 The MDL is as follows for each buffering mode:
89
90 METHOD_BUFFERED:
91
92 MmBuildMdlForNonPagedPool(IoAllocateMdl(Irp->UserBuffer, ... ))
93
94 METHOD_IN_DIRECT:
95
96 Irp->MdlAddress
97
98 METHOD_OUT_DIRECT:
99
100 Irp->MdlAddress
101
102 METHOD_NEITHER:
103
104 NULL. Must use WdfDeviceInitSetIoInCallerContextCallback in order
105 to access the request in the calling threads address space before
106 it is placed into any I/O Queues.
107
108 The MDL is only valid until the request is completed.
109
110Arguments:
111
112 pMdl- Pointer location to return MDL ptr
113
114Returns:
115
116 NTSTATUS
117
118--*/
119{
121
122 ASSERTMSG("Not implemented for UMDF\n", FALSE);
123
125}
126
133 )
134
135/*++
136
137Routine Description:
138
139 Probe and lock a memory buffer for reading.
140
141 This is to be called in the proper process context, and
142 will generate an FxRequestMemory object if successful.
143
144 The FxRequestMemory object will be associated with the FxRequest
145 object, and is automatically released when the FxRequest is completed.
146
147 This function performs validation to ensure that the current
148 thread is in the same process as the thread that originated
149 the I/O request.
150
151Arguments:
152
153
154 Buffer - Buffer to lock down
155
156 Length - Length of buffer
157
158 MemoryObject - FxRequestMemory object to return
159
160Returns:
161
162 NTSTATUS
163
164--*/
165
166{
170
171 ASSERTMSG("Not implemented for UMDF\n", FALSE);
172
174}
175
182 )
183
184/*++
185
186Routine Description:
187
188 Probe and lock a memory buffer for writing.
189
190 This is to be called in the proper process context, and
191 will generate an FxRequestMemory object if successful.
192
193 The FxRequestMemory object will be associated with the FxRequest
194 object, and is automatically released when the FxRequest is completed.
195
196 This function performs validation to ensure that the current
197 thread is in the same process as the thread that originated
198 the I/O request.
199
200Arguments:
201
202
203 Buffer - Buffer to lock down
204
205 Length - Length of buffer
206
207 MemoryObject - FxRequestMemory object to return
208
209Returns:
210
211 NTSTATUS
212
213--*/
214
215{
219
220 ASSERTMSG("Not implemented for UMDF\n", FALSE);
221
223}
224
228 _In_ PFN_WDF_REQUEST_IMPERSONATE EvtRequestImpersonate,
230 )
231{
232 DDI_ENTRY();
233
235 HRESULT hr;
236 MdIrp irp;
237
238 status = GetIrp(&irp);
239 if (!NT_SUCCESS(status)) {
241 "WDFREQUEST is already completed 0x%p, %!STATUS!",
242 GetHandle(), status);
244 return status;
245 }
246
247 hr = irp->ImpersonateRequestorProcess(ImpersonationLevel);
248
249 if (SUCCEEDED(hr)) {
252 irp->RevertImpersonation();
253 }
254 else {
255 status = GetDevice()->NtStatusFromHr(hr);
257 "WDFREQUEST 0x%p, Could not impersonate, %!STATUS!",
258 GetHandle(), status);
259 }
260
261 return status;
262}
263
264
LONG NTSTATUS
Definition: precomp.h:26
Definition: bufpool.h:45
__inline PFX_DRIVER_GLOBALS GetDriverGlobals(VOID)
Definition: fxobject.hpp:734
_Must_inspect_result_ NTSTATUS GetDeviceControlOutputMdl(__out PMDL *pMdl)
_Must_inspect_result_ NTSTATUS ProbeAndLockForRead(__in PVOID Buffer, __in ULONG Length, __deref_out FxRequestMemory **pMemoryObject)
_Must_inspect_result_ NTSTATUS GetMdl(__out PMDL *pMdl)
Definition: fxrequestkm.cpp:80
_Must_inspect_result_ NTSTATUS ProbeAndLockForWrite(__in PVOID Buffer, __in ULONG Length, __deref_out FxRequestMemory **pMemoryObject)
_Must_inspect_result_ NTSTATUS GetIrp(__deref_out MdIrp *ppIrp)
Definition: fxrequest.hpp:975
_Must_inspect_result_ NTSTATUS Impersonate(_In_ SECURITY_IMPERSONATION_LEVEL ImpersonationLevel, _In_ PFN_WDF_REQUEST_IMPERSONATE EvtRequestImpersonate, _In_opt_ PVOID Context)
static VOID CheckAssumptions(VOID)
Definition: fxrequestkm.cpp:34
#define __in
Definition: dbghelp.h:35
#define __deref_out
Definition: dbghelp.h:26
#define __out
Definition: dbghelp.h:62
#define TRACINGREQUEST
Definition: dbgtrace.h:65
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
return pList GetDevice()
FxVerifierDbgBreakPoint(pFxDriverGlobals)
#define DDI_ENTRY()
Definition: fxglobalskm.h:56
FxIrp * irp
_Must_inspect_result_ _In_ WDFREQUEST _In_ SECURITY_IMPERSONATION_LEVEL _In_ PFN_WDF_REQUEST_IMPERSONATE EvtRequestImpersonate
#define SUCCEEDED(hr)
Definition: intsafe.h:50
enum _SECURITY_IMPERSONATION_LEVEL SECURITY_IMPERSONATION_LEVEL
#define _Must_inspect_result_
Definition: ms_sal.h:558
#define _In_
Definition: ms_sal.h:308
#define _In_opt_
Definition: ms_sal.h:309
IWudfIrp * MdIrp
Definition: mxum.h:103
#define ASSERTMSG(msg, exp)
Definition: nt_native.h:431
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:239
#define STATUS_SUCCESS
Definition: shellext.h:65
HRESULT hr
Definition: shlfolder.c:183
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
Definition: ps.c:97
#define GetHandle(h)
Definition: treelist.c:116
uint32_t ULONG
Definition: typedefs.h:59
_Must_inspect_result_ _In_ WDFREQUEST _In_ size_t _Out_ WDFMEMORY * MemoryObject
Definition: wdfrequest.h:1473
_Out_ PBOOLEAN _Out_ PBOOLEAN _Out_ PSECURITY_IMPERSONATION_LEVEL ImpersonationLevel
Definition: psfuncs.h:156