ReactOS  0.4.15-dev-3207-ga415bd4
fxmemorybuffer.hpp
Go to the documentation of this file.
1 /*++
2 
3 Copyright (c) Microsoft Corporation
4 
5 Module Name:
6 
7  FxMemoryBuffer.hpp
8 
9 Abstract:
10 
11 Author:
12 
13 Environment:
14 
15  kernel mode only
16 
17 Revision History:
18 
19 
20 --*/
21 
22 #ifndef _FXMEMORYBUFFER_H_
23 #define _FXMEMORYBUFFER_H_
24 
26 
27 public:
28 
29  // Factory function
30  static
32  NTSTATUS
33  _Create(
37  __in size_t BufferSize,
40  );
41 
43  __in PFX_DRIVER_GLOBALS FxDriverGlobals,
44  __in size_t BufferSize
45  );
46 
47  PVOID
48  GetBuffer(
49  VOID
50  );
51 
52  PVOID
53  __inline
54  operator new(
55  __in size_t Size,
56  __in PFX_DRIVER_GLOBALS FxDriverGlobals,
58  __in USHORT ExtraSize,
59  __in ULONG Tag,
61  )
62  {
63  //
64  // PoolType must be non paged pool but it can be NonPagedPool
65  // or NonPagedPoolNx or their variants
66  //
68 
69  //
70  // Specialize operator new so that we can use the caller's tag when
71  // making the object allocation vs using the default driver-wide tag.
72  //
73  return FxObjectHandleAlloc(FxDriverGlobals,
74  PoolType,
75  Size,
76  Tag,
77  Attributes,
78  ExtraSize,
80  }
81 
82 protected:
83 
85  __in PFX_DRIVER_GLOBALS FxDriverGlobals,
86  __in USHORT ObjectSize,
87  __in size_t BufferSize
88  );
89 
91 };
92 
93 #endif // _FXMEMORYBUFFER_H_
BOOLEAN FxIsPagedPoolType(__in POOL_TYPE Type)
Definition: wdfpool.cpp:43
#define __in_opt
Definition: dbghelp.h:38
FxMemoryBuffer(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in size_t BufferSize)
LONG NTSTATUS
Definition: precomp.h:26
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
DriverGlobals
PVOID GetBuffer(VOID)
enum FxObjectType UINT32 enum FxWmiInstanceAction UINT32 enum FxDriverObjectUmFlags USHORT enum FxWakeInterruptEvents UINT32 PVOID FxObjectHandleAlloc(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in POOL_TYPE PoolType, __in size_t Size, __in ULONG Tag, __in_opt PWDF_OBJECT_ATTRIBUTES Attributes, __in USHORT ExtraSize, __in FxObjectType ObjectType)
Definition: handleapi.cpp:163
#define __out
Definition: dbghelp.h:62
#define ASSERT(a)
Definition: mode.c:44
INT POOL_TYPE
Definition: typedefs.h:78
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ _Strict_type_match_ POOL_TYPE _In_opt_ ULONG PoolTag
Definition: wdfmemory.h:159
#define _Must_inspect_result_
Definition: ms_sal.h:558
_Must_inspect_result_ _In_ WDFDEVICE _In_ BOOLEAN _In_opt_ PVOID Tag
Definition: wdfdevice.h:4061
_Must_inspect_result_ _In_ WDFCOLLECTION _In_ WDFOBJECT Object
unsigned short USHORT
Definition: pedump.c:61
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ _Strict_type_match_ POOL_TYPE PoolType
Definition: wdfdevice.h:3810
unsigned int ULONG
Definition: retypes.h:1
static _Must_inspect_result_ NTSTATUS _Create(__in PFX_DRIVER_GLOBALS DriverGlobals, __in_opt PWDF_OBJECT_ATTRIBUTES Attributes, __in ULONG PoolTag, __in size_t BufferSize, __in POOL_TYPE PoolType, __out FxMemoryObject **Object)
#define __in
Definition: dbghelp.h:35
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
Definition: wdfmemory.h:251
_Must_inspect_result_ _In_ WDFDMAENABLER _In_ _In_opt_ PWDF_OBJECT_ATTRIBUTES Attributes