ReactOS  0.4.15-dev-1171-gab82533
mmfuncs.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Memory manager Functions *
3  ******************************************************************************/
5 /* Alignment Macros */
6 #define ALIGN_DOWN_BY(size, align) \
7  ((ULONG_PTR)(size) & ~((ULONG_PTR)(align) - 1))
8 
9 #define ALIGN_UP_BY(size, align) \
10  (ALIGN_DOWN_BY(((ULONG_PTR)(size) + align - 1), align))
11 
12 #define ALIGN_DOWN_POINTER_BY(ptr, align) \
13  ((PVOID)ALIGN_DOWN_BY(ptr, align))
14 
15 #define ALIGN_UP_POINTER_BY(ptr, align) \
16  ((PVOID)ALIGN_UP_BY(ptr, align))
17 
18 #define ALIGN_DOWN(size, type) \
19  ALIGN_DOWN_BY(size, sizeof(type))
20 
21 #define ALIGN_UP(size, type) \
22  ALIGN_UP_BY(size, sizeof(type))
23 
24 #define ALIGN_DOWN_POINTER(ptr, type) \
25  ALIGN_DOWN_POINTER_BY(ptr, sizeof(type))
26 
27 #define ALIGN_UP_POINTER(ptr, type) \
28  ALIGN_UP_POINTER_BY(ptr, sizeof(type))
29 
30 #ifndef FIELD_OFFSET
31 #define FIELD_OFFSET(type, field) ((ULONG)&(((type *)0)->field))
32 #endif
33 
34 #ifndef FIELD_SIZE
35 #define FIELD_SIZE(type, field) (sizeof(((type *)0)->field))
36 #endif
37 
38 #define POOL_TAGGING 1
39 
40 #if DBG
41 #define IF_DEBUG if (TRUE)
42 #else
43 #define IF_DEBUG if (FALSE)
44 #endif /* DBG */
45 
46 /* ULONG
47  * BYTE_OFFSET(
48  * _In_ PVOID Va)
49  */
50 #define BYTE_OFFSET(Va) \
51  ((ULONG) ((ULONG_PTR) (Va) & (PAGE_SIZE - 1)))
52 
53 /* ULONG
54  * BYTES_TO_PAGES(
55  * _In_ ULONG Size)
56  *
57  * Note: This needs to be like this to avoid overflows!
58  */
59 #define BYTES_TO_PAGES(Size) \
60  (((Size) >> PAGE_SHIFT) + (((Size) & (PAGE_SIZE - 1)) != 0))
61 
62 /* PVOID
63  * PAGE_ALIGN(
64  * _In_ PVOID Va)
65  */
66 #define PAGE_ALIGN(Va) \
67  ((PVOID) ((ULONG_PTR)(Va) & ~(PAGE_SIZE - 1)))
68 
69 /* ULONG_PTR
70  * ROUND_TO_PAGES(
71  * _In_ ULONG_PTR Size)
72  */
73 #define ROUND_TO_PAGES(Size) \
74  (((ULONG_PTR) (Size) + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1))
75 
76 /* ULONG
77  * ADDRESS_AND_SIZE_TO_SPAN_PAGES(
78  * _In_ PVOID Va,
79  * _In_ ULONG Size)
80  */
81 #define ADDRESS_AND_SIZE_TO_SPAN_PAGES(_Va, _Size) \
82  ((ULONG) ((((ULONG_PTR) (_Va) & (PAGE_SIZE - 1)) \
83  + (_Size) + (PAGE_SIZE - 1)) >> PAGE_SHIFT))
84 
85 #define COMPUTE_PAGES_SPANNED(Va, Size) \
86  ADDRESS_AND_SIZE_TO_SPAN_PAGES(Va,Size)
87 
88 /*
89  * ULONG
90  * MmGetMdlByteCount(
91  * _In_ PMDL Mdl)
92  */
93 #define MmGetMdlByteCount(_Mdl) \
94  ((_Mdl)->ByteCount)
95 
96 /*
97  * ULONG
98  * MmGetMdlByteOffset(
99  * IN PMDL Mdl)
100  */
101 #define MmGetMdlByteOffset(_Mdl) \
102  ((_Mdl)->ByteOffset)
103 
104 #define MmGetMdlBaseVa(Mdl) ((Mdl)->StartVa)
105 
106 /*
107  * PPFN_NUMBER
108  * MmGetMdlPfnArray(
109  * _In_ PMDL Mdl)
110  */
111 #define MmGetMdlPfnArray(_Mdl) \
112  ((PPFN_NUMBER) ((_Mdl) + 1))
113 
114 /*
115  * PVOID
116  * MmGetMdlVirtualAddress(
117  * _In_ PMDL Mdl)
118  */
119 #define MmGetMdlVirtualAddress(_Mdl) \
120  ((PVOID) ((PCHAR) ((_Mdl)->StartVa) + (_Mdl)->ByteOffset))
121 
122 #define MmGetProcedureAddress(Address) (Address)
123 #define MmLockPagableCodeSection(Address) MmLockPagableDataSection(Address)
124 
125 /* PVOID MmGetSystemAddressForMdl(
126  * _In_ PMDL Mdl);
127  */
128 #define MmGetSystemAddressForMdl(Mdl) \
129  (((Mdl)->MdlFlags & (MDL_MAPPED_TO_SYSTEM_VA | \
130  MDL_SOURCE_IS_NONPAGED_POOL)) ? \
131  ((Mdl)->MappedSystemVa) : \
132  (MmMapLockedPages((Mdl), KernelMode)))
133 
134 /* PVOID
135  * MmGetSystemAddressForMdlSafe(
136  * _In_ PMDL Mdl,
137  * _In_ MM_PAGE_PRIORITY Priority)
138  */
139 #define MmGetSystemAddressForMdlSafe(_Mdl, _Priority) \
140  (((_Mdl)->MdlFlags & (MDL_MAPPED_TO_SYSTEM_VA \
141  | MDL_SOURCE_IS_NONPAGED_POOL)) ? \
142  (_Mdl)->MappedSystemVa : \
143  (PVOID) MmMapLockedPagesSpecifyCache((_Mdl), \
144  KernelMode, MmCached, NULL, FALSE, (_Priority)))
145 
146 /*
147  * VOID
148  * MmInitializeMdl(
149  * _In_ PMDL MemoryDescriptorList,
150  * _In_ PVOID BaseVa,
151  * _In_ SIZE_T Length)
152  */
153 #define MmInitializeMdl(_MemoryDescriptorList, \
154  _BaseVa, \
155  _Length) \
156 { \
157  (_MemoryDescriptorList)->Next = (PMDL) NULL; \
158  (_MemoryDescriptorList)->Size = (CSHORT) (sizeof(MDL) + \
159  (sizeof(PFN_NUMBER) * ADDRESS_AND_SIZE_TO_SPAN_PAGES(_BaseVa, _Length))); \
160  (_MemoryDescriptorList)->MdlFlags = 0; \
161  (_MemoryDescriptorList)->StartVa = (PVOID) PAGE_ALIGN(_BaseVa); \
162  (_MemoryDescriptorList)->ByteOffset = BYTE_OFFSET(_BaseVa); \
163  (_MemoryDescriptorList)->ByteCount = (ULONG) _Length; \
164 }
165 
166 /*
167  * VOID
168  * MmPrepareMdlForReuse(
169  * _In_ PMDL Mdl)
170  */
171 #define MmPrepareMdlForReuse(_Mdl) \
172 { \
173  if (((_Mdl)->MdlFlags & MDL_PARTIAL_HAS_BEEN_MAPPED) != 0) { \
174  ASSERT(((_Mdl)->MdlFlags & MDL_PARTIAL) != 0); \
175  MmUnmapLockedPages((_Mdl)->MappedSystemVa, (_Mdl)); \
176  } else if (((_Mdl)->MdlFlags & MDL_PARTIAL) == 0) { \
177  ASSERT(((_Mdl)->MdlFlags & MDL_MAPPED_TO_SYSTEM_VA) == 0); \
178  } \
179 }
181 $if (_NTIFS_)
182 
184 ULONG
186  _In_ ULONG TagBase,
187  _In_ ULONG Tag)
188 {
189  //__assume_bound(TagBase); // FIXME
190  return ((ULONG)((TagBase) + ((Tag) << HEAP_TAG_SHIFT)));
191 }
192 $endif (_NTIFS_)
193 
194 #if (NTDDI_VERSION >= NTDDI_WIN2K)
195 $if (_WDMDDK_)
200 PVOID
201 NTAPI
205 
210 PVOID
211 NTAPI
218 
222 PMDL
223 NTAPI
225  _In_ PHYSICAL_ADDRESS LowAddress,
229 
232 VOID
233 NTAPI
236 
237 //DECLSPEC_DEPRECATED_DDK
239 PMDL
240 NTAPI
245  _In_ SIZE_T Length);
246 
249 VOID
250 NTAPI
253 
256 VOID
257 NTAPI
262 
265 VOID
266 NTAPI
269 
272 PVOID
273 NTAPI
275  _In_ PUNICODE_STRING SystemRoutineName);
276 
278 LOGICAL
279 NTAPI
282 
286 PVOID
287 NTAPI
288 MmLockPagableDataSection(
289  _In_ PVOID AddressWithinSection);
290 
295 PVOID
296 NTAPI
301 
306 PVOID
307 NTAPI
310  _In_ __drv_strictType(KPROCESSOR_MODE/enum _MODE,__drv_typeConst)
312 
320 PVOID
321 NTAPI
326  _In_opt_ PVOID RequestedAddress,
327  _In_ ULONG BugCheckOnFailure,
329 
332 PVOID
333 NTAPI
335  _In_ PVOID AddressWithinSection);
336 
341 VOID
342 NTAPI
347 
350 NTAPI
352 
355 VOID
356 NTAPI
358  _In_ PVOID AddressWithinSection);
359 
361 SIZE_T
362 NTAPI
365  _In_ SIZE_T Length);
366 
369 VOID
370 NTAPI
371 MmUnlockPagableImageSection(
372  _In_ PVOID ImageSectionHandle);
373 
376 VOID
377 NTAPI
380 
383 VOID
384 NTAPI
388 
391 VOID
392 NTAPI
398 
401 VOID
402 NTAPI
406 
411 PVOID
412 NTAPI
413 MmAllocateContiguousMemorySpecifyCacheNode(
419  _In_ NODE_REQUIREMENT PreferredNode);
421 $if (_NTDDK_)
422 
426 NTAPI
428 
431 NTAPI
434 
436 BOOLEAN
437 NTAPI
440 
445 PVOID
446 NTAPI
449 
452 VOID
453 NTAPI
457 
459 PVOID
460 NTAPI
463 
467 NTSTATUS
468 NTAPI
473 
478 PVOID
479 NTAPI
484 
488 NTSTATUS
489 NTAPI
491  _In_ PVOID Section,
494 
498 NTSTATUS
499 NTAPI
501  _In_ PVOID Section,
504 
507 BOOLEAN
508 NTAPI
511 
513 BOOLEAN
514 NTAPI
516 
519 VOID
520 NTAPI
521 MmLockPagableSectionByHandle(
522  _In_ PVOID ImageSectionHandle);
523 
526 NTSTATUS
527 NTAPI
530 
533 NTSTATUS
534 NTAPI
537 
540 VOID
541 NTAPI
543  _In_ HANDLE SecureHandle);
544 
547 NTSTATUS
548 NTAPI
550  _In_ PPHYSICAL_ADDRESS StartAddress,
552 
556 HANDLE
557 NTAPI
560  _In_ __in_data_source(USER_MODE) SIZE_T Size,
562 
565 VOID
566 NTAPI
570 
573 NTSTATUS
574 NTAPI
576  _In_ PPHYSICAL_ADDRESS StartAddress,
578 $endif (_NTDDK_)
579 $if (_NTIFS_)
580 
582 BOOLEAN
583 NTAPI
585 
588 BOOLEAN
589 NTAPI
593 
596 BOOLEAN
597 NTAPI
601 
604 BOOLEAN
605 NTAPI
609 
612 BOOLEAN
613 NTAPI
617 $endif (_NTIFS_)
618 
619 #endif /* (NTDDI_VERSION >= NTDDI_WIN2K) */
620 
621 $if (_WDMDDK_ || _NTIFS_)
622 #if (NTDDI_VERSION >= NTDDI_WINXP)
624 
625 $if (_WDMDDK_)
628 NTSTATUS
629 NTAPI
631  _Inout_ PMDL Mdl,
633 
638 PVOID
639 NTAPI
643 
646 VOID
647 NTAPI
650  _In_ ULONG PoolTag);
651 
654 NTSTATUS
655 NTAPI
657  _Out_ PULONG VerifierFlags);
658 
666 PVOID
667 NTAPI
669  _In_ PVOID MappingAddress,
672  _In_ __drv_strictTypeMatch(__drv_typeCond)
674 
678 NTSTATUS
679 NTAPI
683 
686 VOID
687 NTAPI
692 
695 NTSTATUS
696 NTAPI
698  _In_reads_bytes_ (ThunkBufferSize) PVOID ThunkBuffer,
701 $if (_NTIFS_)
702 
705 NTSTATUS
706 NTAPI
708  _In_ ULONG NumberOfLists,
709  _In_reads_ (NumberOfLists) PREAD_LIST *ReadLists);
710 $endif (_NTIFS_)
711 
712 $if (_WDMDDK_ || _NTIFS_)
713 #endif /* (NTDDI_VERSION >= NTDDI_WINXP) */
715 $if (_WDMDDK_ || _NTDDK_)
716 #if (NTDDI_VERSION >= NTDDI_WS03)
718 $if (_WDMDDK_)
721 LOGICAL
722 NTAPI
724  _In_ PHYSICAL_ADDRESS StartAddress,
727 
728 $if (_NTDDK_)
732 NTSTATUS
733 NTAPI
735 $endif (_NTDDK_)
736 $if (_WDMDDK_ || _NTDDK_)
737 #endif /* (NTDDI_VERSION >= NTDDI_WS03) */
739 $if (_WDMDDK_)
740 #if (NTDDI_VERSION >= NTDDI_WS03SP1)
744 PMDL
745 NTAPI
747  _In_ PHYSICAL_ADDRESS LowAddress,
752  _In_ ULONG Flags);
753 #endif
755 
756 #if (NTDDI_VERSION >= NTDDI_VISTA)
757 $if (_WDMDDK_)
760 LOGICAL
761 NTAPI
762 MmIsDriverVerifyingByAddress(
763  _In_ PVOID AddressWithinSection);
765 $if (_NTDDK_)
768 NTSTATUS
769 NTAPI
770 MmRotatePhysicalView(
777 $endif (_NTDDK_)
778 $if (_NTIFS_)
779 
782 ULONG
783 NTAPI
785  _In_ PSECTION_OBJECT_POINTERS SectionPointer);
786 
791 NTSTATUS
792 NTAPI
799  _In_ ULONG Protect);
800 
804 NTSTATUS
805 NTAPI
811 
812 $endif (_NTIFS_)
813 #endif /* (NTDDI_VERSION >= NTDDI_VISTA) */
814 
_Must_inspect_result_ _When_(AccessMode==KernelMode, _IRQL_requires_max_(DISPATCH_LEVEL)) _When_(AccessMode
MMFLUSH_TYPE
Definition: mmtypes.h:183
_Must_inspect_result_ _In_ PHYSICAL_ADDRESS _In_ PHYSICAL_ADDRESS _In_opt_ PHYSICAL_ADDRESS BoundaryAddressMultiple
Definition: mmfuncs.h:214
_Must_inspect_result_ _Out_writes_bytes_opt_(NumberOfBytes)) NTKERNELAPI PVOID NTAPI MmAllocateMappingAddress(_In_ SIZE_T NumberOfBytes
BOOLEAN NTAPI MmCanFileBeTruncated(IN PSECTION_OBJECT_POINTERS SectionObjectPointer, IN PLARGE_INTEGER NewFileSize)
Definition: section.c:4728
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID _In_ ULONG_PTR ZeroBits
Definition: mmfuncs.h:404
return
Definition: dirsup.c:529
#define _Must_inspect_result_
Definition: no_sal2.h:314
BOOLEAN NTAPI MmSetAddressRangeModified(IN PVOID Address, IN SIZE_T Length)
Definition: mmsup.c:162
FORCEINLINE _Post_maybenull_ _Must_inspect_result_ _In_ SIZE_T _In_ ULONG _In_ EX_POOL_PRIORITY Priority
Definition: exfuncs.h:700
_In_ SIZE_T NumberOfBytes
Definition: mmfuncs.h:260
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID _In_ ULONG_PTR _In_ SIZE_T _Inout_opt_ PLARGE_INTEGER _Inout_ PSIZE_T _In_ SECTION_INHERIT _In_ ULONG _In_ ULONG Protect
Definition: zwfuncs.h:214
NTKERNELAPI PHYSICAL_ADDRESS NTAPI MmGetPhysicalAddress(_In_ PVOID BaseAddress)
MDL * PMDLX
Definition: mmtypes.h:121
#define HEAP_MAKE_TAG_FLAGS(b, o)
Definition: nt_native.h:1725
NTSTATUS NTAPI MmAddVerifierThunks(IN PVOID ThunkBuffer, IN ULONG ThunkBufferSize)
Definition: drvmgmt.c:82
#define _In_reads_bytes_opt_(size)
Definition: no_sal2.h:230
VOID NTAPI MmBuildMdlForNonPagedPool(IN PMDL Mdl)
Definition: mdlsup.c:428
NTKERNELAPI PMDL NTAPI MmCreateMdl(_Out_writes_bytes_opt_(sizeof(MDL)+(sizeof(PFN_NUMBER) *ADDRESS_AND_SIZE_TO_SPAN_PAGES(Base, Length))) PMDL MemoryDescriptorList, _In_reads_bytes_opt_(Length) PVOID Base, _In_ SIZE_T Length)
LONG NTSTATUS
Definition: precomp.h:26
_In_opt_ ULONG Base
Definition: rtlfuncs.h:2373
#define _NTIFS_
Definition: ifssupp.h:20
NTKERNELAPI BOOLEAN NTAPI MmIsNonPagedSystemAddressValid(_In_ PVOID VirtualAddress)
_In_ MMFLUSH_TYPE FlushType
Definition: mmfuncs.h:600
_Must_inspect_result_ _In_ _In_ ULONG ProbeMode
Definition: mmfuncs.h:561
#define _WDMDDK_
Definition: wdm.template.h:26
#define _Post_notnull_
Definition: no_sal2.h:460
VOID NTAPI MmUnlockPages(IN PMDL Mdl)
Definition: mdlsup.c:1439
#define NTSYSCALLAPI
Definition: ntbasedef.h:204
NTSTATUS(NTAPI * PMM_ROTATE_COPY_CALLBACK_FUNCTION)(_In_ PMDL DestinationMdl, _In_ PMDL SourceMdl, _In_ PVOID Context)
Definition: mmtypes.h:165
_Post_writable_byte_size_(NumberOfBytes)) NTKERNELAPI PVOID NTAPI MmAllocateContiguousMemory(_In_ SIZE_T NumberOfBytes
PVOID NTAPI MmMapIoSpace(IN PHYSICAL_ADDRESS PhysicalAddress, IN SIZE_T NumberOfBytes, IN MEMORY_CACHING_TYPE CacheType)
Definition: iosup.c:47
NTKERNELAPI LOGICAL NTAPI MmIsDriverVerifying(_In_ struct _DRIVER_OBJECT *DriverObject)
PVOID NTAPI MmMapLockedPages(IN PMDL Mdl, IN KPROCESSOR_MODE AccessMode)
Definition: mdlsup.c:822
VOID NTAPI MmFreeContiguousMemory(IN PVOID BaseAddress)
Definition: contmem.c:653
#define _In_opt_
Definition: no_sal2.h:213
_Must_inspect_result_ _In_ PDEVICE_OBJECT _In_ PSECTION_OBJECT_POINTERS SectionObjectPointer
Definition: fsrtlfuncs.h:1368
PMDL NTAPI MmAllocatePagesForMdlEx(IN PHYSICAL_ADDRESS LowAddress, IN PHYSICAL_ADDRESS HighAddress, IN PHYSICAL_ADDRESS SkipBytes, IN SIZE_T TotalBytes, IN MEMORY_CACHING_TYPE CacheType, IN ULONG Flags)
Definition: mdlsup.c:514
_Must_inspect_result_ _In_ SIZE_T _In_ PVOID PageAddress
Definition: mmfuncs.h:471
NTKERNELAPI SIZE_T NTAPI MmSizeOfMdl(_In_reads_bytes_opt_(Length) PVOID Base, _In_ SIZE_T Length)
uint32_t ULONG_PTR
Definition: typedefs.h:65
enum _MM_SYSTEM_SIZE MM_SYSTEMSIZE
NTSTATUS NTAPI MmAddPhysicalMemory(IN PPHYSICAL_ADDRESS StartAddress, IN OUT PLARGE_INTEGER NumberOfBytes)
Definition: dynamic.c:25
PVOID NTAPI MmMapLockedPagesSpecifyCache(IN PMDL Mdl, IN KPROCESSOR_MODE AccessMode, IN MEMORY_CACHING_TYPE CacheType, IN PVOID BaseAddress, IN ULONG BugCheckOnFailure, IN ULONG Priority)
Definition: mdlsup.c:664
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
ULONG PFN_NUMBER
Definition: ke.h:8
ULONG_PTR * PSIZE_T
Definition: typedefs.h:80
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
__kernel_entry _IRQL_requires_max_(PASSIVE_LEVEL) NTSYSCALLAPI NTSTATUS NTAPI NtFreeVirtualMemory(_In_ HANDLE ProcessHandle
Definition: Messaging.c:64
PVOID NTAPI MmGetSystemRoutineAddress(IN PUNICODE_STRING SystemRoutineName)
Definition: sysldr.c:3432
_Inout_ PMDL MemoryDescriptorList
Definition: mmfuncs.h:405
NTSTATUS NTAPI MmUnmapViewInSystemSpace(IN PVOID MappedBase)
Definition: section.c:3064
VOID NTAPI MmUnmapLockedPages(IN PVOID BaseAddress, IN PMDL Mdl)
Definition: mdlsup.c:841
_In_ ULONG ThunkBufferSize
Definition: mmfuncs.h:699
VOID NTAPI MmFreePagesFromMdl(IN PMDL Mdl)
Definition: mdlsup.c:568
_In_ PEPROCESS _In_ KPROCESSOR_MODE AccessMode
Definition: mmfuncs.h:395
NTSTATUS NTAPI MmUnmapViewInSessionSpace(IN PVOID MappedBase)
Definition: section.c:3025
NTSTATUS NTAPI MmRemovePhysicalMemory(IN PPHYSICAL_ADDRESS StartAddress, IN OUT PLARGE_INTEGER NumberOfBytes)
Definition: dynamic.c:61
_In_ BOOLEAN DelayClose
Definition: mmfuncs.h:592
unsigned char BOOLEAN
PVOID NTAPI MmMapVideoDisplay(IN PHYSICAL_ADDRESS PhysicalAddress, IN SIZE_T NumberOfBytes, IN MEMORY_CACHING_TYPE CacheType)
Definition: iosup.c:243
smooth NULL
Definition: ftsmooth.c:416
_Must_inspect_result_ _In_ PHYSICAL_ADDRESS _In_ PHYSICAL_ADDRESS _In_opt_ PHYSICAL_ADDRESS _In_ MEMORY_CACHING_TYPE CacheType
Definition: mmfuncs.h:214
static WCHAR Address[46]
Definition: ping.c:68
#define FORCEINLINE
Definition: ntbasedef.h:216
#define _Out_
Definition: no_sal2.h:323
static PDRIVER_OBJECT DriverObject
Definition: template.c:42
#define _At_(target, annos)
Definition: no_sal2.h:11
#define NTKERNELAPI
_Must_inspect_result_ _In_ PHYSICAL_ADDRESS _In_ PHYSICAL_ADDRESS SkipBytes
Definition: mmfuncs.h:226
__kernel_entry _Inout_ __drv_freesMem(Mem) PVOID *BaseAddress
_Must_inspect_result_ _In_ __in_data_source(USER_MODE) SIZE_T Size
#define ADDRESS_AND_SIZE_TO_SPAN_PAGES(_Va, _Size)
BOOLEAN NTAPI MmIsRecursiveIoFault(VOID)
Definition: mmsup.c:231
* PPHYSICAL_MEMORY_RANGE
Definition: mmtypes.h:162
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID * BaseAddress
Definition: mmfuncs.h:404
_Inout_ PSIZE_T _In_opt_ PMDLX NewMdl
Definition: mmfuncs.h:772
#define __drv_allocatesMem(kind)
Definition: driverspecs.h:239
#define __kernel_entry
Definition: specstrings.h:50
BOOLEAN NTAPI MmFlushImageSection(IN PSECTION_OBJECT_POINTERS SectionObjectPointer, IN MMFLUSH_TYPE FlushType)
Definition: section.c:4802
_In_reads_(NumberOfLists) PREAD_LIST *ReadLists)
#define _Outptr_result_buffer_(size)
Definition: no_sal2.h:414
#define _Success_(expr)
Definition: no_sal2.h:635
_Inout_ PSIZE_T _In_opt_ PMDLX _In_ MM_ROTATE_DIRECTION Direction
Definition: mmfuncs.h:772
PVOID NTAPI MmPageEntireDriver(IN PVOID AddressWithinSection)
Definition: sysldr.c:3385
PVOID NTAPI MmSecureVirtualMemory(IN PVOID Address, IN SIZE_T Length, IN ULONG Mode)
Definition: virtual.c:2669
_Must_inspect_result_ _In_ ULONG PoolTag
Definition: mmfuncs.h:642
_Must_inspect_result_ _In_ PHYSICAL_ADDRESS _In_ PHYSICAL_ADDRESS _In_opt_ PHYSICAL_ADDRESS _In_ MEMORY_CACHING_TYPE _In_ NODE_REQUIREMENT PreferredNode
Definition: mmfuncs.h:415
NTKERNELAPI MM_SYSTEMSIZE NTAPI MmQuerySystemSize(VOID)
Definition: mmsup.c:257
ULONG NTAPI MmDoesFileHaveUserWritableReferences(IN PSECTION_OBJECT_POINTERS SectionPointer)
Definition: section.c:3284
#define _Inout_
Definition: no_sal2.h:244
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
CCHAR KPROCESSOR_MODE
Definition: ketypes.h:7
VOID NTAPI MmResetDriverPaging(IN PVOID AddressWithinSection)
Definition: sysldr.c:3422
BOOLEAN NTAPI MmIsAddressValid(IN PVOID VirtualAddress)
Definition: mmsup.c:174
_In_opt_ PLARGE_INTEGER NewFileSize
Definition: mmfuncs.h:608
LOGICAL NTAPI MmIsIoSpaceActive(IN PHYSICAL_ADDRESS StartAddress, IN SIZE_T NumberOfBytes)
Definition: iosup.c:271
NTSTATUS NTAPI MmMapViewInSystemSpace(IN PVOID SectionObject, OUT PVOID *MappedBase, IN OUT PSIZE_T ViewSize)
Definition: section.c:4851
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS PhysicalAddress
Definition: iotypes.h:1081
MDL
Definition: mmtypes.h:117
NTKERNELAPI BOOLEAN NTAPI MmIsThisAnNtAsSystem(VOID)
Definition: mmsup.c:246
NTSTATUS NTAPI MmCreateMirror(VOID)
Definition: mmsup.c:265
_In_ PHYSICAL_ADDRESS HighestAcceptableAddress
Definition: mmfuncs.h:204
BOOLEAN NTAPI MmForceSectionClosed(IN PSECTION_OBJECT_POINTERS SectionObjectPointer, IN BOOLEAN DelayClose)
Definition: section.c:2981
_MODE
Definition: ketypes.h:10
_In_ ULONG _In_ BOOLEAN _Must_inspect_result_ PVOID * VirtualAddress
Definition: ndis.h:3791
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
#define _In_reads_bytes_(size)
Definition: no_sal2.h:229
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID _In_ ULONG_PTR _In_ SIZE_T _Inout_opt_ PLARGE_INTEGER _Inout_ PSIZE_T _In_ SECTION_INHERIT _In_ ULONG AllocationType
Definition: mmfuncs.h:404
#define _Maybe_raises_SEH_exception_
Definition: no_sal2.h:313
_Must_inspect_result_ _In_ PHYSICAL_ADDRESS LowestAcceptableAddress
Definition: mmfuncs.h:214
NTSTATUS NTAPI MmIsVerifierEnabled(OUT PULONG VerifierFlags)
Definition: drvmgmt.c:233
PPHYSICAL_MEMORY_RANGE NTAPI MmGetPhysicalMemoryRanges(VOID)
Definition: dynamic.c:73
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS _In_ LARGE_INTEGER ByteCount
Definition: iotypes.h:1081
_Must_inspect_result_ _Maybe_raises_SEH_exception_ _In_ __drv_strictType(KPROCESSOR_MODE/enum _MODE, __drv_typeConst) KPROCESSOR_MODE AccessMode)
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
#define _In_
Definition: no_sal2.h:204
ULONG_PTR SIZE_T
Definition: typedefs.h:80
NTSTATUS NTAPI MmProtectMdlSystemAddress(IN PMDL MemoryDescriptorList, IN ULONG NewProtect)
Definition: mdlsup.c:1671
NTSTATUS NTAPI NtAllocateVirtualMemory(IN HANDLE ProcessHandle, IN OUT PVOID *UBaseAddress, IN ULONG_PTR ZeroBits, IN OUT PSIZE_T URegionSize, IN ULONG AllocationType, IN ULONG Protect)
Definition: virtual.c:4367
#define HEAP_TAG_SHIFT
Definition: nt_native.h:1724
VOID NTAPI MmProbeAndLockPages(IN PMDL Mdl, IN KPROCESSOR_MODE AccessMode, IN LOCK_OPERATION Operation)
Definition: mdlsup.c:935
enum _LOCK_OPERATION LOCK_OPERATION
__kernel_entry _Inout_ _Inout_ PSIZE_T _In_ ULONG FreeType
Definition: mmfuncs.h:172
_Must_inspect_result_ _In_ PHYSICAL_ADDRESS HighAddress
Definition: mmfuncs.h:226
__kernel_entry _Inout_ _Inout_ PSIZE_T RegionSize
Definition: mmfuncs.h:172
enum _MM_ROTATE_DIRECTION MM_ROTATE_DIRECTION
VOID NTAPI MmUnmapIoSpace(IN PVOID BaseAddress, IN SIZE_T NumberOfBytes)
Definition: iosup.c:193
PVOID NTAPI MmMapLockedPagesWithReservedMapping(IN PVOID MappingAddress, IN ULONG PoolTag, IN PMDL MemoryDescriptorList, IN MEMORY_CACHING_TYPE CacheType)
Definition: mdlsup.c:1633
_Must_inspect_result_ _In_ ULONG NewProtect
Definition: mmfuncs.h:682
_In_ PEPROCESS Process
Definition: mmfuncs.h:395
NTSTATUS NTAPI MmAdvanceMdl(IN PMDL Mdl, IN ULONG NumberOfBytes)
Definition: mdlsup.c:1621
unsigned int * PULONG
Definition: retypes.h:1
PVOID NTAPI MmAllocateContiguousMemory(IN SIZE_T NumberOfBytes, IN PHYSICAL_ADDRESS HighestAcceptableAddress)
Definition: contmem.c:626
#define __drv_strictTypeMatch(mode)
Definition: driverspecs.h:312
VOID NTAPI MmFreeNonCachedMemory(IN PVOID BaseAddress, IN SIZE_T NumberOfBytes)
Definition: ncache.c:172
_In_ PEPROCESS _In_ KPROCESSOR_MODE _In_ LOCK_OPERATION Operation
Definition: mmfuncs.h:395
NTSTATUS NTAPI MmMapUserAddressesToPage(IN PVOID BaseAddress, IN SIZE_T NumberOfBytes, IN PVOID PageAddress)
Definition: mmsup.c:31
_Must_inspect_result_ _Outptr_result_bytebuffer_ ViewSize PVOID * MappedBase
Definition: mmfuncs.h:492
IN ULONG IN ULONG Tag
Definition: evtlib.h:159
VOID NTAPI MmUnmapVideoDisplay(IN PVOID BaseAddress, IN SIZE_T NumberOfBytes)
Definition: iosup.c:260
#define _Field_size_bytes_opt_(size)
Definition: no_sal2.h:193
VOID NTAPI MmFreeContiguousMemorySpecifyCache(IN PVOID BaseAddress, IN SIZE_T NumberOfBytes, IN MEMORY_CACHING_TYPE CacheType)
Definition: contmem.c:666
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID _In_ ULONG_PTR _In_ SIZE_T _Inout_opt_ PLARGE_INTEGER _Inout_ PSIZE_T ViewSize
Definition: mmfuncs.h:404
#define _Outptr_result_bytebuffer_(size)
Definition: no_sal2.h:420
unsigned int ULONG
Definition: retypes.h:1
NTKERNELAPI PVOID NTAPI MmGetVirtualForPhysical(_In_ PHYSICAL_ADDRESS PhysicalAddress)
$endif(_NTIFS_) $if(_WDMDDK_) _Must_inspect_result_ _IRQL_requires_max_(DISPATCH_LEVEL) _When_(return !
Definition: rtlfuncs.h:2827
VOID NTAPI MmUnmapReservedMapping(IN PVOID BaseAddress, IN ULONG PoolTag, IN PMDL MemoryDescriptorList)
Definition: mdlsup.c:1647
NTSTATUS NTAPI MmMapViewInSessionSpace(IN PVOID Section, OUT PVOID *MappedBase, IN OUT PSIZE_T ViewSize)
Definition: section.c:2993
_In_ HANDLE ProcessHandle
Definition: mmfuncs.h:403
enum _MEMORY_CACHING_TYPE MEMORY_CACHING_TYPE
PVOID NTAPI MmAllocateNonCachedMemory(IN SIZE_T NumberOfBytes)
Definition: ncache.c:25
#define APC_LEVEL
Definition: env_spec_w32.h:695
PMDL NTAPI MmAllocatePagesForMdl(IN PHYSICAL_ADDRESS LowAddress, IN PHYSICAL_ADDRESS HighAddress, IN PHYSICAL_ADDRESS SkipBytes, IN SIZE_T TotalBytes)
Definition: mdlsup.c:493
PVOID NTAPI MmAllocateMappingAddress(IN SIZE_T NumberOfBytes, IN ULONG PoolTag)
Definition: pool.c:1389
_Inout_ PSIZE_T _In_opt_ PMDLX _In_ MM_ROTATE_DIRECTION _In_ PMM_ROTATE_COPY_CALLBACK_FUNCTION CopyFunction
Definition: mmfuncs.h:772
#define _NTDDK_
NTSTATUS NTAPI MmPrefetchPages(IN ULONG NumberOfLists, IN PREAD_LIST *ReadLists)
Definition: mdlsup.c:1659
VOID NTAPI MmProbeAndLockProcessPages(IN OUT PMDL MemoryDescriptorList, IN PEPROCESS Process, IN KPROCESSOR_MODE AccessMode, IN LOCK_OPERATION Operation)
Definition: mdlsup.c:1683
$if(_WDMDDK_) $endif(_WDMDDK_) $if(_NTIFS_) FORCEINLINE ULONG HEAP_MAKE_TAG_FLAGS(_In_ ULONG TagBase
Definition: ke.h:1
VOID NTAPI MmUnsecureVirtualMemory(IN PVOID SecureMem)
Definition: virtual.c:2682
_Must_inspect_result_ _In_ PHYSICAL_ADDRESS _In_ PHYSICAL_ADDRESS _In_ SIZE_T TotalBytes
Definition: mmfuncs.h:226
IN PDCB IN PCCB IN VBO IN OUT PULONG OUT PDIRENT OUT PBCB OUT PVBO ByteOffset
Definition: fatprocs.h:725
VOID NTAPI MmFreeMappingAddress(IN PVOID BaseAddress, IN ULONG PoolTag)
Definition: pool.c:1401
PVOID NTAPI MmAllocateContiguousMemorySpecifyCache(IN SIZE_T NumberOfBytes, IN PHYSICAL_ADDRESS LowestAcceptableAddress OPTIONAL, IN PHYSICAL_ADDRESS HighestAcceptableAddress, IN PHYSICAL_ADDRESS BoundaryAddressMultiple OPTIONAL, IN MEMORY_CACHING_TYPE CacheType OPTIONAL)
Definition: contmem.c:574
NTSTATUS NTAPI NtFreeVirtualMemory(IN HANDLE ProcessHandle, IN PVOID *UBaseAddress, IN PSIZE_T URegionSize, IN ULONG FreeType)
Definition: virtual.c:5090