ReactOS  0.4.15-dev-3017-g1d9542d
fxrequestbufferum.cpp
Go to the documentation of this file.
1 /*++
2 
3 Copyright (c) Microsoft. All rights reserved.
4 
5 Module Name:
6 
7  FxRequestBufferUm.cpp
8 
9 Abstract:
10 
11  This module implements a memory union object
12 
13 Author:
14 
15 
16 
17 Environment:
18 
19  User mode only
20 
21 Revision History:
22 
23 --*/
24 
25 #include "FxSupportPch.hpp"
26 
27 extern "C" {
28 #include "FxRequestBufferUm.tmh"
29 }
30 
34  __in PFX_DRIVER_GLOBALS FxDriverGlobals,
36  __inout PMDL* MdlToFree,
37  __inout PBOOLEAN UnlockWhenFreed,
39  __in BOOLEAN ReuseMdl,
40  __inout_opt size_t* SizeOfMdl
41  )
42 /*++
43 
44 Routine Description:
45 
46  This function attempts to reuse the passed-in MDL (if any) or allocates
47  a new MDL if reuse flag isn't passed-in or if the existing MDL isn't
48  big enough.
49 
50 Arguments:
51 
52 Return Value:
53  FxDriverGlobals - Driver globals
54 
55  Mdl - on return it contains the MDL allocated/reused
56 
57  MdlToFree - pointer to any MDL
58  * to be reused, if the size is <= current size, or
59  * freed and set to newly allocated MDL
60 
61  UnlockWhenFreed - whether to unlock pages when freeing MDL
62  (if FALSE, MDL may represent just MDL buffer but the pages
63  might have already been unlocked)
64 
65  Operation - Operation to pass to MmLockPages
66 
67  ReuseMdl - whether to reuse *MdlToFree
68  Please note that this can be FALSE even when MDL is supplied
69 
70  SizeOfMdl - on input contains size of *MdlToFree,
71  on return contains size of *Mdl
72 
73 Remarks:
74 
75  *MdlToFree is modified only when this function frees the passed in MDL
76  Otherwise it leaves it untouched. Caller is responsible for storing
77  properly initialized value and/or freeing what's stored in the value.
78 
79  --*/
80 {
81  UNREFERENCED_PARAMETER(FxDriverGlobals);
83  UNREFERENCED_PARAMETER(MdlToFree);
84  UNREFERENCED_PARAMETER(UnlockWhenFreed);
86  UNREFERENCED_PARAMETER(ReuseMdl);
88 
91 }
92 
93 VOID
96  __in PWDFMEMORY_OFFSET Offsets
97  )
98 {
100  u.Memory.Memory = Memory;
101  u.Memory.Offsets = Offsets;
102 }
103 
VOID SetMemory(__in IFxMemory *Memory, __in PWDFMEMORY_OFFSET Offsets)
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
LONG NTSTATUS
Definition: precomp.h:26
PWDFMEMORY_OFFSET Offsets
VOID UfxVerifierTrapNotImpl()
#define __inout_opt
Definition: dbghelp.h:53
return STATUS_NOT_IMPLEMENTED
unsigned char BOOLEAN
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ _Strict_type_match_ POOL_TYPE _In_opt_ ULONG _In_ _Out_ WDFMEMORY * Memory
Definition: wdfmemory.h:169
union FxRequestBuffer::@4582 u
char * PBOOLEAN
Definition: retypes.h:11
static ULONG SizeOfMdl(VOID)
Definition: NtReadFile.c:36
#define __inout
Definition: dbghelp.h:50
#define _Must_inspect_result_
Definition: ms_sal.h:558
enum _LOCK_OPERATION LOCK_OPERATION
FxRequestBufferType DataType
_In_ WDFDEVICE _In_ PVOID _In_opt_ PMDL Mdl
#define __deref_out_opt
Definition: dbghelp.h:29
_Must_inspect_result_ NTSTATUS GetOrAllocateMdl(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __deref_out_opt PMDL *Mdl, __inout PMDL *MdlToFree, __inout PBOOLEAN UnlockWhenFreed, __in LOCK_OPERATION Operation, __in BOOLEAN ReuseMdl=FALSE, __inout_opt size_t *SizeOfMdl=NULL)
_In_ FLT_SET_CONTEXT_OPERATION Operation
Definition: fltkernel.h:1467
#define __in
Definition: dbghelp.h:35