ReactOS 0.4.15-dev-5664-g3bf4ef6
wdfmemory.h
Go to the documentation of this file.
1/*++
2
3Copyright (c) Microsoft Corporation. All rights reserved.
4
5_WdfVersionBuild_
6
7Module Name:
8
9 WdfMemory.h
10
11Abstract:
12
13 Contains prototypes for managing memory objects in the driver frameworks.
14
15Author:
16
17Environment:
18
19 kernel mode only
20
21Revision History:
22
23--*/
24
25//
26// NOTE: This header is generated by stubwork. Please make any
27// modifications to the corresponding template files
28// (.x or .y) and use stubwork to regenerate the header
29//
30
31#ifndef _WDFMEMORY_H_
32#define _WDFMEMORY_H_
33
34#ifndef WDF_EXTERN_C
35 #ifdef __cplusplus
36 #define WDF_EXTERN_C extern "C"
37 #define WDF_EXTERN_C_START extern "C" {
38 #define WDF_EXTERN_C_END }
39 #else
40 #define WDF_EXTERN_C
41 #define WDF_EXTERN_C_START
42 #define WDF_EXTERN_C_END
43 #endif
44#endif
45
47
48
49
50#if (NTDDI_VERSION >= NTDDI_WIN2K)
51
58
59
60
61typedef struct _WDFMEMORY_OFFSET {
62 //
63 // Offset into the WDFMEMORY that the operation should start at.
64 //
66
67 //
68 // Number of bytes that the operation should access. If 0, the entire
69 // length of the WDFMEMORY buffer will be used in the operation or ignored
70 // depending on the API.
71 //
73
75
76typedef struct _WDF_MEMORY_DESCRIPTOR {
78
79 union {
80 struct {
82
85
86 struct {
88
91
92 struct {
93 WDFMEMORY Memory;
96 } u;
97
99
101VOID
106 )
107{
109
111 Descriptor->u.BufferType.Buffer = Buffer;
112 Descriptor->u.BufferType.Length = BufferLength;
113}
114
116VOID
119 _In_ WDFMEMORY Memory,
121 )
122{
124
126 Descriptor->u.HandleType.Memory = Memory;
127 Descriptor->u.HandleType.Offsets = Offsets;
128}
129
130
132VOID
135 _In_ PMDL Mdl,
137 )
138{
140
142 Descriptor->u.MdlType.Mdl = Mdl;
143 Descriptor->u.MdlType.BufferLength = BufferLength;
144}
145
146//
147// WDF Function: WdfMemoryCreate
148//
149typedef
153WDFAPI
155(STDCALL *PFN_WDFMEMORYCREATE)(
156 _In_
160 _In_
165 _In_
167 size_t BufferSize,
168 _Out_
169 WDFMEMORY* Memory,
172 );
173
179WdfMemoryCreate(
182 _In_
187 _In_
189 size_t BufferSize,
190 _Out_
191 WDFMEMORY* Memory,
194 )
195{
197}
198
199//
200// WDF Function: WdfMemoryCreatePreallocated
201//
202typedef
205WDFAPI
207(STDCALL *PFN_WDFMEMORYCREATEPREALLOCATED)(
208 _In_
214 _In_
216 size_t BufferSize,
217 _Out_
218 WDFMEMORY* Memory
219 );
220
225WdfMemoryCreatePreallocated(
230 _In_
232 size_t BufferSize,
233 _Out_
234 WDFMEMORY* Memory
235 )
236{
238}
239
240//
241// WDF Function: WdfMemoryGetBuffer
242//
243typedef
245WDFAPI
246PVOID
247(STDCALL *PFN_WDFMEMORYGETBUFFER)(
248 _In_
250 _In_
251 WDFMEMORY Memory,
254 );
255
258PVOID
259WdfMemoryGetBuffer(
260 _In_
261 WDFMEMORY Memory,
263 size_t* BufferSize
264 )
265{
266 return ((PFN_WDFMEMORYGETBUFFER) WdfFunctions[WdfMemoryGetBufferTableIndex])(WdfDriverGlobals, Memory, BufferSize);
267}
268
269//
270// WDF Function: WdfMemoryAssignBuffer
271//
272typedef
275WDFAPI
277(STDCALL *PFN_WDFMEMORYASSIGNBUFFER)(
278 _In_
280 _In_
281 WDFMEMORY Memory,
284 _In_
286 size_t BufferSize
287 );
288
293WdfMemoryAssignBuffer(
294 _In_
295 WDFMEMORY Memory,
298 _In_
300 size_t BufferSize
301 )
302{
304}
305
306//
307// WDF Function: WdfMemoryCopyToBuffer
308//
309typedef
312WDFAPI
314(STDCALL *PFN_WDFMEMORYCOPYTOBUFFER)(
315 _In_
317 _In_
318 WDFMEMORY SourceMemory,
319 _In_
321 _Out_writes_bytes_( NumBytesToCopyTo )
323 _In_
324 _When_(NumBytesToCopyTo == 0, __drv_reportError(NumBytesToCopyTo cannot be zero))
325 size_t NumBytesToCopyTo
326 );
327
332WdfMemoryCopyToBuffer(
333 _In_
334 WDFMEMORY SourceMemory,
335 _In_
336 size_t SourceOffset,
337 _Out_writes_bytes_( NumBytesToCopyTo )
339 _In_
340 _When_(NumBytesToCopyTo == 0, __drv_reportError(NumBytesToCopyTo cannot be zero))
341 size_t NumBytesToCopyTo
342 )
343{
344 return ((PFN_WDFMEMORYCOPYTOBUFFER) WdfFunctions[WdfMemoryCopyToBufferTableIndex])(WdfDriverGlobals, SourceMemory, SourceOffset, Buffer, NumBytesToCopyTo);
345}
346
347//
348// WDF Function: WdfMemoryCopyFromBuffer
349//
350typedef
353WDFAPI
355(STDCALL *PFN_WDFMEMORYCOPYFROMBUFFER)(
356 _In_
358 _In_
360 _In_
362 _In_
364 _In_
365 _When_(NumBytesToCopyFrom == 0, __drv_reportError(NumBytesToCopyFrom cannot be zero))
366 size_t NumBytesToCopyFrom
367 );
368
373WdfMemoryCopyFromBuffer(
374 _In_
375 WDFMEMORY DestinationMemory,
376 _In_
377 size_t DestinationOffset,
378 _In_
380 _In_
381 _When_(NumBytesToCopyFrom == 0, __drv_reportError(NumBytesToCopyFrom cannot be zero))
382 size_t NumBytesToCopyFrom
383 )
384{
385 return ((PFN_WDFMEMORYCOPYFROMBUFFER) WdfFunctions[WdfMemoryCopyFromBufferTableIndex])(WdfDriverGlobals, DestinationMemory, DestinationOffset, Buffer, NumBytesToCopyFrom);
386}
387
388//
389// WDF Function: WdfLookasideListCreate
390//
391typedef
395WDFAPI
397(STDCALL *PFN_WDFLOOKASIDELISTCREATE)(
398 _In_
402 _In_
404 size_t BufferSize,
405 _In_
412 _Out_
413 WDFLOOKASIDE* Lookaside
414 );
415
421WdfLookasideListCreate(
424 _In_
426 size_t BufferSize,
427 _In_
434 _Out_
435 WDFLOOKASIDE* Lookaside
436 )
437{
439}
440
441//
442// WDF Function: WdfMemoryCreateFromLookaside
443//
444typedef
447WDFAPI
449(STDCALL *PFN_WDFMEMORYCREATEFROMLOOKASIDE)(
450 _In_
452 _In_
453 WDFLOOKASIDE Lookaside,
454 _Out_
455 WDFMEMORY* Memory
456 );
457
462WdfMemoryCreateFromLookaside(
463 _In_
464 WDFLOOKASIDE Lookaside,
465 _Out_
466 WDFMEMORY* Memory
467 )
468{
469 return ((PFN_WDFMEMORYCREATEFROMLOOKASIDE) WdfFunctions[WdfMemoryCreateFromLookasideTableIndex])(WdfDriverGlobals, Lookaside, Memory);
470}
471
472
473
474#endif // (NTDDI_VERSION >= NTDDI_WIN2K)
475
476
478
479#endif // _WDFMEMORY_H_
480
LONG NTSTATUS
Definition: precomp.h:26
#define __drv_aliasesMem
Definition: btrfs_drv.h:203
Definition: bufpool.h:45
#define NTSTATUS
Definition: precomp.h:20
#define __drv_reportError(why)
Definition: driverspecs.h:319
#define APC_LEVEL
Definition: env_spec_w32.h:695
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
DriverGlobals
void * PVOID
Definition: retypes.h:9
unsigned int ULONG
Definition: retypes.h:1
#define _Out_opt_
Definition: ms_sal.h:346
#define _Pre_notnull_
Definition: ms_sal.h:680
#define _Must_inspect_result_
Definition: ms_sal.h:558
#define _Out_
Definition: ms_sal.h:345
#define _Strict_type_match_
Definition: ms_sal.h:2954
#define _In_
Definition: ms_sal.h:308
#define _In_opt_
Definition: ms_sal.h:309
int zero
Definition: sehframes.cpp:29
size_t BufferOffset
Definition: wdfmemory.h:65
size_t BufferLength
Definition: wdfmemory.h:72
struct _WDF_MEMORY_DESCRIPTOR::@3678::@3680 MdlType
PWDFMEMORY_OFFSET Offsets
Definition: wdfmemory.h:94
struct _WDF_MEMORY_DESCRIPTOR::@3678::@3679 BufferType
WDF_MEMORY_DESCRIPTOR_TYPE Type
Definition: wdfmemory.h:77
struct _WDF_MEMORY_DESCRIPTOR::@3678::@3681 HandleType
union _WDF_MEMORY_DESCRIPTOR::@3678 u
INT POOL_TYPE
Definition: typedefs.h:78
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define STDCALL
Definition: wdf.h:45
#define WdfFunctions
Definition: wdf.h:66
_Must_inspect_result_ _In_ WDFDMAENABLER _In_ _In_opt_ PWDF_OBJECT_ATTRIBUTES Attributes
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ _Strict_type_match_ POOL_TYPE PoolType
Definition: wdfdevice.h:3815
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG BufferLength
Definition: wdfdevice.h:3771
_In_ WDFDEVICE _In_ PVOID _In_opt_ PMDL Mdl
PWDF_DRIVER_GLOBALS WdfDriverGlobals
@ WdfMemoryCopyToBufferTableIndex
Definition: wdffuncenum.h:221
@ WdfMemoryGetBufferTableIndex
Definition: wdffuncenum.h:219
@ WdfMemoryCopyFromBufferTableIndex
Definition: wdffuncenum.h:222
@ WdfMemoryCreateFromLookasideTableIndex
Definition: wdffuncenum.h:224
@ WdfMemoryAssignBufferTableIndex
Definition: wdffuncenum.h:220
@ WdfMemoryCreateTableIndex
Definition: wdffuncenum.h:217
@ WdfMemoryCreatePreallocatedTableIndex
Definition: wdffuncenum.h:218
@ WdfLookasideListCreateTableIndex
Definition: wdffuncenum.h:223
FORCEINLINE VOID WDF_MEMORY_DESCRIPTOR_INIT_BUFFER(_Out_ PWDF_MEMORY_DESCRIPTOR Descriptor, _In_ PVOID Buffer, _In_ ULONG BufferLength)
Definition: wdfmemory.h:102
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ __drv_aliasesMem PVOID Buffer
Definition: wdfmemory.h:213
#define WDF_EXTERN_C_END
Definition: wdfmemory.h:42
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ _In_ _Strict_type_match_ POOL_TYPE _In_opt_ PWDF_OBJECT_ATTRIBUTES MemoryAttributes
Definition: wdfmemory.h:409
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES Attributes
Definition: wdfmemory.h:159
_Must_inspect_result_ _In_ WDFMEMORY SourceMemory
Definition: wdfmemory.h:318
FORCEINLINE VOID WDF_MEMORY_DESCRIPTOR_INIT_MDL(_Out_ PWDF_MEMORY_DESCRIPTOR Descriptor, _In_ PMDL Mdl, _In_ ULONG BufferLength)
Definition: wdfmemory.h:133
struct _WDF_MEMORY_DESCRIPTOR * PWDF_MEMORY_DESCRIPTOR
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ _Strict_type_match_ POOL_TYPE _In_opt_ ULONG _In_ _Out_ WDFMEMORY * Memory
Definition: wdfmemory.h:169
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
Definition: wdfmemory.h:254
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ _Strict_type_match_ POOL_TYPE _In_opt_ ULONG _In_ _Out_ WDFMEMORY _Outptr_opt_result_bytebuffer_(BufferSize) PVOID *Buffer)
Definition: wdfmemory.h:170
_Must_inspect_result_ _In_ WDFMEMORY _In_ size_t SourceOffset
Definition: wdfmemory.h:320
#define WDF_EXTERN_C_START
Definition: wdfmemory.h:41
_Must_inspect_result_ _In_ WDFMEMORY _Pre_notnull_ _Pre_writable_byte_size_(BufferSize) PVOID Buffer
Definition: wdfmemory.h:282
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ _Strict_type_match_ POOL_TYPE PoolType
Definition: wdfmemory.h:162
struct _WDFMEMORY_OFFSET * PWDFMEMORY_OFFSET
struct _WDFMEMORY_OFFSET WDFMEMORY_OFFSET
_Must_inspect_result_ _In_ WDFMEMORY _In_ size_t DestinationOffset
Definition: wdfmemory.h:361
_Must_inspect_result_ _In_ WDFMEMORY DestinationMemory
Definition: wdfmemory.h:359
_Must_inspect_result_ _In_ WDFMEMORY _In_ size_t _Out_writes_bytes_(NumBytesToCopyTo) PVOID Buffer
Definition: wdfmemory.h:321
_WDF_MEMORY_DESCRIPTOR_TYPE
Definition: wdfmemory.h:52
@ WdfMemoryDescriptorTypeInvalid
Definition: wdfmemory.h:53
@ WdfMemoryDescriptorTypeBuffer
Definition: wdfmemory.h:54
@ WdfMemoryDescriptorTypeHandle
Definition: wdfmemory.h:56
@ WdfMemoryDescriptorTypeMdl
Definition: wdfmemory.h:55
FORCEINLINE VOID WDF_MEMORY_DESCRIPTOR_INIT_HANDLE(_Out_ PWDF_MEMORY_DESCRIPTOR Descriptor, _In_ WDFMEMORY Memory, _In_opt_ PWDFMEMORY_OFFSET Offsets)
Definition: wdfmemory.h:117
_Must_inspect_result_ _When_(PoolType==1||PoolType==257, _IRQL_requires_max_(APC_LEVEL)) _When_(PoolType
Definition: wdfmemory.h:151
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ _In_ _Strict_type_match_ POOL_TYPE _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_opt_ ULONG _Out_ WDFLOOKASIDE * Lookaside
Definition: wdfmemory.h:414
struct _WDF_MEMORY_DESCRIPTOR WDF_MEMORY_DESCRIPTOR
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ _Strict_type_match_ POOL_TYPE _In_opt_ ULONG PoolTag
Definition: wdfmemory.h:164
WDF_EXTERN_C_START enum _WDF_MEMORY_DESCRIPTOR_TYPE WDF_MEMORY_DESCRIPTOR_TYPE
_Must_inspect_result_ _IRQL_requires_max_(DISPATCH_LEVEL)) WDFAPI NTSTATUS(STDCALL *PFN_WDFMEMORYCREATE)(_In_ PWDF_DRIVER_GLOBALS DriverGlobals
Definition: wdfmemory.h:152
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES LookasideAttributes
Definition: wdfmemory.h:401
_Must_inspect_result_ _In_ WDFIORESLIST _In_ PIO_RESOURCE_DESCRIPTOR Descriptor
Definition: wdfresource.h:342
#define WDFAPI
Definition: wdftypes.h:53
#define FORCEINLINE
Definition: wdftypes.h:67