1c2c66affSColin Finck /******************************************************************************
2c2c66affSColin Finck * Memory manager Functions *
3c2c66affSColin Finck ******************************************************************************/
4c2c66affSColin Finck $if (_WDMDDK_)
5c2c66affSColin Finck /* Alignment Macros */
6c2c66affSColin Finck #define ALIGN_DOWN_BY(size, align) \
7c2c66affSColin Finck ((ULONG_PTR)(size) & ~((ULONG_PTR)(align) - 1))
8c2c66affSColin Finck
9c2c66affSColin Finck #define ALIGN_UP_BY(size, align) \
10c2c66affSColin Finck (ALIGN_DOWN_BY(((ULONG_PTR)(size) + align - 1), align))
11c2c66affSColin Finck
12c2c66affSColin Finck #define ALIGN_DOWN_POINTER_BY(ptr, align) \
13c2c66affSColin Finck ((PVOID)ALIGN_DOWN_BY(ptr, align))
14c2c66affSColin Finck
15c2c66affSColin Finck #define ALIGN_UP_POINTER_BY(ptr, align) \
16c2c66affSColin Finck ((PVOID)ALIGN_UP_BY(ptr, align))
17c2c66affSColin Finck
18c2c66affSColin Finck #define ALIGN_DOWN(size, type) \
19c2c66affSColin Finck ALIGN_DOWN_BY(size, sizeof(type))
20c2c66affSColin Finck
21c2c66affSColin Finck #define ALIGN_UP(size, type) \
22c2c66affSColin Finck ALIGN_UP_BY(size, sizeof(type))
23c2c66affSColin Finck
24c2c66affSColin Finck #define ALIGN_DOWN_POINTER(ptr, type) \
25c2c66affSColin Finck ALIGN_DOWN_POINTER_BY(ptr, sizeof(type))
26c2c66affSColin Finck
27c2c66affSColin Finck #define ALIGN_UP_POINTER(ptr, type) \
28c2c66affSColin Finck ALIGN_UP_POINTER_BY(ptr, sizeof(type))
29c2c66affSColin Finck
30c2c66affSColin Finck #ifndef FIELD_OFFSET
31c2c66affSColin Finck #define FIELD_OFFSET(type, field) ((ULONG)&(((type *)0)->field))
32c2c66affSColin Finck #endif
33c2c66affSColin Finck
34c2c66affSColin Finck #ifndef FIELD_SIZE
35c2c66affSColin Finck #define FIELD_SIZE(type, field) (sizeof(((type *)0)->field))
36c2c66affSColin Finck #endif
37c2c66affSColin Finck
38c2c66affSColin Finck #define POOL_TAGGING 1
39c2c66affSColin Finck
40c2c66affSColin Finck #if DBG
41c2c66affSColin Finck #define IF_DEBUG if (TRUE)
42c2c66affSColin Finck #else
43c2c66affSColin Finck #define IF_DEBUG if (FALSE)
44c2c66affSColin Finck #endif /* DBG */
45c2c66affSColin Finck
46c2c66affSColin Finck /* ULONG
47c2c66affSColin Finck * BYTE_OFFSET(
48c2c66affSColin Finck * _In_ PVOID Va)
49c2c66affSColin Finck */
50c2c66affSColin Finck #define BYTE_OFFSET(Va) \
51c2c66affSColin Finck ((ULONG) ((ULONG_PTR) (Va) & (PAGE_SIZE - 1)))
52c2c66affSColin Finck
53c2c66affSColin Finck /* ULONG
54c2c66affSColin Finck * BYTES_TO_PAGES(
55c2c66affSColin Finck * _In_ ULONG Size)
56c2c66affSColin Finck *
57c2c66affSColin Finck * Note: This needs to be like this to avoid overflows!
58c2c66affSColin Finck */
59c2c66affSColin Finck #define BYTES_TO_PAGES(Size) \
60c2c66affSColin Finck (((Size) >> PAGE_SHIFT) + (((Size) & (PAGE_SIZE - 1)) != 0))
61c2c66affSColin Finck
62c2c66affSColin Finck /* PVOID
63c2c66affSColin Finck * PAGE_ALIGN(
64c2c66affSColin Finck * _In_ PVOID Va)
65c2c66affSColin Finck */
66c2c66affSColin Finck #define PAGE_ALIGN(Va) \
67c2c66affSColin Finck ((PVOID) ((ULONG_PTR)(Va) & ~(PAGE_SIZE - 1)))
68c2c66affSColin Finck
69c2c66affSColin Finck /* ULONG_PTR
70c2c66affSColin Finck * ROUND_TO_PAGES(
71c2c66affSColin Finck * _In_ ULONG_PTR Size)
72c2c66affSColin Finck */
73c2c66affSColin Finck #define ROUND_TO_PAGES(Size) \
74c2c66affSColin Finck (((ULONG_PTR) (Size) + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1))
75c2c66affSColin Finck
76c2c66affSColin Finck /* ULONG
77c2c66affSColin Finck * ADDRESS_AND_SIZE_TO_SPAN_PAGES(
78c2c66affSColin Finck * _In_ PVOID Va,
79c2c66affSColin Finck * _In_ ULONG Size)
80c2c66affSColin Finck */
81c2c66affSColin Finck #define ADDRESS_AND_SIZE_TO_SPAN_PAGES(_Va, _Size) \
82c2c66affSColin Finck ((ULONG) ((((ULONG_PTR) (_Va) & (PAGE_SIZE - 1)) \
83c2c66affSColin Finck + (_Size) + (PAGE_SIZE - 1)) >> PAGE_SHIFT))
84c2c66affSColin Finck
85c2c66affSColin Finck #define COMPUTE_PAGES_SPANNED(Va, Size) \
86c2c66affSColin Finck ADDRESS_AND_SIZE_TO_SPAN_PAGES(Va,Size)
87c2c66affSColin Finck
88c2c66affSColin Finck /*
89c2c66affSColin Finck * ULONG
90c2c66affSColin Finck * MmGetMdlByteCount(
91c2c66affSColin Finck * _In_ PMDL Mdl)
92c2c66affSColin Finck */
93c2c66affSColin Finck #define MmGetMdlByteCount(_Mdl) \
94c2c66affSColin Finck ((_Mdl)->ByteCount)
95c2c66affSColin Finck
96c2c66affSColin Finck /*
97c2c66affSColin Finck * ULONG
98c2c66affSColin Finck * MmGetMdlByteOffset(
99c2c66affSColin Finck * IN PMDL Mdl)
100c2c66affSColin Finck */
101c2c66affSColin Finck #define MmGetMdlByteOffset(_Mdl) \
102c2c66affSColin Finck ((_Mdl)->ByteOffset)
103c2c66affSColin Finck
104c2c66affSColin Finck #define MmGetMdlBaseVa(Mdl) ((Mdl)->StartVa)
105c2c66affSColin Finck
106c2c66affSColin Finck /*
107c2c66affSColin Finck * PPFN_NUMBER
108c2c66affSColin Finck * MmGetMdlPfnArray(
109c2c66affSColin Finck * _In_ PMDL Mdl)
110c2c66affSColin Finck */
111c2c66affSColin Finck #define MmGetMdlPfnArray(_Mdl) \
112c2c66affSColin Finck ((PPFN_NUMBER) ((_Mdl) + 1))
113c2c66affSColin Finck
114c2c66affSColin Finck /*
115c2c66affSColin Finck * PVOID
116c2c66affSColin Finck * MmGetMdlVirtualAddress(
117c2c66affSColin Finck * _In_ PMDL Mdl)
118c2c66affSColin Finck */
119c2c66affSColin Finck #define MmGetMdlVirtualAddress(_Mdl) \
120c2c66affSColin Finck ((PVOID) ((PCHAR) ((_Mdl)->StartVa) + (_Mdl)->ByteOffset))
121c2c66affSColin Finck
122c2c66affSColin Finck #define MmGetProcedureAddress(Address) (Address)
123c2c66affSColin Finck #define MmLockPagableCodeSection(Address) MmLockPagableDataSection(Address)
124c2c66affSColin Finck
125c2c66affSColin Finck /* PVOID MmGetSystemAddressForMdl(
126c2c66affSColin Finck * _In_ PMDL Mdl);
127c2c66affSColin Finck */
128c2c66affSColin Finck #define MmGetSystemAddressForMdl(Mdl) \
129c2c66affSColin Finck (((Mdl)->MdlFlags & (MDL_MAPPED_TO_SYSTEM_VA | \
130c2c66affSColin Finck MDL_SOURCE_IS_NONPAGED_POOL)) ? \
131c2c66affSColin Finck ((Mdl)->MappedSystemVa) : \
132c2c66affSColin Finck (MmMapLockedPages((Mdl), KernelMode)))
133c2c66affSColin Finck
134c2c66affSColin Finck /* PVOID
135c2c66affSColin Finck * MmGetSystemAddressForMdlSafe(
136c2c66affSColin Finck * _In_ PMDL Mdl,
137c2c66affSColin Finck * _In_ MM_PAGE_PRIORITY Priority)
138c2c66affSColin Finck */
139c2c66affSColin Finck #define MmGetSystemAddressForMdlSafe(_Mdl, _Priority) \
140c2c66affSColin Finck (((_Mdl)->MdlFlags & (MDL_MAPPED_TO_SYSTEM_VA \
141c2c66affSColin Finck | MDL_SOURCE_IS_NONPAGED_POOL)) ? \
142c2c66affSColin Finck (_Mdl)->MappedSystemVa : \
143c2c66affSColin Finck (PVOID) MmMapLockedPagesSpecifyCache((_Mdl), \
144c2c66affSColin Finck KernelMode, MmCached, NULL, FALSE, (_Priority)))
145c2c66affSColin Finck
146c2c66affSColin Finck /*
147c2c66affSColin Finck * VOID
148c2c66affSColin Finck * MmInitializeMdl(
149c2c66affSColin Finck * _In_ PMDL MemoryDescriptorList,
150c2c66affSColin Finck * _In_ PVOID BaseVa,
151c2c66affSColin Finck * _In_ SIZE_T Length)
152c2c66affSColin Finck */
153c2c66affSColin Finck #define MmInitializeMdl(_MemoryDescriptorList, \
154c2c66affSColin Finck _BaseVa, \
155c2c66affSColin Finck _Length) \
156c2c66affSColin Finck { \
157c2c66affSColin Finck (_MemoryDescriptorList)->Next = (PMDL) NULL; \
158c2c66affSColin Finck (_MemoryDescriptorList)->Size = (CSHORT) (sizeof(MDL) + \
159c2c66affSColin Finck (sizeof(PFN_NUMBER) * ADDRESS_AND_SIZE_TO_SPAN_PAGES(_BaseVa, _Length))); \
160c2c66affSColin Finck (_MemoryDescriptorList)->MdlFlags = 0; \
161c2c66affSColin Finck (_MemoryDescriptorList)->StartVa = (PVOID) PAGE_ALIGN(_BaseVa); \
162c2c66affSColin Finck (_MemoryDescriptorList)->ByteOffset = BYTE_OFFSET(_BaseVa); \
163c2c66affSColin Finck (_MemoryDescriptorList)->ByteCount = (ULONG) _Length; \
164c2c66affSColin Finck }
165c2c66affSColin Finck
166c2c66affSColin Finck /*
167c2c66affSColin Finck * VOID
168c2c66affSColin Finck * MmPrepareMdlForReuse(
169c2c66affSColin Finck * _In_ PMDL Mdl)
170c2c66affSColin Finck */
171c2c66affSColin Finck #define MmPrepareMdlForReuse(_Mdl) \
172c2c66affSColin Finck { \
173c2c66affSColin Finck if (((_Mdl)->MdlFlags & MDL_PARTIAL_HAS_BEEN_MAPPED) != 0) { \
174c2c66affSColin Finck ASSERT(((_Mdl)->MdlFlags & MDL_PARTIAL) != 0); \
175c2c66affSColin Finck MmUnmapLockedPages((_Mdl)->MappedSystemVa, (_Mdl)); \
176c2c66affSColin Finck } else if (((_Mdl)->MdlFlags & MDL_PARTIAL) == 0) { \
177c2c66affSColin Finck ASSERT(((_Mdl)->MdlFlags & MDL_MAPPED_TO_SYSTEM_VA) == 0); \
178c2c66affSColin Finck } \
179c2c66affSColin Finck }
$endif(_WDMDDK_)180c2c66affSColin Finck $endif (_WDMDDK_)
181c2c66affSColin Finck $if (_NTIFS_)
182c2c66affSColin Finck
183c2c66affSColin Finck FORCEINLINE
184c2c66affSColin Finck ULONG
185c2c66affSColin Finck HEAP_MAKE_TAG_FLAGS(
186c2c66affSColin Finck _In_ ULONG TagBase,
187c2c66affSColin Finck _In_ ULONG Tag)
188c2c66affSColin Finck {
189c2c66affSColin Finck //__assume_bound(TagBase); // FIXME
190c2c66affSColin Finck return ((ULONG)((TagBase) + ((Tag) << HEAP_TAG_SHIFT)));
191c2c66affSColin Finck }
192c2c66affSColin Finck $endif (_NTIFS_)
193c2c66affSColin Finck
194c2c66affSColin Finck #if (NTDDI_VERSION >= NTDDI_WIN2K)
195c2c66affSColin Finck $if (_WDMDDK_)
196c2c66affSColin Finck _Must_inspect_result_
197c2c66affSColin Finck _IRQL_requires_max_(DISPATCH_LEVEL)
198c2c66affSColin Finck _When_ (return != NULL, _Post_writable_byte_size_ (NumberOfBytes))
199c2c66affSColin Finck NTKERNELAPI
200c2c66affSColin Finck PVOID
201c2c66affSColin Finck NTAPI
202c2c66affSColin Finck MmAllocateContiguousMemory(
203c2c66affSColin Finck _In_ SIZE_T NumberOfBytes,
204c2c66affSColin Finck _In_ PHYSICAL_ADDRESS HighestAcceptableAddress);
205c2c66affSColin Finck
206c2c66affSColin Finck _Must_inspect_result_
207c2c66affSColin Finck _IRQL_requires_max_(DISPATCH_LEVEL)
208c2c66affSColin Finck _When_ (return != NULL, _Post_writable_byte_size_ (NumberOfBytes))
209c2c66affSColin Finck NTKERNELAPI
210c2c66affSColin Finck PVOID
211c2c66affSColin Finck NTAPI
212c2c66affSColin Finck MmAllocateContiguousMemorySpecifyCache(
213c2c66affSColin Finck _In_ SIZE_T NumberOfBytes,
214c2c66affSColin Finck _In_ PHYSICAL_ADDRESS LowestAcceptableAddress,
215c2c66affSColin Finck _In_ PHYSICAL_ADDRESS HighestAcceptableAddress,
216c2c66affSColin Finck _In_opt_ PHYSICAL_ADDRESS BoundaryAddressMultiple,
217c2c66affSColin Finck _In_ MEMORY_CACHING_TYPE CacheType);
218c2c66affSColin Finck
219c2c66affSColin Finck _Must_inspect_result_
220c2c66affSColin Finck _IRQL_requires_max_(DISPATCH_LEVEL)
221c2c66affSColin Finck NTKERNELAPI
222c2c66affSColin Finck PMDL
223c2c66affSColin Finck NTAPI
224c2c66affSColin Finck MmAllocatePagesForMdl(
225c2c66affSColin Finck _In_ PHYSICAL_ADDRESS LowAddress,
226c2c66affSColin Finck _In_ PHYSICAL_ADDRESS HighAddress,
227c2c66affSColin Finck _In_ PHYSICAL_ADDRESS SkipBytes,
228c2c66affSColin Finck _In_ SIZE_T TotalBytes);
229c2c66affSColin Finck
230c2c66affSColin Finck _IRQL_requires_max_(DISPATCH_LEVEL)
231c2c66affSColin Finck NTKERNELAPI
232c2c66affSColin Finck VOID
233c2c66affSColin Finck NTAPI
234c2c66affSColin Finck MmBuildMdlForNonPagedPool(
235c2c66affSColin Finck _Inout_ PMDL MemoryDescriptorList);
236c2c66affSColin Finck
237c2c66affSColin Finck //DECLSPEC_DEPRECATED_DDK
238c2c66affSColin Finck NTKERNELAPI
239c2c66affSColin Finck PMDL
240c2c66affSColin Finck NTAPI
241c2c66affSColin Finck MmCreateMdl(
242c2c66affSColin Finck _Out_writes_bytes_opt_ (sizeof (MDL) + (sizeof (PFN_NUMBER) * ADDRESS_AND_SIZE_TO_SPAN_PAGES (Base, Length)))
243c2c66affSColin Finck PMDL MemoryDescriptorList,
244c2c66affSColin Finck _In_reads_bytes_opt_ (Length) PVOID Base,
245c2c66affSColin Finck _In_ SIZE_T Length);
246c2c66affSColin Finck
247c2c66affSColin Finck _IRQL_requires_max_(DISPATCH_LEVEL)
248c2c66affSColin Finck NTKERNELAPI
249c2c66affSColin Finck VOID
250c2c66affSColin Finck NTAPI
251c2c66affSColin Finck MmFreeContiguousMemory(
252c2c66affSColin Finck _In_ PVOID BaseAddress);
253c2c66affSColin Finck
254c2c66affSColin Finck _IRQL_requires_max_ (DISPATCH_LEVEL)
255c2c66affSColin Finck NTKERNELAPI
256c2c66affSColin Finck VOID
257c2c66affSColin Finck NTAPI
258c2c66affSColin Finck MmFreeContiguousMemorySpecifyCache(
259c2c66affSColin Finck _In_reads_bytes_ (NumberOfBytes) PVOID BaseAddress,
260c2c66affSColin Finck _In_ SIZE_T NumberOfBytes,
261c2c66affSColin Finck _In_ MEMORY_CACHING_TYPE CacheType);
262c2c66affSColin Finck
263c2c66affSColin Finck _IRQL_requires_max_(DISPATCH_LEVEL)
264c2c66affSColin Finck NTKERNELAPI
265c2c66affSColin Finck VOID
266c2c66affSColin Finck NTAPI
267c2c66affSColin Finck MmFreePagesFromMdl(
268c2c66affSColin Finck _Inout_ PMDL MemoryDescriptorList);
269c2c66affSColin Finck
270c2c66affSColin Finck _IRQL_requires_max_(PASSIVE_LEVEL)
271c2c66affSColin Finck NTKERNELAPI
272c2c66affSColin Finck PVOID
273c2c66affSColin Finck NTAPI
274c2c66affSColin Finck MmGetSystemRoutineAddress(
275c2c66affSColin Finck _In_ PUNICODE_STRING SystemRoutineName);
276c2c66affSColin Finck
277c2c66affSColin Finck NTKERNELAPI
278c2c66affSColin Finck LOGICAL
279c2c66affSColin Finck NTAPI
280c2c66affSColin Finck MmIsDriverVerifying(
281c2c66affSColin Finck _In_ struct _DRIVER_OBJECT *DriverObject);
282c2c66affSColin Finck
283c2c66affSColin Finck _Must_inspect_result_
284c2c66affSColin Finck _IRQL_requires_max_(APC_LEVEL)
285c2c66affSColin Finck NTKERNELAPI
286c2c66affSColin Finck PVOID
287c2c66affSColin Finck NTAPI
288c2c66affSColin Finck MmLockPagableDataSection(
289c2c66affSColin Finck _In_ PVOID AddressWithinSection);
290c2c66affSColin Finck
291c2c66affSColin Finck _Must_inspect_result_
292c2c66affSColin Finck _IRQL_requires_max_(DISPATCH_LEVEL)
293c2c66affSColin Finck _Out_writes_bytes_opt_ (NumberOfBytes)
294c2c66affSColin Finck NTKERNELAPI
295c2c66affSColin Finck PVOID
296c2c66affSColin Finck NTAPI
297c2c66affSColin Finck MmMapIoSpace(
298c2c66affSColin Finck _In_ PHYSICAL_ADDRESS PhysicalAddress,
299c2c66affSColin Finck _In_ SIZE_T NumberOfBytes,
300c2c66affSColin Finck _In_ MEMORY_CACHING_TYPE CacheType);
301c2c66affSColin Finck
302c2c66affSColin Finck _Must_inspect_result_
303c2c66affSColin Finck _When_(AccessMode==KernelMode, _IRQL_requires_max_(DISPATCH_LEVEL))
304c2c66affSColin Finck _When_(AccessMode==UserMode, _Maybe_raises_SEH_exception_ _IRQL_requires_max_(APC_LEVEL))
305c2c66affSColin Finck NTKERNELAPI
306c2c66affSColin Finck PVOID
307c2c66affSColin Finck NTAPI
308c2c66affSColin Finck MmMapLockedPages(
309c2c66affSColin Finck _Inout_ PMDL MemoryDescriptorList,
310c2c66affSColin Finck _In_ __drv_strictType(KPROCESSOR_MODE/enum _MODE,__drv_typeConst)
311c2c66affSColin Finck KPROCESSOR_MODE AccessMode);
312c2c66affSColin Finck
313c2c66affSColin Finck _Post_writable_byte_size_(MemoryDescriptorList->ByteCount)
314c2c66affSColin Finck _When_(AccessMode==KernelMode, _IRQL_requires_max_(DISPATCH_LEVEL))
315c2c66affSColin Finck _When_(AccessMode==UserMode, _Maybe_raises_SEH_exception_ _IRQL_requires_max_(APC_LEVEL) _Post_notnull_)
316c2c66affSColin Finck _At_(MemoryDescriptorList->MappedSystemVa, _Post_writable_byte_size_(MemoryDescriptorList->ByteCount))
317c2c66affSColin Finck _Must_inspect_result_
318c2c66affSColin Finck _Success_(return != NULL)
319c2c66affSColin Finck NTKERNELAPI
320c2c66affSColin Finck PVOID
321c2c66affSColin Finck NTAPI
322c2c66affSColin Finck MmMapLockedPagesSpecifyCache(
323c2c66affSColin Finck _Inout_ PMDL MemoryDescriptorList,
324d01518daSVictor Perevertkin _In_ __drv_strictType(KPROCESSOR_MODE/enum _MODE,__drv_typeConst) KPROCESSOR_MODE AccessMode,
325c2c66affSColin Finck _In_ __drv_strictTypeMatch(__drv_typeCond) MEMORY_CACHING_TYPE CacheType,
326d01518daSVictor Perevertkin _In_opt_ PVOID RequestedAddress,
327c2c66affSColin Finck _In_ ULONG BugCheckOnFailure,
328d01518daSVictor Perevertkin _In_ ULONG Priority);
329c2c66affSColin Finck
330c2c66affSColin Finck _IRQL_requires_max_(APC_LEVEL)
331c2c66affSColin Finck NTKERNELAPI
332c2c66affSColin Finck PVOID
333c2c66affSColin Finck NTAPI
334c2c66affSColin Finck MmPageEntireDriver(
335c2c66affSColin Finck _In_ PVOID AddressWithinSection);
336c2c66affSColin Finck
337c2c66affSColin Finck _IRQL_requires_max_(DISPATCH_LEVEL)
338c2c66affSColin Finck _At_(MemoryDescriptorList->StartVa + MemoryDescriptorList->ByteOffset,
339c2c66affSColin Finck _Field_size_bytes_opt_(MemoryDescriptorList->ByteCount))
340c2c66affSColin Finck NTKERNELAPI
341c2c66affSColin Finck VOID
342c2c66affSColin Finck NTAPI
343c2c66affSColin Finck MmProbeAndLockPages(
344c2c66affSColin Finck _Inout_ PMDL MemoryDescriptorList,
345c2c66affSColin Finck _In_ KPROCESSOR_MODE AccessMode,
346c2c66affSColin Finck _In_ LOCK_OPERATION Operation);
347c2c66affSColin Finck
348c2c66affSColin Finck NTKERNELAPI
349c2c66affSColin Finck MM_SYSTEMSIZE
350c2c66affSColin Finck NTAPI
351c2c66affSColin Finck MmQuerySystemSize(VOID);
352c2c66affSColin Finck
353c2c66affSColin Finck _IRQL_requires_max_(APC_LEVEL)
354c2c66affSColin Finck NTKERNELAPI
355c2c66affSColin Finck VOID
356c2c66affSColin Finck NTAPI
357c2c66affSColin Finck MmResetDriverPaging(
358c2c66affSColin Finck _In_ PVOID AddressWithinSection);
359c2c66affSColin Finck
360c2c66affSColin Finck NTKERNELAPI
361c2c66affSColin Finck SIZE_T
362c2c66affSColin Finck NTAPI
363c2c66affSColin Finck MmSizeOfMdl(
364c2c66affSColin Finck _In_reads_bytes_opt_ (Length) PVOID Base,
365c2c66affSColin Finck _In_ SIZE_T Length);
366c2c66affSColin Finck
367c2c66affSColin Finck _IRQL_requires_max_(DISPATCH_LEVEL)
368c2c66affSColin Finck NTKERNELAPI
369c2c66affSColin Finck VOID
370c2c66affSColin Finck NTAPI
371c2c66affSColin Finck MmUnlockPagableImageSection(
372c2c66affSColin Finck _In_ PVOID ImageSectionHandle);
373c2c66affSColin Finck
374c2c66affSColin Finck _IRQL_requires_max_(DISPATCH_LEVEL)
375c2c66affSColin Finck NTKERNELAPI
376c2c66affSColin Finck VOID
377c2c66affSColin Finck NTAPI
378c2c66affSColin Finck MmUnlockPages(
379c2c66affSColin Finck _Inout_ PMDL MemoryDescriptorList);
380c2c66affSColin Finck
381c2c66affSColin Finck _IRQL_requires_max_(DISPATCH_LEVEL)
382c2c66affSColin Finck NTKERNELAPI
383c2c66affSColin Finck VOID
384c2c66affSColin Finck NTAPI
385c2c66affSColin Finck MmUnmapIoSpace(
386c2c66affSColin Finck _In_reads_bytes_ (NumberOfBytes) PVOID BaseAddress,
387c2c66affSColin Finck _In_ SIZE_T NumberOfBytes);
388c2c66affSColin Finck
389c2c66affSColin Finck _IRQL_requires_max_ (APC_LEVEL)
390c2c66affSColin Finck NTKERNELAPI
391c2c66affSColin Finck VOID
392c2c66affSColin Finck NTAPI
393c2c66affSColin Finck MmProbeAndLockProcessPages(
394c2c66affSColin Finck _Inout_ PMDL MemoryDescriptorList,
395c2c66affSColin Finck _In_ PEPROCESS Process,
396c2c66affSColin Finck _In_ KPROCESSOR_MODE AccessMode,
397c2c66affSColin Finck _In_ LOCK_OPERATION Operation);
398c2c66affSColin Finck
399c2c66affSColin Finck _IRQL_requires_max_(DISPATCH_LEVEL)
400c2c66affSColin Finck NTKERNELAPI
401c2c66affSColin Finck VOID
402c2c66affSColin Finck NTAPI
403c2c66affSColin Finck MmUnmapLockedPages(
404c2c66affSColin Finck _In_ PVOID BaseAddress,
405c2c66affSColin Finck _Inout_ PMDL MemoryDescriptorList);
406c2c66affSColin Finck
407c2c66affSColin Finck _Must_inspect_result_
408c2c66affSColin Finck _IRQL_requires_max_(DISPATCH_LEVEL)
409c2c66affSColin Finck _When_ (return != NULL, _Post_writable_byte_size_ (NumberOfBytes))
410c2c66affSColin Finck NTKERNELAPI
411c2c66affSColin Finck PVOID
412c2c66affSColin Finck NTAPI
413c2c66affSColin Finck MmAllocateContiguousMemorySpecifyCacheNode(
414c2c66affSColin Finck _In_ SIZE_T NumberOfBytes,
415c2c66affSColin Finck _In_ PHYSICAL_ADDRESS LowestAcceptableAddress,
416c2c66affSColin Finck _In_ PHYSICAL_ADDRESS HighestAcceptableAddress,
417c2c66affSColin Finck _In_opt_ PHYSICAL_ADDRESS BoundaryAddressMultiple,
418c2c66affSColin Finck _In_ MEMORY_CACHING_TYPE CacheType,
419c2c66affSColin Finck _In_ NODE_REQUIREMENT PreferredNode);
420c2c66affSColin Finck $endif (_WDMDDK_)
421c2c66affSColin Finck $if (_NTDDK_)
422c2c66affSColin Finck
423c2c66affSColin Finck _IRQL_requires_max_ (PASSIVE_LEVEL)
424c2c66affSColin Finck NTKERNELAPI
425c2c66affSColin Finck PPHYSICAL_MEMORY_RANGE
426c2c66affSColin Finck NTAPI
427c2c66affSColin Finck MmGetPhysicalMemoryRanges(VOID);
428c2c66affSColin Finck
429c2c66affSColin Finck NTKERNELAPI
430c2c66affSColin Finck PHYSICAL_ADDRESS
431c2c66affSColin Finck NTAPI
432c2c66affSColin Finck MmGetPhysicalAddress(
433c2c66affSColin Finck _In_ PVOID BaseAddress);
434c2c66affSColin Finck
435c2c66affSColin Finck NTKERNELAPI
436c2c66affSColin Finck BOOLEAN
437c2c66affSColin Finck NTAPI
438c2c66affSColin Finck MmIsNonPagedSystemAddressValid(
439c2c66affSColin Finck _In_ PVOID VirtualAddress);
440c2c66affSColin Finck
441c2c66affSColin Finck _Must_inspect_result_
442c2c66affSColin Finck _IRQL_requires_max_(APC_LEVEL)
443c2c66affSColin Finck _Out_writes_bytes_opt_(NumberOfBytes)
444c2c66affSColin Finck NTKERNELAPI
445c2c66affSColin Finck PVOID
446c2c66affSColin Finck NTAPI
447c2c66affSColin Finck MmAllocateNonCachedMemory(
448c2c66affSColin Finck _In_ SIZE_T NumberOfBytes);
449c2c66affSColin Finck
450c2c66affSColin Finck _IRQL_requires_max_(APC_LEVEL)
451c2c66affSColin Finck NTKERNELAPI
452c2c66affSColin Finck VOID
453c2c66affSColin Finck NTAPI
454c2c66affSColin Finck MmFreeNonCachedMemory(
455c2c66affSColin Finck _In_reads_bytes_(NumberOfBytes) PVOID BaseAddress,
456c2c66affSColin Finck _In_ SIZE_T NumberOfBytes);
457c2c66affSColin Finck
458c2c66affSColin Finck NTKERNELAPI
459c2c66affSColin Finck PVOID
460c2c66affSColin Finck NTAPI
461c2c66affSColin Finck MmGetVirtualForPhysical(
462c2c66affSColin Finck _In_ PHYSICAL_ADDRESS PhysicalAddress);
463c2c66affSColin Finck
464c2c66affSColin Finck _Must_inspect_result_
465c2c66affSColin Finck _IRQL_requires_max_(APC_LEVEL)
466c2c66affSColin Finck NTKERNELAPI
467c2c66affSColin Finck NTSTATUS
468c2c66affSColin Finck NTAPI
469c2c66affSColin Finck MmMapUserAddressesToPage(
470c2c66affSColin Finck _In_reads_bytes_(NumberOfBytes) PVOID BaseAddress,
471c2c66affSColin Finck _In_ SIZE_T NumberOfBytes,
472c2c66affSColin Finck _In_ PVOID PageAddress);
473c2c66affSColin Finck
474c2c66affSColin Finck _Must_inspect_result_
475c2c66affSColin Finck _IRQL_requires_max_(APC_LEVEL)
476c2c66affSColin Finck _Out_writes_bytes_opt_(NumberOfBytes)
477c2c66affSColin Finck NTKERNELAPI
478c2c66affSColin Finck PVOID
479c2c66affSColin Finck NTAPI
480c2c66affSColin Finck MmMapVideoDisplay(
481c2c66affSColin Finck _In_ PHYSICAL_ADDRESS PhysicalAddress,
482c2c66affSColin Finck _In_ SIZE_T NumberOfBytes,
483c2c66affSColin Finck _In_ MEMORY_CACHING_TYPE CacheType);
484c2c66affSColin Finck
485c2c66affSColin Finck _Must_inspect_result_
486c2c66affSColin Finck _IRQL_requires_max_(APC_LEVEL)
487c2c66affSColin Finck NTKERNELAPI
488c2c66affSColin Finck NTSTATUS
489c2c66affSColin Finck NTAPI
490c2c66affSColin Finck MmMapViewInSessionSpace(
491c2c66affSColin Finck _In_ PVOID Section,
492c2c66affSColin Finck _Outptr_result_bytebuffer_(*ViewSize) PVOID *MappedBase,
493c2c66affSColin Finck _Inout_ PSIZE_T ViewSize);
494c2c66affSColin Finck
495c2c66affSColin Finck _Must_inspect_result_
496c2c66affSColin Finck _IRQL_requires_max_(APC_LEVEL)
497c2c66affSColin Finck NTKERNELAPI
498c2c66affSColin Finck NTSTATUS
499c2c66affSColin Finck NTAPI
500c2c66affSColin Finck MmMapViewInSystemSpace(
501c2c66affSColin Finck _In_ PVOID Section,
502c2c66affSColin Finck _Outptr_result_bytebuffer_(*ViewSize) PVOID *MappedBase,
503c2c66affSColin Finck _Inout_ PSIZE_T ViewSize);
504c2c66affSColin Finck
505c2c66affSColin Finck _IRQL_requires_max_(DISPATCH_LEVEL)
506c2c66affSColin Finck NTKERNELAPI
507c2c66affSColin Finck BOOLEAN
508c2c66affSColin Finck NTAPI
509c2c66affSColin Finck MmIsAddressValid(
510c2c66affSColin Finck _In_ PVOID VirtualAddress);
511c2c66affSColin Finck
512c2c66affSColin Finck NTKERNELAPI
513c2c66affSColin Finck BOOLEAN
514c2c66affSColin Finck NTAPI
515c2c66affSColin Finck MmIsThisAnNtAsSystem(VOID);
516c2c66affSColin Finck
517c2c66affSColin Finck _IRQL_requires_max_(APC_LEVEL)
518c2c66affSColin Finck NTKERNELAPI
519c2c66affSColin Finck VOID
520c2c66affSColin Finck NTAPI
521c2c66affSColin Finck MmLockPagableSectionByHandle(
522c2c66affSColin Finck _In_ PVOID ImageSectionHandle);
523c2c66affSColin Finck
524c2c66affSColin Finck _IRQL_requires_max_(APC_LEVEL)
525c2c66affSColin Finck NTKERNELAPI
526c2c66affSColin Finck NTSTATUS
527c2c66affSColin Finck NTAPI
528c2c66affSColin Finck MmUnmapViewInSessionSpace(
529c2c66affSColin Finck _In_ PVOID MappedBase);
530c2c66affSColin Finck
531c2c66affSColin Finck _IRQL_requires_max_(APC_LEVEL)
532c2c66affSColin Finck NTKERNELAPI
533c2c66affSColin Finck NTSTATUS
534c2c66affSColin Finck NTAPI
535c2c66affSColin Finck MmUnmapViewInSystemSpace(
536c2c66affSColin Finck _In_ PVOID MappedBase);
537c2c66affSColin Finck
538c2c66affSColin Finck _IRQL_requires_max_(APC_LEVEL)
539c2c66affSColin Finck NTKERNELAPI
540c2c66affSColin Finck VOID
541c2c66affSColin Finck NTAPI
542c2c66affSColin Finck MmUnsecureVirtualMemory(
543c2c66affSColin Finck _In_ HANDLE SecureHandle);
544c2c66affSColin Finck
545c2c66affSColin Finck _IRQL_requires_max_ (PASSIVE_LEVEL)
546c2c66affSColin Finck NTKERNELAPI
547c2c66affSColin Finck NTSTATUS
548c2c66affSColin Finck NTAPI
549c2c66affSColin Finck MmRemovePhysicalMemory(
550c2c66affSColin Finck _In_ PPHYSICAL_ADDRESS StartAddress,
551c2c66affSColin Finck _Inout_ PLARGE_INTEGER NumberOfBytes);
552c2c66affSColin Finck
553c2c66affSColin Finck _Must_inspect_result_
554c2c66affSColin Finck _IRQL_requires_max_(APC_LEVEL)
555c2c66affSColin Finck NTKERNELAPI
556c2c66affSColin Finck HANDLE
557c2c66affSColin Finck NTAPI
558c2c66affSColin Finck MmSecureVirtualMemory(
559c2c66affSColin Finck __in_data_source(USER_MODE) _In_reads_bytes_ (Size) PVOID Address,
560c2c66affSColin Finck _In_ __in_data_source(USER_MODE) SIZE_T Size,
561c2c66affSColin Finck _In_ ULONG ProbeMode);
562c2c66affSColin Finck
563c2c66affSColin Finck _IRQL_requires_max_(APC_LEVEL)
564c2c66affSColin Finck NTKERNELAPI
565c2c66affSColin Finck VOID
566c2c66affSColin Finck NTAPI
567c2c66affSColin Finck MmUnmapVideoDisplay(
568c2c66affSColin Finck _In_reads_bytes_(NumberOfBytes) PVOID BaseAddress,
569c2c66affSColin Finck _In_ SIZE_T NumberOfBytes);
570c2c66affSColin Finck
571c2c66affSColin Finck _IRQL_requires_max_ (PASSIVE_LEVEL)
572c2c66affSColin Finck NTKERNELAPI
573c2c66affSColin Finck NTSTATUS
574c2c66affSColin Finck NTAPI
575c2c66affSColin Finck MmAddPhysicalMemory(
576c2c66affSColin Finck _In_ PPHYSICAL_ADDRESS StartAddress,
577c2c66affSColin Finck _Inout_ PLARGE_INTEGER NumberOfBytes);
578c2c66affSColin Finck $endif (_NTDDK_)
579c2c66affSColin Finck $if (_NTIFS_)
580c2c66affSColin Finck
581c2c66affSColin Finck NTKERNELAPI
582c2c66affSColin Finck BOOLEAN
583c2c66affSColin Finck NTAPI
584c2c66affSColin Finck MmIsRecursiveIoFault(VOID);
585c2c66affSColin Finck
586c2c66affSColin Finck _IRQL_requires_max_ (APC_LEVEL)
587c2c66affSColin Finck NTKERNELAPI
588c2c66affSColin Finck BOOLEAN
589c2c66affSColin Finck NTAPI
590c2c66affSColin Finck MmForceSectionClosed(
591c2c66affSColin Finck _In_ PSECTION_OBJECT_POINTERS SectionObjectPointer,
592c2c66affSColin Finck _In_ BOOLEAN DelayClose);
593c2c66affSColin Finck
594c2c66affSColin Finck _IRQL_requires_max_ (APC_LEVEL)
595c2c66affSColin Finck NTKERNELAPI
596c2c66affSColin Finck BOOLEAN
597c2c66affSColin Finck NTAPI
598c2c66affSColin Finck MmFlushImageSection(
599c2c66affSColin Finck _In_ PSECTION_OBJECT_POINTERS SectionObjectPointer,
600c2c66affSColin Finck _In_ MMFLUSH_TYPE FlushType);
601c2c66affSColin Finck
602c2c66affSColin Finck _IRQL_requires_max_ (APC_LEVEL)
603c2c66affSColin Finck NTKERNELAPI
604c2c66affSColin Finck BOOLEAN
605c2c66affSColin Finck NTAPI
606c2c66affSColin Finck MmCanFileBeTruncated(
607c2c66affSColin Finck _In_ PSECTION_OBJECT_POINTERS SectionObjectPointer,
608c2c66affSColin Finck _In_opt_ PLARGE_INTEGER NewFileSize);
609c2c66affSColin Finck
610c2c66affSColin Finck _IRQL_requires_max_ (APC_LEVEL)
611c2c66affSColin Finck NTKERNELAPI
612c2c66affSColin Finck BOOLEAN
613c2c66affSColin Finck NTAPI
614c2c66affSColin Finck MmSetAddressRangeModified(
615c2c66affSColin Finck _In_reads_bytes_ (Length) PVOID Address,
616c2c66affSColin Finck _In_ SIZE_T Length);
617c2c66affSColin Finck $endif (_NTIFS_)
618c2c66affSColin Finck
619c2c66affSColin Finck #endif /* (NTDDI_VERSION >= NTDDI_WIN2K) */
620c2c66affSColin Finck
621c2c66affSColin Finck $if (_WDMDDK_ || _NTIFS_)
622c2c66affSColin Finck #if (NTDDI_VERSION >= NTDDI_WINXP)
623c2c66affSColin Finck $endif (_WDMDDK_ || _NTIFS_)
624c2c66affSColin Finck
625c2c66affSColin Finck $if (_WDMDDK_)
626c2c66affSColin Finck _IRQL_requires_max_(DISPATCH_LEVEL)
627c2c66affSColin Finck NTKERNELAPI
628c2c66affSColin Finck NTSTATUS
629c2c66affSColin Finck NTAPI
630c2c66affSColin Finck MmAdvanceMdl(
631c2c66affSColin Finck _Inout_ PMDL Mdl,
632c2c66affSColin Finck _In_ ULONG NumberOfBytes);
633c2c66affSColin Finck
634c2c66affSColin Finck _Must_inspect_result_
635c2c66affSColin Finck _IRQL_requires_max_(APC_LEVEL)
636*83d74e74SOleg Dubinskiy _Ret_maybenull_
637c2c66affSColin Finck NTKERNELAPI
638c2c66affSColin Finck PVOID
639c2c66affSColin Finck NTAPI
640c2c66affSColin Finck MmAllocateMappingAddress(
641c2c66affSColin Finck _In_ SIZE_T NumberOfBytes,
642c2c66affSColin Finck _In_ ULONG PoolTag);
643c2c66affSColin Finck
644c2c66affSColin Finck _IRQL_requires_max_(APC_LEVEL)
645c2c66affSColin Finck NTKERNELAPI
646c2c66affSColin Finck VOID
647c2c66affSColin Finck NTAPI
648c2c66affSColin Finck MmFreeMappingAddress(
649*83d74e74SOleg Dubinskiy _In_ __drv_freesMem(Mem) _Post_invalid_ PVOID BaseAddress,
650c2c66affSColin Finck _In_ ULONG PoolTag);
651c2c66affSColin Finck
652c2c66affSColin Finck _IRQL_requires_max_ (APC_LEVEL)
653c2c66affSColin Finck NTKERNELAPI
654c2c66affSColin Finck NTSTATUS
655c2c66affSColin Finck NTAPI
656c2c66affSColin Finck MmIsVerifierEnabled(
657c2c66affSColin Finck _Out_ PULONG VerifierFlags);
658c2c66affSColin Finck
659c2c66affSColin Finck _Post_writable_byte_size_(MemoryDescriptorList->ByteCount)
660c2c66affSColin Finck _IRQL_requires_max_(DISPATCH_LEVEL)
661c2c66affSColin Finck _At_(MemoryDescriptorList->MappedSystemVa + MemoryDescriptorList->ByteOffset,
662c2c66affSColin Finck _Post_writable_byte_size_(MemoryDescriptorList->ByteCount))
663c2c66affSColin Finck _Must_inspect_result_
664c2c66affSColin Finck _Success_(return != NULL)
665c2c66affSColin Finck NTKERNELAPI
666c2c66affSColin Finck PVOID
667c2c66affSColin Finck NTAPI
668c2c66affSColin Finck MmMapLockedPagesWithReservedMapping(
669c2c66affSColin Finck _In_ PVOID MappingAddress,
670c2c66affSColin Finck _In_ ULONG PoolTag,
671c2c66affSColin Finck _Inout_ PMDL MemoryDescriptorList,
672c2c66affSColin Finck _In_ __drv_strictTypeMatch(__drv_typeCond)
673c2c66affSColin Finck MEMORY_CACHING_TYPE CacheType);
674c2c66affSColin Finck
675c2c66affSColin Finck _Must_inspect_result_
676c2c66affSColin Finck _IRQL_requires_max_(DISPATCH_LEVEL)
677c2c66affSColin Finck NTKERNELAPI
678c2c66affSColin Finck NTSTATUS
679c2c66affSColin Finck NTAPI
680c2c66affSColin Finck MmProtectMdlSystemAddress(
681c2c66affSColin Finck _In_ PMDL MemoryDescriptorList,
682c2c66affSColin Finck _In_ ULONG NewProtect);
683c2c66affSColin Finck
684c2c66affSColin Finck _IRQL_requires_max_(DISPATCH_LEVEL)
685c2c66affSColin Finck NTKERNELAPI
686c2c66affSColin Finck VOID
687c2c66affSColin Finck NTAPI
688c2c66affSColin Finck MmUnmapReservedMapping(
689c2c66affSColin Finck _In_ PVOID BaseAddress,
690c2c66affSColin Finck _In_ ULONG PoolTag,
691c2c66affSColin Finck _Inout_ PMDL MemoryDescriptorList);
692c2c66affSColin Finck
693c2c66affSColin Finck _IRQL_requires_max_ (APC_LEVEL)
694c2c66affSColin Finck NTKERNELAPI
695c2c66affSColin Finck NTSTATUS
696c2c66affSColin Finck NTAPI
697c2c66affSColin Finck MmAddVerifierThunks(
698c2c66affSColin Finck _In_reads_bytes_ (ThunkBufferSize) PVOID ThunkBuffer,
699c2c66affSColin Finck _In_ ULONG ThunkBufferSize);
700c2c66affSColin Finck $endif (_WDMDDK_)
701c2c66affSColin Finck $if (_NTIFS_)
702c2c66affSColin Finck
703c2c66affSColin Finck _IRQL_requires_max_ (PASSIVE_LEVEL)
704c2c66affSColin Finck NTKERNELAPI
705c2c66affSColin Finck NTSTATUS
706c2c66affSColin Finck NTAPI
707c2c66affSColin Finck MmPrefetchPages(
708c2c66affSColin Finck _In_ ULONG NumberOfLists,
709c2c66affSColin Finck _In_reads_ (NumberOfLists) PREAD_LIST *ReadLists);
710c2c66affSColin Finck $endif (_NTIFS_)
711c2c66affSColin Finck
712c2c66affSColin Finck $if (_WDMDDK_ || _NTIFS_)
713c2c66affSColin Finck #endif /* (NTDDI_VERSION >= NTDDI_WINXP) */
714c2c66affSColin Finck $endif (_WDMDDK_ || _NTIFS_)
715c2c66affSColin Finck $if (_WDMDDK_ || _NTDDK_)
716c2c66affSColin Finck #if (NTDDI_VERSION >= NTDDI_WS03)
717c2c66affSColin Finck $endif (_WDMDDK_ || _NTDDK_)
718c2c66affSColin Finck $if (_WDMDDK_)
719c2c66affSColin Finck _IRQL_requires_max_ (DISPATCH_LEVEL)
720c2c66affSColin Finck NTKERNELAPI
721c2c66affSColin Finck LOGICAL
722c2c66affSColin Finck NTAPI
723c2c66affSColin Finck MmIsIoSpaceActive(
724c2c66affSColin Finck _In_ PHYSICAL_ADDRESS StartAddress,
725c2c66affSColin Finck _In_ SIZE_T NumberOfBytes);
726c2c66affSColin Finck $endif (_WDMDDK_)
727c2c66affSColin Finck
728c2c66affSColin Finck $if (_NTDDK_)
729c2c66affSColin Finck _Must_inspect_result_
730c2c66affSColin Finck _IRQL_requires_max_(PASSIVE_LEVEL)
731c2c66affSColin Finck NTKERNELAPI
732c2c66affSColin Finck NTSTATUS
733c2c66affSColin Finck NTAPI
734c2c66affSColin Finck MmCreateMirror(VOID);
735c2c66affSColin Finck $endif (_NTDDK_)
736c2c66affSColin Finck $if (_WDMDDK_ || _NTDDK_)
737c2c66affSColin Finck #endif /* (NTDDI_VERSION >= NTDDI_WS03) */
738c2c66affSColin Finck $endif (_WDMDDK_ || _NTDDK_)
739c2c66affSColin Finck $if (_WDMDDK_)
740c2c66affSColin Finck #if (NTDDI_VERSION >= NTDDI_WS03SP1)
741c2c66affSColin Finck _Must_inspect_result_
742c2c66affSColin Finck _IRQL_requires_max_ (DISPATCH_LEVEL)
743c2c66affSColin Finck NTKERNELAPI
744c2c66affSColin Finck PMDL
745c2c66affSColin Finck NTAPI
746c2c66affSColin Finck MmAllocatePagesForMdlEx(
747c2c66affSColin Finck _In_ PHYSICAL_ADDRESS LowAddress,
748c2c66affSColin Finck _In_ PHYSICAL_ADDRESS HighAddress,
749c2c66affSColin Finck _In_ PHYSICAL_ADDRESS SkipBytes,
750c2c66affSColin Finck _In_ SIZE_T TotalBytes,
751c2c66affSColin Finck _In_ MEMORY_CACHING_TYPE CacheType,
752c2c66affSColin Finck _In_ ULONG Flags);
753c2c66affSColin Finck #endif
754c2c66affSColin Finck $endif (_WDMDDK_)
755c2c66affSColin Finck
756c2c66affSColin Finck #if (NTDDI_VERSION >= NTDDI_VISTA)
757c2c66affSColin Finck $if (_WDMDDK_)
758c2c66affSColin Finck _IRQL_requires_max_ (APC_LEVEL)
759c2c66affSColin Finck NTKERNELAPI
760c2c66affSColin Finck LOGICAL
761c2c66affSColin Finck NTAPI
762c2c66affSColin Finck MmIsDriverVerifyingByAddress(
763c2c66affSColin Finck _In_ PVOID AddressWithinSection);
764c2c66affSColin Finck $endif (_WDMDDK_)
765c2c66affSColin Finck $if (_NTDDK_)
766c2c66affSColin Finck _Must_inspect_result_
767c2c66affSColin Finck _IRQL_requires_max_(APC_LEVEL)
768c2c66affSColin Finck NTSTATUS
769c2c66affSColin Finck NTAPI
770c2c66affSColin Finck MmRotatePhysicalView(
771c2c66affSColin Finck _In_ PVOID VirtualAddress,
772c2c66affSColin Finck _Inout_ PSIZE_T NumberOfBytes,
773c2c66affSColin Finck _In_opt_ PMDLX NewMdl,
774c2c66affSColin Finck _In_ MM_ROTATE_DIRECTION Direction,
775c2c66affSColin Finck _In_ PMM_ROTATE_COPY_CALLBACK_FUNCTION CopyFunction,
776c2c66affSColin Finck _In_opt_ PVOID Context);
777c2c66affSColin Finck $endif (_NTDDK_)
778c2c66affSColin Finck $if (_NTIFS_)
779c2c66affSColin Finck
780c2c66affSColin Finck _IRQL_requires_max_ (APC_LEVEL)
781c2c66affSColin Finck NTKERNELAPI
782c2c66affSColin Finck ULONG
783c2c66affSColin Finck NTAPI
784c2c66affSColin Finck MmDoesFileHaveUserWritableReferences(
785c2c66affSColin Finck _In_ PSECTION_OBJECT_POINTERS SectionPointer);
786c2c66affSColin Finck
787c2c66affSColin Finck _Must_inspect_result_
788c2c66affSColin Finck _At_(*BaseAddress, __drv_allocatesMem(Mem))
789c2c66affSColin Finck __kernel_entry
790c2c66affSColin Finck NTSYSCALLAPI
791c2c66affSColin Finck NTSTATUS
792c2c66affSColin Finck NTAPI
793c2c66affSColin Finck NtAllocateVirtualMemory(
794c2c66affSColin Finck _In_ HANDLE ProcessHandle,
795c2c66affSColin Finck _Inout_ _Outptr_result_buffer_(*RegionSize) PVOID *BaseAddress,
796c2c66affSColin Finck _In_ ULONG_PTR ZeroBits,
797c2c66affSColin Finck _Inout_ PSIZE_T RegionSize,
798c2c66affSColin Finck _In_ ULONG AllocationType,
799c2c66affSColin Finck _In_ ULONG Protect);
800c2c66affSColin Finck
801c2c66affSColin Finck __kernel_entry
802c2c66affSColin Finck _IRQL_requires_max_(PASSIVE_LEVEL)
803c2c66affSColin Finck NTSYSCALLAPI
804c2c66affSColin Finck NTSTATUS
805c2c66affSColin Finck NTAPI
806c2c66affSColin Finck NtFreeVirtualMemory(
807c2c66affSColin Finck _In_ HANDLE ProcessHandle,
808c2c66affSColin Finck _Inout_ __drv_freesMem(Mem) PVOID *BaseAddress,
809c2c66affSColin Finck _Inout_ PSIZE_T RegionSize,
810c2c66affSColin Finck _In_ ULONG FreeType);
811c2c66affSColin Finck
812c2c66affSColin Finck $endif (_NTIFS_)
813c2c66affSColin Finck #endif /* (NTDDI_VERSION >= NTDDI_VISTA) */
814c2c66affSColin Finck
815