ReactOS  0.4.15-dev-3331-g8ebe441
fxrequestbasekm.hpp
Go to the documentation of this file.
1 /*++
2 
3  Copyright (c) Microsoft Corporation
4 
5  Module Name:
6 
7  FxRequestBaseKm.hpp
8 
9  Abstract:
10 
11  This module implements km specific functions for FxRequestBase.
12 
13  Author:
14 
15 
16 
17  Environment:
18 
19  Kernel mode only
20 
21  Revision History:
22 
23  --*/
24 
25 #ifndef _FXREQUESTBASEKM_HPP_
26 #define _FXREQUESTBASEKM_HPP_
27 
28 
29 VOID
30 __inline
32  VOID
33  )
34 {
35  PMDL pMdl, pNext;
36 
37  if (IsAllocatedFromIo() || IsCanComplete()) {
38  return;
39  }
40 
41  pMdl = m_Irp.GetIrp()->MdlAddress;
42 
43  //
44  // Free any PMDLs that the lower layer allocated. Since we are going
45  // to free the PIRP ourself and not call IoCompleteRequest, we must mimic
46  // the behavior in IoCompleteRequest which does the same thing.
47  //
48  while (pMdl != NULL) {
49  pNext = pMdl->Next;
50 
51  if (pMdl->MdlFlags & MDL_PAGES_LOCKED) {
52  MmUnlockPages(pMdl);
53  }
54  else if (GetDriverGlobals()->FxVerifierOn) {
55  DbgPrint("pMdl %p, Flags 0x%x in PIRP %p should be locked",
56  pMdl, pMdl->MdlFlags, m_Irp.GetIrp());
57 
59  }
60 
61  FxIrpMdlFree(pMdl);
62  pMdl = pNext;
63  }
64 
65  m_Irp.GetIrp()->MdlAddress = NULL;
66 }
67 
68 #endif // _FXREQUESTBASEKM_HPP
#define DbgPrint
Definition: hal.h:12
VOID NTAPI MmUnlockPages(IN PMDL Mdl)
Definition: mdlsup.c:1426
BOOLEAN __inline IsAllocatedFromIo(VOID)
VOID FreeMdls(VOID)
#define MDL_PAGES_LOCKED
Definition: mmtypes.h:19
VOID __inline FxIrpMdlFree(__in PMDL Mdl)
Definition: fxmdl.h:75
__inline PFX_DRIVER_GLOBALS GetDriverGlobals(VOID)
Definition: fxobject.hpp:734
MdIrp GetIrp(VOID)
Definition: fxirpum.cpp:15
BOOLEAN __inline IsCanComplete(VOID)
#define NULL
Definition: types.h:112
FxVerifierDbgBreakPoint(pFxDriverGlobals)