ReactOS 0.4.16-dev-334-g4d9f67c
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
184ULONG
186 _In_ ULONG TagBase,
188{
189 //__assume_bound(TagBase); // FIXME
190 return ((ULONG)((TagBase) + ((Tag) << HEAP_TAG_SHIFT)));
191}
193
194#if (NTDDI_VERSION >= NTDDI_WIN2K)
200PVOID
201NTAPI
205
210PVOID
211NTAPI
218
222PMDL
223NTAPI
225 _In_ PHYSICAL_ADDRESS LowAddress,
229
232VOID
233NTAPI
236
237//DECLSPEC_DEPRECATED_DDK
239PMDL
240NTAPI
246
249VOID
250NTAPI
253
256VOID
257NTAPI
262
265VOID
266NTAPI
269
272PVOID
273NTAPI
275 _In_ PUNICODE_STRING SystemRoutineName);
276
278LOGICAL
279NTAPI
282
286PVOID
287NTAPI
288MmLockPagableDataSection(
289 _In_ PVOID AddressWithinSection);
290
295PVOID
296NTAPI
301
306PVOID
307NTAPI
312
320PVOID
321NTAPI
326 _In_opt_ PVOID RequestedAddress,
327 _In_ ULONG BugCheckOnFailure,
329
332PVOID
333NTAPI
335 _In_ PVOID AddressWithinSection);
336
341VOID
342NTAPI
347
350NTAPI
352
355VOID
356NTAPI
358 _In_ PVOID AddressWithinSection);
359
361SIZE_T
362NTAPI
366
369VOID
370NTAPI
371MmUnlockPagableImageSection(
372 _In_ PVOID ImageSectionHandle);
373
376VOID
377NTAPI
380
383VOID
384NTAPI
388
391VOID
392NTAPI
393MmProbeAndLockProcessPages(
398
401VOID
402NTAPI
406
411PVOID
412NTAPI
413MmAllocateContiguousMemorySpecifyCacheNode(
419 _In_ NODE_REQUIREMENT PreferredNode);
421$if (_NTDDK_)
422
426NTAPI
428
431NTAPI
434
437NTAPI
440
445PVOID
446NTAPI
449
452VOID
453NTAPI
457
459PVOID
460NTAPI
463
468NTAPI
473
478PVOID
479NTAPI
484
489NTAPI
491 _In_ PVOID Section,
494
499NTAPI
501 _In_ PVOID Section,
504
508NTAPI
511
514NTAPI
516
519VOID
520NTAPI
521MmLockPagableSectionByHandle(
522 _In_ PVOID ImageSectionHandle);
523
527NTAPI
530
534NTAPI
537
540VOID
541NTAPI
543 _In_ HANDLE SecureHandle);
544
548NTAPI
550 _In_ PPHYSICAL_ADDRESS StartAddress,
552
556HANDLE
557NTAPI
562
565VOID
566NTAPI
570
574NTAPI
576 _In_ PPHYSICAL_ADDRESS StartAddress,
579$if (_NTIFS_)
580
583NTAPI
585
589NTAPI
593
597NTAPI
601
605NTAPI
609
613NTAPI
618
619#endif /* (NTDDI_VERSION >= NTDDI_WIN2K) */
620
622#if (NTDDI_VERSION >= NTDDI_WINXP)
624
629NTAPI
633
638PVOID
639NTAPI
640MmAllocateMappingAddress(
643
646VOID
647NTAPI
648MmFreeMappingAddress(
651
655NTAPI
657 _Out_ PULONG VerifierFlags);
658
666PVOID
667NTAPI
669 _In_ PVOID MappingAddress,
672 _In_ __drv_strictTypeMatch(__drv_typeCond)
674
679NTAPI
683
686VOID
687NTAPI
692
696NTAPI
701$if (_NTIFS_)
702
706NTAPI
708 _In_ ULONG NumberOfLists,
709 _In_reads_ (NumberOfLists) PREAD_LIST *ReadLists);
711
713#endif /* (NTDDI_VERSION >= NTDDI_WINXP) */
716#if (NTDDI_VERSION >= NTDDI_WS03)
721LOGICAL
722NTAPI
724 _In_ PHYSICAL_ADDRESS StartAddress,
727
728$if (_NTDDK_)
733NTAPI
737#endif /* (NTDDI_VERSION >= NTDDI_WS03) */
740#if (NTDDI_VERSION >= NTDDI_WS03SP1)
744PMDL
745NTAPI
747 _In_ PHYSICAL_ADDRESS LowAddress,
753#endif
755
756#if (NTDDI_VERSION >= NTDDI_VISTA)
760LOGICAL
761NTAPI
762MmIsDriverVerifyingByAddress(
763 _In_ PVOID AddressWithinSection);
765$if (_NTDDK_)
769NTAPI
770MmRotatePhysicalView(
778$if (_NTIFS_)
779
782ULONG
783NTAPI
785 _In_ PSECTION_OBJECT_POINTERS SectionPointer);
786
792NTAPI
800
805NTAPI
811
813#endif /* (NTDDI_VERSION >= NTDDI_VISTA) */
814
NTSTATUS NTAPI MmUnmapViewInSystemSpace(IN PVOID MappedBase)
Definition: section.c:2761
BOOLEAN NTAPI MmForceSectionClosed(IN PSECTION_OBJECT_POINTERS SectionObjectPointer, IN BOOLEAN DelayClose)
Definition: section.c:2675
ULONG NTAPI MmDoesFileHaveUserWritableReferences(IN PSECTION_OBJECT_POINTERS SectionPointer)
Definition: section.c:2985
NTSTATUS NTAPI MmUnmapViewInSessionSpace(IN PVOID MappedBase)
Definition: section.c:2722
NTSTATUS NTAPI MmMapViewInSessionSpace(IN PVOID Section, OUT PVOID *MappedBase, IN OUT PSIZE_T ViewSize)
Definition: section.c:2687
unsigned char BOOLEAN
LONG NTSTATUS
Definition: precomp.h:26
return
Definition: dirsup.c:529
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
VOID NTAPI MmFreeContiguousMemorySpecifyCache(IN PVOID BaseAddress, IN SIZE_T NumberOfBytes, IN MEMORY_CACHING_TYPE CacheType)
Definition: contmem.c:666
PVOID NTAPI MmAllocateContiguousMemory(IN SIZE_T NumberOfBytes, IN PHYSICAL_ADDRESS HighestAcceptableAddress)
Definition: contmem.c:626
VOID NTAPI MmFreeContiguousMemory(IN PVOID BaseAddress)
Definition: contmem.c:653
#define NULL
Definition: types.h:112
#define __drv_strictType(typename, mode)
Definition: driverspecs.h:329
#define __drv_freesMem(kind)
Definition: driverspecs.h:272
#define _IRQL_requires_max_(irql)
Definition: driverspecs.h:230
#define __drv_allocatesMem(kind)
Definition: driverspecs.h:257
#define __drv_strictTypeMatch(mode)
Definition: driverspecs.h:330
NTSTATUS NTAPI MmAddVerifierThunks(IN PVOID ThunkBuffer, IN ULONG ThunkBufferSize)
Definition: drvmgmt.c:82
NTSTATUS NTAPI MmIsVerifierEnabled(OUT PULONG VerifierFlags)
Definition: drvmgmt.c:233
PPHYSICAL_MEMORY_RANGE NTAPI MmGetPhysicalMemoryRanges(VOID)
Definition: dynamic.c:73
NTSTATUS NTAPI MmAddPhysicalMemory(IN PPHYSICAL_ADDRESS StartAddress, IN OUT PLARGE_INTEGER NumberOfBytes)
Definition: dynamic.c:25
NTSTATUS NTAPI MmRemovePhysicalMemory(IN PPHYSICAL_ADDRESS StartAddress, IN OUT PLARGE_INTEGER NumberOfBytes)
Definition: dynamic.c:61
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
#define APC_LEVEL
Definition: env_spec_w32.h:695
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
IN PDCB IN PCCB IN VBO IN OUT PULONG OUT PDIRENT OUT PBCB OUT PVBO ByteOffset
Definition: fatprocs.h:732
_Must_inspect_result_ _In_ PDEVICE_OBJECT _In_ PSECTION_OBJECT_POINTERS SectionObjectPointer
Definition: fsrtlfuncs.h:1369
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:223
#define _NTIFS_
Definition: ifssupp.h:20
PVOID NTAPI MmMapVideoDisplay(IN PHYSICAL_ADDRESS PhysicalAddress, IN SIZE_T NumberOfBytes, IN MEMORY_CACHING_TYPE CacheType)
Definition: iosup.c:243
VOID NTAPI MmUnmapIoSpace(IN PVOID BaseAddress, IN SIZE_T NumberOfBytes)
Definition: iosup.c:193
LOGICAL NTAPI MmIsIoSpaceActive(IN PHYSICAL_ADDRESS StartAddress, IN SIZE_T NumberOfBytes)
Definition: iosup.c:271
PVOID NTAPI MmMapIoSpace(IN PHYSICAL_ADDRESS PhysicalAddress, IN SIZE_T NumberOfBytes, IN MEMORY_CACHING_TYPE CacheType)
Definition: iosup.c:47
VOID NTAPI MmUnmapVideoDisplay(IN PVOID BaseAddress, IN SIZE_T NumberOfBytes)
Definition: iosup.c:260
PVOID NTAPI MmMapLockedPagesWithReservedMapping(_In_ PVOID MappingAddress, _In_ ULONG PoolTag, _In_ PMDL Mdl, _In_ MEMORY_CACHING_TYPE CacheType)
Definition: mdlsup.c:1629
PVOID NTAPI MmMapLockedPages(IN PMDL Mdl, IN KPROCESSOR_MODE AccessMode)
Definition: mdlsup.c:818
VOID NTAPI MmFreePagesFromMdl(IN PMDL Mdl)
Definition: mdlsup.c:564
VOID NTAPI MmProbeAndLockPages(IN PMDL Mdl, IN KPROCESSOR_MODE AccessMode, IN LOCK_OPERATION Operation)
Definition: mdlsup.c:931
VOID NTAPI MmUnmapReservedMapping(_In_ PVOID BaseAddress, _In_ ULONG PoolTag, _In_ PMDL Mdl)
Definition: mdlsup.c:1749
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:510
NTSTATUS NTAPI MmPrefetchPages(IN ULONG NumberOfLists, IN PREAD_LIST *ReadLists)
Definition: mdlsup.c:1850
PMDL NTAPI MmAllocatePagesForMdl(IN PHYSICAL_ADDRESS LowAddress, IN PHYSICAL_ADDRESS HighAddress, IN PHYSICAL_ADDRESS SkipBytes, IN SIZE_T TotalBytes)
Definition: mdlsup.c:489
VOID NTAPI MmUnlockPages(IN PMDL Mdl)
Definition: mdlsup.c:1435
VOID NTAPI MmBuildMdlForNonPagedPool(IN PMDL Mdl)
Definition: mdlsup.c:424
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:660
VOID NTAPI MmUnmapLockedPages(IN PVOID BaseAddress, IN PMDL Mdl)
Definition: mdlsup.c:837
NTSTATUS NTAPI MmProtectMdlSystemAddress(IN PMDL MemoryDescriptorList, IN ULONG NewProtect)
Definition: mdlsup.c:1862
NTSTATUS NTAPI MmAdvanceMdl(IN PMDL Mdl, IN ULONG NumberOfBytes)
Definition: mdlsup.c:1617
NTSTATUS NTAPI MmMapUserAddressesToPage(IN PVOID BaseAddress, IN SIZE_T NumberOfBytes, IN PVOID PageAddress)
Definition: mmsup.c:31
NTSTATUS NTAPI MmCreateMirror(VOID)
Definition: mmsup.c:265
BOOLEAN NTAPI MmSetAddressRangeModified(IN PVOID Address, IN SIZE_T Length)
Definition: mmsup.c:162
BOOLEAN NTAPI MmIsAddressValid(IN PVOID VirtualAddress)
Definition: mmsup.c:174
BOOLEAN NTAPI MmIsRecursiveIoFault(VOID)
Definition: mmsup.c:231
#define _Post_notnull_
Definition: ms_sal.h:701
VOID NTAPI MmFreeNonCachedMemory(IN PVOID BaseAddress, IN SIZE_T NumberOfBytes)
Definition: ncache.c:172
PVOID NTAPI MmAllocateNonCachedMemory(IN SIZE_T NumberOfBytes)
Definition: ncache.c:25
#define KernelMode
Definition: asm.h:34
#define UserMode
Definition: asm.h:35
_In_ HANDLE ProcessHandle
Definition: mmfuncs.h:403
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID _In_ ULONG_PTR ZeroBits
Definition: mmfuncs.h:405
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID * BaseAddress
Definition: mmfuncs.h:404
_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:410
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID _In_ ULONG_PTR _In_ SIZE_T _Inout_opt_ PLARGE_INTEGER _Inout_ PSIZE_T ViewSize
Definition: mmfuncs.h:408
__kernel_entry _Inout_ _Inout_ PSIZE_T RegionSize
Definition: mmfuncs.h:172
__kernel_entry _Inout_ _Inout_ PSIZE_T _In_ ULONG FreeType
Definition: mmfuncs.h:174
_In_opt_ ULONG Base
Definition: rtlfuncs.h:2451
#define _In_reads_bytes_(s)
Definition: no_sal2.h:170
#define _In_reads_(s)
Definition: no_sal2.h:168
#define _Outptr_result_bytebuffer_(s)
Definition: no_sal2.h:288
#define _Inout_
Definition: no_sal2.h:162
#define _Ret_maybenull_
Definition: no_sal2.h:328
#define _Field_size_bytes_opt_(s)
Definition: no_sal2.h:338
#define _Success_(c)
Definition: no_sal2.h:84
#define _At_(t, a)
Definition: no_sal2.h:40
#define _Outptr_result_buffer_(s)
Definition: no_sal2.h:286
#define _Post_writable_byte_size_(s)
Definition: no_sal2.h:542
#define _Out_writes_bytes_opt_(s)
Definition: no_sal2.h:228
#define _Post_invalid_
Definition: no_sal2.h:524
#define _Must_inspect_result_
Definition: no_sal2.h:62
#define _Out_
Definition: no_sal2.h:160
#define _In_
Definition: no_sal2.h:158
#define _In_opt_
Definition: no_sal2.h:212
#define _Maybe_raises_SEH_exception_
Definition: no_sal2.h:396
#define _When_(c, a)
Definition: no_sal2.h:38
#define _In_reads_bytes_opt_(s)
Definition: no_sal2.h:224
#define HEAP_TAG_SHIFT
Definition: nt_native.h:1724
#define HEAP_MAKE_TAG_FLAGS(b, o)
Definition: nt_native.h:1725
#define NTSYSCALLAPI
Definition: ntbasedef.h:204
#define _NTDDK_
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
NTSTATUS NTAPI NtFreeVirtualMemory(IN HANDLE ProcessHandle, IN PVOID *UBaseAddress, IN PSIZE_T URegionSize, IN ULONG FreeType)
Definition: virtual.c:5230
VOID NTAPI MmUnsecureVirtualMemory(IN PVOID SecureMem)
Definition: virtual.c:2807
PVOID NTAPI MmSecureVirtualMemory(IN PVOID Address, IN SIZE_T Length, IN ULONG Mode)
Definition: virtual.c:2794
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:4492
static WCHAR Address[46]
Definition: ping.c:68
ULONG PFN_NUMBER
Definition: ke.h:9
NTSTATUS NTAPI MmMapViewInSystemSpace(IN PVOID SectionObject, OUT PVOID *MappedBase, IN OUT PSIZE_T ViewSize)
Definition: section.c:4452
BOOLEAN NTAPI MmCanFileBeTruncated(_In_ PSECTION_OBJECT_POINTERS SectionObjectPointer, _In_opt_ PLARGE_INTEGER NewFileSize)
Definition: section.c:4260
BOOLEAN NTAPI MmFlushImageSection(IN PSECTION_OBJECT_POINTERS SectionObjectPointer, IN MMFLUSH_TYPE FlushType)
Definition: section.c:4361
#define __kernel_entry
Definition: specstrings.h:355
#define __in_data_source(src_sym)
Definition: specstrings.h:348
PVOID NTAPI MmGetSystemRoutineAddress(IN PUNICODE_STRING SystemRoutineName)
Definition: sysldr.c:3604
PVOID NTAPI MmPageEntireDriver(IN PVOID AddressWithinSection)
Definition: sysldr.c:3557
VOID NTAPI MmResetDriverPaging(IN PVOID AddressWithinSection)
Definition: sysldr.c:3594
ULONG_PTR * PSIZE_T
Definition: typedefs.h:80
uint32_t * PULONG
Definition: typedefs.h:59
#define NTAPI
Definition: typedefs.h:36
ULONG_PTR SIZE_T
Definition: typedefs.h:80
uint32_t ULONG_PTR
Definition: typedefs.h:65
uint32_t ULONG
Definition: typedefs.h:59
_Must_inspect_result_ _In_ WDFDEVICE _In_ BOOLEAN _In_opt_ PVOID Tag
Definition: wdfdevice.h:4065
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533
_Must_inspect_result_ _In_ WDFDMATRANSACTION _In_ PFN_WDF_PROGRAM_DMA _In_ WDF_DMA_DIRECTION _In_ PMDL _In_ PVOID VirtualAddress
_In_ WDFDEVICE _In_ PVOID _In_opt_ PMDL Mdl
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
Definition: wdfdriver.h:213
_In_ WDFINTERRUPT _In_ WDF_INTERRUPT_POLICY _In_ WDF_INTERRUPT_PRIORITY Priority
Definition: wdfinterrupt.h:655
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ _Strict_type_match_ POOL_TYPE _In_opt_ ULONG PoolTag
Definition: wdfmemory.h:164
#define FORCEINLINE
Definition: wdftypes.h:67
#define _WDMDDK_
Definition: wdm.template.h:26
#define NTKERNELAPI
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS PhysicalAddress
Definition: iotypes.h:1098
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS _In_ LARGE_INTEGER ByteCount
Definition: iotypes.h:1099
CCHAR KPROCESSOR_MODE
Definition: ketypes.h:7
enum _LOCK_OPERATION LOCK_OPERATION
_MODE
Definition: ketypes.h:10
_In_ PEPROCESS _In_ KPROCESSOR_MODE _In_ LOCK_OPERATION Operation
Definition: mmfuncs.h:397
_Must_inspect_result_ _Outptr_result_bytebuffer_ ViewSize PVOID * MappedBase
Definition: mmfuncs.h:492
_In_ ULONG ThunkBufferSize
Definition: mmfuncs.h:699
_Must_inspect_result_ _In_ PHYSICAL_ADDRESS HighAddress
Definition: mmfuncs.h:226
_Must_inspect_result_ _In_ PHYSICAL_ADDRESS _In_ PHYSICAL_ADDRESS _In_opt_ PHYSICAL_ADDRESS BoundaryAddressMultiple
Definition: mmfuncs.h:216
_Inout_ PMDL MemoryDescriptorList
Definition: mmfuncs.h:405
_In_ SIZE_T NumberOfBytes
Definition: mmfuncs.h:260
$endif(_NTIFS_) $if(_WDMDDK_) _Must_inspect_result_ _IRQL_requires_max_(DISPATCH_LEVEL) _When_(return !
Definition: rtlfuncs.h:2842
NTKERNELAPI PVOID NTAPI MmGetVirtualForPhysical(_In_ PHYSICAL_ADDRESS PhysicalAddress)
NTKERNELAPI BOOLEAN NTAPI MmIsNonPagedSystemAddressValid(_In_ PVOID VirtualAddress)
_Must_inspect_result_ _In_ _In_ ULONG ProbeMode
Definition: mmfuncs.h:561
_Must_inspect_result_ _In_ PHYSICAL_ADDRESS _In_ PHYSICAL_ADDRESS _In_opt_ PHYSICAL_ADDRESS _In_ MEMORY_CACHING_TYPE _In_ NODE_REQUIREMENT PreferredNode
Definition: mmfuncs.h:419
_In_ PEPROCESS _In_ KPROCESSOR_MODE AccessMode
Definition: mmfuncs.h:396
NTKERNELAPI BOOLEAN NTAPI MmIsThisAnNtAsSystem(VOID)
Definition: mmsup.c:246
NTKERNELAPI PHYSICAL_ADDRESS NTAPI MmGetPhysicalAddress(_In_ PVOID BaseAddress)
$if(_WDMDDK_) $endif(_WDMDDK_) $if(_NTIFS_) FORCEINLINE ULONG HEAP_MAKE_TAG_FLAGS(_In_ ULONG TagBase
Definition: ke.h:1
_Inout_ PSIZE_T _In_opt_ PMDLX _In_ MM_ROTATE_DIRECTION Direction
Definition: mmfuncs.h:774
_Inout_ PSIZE_T _In_opt_ PMDLX NewMdl
Definition: mmfuncs.h:773
NTKERNELAPI SIZE_T NTAPI MmSizeOfMdl(_In_reads_bytes_opt_(Length) PVOID Base, _In_ SIZE_T Length)
NTKERNELAPI MM_SYSTEMSIZE NTAPI MmQuerySystemSize(VOID)
Definition: mmsup.c:257
NTKERNELAPI LOGICAL NTAPI MmIsDriverVerifying(_In_ struct _DRIVER_OBJECT *DriverObject)
_Must_inspect_result_ _In_ ULONG NewProtect
Definition: mmfuncs.h:682
_Must_inspect_result_ _In_ PHYSICAL_ADDRESS LowestAcceptableAddress
Definition: mmfuncs.h:214
_In_ BOOLEAN DelayClose
Definition: mmfuncs.h:592
_Must_inspect_result_ _In_ SIZE_T _In_ PVOID PageAddress
Definition: mmfuncs.h:472
#define ADDRESS_AND_SIZE_TO_SPAN_PAGES(_Va, _Size)
_In_opt_ PLARGE_INTEGER NewFileSize
Definition: mmfuncs.h:608
_In_ MMFLUSH_TYPE FlushType
Definition: mmfuncs.h:600
_In_ PHYSICAL_ADDRESS HighestAcceptableAddress
Definition: mmfuncs.h:204
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)
_Must_inspect_result_ _In_ PHYSICAL_ADDRESS _In_ PHYSICAL_ADDRESS SkipBytes
Definition: mmfuncs.h:227
_Inout_ PSIZE_T _In_opt_ PMDLX _In_ MM_ROTATE_DIRECTION _In_ PMM_ROTATE_COPY_CALLBACK_FUNCTION CopyFunction
Definition: mmfuncs.h:775
_Must_inspect_result_ _In_ PHYSICAL_ADDRESS _In_ PHYSICAL_ADDRESS _In_opt_ PHYSICAL_ADDRESS _In_ MEMORY_CACHING_TYPE CacheType
Definition: mmfuncs.h:217
_Must_inspect_result_ _In_ PHYSICAL_ADDRESS _In_ PHYSICAL_ADDRESS _In_ SIZE_T TotalBytes
Definition: mmfuncs.h:228
MMFLUSH_TYPE
Definition: mmtypes.h:183
enum _MM_SYSTEM_SIZE MM_SYSTEMSIZE
MDL
Definition: mmtypes.h:117
enum _MEMORY_CACHING_TYPE MEMORY_CACHING_TYPE
* PPHYSICAL_MEMORY_RANGE
Definition: mmtypes.h:162
enum _MM_ROTATE_DIRECTION MM_ROTATE_DIRECTION
NTSTATUS(NTAPI * PMM_ROTATE_COPY_CALLBACK_FUNCTION)(_In_ PMDL DestinationMdl, _In_ PMDL SourceMdl, _In_ PVOID Context)
Definition: mmtypes.h:165
MDL * PMDLX
Definition: mmtypes.h:121
_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:221