ReactOS 0.4.16-dev-197-g92996da
ifxmemory.hpp
Go to the documentation of this file.
1//
2// Copyright (C) Microsoft. All rights reserved.
3//
4/*++
5
6Module Name:
7
8 IFxMemory.hpp
9
10Abstract:
11
12 Abstract base class for a memory object. It is necessary to split the
13 memory interface away from an FxObject derived base class so that we can
14 hand out WDFMEMORY handles that are embedded within other FxObject derived
15 classes without having to embed another FxObject derived class within the
16 parent.
17
18Author:
19
20
21
22Environment:
23
24 kernel mode only
25
26Revision History:
27
28--*/
29
30#ifndef __IFX_MEMORY_HPP__
31#define __IFX_MEMORY_HPP__
32
33// begin_wpp enum
36};
37// end_wpp
38
39
40class IFxMemory {
41public:
42 virtual
43 PVOID
45 VOID
46 ) =0;
47
48 virtual
49 size_t
51 VOID
52 ) =0;
53
54 virtual
55 PMDL
57 VOID
58 ) =0;
59
60 virtual
61 WDFMEMORY
63 VOID
64 ) =0;
65
66 //
67 // Value returned is a bit field from the enum IFxMemoryFlags
68 //
69 virtual
70 USHORT
72 VOID
73 ) =0;
74
75 virtual
78 VOID
79 ) =0;
80
81 virtual
82 ULONG
87 ) =0;
88
89 virtual
90 ULONG
95 ) =0;
96
97 virtual
98 VOID
100 VOID
101 ) =0;
102
107 )
108 {
110 size_t total;
111
112 if (Offsets == NULL) {
113 return STATUS_SUCCESS;
114 }
115
116 status = RtlSizeTAdd(Offsets->BufferLength, Offsets->BufferOffset, &total);
117
118 if (!NT_SUCCESS(status)) {
119 return status;
120 }
121
122 if (total > GetBufferSize()) {
124 }
125
126 return STATUS_SUCCESS;
127 }
128
132 __in_opt PWDFMEMORY_OFFSET DestinationOffsets,
133 __in_bcount(SourceBufferLength) PVOID SourceBuffer,
134 __in size_t SourceBufferLength,
135 __in_opt PWDFMEMORY_OFFSET SourceOffsets
136 );
137
140 CopyToPtr(
141 __in_opt PWDFMEMORY_OFFSET SourceOffsets,
142 __out_bcount(DestinationBufferLength) PVOID DestinationBuffer,
143 __in size_t DestinationBufferLength,
144 __in_opt PWDFMEMORY_OFFSET DestinationOffsets
145 );
146
147protected:
148 static
152 __in_bcount(SourceBufferLength) PVOID SourceBuffer,
153 __in size_t SourceBufferLength,
154 __in_opt PWDFMEMORY_OFFSET SourceOffsets,
155 __out_bcount(DestinationBufferLength) PVOID DestinationBuffer,
156 __in size_t DestinationBufferLength,
157 __in_opt PWDFMEMORY_OFFSET DestinationOffsets
158 );
159};
160
161#endif // __IFX_MEMORY_HPP__
LONG NTSTATUS
Definition: precomp.h:26
Definition: File.h:16
virtual size_t GetBufferSize(VOID)=0
virtual USHORT GetFlags(VOID)=0
virtual ULONG Release(__in PVOID Tag, __in LONG Line, __in_opt PSTR File)=0
virtual PMDL GetMdl(VOID)=0
_Must_inspect_result_ NTSTATUS ValidateMemoryOffsets(__in_opt PWDFMEMORY_OFFSET Offsets)
Definition: ifxmemory.hpp:105
virtual WDFMEMORY GetHandle(VOID)=0
virtual ULONG AddRef(__in PVOID Tag, __in LONG Line, __in_opt PSTR File)=0
virtual PFX_DRIVER_GLOBALS GetDriverGlobals(VOID)=0
_Must_inspect_result_ NTSTATUS CopyToPtr(__in_opt PWDFMEMORY_OFFSET SourceOffsets, __out_bcount(DestinationBufferLength) PVOID DestinationBuffer, __in size_t DestinationBufferLength, __in_opt PWDFMEMORY_OFFSET DestinationOffsets)
virtual PVOID GetBuffer(VOID)=0
virtual VOID Delete(VOID)=0
_Must_inspect_result_ NTSTATUS CopyFromPtr(__in_opt PWDFMEMORY_OFFSET DestinationOffsets, __in_bcount(SourceBufferLength) PVOID SourceBuffer, __in size_t SourceBufferLength, __in_opt PWDFMEMORY_OFFSET SourceOffsets)
static _Must_inspect_result_ NTSTATUS _CopyPtrToPtr(__in_bcount(SourceBufferLength) PVOID SourceBuffer, __in size_t SourceBufferLength, __in_opt PWDFMEMORY_OFFSET SourceOffsets, __out_bcount(DestinationBufferLength) PVOID DestinationBuffer, __in size_t DestinationBufferLength, __in_opt PWDFMEMORY_OFFSET DestinationOffsets)
#define __in
Definition: dbghelp.h:35
#define __out_bcount(x)
Definition: dbghelp.h:68
#define __in_bcount(x)
Definition: dbghelp.h:41
#define __in_opt
Definition: dbghelp.h:38
#define NULL
Definition: types.h:112
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
size_t total
IFxMemoryFlags
Definition: ifxmemory.hpp:34
@ IFxMemoryFlagReadOnly
Definition: ifxmemory.hpp:35
#define _Must_inspect_result_
Definition: ms_sal.h:558
#define STATUS_INTEGER_OVERFLOW
Definition: ntstatus.h:385
long LONG
Definition: pedump.c:60
unsigned short USHORT
Definition: pedump.c:61
#define STATUS_SUCCESS
Definition: shellext.h:65
Definition: ncftp.h:79
Definition: ps.c:97
char * PSTR
Definition: typedefs.h:51
uint32_t ULONG
Definition: typedefs.h:59
_Must_inspect_result_ _In_ WDFDEVICE _In_ BOOLEAN _In_opt_ PVOID Tag
Definition: wdfdevice.h:4065