1 /*++ 2 3 Copyright (c) Microsoft Corporation 4 5 Module Name: 6 7 FxStump.hpp 8 9 Abstract: 10 11 Author: 12 13 Revision History: 14 15 --*/ 16 17 #ifndef _FXSTUMP_HPP_ 18 #define _FXSTUMP_HPP_ 19 20 struct FxStump { 21 22 protected: FxStumpFxStump23 FxStump( 24 VOID 25 ) 26 { 27 } 28 29 public: 30 PVOID operator newFxStump31 operator new( 32 __in size_t Size, 33 __in PFX_DRIVER_GLOBALS FxDriverGlobals 34 ) 35 { 36 return FxPoolAllocate(FxDriverGlobals, NonPagedPool, Size); 37 } 38 39 PVOID operator newFxStump40 operator new( 41 __in size_t Size, 42 __in PFX_DRIVER_GLOBALS FxDriverGlobals, 43 __in POOL_TYPE PoolType 44 ) 45 { 46 return FxPoolAllocate(FxDriverGlobals, PoolType, Size); 47 } 48 49 VOID operator deleteFxStump50 operator delete( 51 __in PVOID pointer 52 ) 53 { 54 if (pointer) { 55 FxPoolFree(pointer); 56 } 57 } 58 59 #if (FX_CORE_MODE == FX_CORE_USER_MODE) 60 61 PVOID operator new[]FxStump62 operator new[]( 63 __in size_t Size, 64 __in PFX_DRIVER_GLOBALS FxDriverGlobals 65 ) 66 { 67 return FxPoolAllocate(FxDriverGlobals, NonPagedPool, Size); 68 } 69 70 VOID operator delete[]FxStump71 operator delete[]( 72 __in PVOID pointer 73 ) 74 { 75 if (pointer) { 76 FxPoolFree(pointer); 77 } 78 } 79 80 #endif 81 82 }; 83 84 struct FxGlobalsStump : public FxStump { 85 86 private: 87 PFX_DRIVER_GLOBALS m_Globals; 88 89 public: FxGlobalsStumpFxGlobalsStump90 FxGlobalsStump( 91 __in PFX_DRIVER_GLOBALS FxDriverGlobals 92 ) 93 { 94 m_Globals = FxDriverGlobals; 95 } 96 97 PFX_DRIVER_GLOBALS GetDriverGlobalsFxGlobalsStump98 GetDriverGlobals( 99 VOID 100 ) 101 { 102 return m_Globals; 103 } 104 }; 105 106 #endif // _FXSTUMP_HPP_ 107 108