ReactOS  0.4.15-dev-2700-g4b4ffa9
fxmemorybufferpreallocated.cpp
Go to the documentation of this file.
1 /*++
2 
3 Copyright (c) Microsoft Corporation
4 
5 Module Name:
6 
7  FxMemoryBufferPreallocated.cpp
8 
9 Abstract:
10 
11  This module implements a frameworks managed FxMemoryBufferPreallocated
12 
13 Author:
14 
15 Environment:
16 
17  kernel mode only
18 
19 Revision History:
20 
21 --*/
22 
23 #include "coreprivshared.hpp"
25 
27  _In_ PFX_DRIVER_GLOBALS FxDriverGlobals,
29  _In_ size_t BufferSize
30  ) :
31  FxMemoryObject(FxDriverGlobals, sizeof(*this), BufferSize),
32  m_pBuffer(Buffer)
33 /*++
34 
35 Routine Description:
36  Contstructor for this object. Stores off all the pointers and sizes passed
37  in by the caller.
38 
39 Arguments:
40  Buffer - Buffer to associate with this object
41 
42  BufferSize - Size of Buffer in bytes
43 
44 Return Value:
45  None
46 
47  --*/
48 {
49 }
50 
52  _In_ PFX_DRIVER_GLOBALS FxDriverGlobals,
53  _In_ USHORT ObjectSize,
55  _In_ size_t BufferSize
56  ) :
57  FxMemoryObject(FxDriverGlobals, ObjectSize, BufferSize),
58  m_pBuffer(Buffer)
59 /*++
60 
61 Routine Description:
62  Contstructor for this object. Stores off all the pointers and sizes passed
63  in by the caller.
64 
65 Arguments:
66  ObjectSize - Size of the derived object
67 
68  Buffer - Buffer to associate with this object
69 
70  BufferSize - Size of Buffer in bytes
71 
72 Return Value:
73  None
74 
75  --*/
76 {
77 }
78 
79 
81  __in USHORT ObjectSize,
82  __in PFX_DRIVER_GLOBALS FxDriverGlobals
83  ) : FxMemoryObject(FxDriverGlobals, ObjectSize, 0), m_pBuffer(NULL)
84 /*++
85 
86 Routine Description:
87  Contstructor for this object. Stores off all the pointers and sizes passed
88  in by the caller.
89 
90 Arguments:
91  ObjectSize - Size of the derived object.
92 
93 Return Value:
94  None
95 
96  --*/
97 {
98 }
99 
101 /*++
102 
103 Routine Description:
104  Destructor for this object. Does nothing with the client memory since
105  the client owns it.
106 
107 Arguments:
108  None
109 
110 Return Value:
111  None
112 
113  --*/
114 {
115 }
116 
118 NTSTATUS
121  )
122 {
123  if (Params->Type == FX_TYPE_MEMORY_PREALLOCATED) {
124  *Params->Object = (FxMemoryBufferPreallocated*) this;
125  return STATUS_SUCCESS;
126  }
127  else {
128  return FxMemoryObject::QueryInterface(Params); // __super call
129  }
130 }
131 
132 VOID
135  _In_ size_t BufferSize
136  )
137 /*++
138 
139 Routine Description:
140  Updates the internal pointer to a new value.
141 
142 
143 Arguments:
144  Buffer - new buffer
145 
146  BufferSize - length of Buffer in bytes
147 
148 Return Value:
149  None.
150 
151  --*/
152 
153 {
154  m_pBuffer = Buffer;
156 }
#define _Must_inspect_result_
Definition: no_sal2.h:62
_In_ WDFIOTARGET _In_ PWDF_REQUEST_COMPLETION_PARAMS Params
Definition: wdfrequest.h:306
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
VOID UpdateBuffer(_Pre_notnull_ _Pre_writable_byte_size_(BufferSize) PVOID Buffer, _In_ size_t BufferSize)
LONG NTSTATUS
Definition: precomp.h:26
Definition: bufpool.h:45
#define __inout
Definition: dbghelp.h:50
#define _Pre_notnull_
Definition: no_sal2.h:516
#define _In_
Definition: no_sal2.h:158
unsigned short USHORT
Definition: pedump.c:61
FxMemoryBufferPreallocated(_In_ PFX_DRIVER_GLOBALS FxDriverGlobals, _Pre_notnull_ _Pre_writable_byte_size_(BufferSize) PVOID Buffer, _In_ size_t BufferSize)
#define NULL
Definition: types.h:112
_Must_inspect_result_ NTSTATUS QueryInterface(__inout FxQueryInterfaceParams *Params)
#define _Pre_writable_byte_size_(s)
Definition: no_sal2.h:534
#define STATUS_SUCCESS
Definition: shellext.h:65
#define __in
Definition: dbghelp.h:35
virtual _Must_inspect_result_ NTSTATUS QueryInterface(__inout FxQueryInterfaceParams *Params)
#define BufferSize
Definition: mmc.h:75
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
Definition: wdfmemory.h:251