[WIN32K]
[reactos.git] / reactos / include / ndk / mmfuncs.h
1 /*++ NDK Version: 0098
2
3 Copyright (c) Alex Ionescu. All rights reserved.
4
5 Header Name:
6
7 mmfuncs.h
8
9 Abstract:
10
11 Functions definitions for the Memory Manager.
12
13 Author:
14
15 Alex Ionescu (alexi@tinykrnl.org) - Updated - 27-Feb-2006
16
17 --*/
18
19 #ifndef _MMFUNCS_H
20 #define _MMFUNCS_H
21
22 //
23 // Dependencies
24 //
25 #include <umtypes.h>
26
27 #ifndef NTOS_MODE_USER
28
29 //
30 // Section Functions
31 //
32 NTSTATUS
33 NTAPI
34 MmCreateSection(
35 OUT PVOID *SectionObject,
36 IN ACCESS_MASK DesiredAccess,
37 IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
38 IN PLARGE_INTEGER MaximumSize,
39 IN ULONG SectionPageProtection,
40 IN ULONG AllocationAttributes,
41 IN HANDLE FileHandle OPTIONAL,
42 IN PFILE_OBJECT File OPTIONAL
43 );
44
45 NTSTATUS
46 NTAPI
47 MmMapViewOfSection(
48 IN PVOID SectionObject,
49 IN PEPROCESS Process,
50 IN OUT PVOID *BaseAddress,
51 IN ULONG_PTR ZeroBits,
52 IN SIZE_T CommitSize,
53 IN OUT PLARGE_INTEGER SectionOffset OPTIONAL,
54 IN OUT PSIZE_T ViewSize,
55 IN SECTION_INHERIT InheritDisposition,
56 IN ULONG AllocationType,
57 IN ULONG Protect
58 );
59
60 NTSTATUS
61 NTAPI
62 MmUnmapViewOfSection(
63 struct _EPROCESS* Process,
64 PVOID BaseAddress
65 );
66
67 #endif
68
69 //
70 // Native calls
71 //
72 NTSYSCALLAPI
73 NTSTATUS
74 NTAPI
75 NtAreMappedFilesTheSame(
76 IN PVOID File1MappedAsAnImage,
77 IN PVOID File2MappedAsFile
78 );
79
80 NTSTATUS
81 NTAPI
82 NtAllocateUserPhysicalPages(
83 IN HANDLE ProcessHandle,
84 IN OUT PULONG_PTR NumberOfPages,
85 IN OUT PULONG_PTR UserPfnArray
86 );
87
88 NTSYSCALLAPI
89 NTSTATUS
90 NTAPI
91 NtAllocateVirtualMemory(
92 IN HANDLE ProcessHandle,
93 IN OUT PVOID *BaseAddress,
94 IN ULONG_PTR ZeroBits,
95 IN OUT PSIZE_T RegionSize,
96 IN ULONG AllocationType,
97 IN ULONG Protect
98 );
99
100 NTSYSCALLAPI
101 NTSTATUS
102 NTAPI
103 NtCreatePagingFile(
104 IN PUNICODE_STRING FileName,
105 IN PLARGE_INTEGER InitialSize,
106 IN PLARGE_INTEGER MaxiumSize,
107 IN ULONG Reserved
108 );
109
110 NTSYSCALLAPI
111 NTSTATUS
112 NTAPI
113 NtCreateSection(
114 OUT PHANDLE SectionHandle,
115 IN ACCESS_MASK DesiredAccess,
116 IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
117 IN PLARGE_INTEGER MaximumSize OPTIONAL,
118 IN ULONG SectionPageProtection OPTIONAL,
119 IN ULONG AllocationAttributes,
120 IN HANDLE FileHandle OPTIONAL
121 );
122
123 NTSYSCALLAPI
124 NTSTATUS
125 NTAPI
126 NtExtendSection(
127 IN HANDLE SectionHandle,
128 IN PLARGE_INTEGER NewMaximumSize
129 );
130
131 NTSYSCALLAPI
132 NTSTATUS
133 NTAPI
134 NtFlushVirtualMemory(
135 IN HANDLE ProcessHandle,
136 IN OUT PVOID *BaseAddress,
137 IN OUT PSIZE_T RegionSize,
138 OUT PIO_STATUS_BLOCK IoStatus
139 );
140
141 NTSTATUS
142 NTAPI
143 NtFreeUserPhysicalPages(
144 IN HANDLE ProcessHandle,
145 IN OUT PULONG_PTR NumberOfPages,
146 IN OUT PULONG_PTR UserPfnArray
147 );
148
149 NTSYSCALLAPI
150 NTSTATUS
151 NTAPI
152 NtFreeVirtualMemory(
153 IN HANDLE ProcessHandle,
154 IN PVOID *BaseAddress,
155 IN PSIZE_T RegionSize,
156 IN ULONG FreeType
157 );
158
159
160 NTSTATUS
161 NTAPI
162 NtGetWriteWatch(
163 IN HANDLE ProcessHandle,
164 IN ULONG Flags,
165 IN PVOID BaseAddress,
166 IN SIZE_T RegionSize,
167 IN PVOID *UserAddressArray,
168 OUT PULONG_PTR EntriesInUserAddressArray,
169 OUT PULONG Granularity
170 );
171
172 NTSYSCALLAPI
173 NTSTATUS
174 NTAPI
175 NtLockVirtualMemory(
176 IN HANDLE ProcessHandle,
177 IN OUT PVOID *BaseAddress,
178 IN OUT PSIZE_T NumberOfBytesToLock,
179 IN ULONG MapType
180 );
181
182 NTSTATUS
183 NTAPI
184 NtMapUserPhysicalPages(
185 IN PVOID VirtualAddresses,
186 IN ULONG_PTR NumberOfPages,
187 IN OUT PULONG_PTR UserPfnArray
188 );
189
190 NTSTATUS
191 NTAPI
192 NtMapUserPhysicalPagesScatter(
193 IN PVOID *VirtualAddresses,
194 IN ULONG_PTR NumberOfPages,
195 IN OUT PULONG_PTR UserPfnArray
196 );
197
198 NTSYSCALLAPI
199 NTSTATUS
200 NTAPI
201 NtMapViewOfSection(
202 IN HANDLE SectionHandle,
203 IN HANDLE ProcessHandle,
204 IN OUT PVOID *BaseAddress,
205 IN ULONG_PTR ZeroBits,
206 IN SIZE_T CommitSize,
207 IN OUT PLARGE_INTEGER SectionOffset OPTIONAL,
208 IN OUT PSIZE_T ViewSize,
209 IN SECTION_INHERIT InheritDisposition,
210 IN ULONG AllocationType,
211 IN ULONG AccessProtection
212 );
213
214 NTSYSCALLAPI
215 NTSTATUS
216 NTAPI
217 NtOpenSection(
218 OUT PHANDLE SectionHandle,
219 IN ACCESS_MASK DesiredAccess,
220 IN POBJECT_ATTRIBUTES ObjectAttributes
221 );
222
223 NTSYSCALLAPI
224 NTSTATUS
225 NTAPI
226 NtProtectVirtualMemory(
227 IN HANDLE ProcessHandle,
228 IN PVOID *BaseAddress,
229 IN SIZE_T *NumberOfBytesToProtect,
230 IN ULONG NewAccessProtection,
231 OUT PULONG OldAccessProtection
232 );
233
234 NTSYSCALLAPI
235 NTSTATUS
236 NTAPI
237 NtQuerySection(
238 IN HANDLE SectionHandle,
239 IN SECTION_INFORMATION_CLASS SectionInformationClass,
240 OUT PVOID SectionInformation,
241 IN SIZE_T Length,
242 OUT PSIZE_T ResultLength
243 );
244
245 NTSYSCALLAPI
246 NTSTATUS
247 NTAPI
248 NtQueryVirtualMemory(
249 IN HANDLE ProcessHandle,
250 IN PVOID Address,
251 IN MEMORY_INFORMATION_CLASS VirtualMemoryInformationClass,
252 OUT PVOID VirtualMemoryInformation,
253 IN SIZE_T Length,
254 OUT PSIZE_T ResultLength
255 );
256
257 NTSYSCALLAPI
258 NTSTATUS
259 NTAPI
260 NtReadVirtualMemory(
261 IN HANDLE ProcessHandle,
262 IN PVOID BaseAddress,
263 OUT PVOID Buffer,
264 IN SIZE_T NumberOfBytesToRead,
265 OUT PSIZE_T NumberOfBytesRead
266 );
267
268 NTSTATUS
269 NTAPI
270 NtResetWriteWatch(
271 IN HANDLE ProcessHandle,
272 IN PVOID BaseAddress,
273 IN SIZE_T RegionSize
274 );
275
276 NTSYSCALLAPI
277 NTSTATUS
278 NTAPI
279 NtUnlockVirtualMemory(
280 IN HANDLE ProcessHandle,
281 IN OUT PVOID *BaseAddress,
282 IN OUT PSIZE_T NumberOfBytesToUnlock,
283 IN ULONG MapType
284 );
285
286 NTSYSCALLAPI
287 NTSTATUS
288 NTAPI
289 NtUnmapViewOfSection(
290 IN HANDLE ProcessHandle,
291 IN PVOID BaseAddress
292 );
293
294 NTSYSCALLAPI
295 NTSTATUS
296 NTAPI
297 NtWriteVirtualMemory(
298 IN HANDLE ProcessHandle,
299 IN PVOID BaseAddress,
300 IN PVOID Buffer,
301 IN SIZE_T NumberOfBytesToWrite,
302 OUT PSIZE_T NumberOfBytesWritten
303 );
304
305 NTSYSAPI
306 NTSTATUS
307 NTAPI
308 ZwAreMappedFilesTheSame(
309 IN PVOID File1MappedAsAnImage,
310 IN PVOID File2MappedAsFile
311 );
312
313 NTSYSAPI
314 NTSTATUS
315 NTAPI
316 ZwAllocateVirtualMemory(
317 IN HANDLE ProcessHandle,
318 IN OUT PVOID *BaseAddress,
319 IN ULONG_PTR ZeroBits,
320 IN OUT PSIZE_T RegionSize,
321 IN ULONG AllocationType,
322 IN ULONG Protect
323 );
324
325 NTSYSAPI
326 NTSTATUS
327 NTAPI
328 ZwCreatePagingFile(
329 IN PUNICODE_STRING FileName,
330 IN PLARGE_INTEGER InitialSize,
331 IN PLARGE_INTEGER MaxiumSize,
332 IN ULONG Reserved
333 );
334
335 NTSYSAPI
336 NTSTATUS
337 NTAPI
338 ZwCreateSection(
339 OUT PHANDLE SectionHandle,
340 IN ACCESS_MASK DesiredAccess,
341 IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
342 IN PLARGE_INTEGER MaximumSize OPTIONAL,
343 IN ULONG SectionPageProtection OPTIONAL,
344 IN ULONG AllocationAttributes,
345 IN HANDLE FileHandle OPTIONAL
346 );
347
348 NTSYSAPI
349 NTSTATUS
350 NTAPI
351 ZwExtendSection(
352 IN HANDLE SectionHandle,
353 IN PLARGE_INTEGER NewMaximumSize
354 );
355
356 NTSYSAPI
357 NTSTATUS
358 NTAPI
359 ZwFreeVirtualMemory(
360 IN HANDLE ProcessHandle,
361 IN PVOID *BaseAddress,
362 IN PSIZE_T RegionSize,
363 IN ULONG FreeType
364 );
365
366 NTSYSAPI
367 NTSTATUS
368 NTAPI
369 ZwLockVirtualMemory(
370 IN HANDLE ProcessHandle,
371 IN OUT PVOID *BaseAddress,
372 IN OUT PSIZE_T NumberOfBytesToLock,
373 IN ULONG MapType
374 );
375
376 NTSYSAPI
377 NTSTATUS
378 NTAPI
379 ZwMapViewOfSection(
380 IN HANDLE SectionHandle,
381 IN HANDLE ProcessHandle,
382 IN OUT PVOID *BaseAddress,
383 IN ULONG_PTR ZeroBits,
384 IN SIZE_T CommitSize,
385 IN OUT PLARGE_INTEGER SectionOffset OPTIONAL,
386 IN OUT PSIZE_T ViewSize,
387 IN SECTION_INHERIT InheritDisposition,
388 IN ULONG AllocationType,
389 IN ULONG AccessProtection
390 );
391
392 NTSYSAPI
393 NTSTATUS
394 NTAPI
395 ZwOpenSection(
396 OUT PHANDLE SectionHandle,
397 IN ACCESS_MASK DesiredAccess,
398 IN POBJECT_ATTRIBUTES ObjectAttributes
399 );
400
401 NTSYSAPI
402 NTSTATUS
403 NTAPI
404 ZwProtectVirtualMemory(
405 IN HANDLE ProcessHandle,
406 IN PVOID *BaseAddress,
407 IN SIZE_T *NumberOfBytesToProtect,
408 IN ULONG NewAccessProtection,
409 OUT PULONG OldAccessProtection
410 );
411
412 NTSYSAPI
413 NTSTATUS
414 NTAPI
415 ZwQuerySection(
416 IN HANDLE SectionHandle,
417 IN SECTION_INFORMATION_CLASS SectionInformationClass,
418 OUT PVOID SectionInformation,
419 IN SIZE_T Length,
420 OUT PSIZE_T ResultLength
421 );
422
423 NTSYSAPI
424 NTSTATUS
425 NTAPI
426 ZwQueryVirtualMemory(
427 IN HANDLE ProcessHandle,
428 IN PVOID Address,
429 IN MEMORY_INFORMATION_CLASS VirtualMemoryInformationClass,
430 OUT PVOID VirtualMemoryInformation,
431 IN SIZE_T Length,
432 OUT PSIZE_T ResultLength
433 );
434
435 NTSYSAPI
436 NTSTATUS
437 NTAPI
438 ZwReadVirtualMemory(
439 IN HANDLE ProcessHandle,
440 IN PVOID BaseAddress,
441 OUT PVOID Buffer,
442 IN SIZE_T NumberOfBytesToRead,
443 OUT PSIZE_T NumberOfBytesRead
444 );
445
446 NTSYSAPI
447 NTSTATUS
448 NTAPI
449 ZwUnlockVirtualMemory(
450 IN HANDLE ProcessHandle,
451 IN OUT PVOID *BaseAddress,
452 IN OUT PSIZE_T NumberOfBytesToUnlock,
453 IN ULONG MapType
454 );
455
456 NTSYSAPI
457 NTSTATUS
458 NTAPI
459 ZwUnmapViewOfSection(
460 IN HANDLE ProcessHandle,
461 IN PVOID BaseAddress
462 );
463
464 NTSYSAPI
465 NTSTATUS
466 NTAPI
467 ZwWriteVirtualMemory(
468 IN HANDLE ProcessHandle,
469 IN PVOID BaseAddress,
470 IN PVOID Buffer,
471 IN SIZE_T NumberOfBytesToWrite,
472 OUT PSIZE_T NumberOfBytesWritten
473 );
474
475 #endif