ReactOS 0.4.15-dev-8131-g4988de4
ZwMapViewOfSection.c
Go to the documentation of this file.
1/*
2* PROJECT: ReactOS kernel-mode tests
3* LICENSE: GPLv2+ - See COPYING in the top level directory
4* PURPOSE: Kernel-Mode Test Suite ZwMapViewOfSection
5* PROGRAMMER: Nikolay Borisov <nib9@aber.ac.uk>
6*/
7
8#include <kmt_test.h>
9
10#define IGNORE -99
11#define NEW_CONTENT "NewContent"
12#define NEW_CONTENT_LEN sizeof(NEW_CONTENT)
13
14static UNICODE_STRING FileReadOnlyPath = RTL_CONSTANT_STRING(L"\\SystemRoot\\system32\\ntdll.dll");
15static UNICODE_STRING NtosImgPath = RTL_CONSTANT_STRING(L"\\SystemRoot\\system32\\ntoskrnl.exe");
16static UNICODE_STRING WritableFilePath = RTL_CONSTANT_STRING(L"\\SystemRoot\\kmtest-MmSection.txt");
17static UNICODE_STRING SharedSectionName = RTL_CONSTANT_STRING(L"\\BaseNamedObjects\\kmtest-SharedSection");
18extern const char TestString[];
19extern const ULONG TestStringSize;
23
24#define TestMapView(SectionHandle, ProcessHandle, BaseAddress2, ZeroBits, CommitSize, SectionOffset, ViewSize2, InheritDisposition, AllocationType, Win32Protect, MapStatus, UnmapStatus) do \
25 { \
26 Status = ZwMapViewOfSection(SectionHandle, ProcessHandle, BaseAddress2, ZeroBits, CommitSize, SectionOffset, ViewSize2, InheritDisposition, AllocationType, Win32Protect); \
27 ok_eq_hex(Status, MapStatus); \
28 if (NT_SUCCESS(Status)) \
29 { \
30 Status = ZwUnmapViewOfSection(ProcessHandle, BaseAddress); \
31 if (UnmapStatus != IGNORE) ok_eq_hex(Status, UnmapStatus); \
32 *BaseAddress2 = NULL; \
33 *ViewSize2 = 0; \
34 } \
35 } while (0) \
36
37#define MmTestMapView(Object, ProcessHandle, BaseAddress2, ZeroBits, CommitSize, SectionOffset, ViewSize2, InheritDisposition, AllocationType, Win32Protect, MapStatus, UnmapStatus) do \
38 { \
39 Status = MmMapViewOfSection(Object, ProcessHandle, BaseAddress2, ZeroBits, CommitSize, SectionOffset, ViewSize2, InheritDisposition, AllocationType, Win32Protect); \
40 ok_eq_hex(Status, MapStatus); \
41 if (NT_SUCCESS(Status)) \
42 { \
43 Status = MmUnmapViewOfSection(ProcessHandle, BaseAddress); \
44 if (UnmapStatus != IGNORE) ok_eq_hex(Status, UnmapStatus); \
45 *BaseAddress2 = NULL; \
46 *ViewSize2 = 0; \
47 } \
48 } while (0) \
49
50#define CheckObject(Handle, Pointers, Handles) do \
51{ \
52 PUBLIC_OBJECT_BASIC_INFORMATION ObjectInfo; \
53 Status = ZwQueryObject(Handle, ObjectBasicInformation, \
54 &ObjectInfo, sizeof ObjectInfo, NULL); \
55 ok_eq_hex(Status, STATUS_SUCCESS); \
56 ok_eq_ulong(ObjectInfo.PointerCount, Pointers); \
57 ok_eq_ulong(ObjectInfo.HandleCount, Handles); \
58} while (0) \
59
60static
61VOID
62KmtInitTestFiles(PHANDLE ReadOnlyFile, PHANDLE WriteOnlyFile, PHANDLE ExecutableFile)
63{
67
68 //INIT THE READ-ONLY FILE
71 ok(*ReadOnlyFile != NULL, "Couldn't acquire READONLY handle\n");
72
73 //INIT THE EXECUTABLE FILE
76 ok(*ExecutableFile != NULL, "Couldn't acquire EXECUTE handle\n");
77
78 //INIT THE WRITE-ONLY FILE
79 //TODO: Delete the file when the tests are all executed
83 ok(*WriteOnlyFile != NULL, "WriteOnlyFile is NULL\n");
84 if (!skip(*WriteOnlyFile != NULL, "No WriteOnlyFile\n"))
85 {
86 FileOffset.QuadPart = 0;
87 Status = ZwWriteFile(*WriteOnlyFile, NULL, NULL, NULL, &IoStatusBlock, (PVOID)TestString, TestStringSize, &FileOffset, NULL);
88 ok(Status == STATUS_SUCCESS || Status == STATUS_PENDING, "Status = 0x%08lx\n", Status);
89 Status = ZwWaitForSingleObject(*WriteOnlyFile, FALSE, NULL);
92 }
93}
94
95static
96VOID
97SimpleErrorChecks(HANDLE FileHandleReadOnly, HANDLE FileHandleWriteOnly, HANDLE ExecutableImg)
98{
100 HANDLE WriteSectionHandle;
101 HANDLE ReadOnlySection;
102 HANDLE PageFileSectionHandle;
105 SIZE_T AllocSize = TestStringSize;
106 SIZE_T ViewSize = 0;
108 PVOID AllocBase = NULL;
109 MaximumSize.QuadPart = TestStringSize;
110
111 //Used for parameters working on file-based section
112 Status = ZwCreateSection(&WriteSectionHandle, SECTION_ALL_ACCESS, NULL, &MaximumSize, PAGE_READWRITE, SEC_COMMIT, FileHandleWriteOnly);
114
115 Status = ZwCreateSection(&ReadOnlySection, SECTION_ALL_ACCESS, NULL, &MaximumSize, PAGE_READONLY, SEC_COMMIT, FileHandleReadOnly);
117
118 //Used for parameters taking effect only on page-file backed section
120 Status = ZwCreateSection(&PageFileSectionHandle, SECTION_ALL_ACCESS, NULL, &MaximumSize, PAGE_READWRITE, SEC_COMMIT, NULL);
122
123 MaximumSize.QuadPart = TestStringSize;
124
125 //section handle
130
131 //process handle
132 TestMapView(WriteSectionHandle, (HANDLE)(ULONG_PTR)0xDEADBEEFDEADBEEFull, &BaseAddress, 0, 0, NULL, &ViewSize, ViewUnmap, 0, PAGE_READWRITE, STATUS_INVALID_HANDLE, IGNORE);
134
135 //base address
136 BaseAddress = (PVOID)(ULONG_PTR)0x00567A20;
138
139 BaseAddress = (PVOID)(ULONG_PTR)0x60000000;
141
142 BaseAddress = (PVOID)((char *)MmSystemRangeStart + 200);
144
145 //invalid section handle AND unaligned base address
146 BaseAddress = (PVOID)(ULONG_PTR)0x00567A20;
148
149 //invalid process handle AND unaligned base address
150 BaseAddress = (PVOID)(ULONG_PTR)0x00567A20;
151 TestMapView(WriteSectionHandle, (HANDLE)(ULONG_PTR)0xDEADBEEFDEADBEEFull, &BaseAddress, 0, 0, NULL, &ViewSize, ViewUnmap, 0, PAGE_READWRITE, STATUS_INVALID_HANDLE, IGNORE);
152
153 //try mapping section to an already mapped address
154 Status = ZwAllocateVirtualMemory(NtCurrentProcess(), &AllocBase, 0, &AllocSize, MEM_COMMIT, PAGE_READWRITE);
155 if (!skip(NT_SUCCESS(Status), "Cannot allocate memory\n"))
156 {
157 BaseAddress = AllocBase;
159 Status = ZwFreeVirtualMemory(NtCurrentProcess(), &AllocBase, &AllocSize, MEM_RELEASE);
161 }
162
163 //zero bits
170
171 //commit size
178
179 //section offset
180 SectionOffset.QuadPart = 0;
182 ok_eq_ulonglong(SectionOffset.QuadPart, 0);
183
184 SectionOffset.QuadPart = 0x00040211; //MSDN is wrong, in w2k3 the ZwMapViewOfSection doesn't align offsets automatically
186
187 SectionOffset.QuadPart = -1;
189
190 //View Size
192
193 ViewSize = -1;
195
199
202
205
206 //allocation type
211
212 //win32protect
224
225 ZwClose(WriteSectionHandle);
226 ZwClose(PageFileSectionHandle);
227 ZwClose(ReadOnlySection);
228}
229
230
231static
232VOID
233AdvancedErrorChecks(HANDLE FileHandleReadOnly, HANDLE FileHandleWriteOnly)
234{
237 HANDLE FileSectionHandle;
240 SIZE_T ViewSize = 0;
242
243 MaximumSize.QuadPart = TestStringSize;
244 //Used for parameters working on file-based section
245 Status = ZwCreateSection(&FileSectionHandle, SECTION_ALL_ACCESS, NULL, &MaximumSize, PAGE_READWRITE, SEC_COMMIT, FileHandleWriteOnly);
247
248 Status = ObReferenceObjectByHandle(FileSectionHandle,
250 NULL,
253 NULL);
254
256
257 //Bypassing Zw function calls mean bypassing the alignment checks which are not crucial for the branches being tested here
258
259 //test first conditional branch
260 ViewSize = -1;
262
263 //test second conditional branch
264 ViewSize = 1;
265 SectionOffset.QuadPart = TestStringSize;
267
269 ZwClose(FileSectionHandle);
270}
271
272static
273SIZE_T
275{
279 PVOID FileContent;
280 SIZE_T Match;
281
282 Match = 0;
283 ByteOffset.QuadPart = 0;
284
285 FileContent = ExAllocatePoolWithTag(PagedPool, BufferLength, 'Test');
286 if (!skip((FileContent != NULL), "Error allocating memory for FileContent\n"))
287 {
288 Status = ZwReadFile(FileHandle, NULL, NULL, NULL, &IoStatusBlock, FileContent, BufferLength, &ByteOffset, NULL);
291
292 Match = 0;
293 Match = RtlCompareMemory(FileContent, Buffer, BufferLength);
294 ExFreePoolWithTag(FileContent, 'Test');
295 }
296
297 return Match;
298}
299
300
301static
302VOID
303NTAPI
305{
308 HANDLE SectionHandle;
310 SIZE_T Match;
313
314 UNREFERENCED_PARAMETER(StartContext);
315
318 SectionOffset.QuadPart = 0;
319
322 if (!skip(NT_SUCCESS(Status), "Error acquiring handle to section. Error = %p\n", Status))
323 {
324 CheckObject(SectionHandle, 4, 2);
325 Status = ZwMapViewOfSection(SectionHandle, NtCurrentProcess(), &BaseAddress, 0, TestStringSize, &SectionOffset, &ViewSize, ViewUnmap, 0, PAGE_READWRITE);
326
327 //make sure ZwMapViewofSection doesn't touch the section ref counts.
328 CheckObject(SectionHandle, 4, 2);
329
330 if (!skip(NT_SUCCESS(Status), "Error mapping page file view in system process. Error = %p\n", Status))
331 {
334
336 ZwUnmapViewOfSection(NtCurrentProcess(), BaseAddress);
337
338 //make sure ZwMapViewofSection doesn't touch the section ref counts.
339 CheckObject(SectionHandle, 4, 2);
340 }
341
342 ZwClose(SectionHandle);
343 }
344
346}
347
348
349static
350VOID
351BehaviorChecks(HANDLE FileHandleReadOnly, HANDLE FileHandleWriteOnly)
352{
356 HANDLE WriteSectionHandle;
357 HANDLE SysThreadHandle;
361 SIZE_T Match;
362 SIZE_T ViewSize = 0;
363
365 MaximumSize.QuadPart = TestStringSize;
366 SectionOffset.QuadPart = 0;
367
368 Status = ZwCreateSection(&WriteSectionHandle, SECTION_ALL_ACCESS, &ObjectAttributes, &MaximumSize, PAGE_READWRITE, SEC_COMMIT, FileHandleWriteOnly);
369 CheckObject(WriteSectionHandle, 3, 1);
370 ok(NT_SUCCESS(Status), "Error creating write section from file. Error = %p\n", Status);
371
372 //check for section reading/writing by comparing section content to a well-known value.
373 Status = ZwMapViewOfSection(WriteSectionHandle, NtCurrentProcess() ,&BaseAddress, 0, 0, &SectionOffset, &ViewSize, ViewUnmap, 0, PAGE_READWRITE);
374 CheckObject(WriteSectionHandle, 3, 1);
375 if (!skip(NT_SUCCESS(Status), "Error mapping view with READ/WRITE priv. Error = %p\n", Status))
376 {
379
380 //now check writing to section
382
385
386 //check to see if the contents have been flushed to the actual file on disk.
387 Match = CompareFileContents(FileHandleWriteOnly, NEW_CONTENT_LEN, NEW_CONTENT);
389
390 //bring everything back to normal
392
393 //Initiate an external thread to modify the file
396 if (!skip(NT_SUCCESS(Status), "Error creating System thread. Error = %p\n", Status))
397 {
399 if (!skip(NT_SUCCESS(Status), "Error getting reference to System thread when testing file-backed section\n"))
400 {
401 //wait until the system thread actually terminates
403
404 //no longer need the thread object
406
407 //test for bi-directional access to the shared page file
410
411 //bring everything back to normal, again
413 }
414 }
415
416 ZwUnmapViewOfSection(NtCurrentProcess(), BaseAddress);
417 }
418
419 //Try to write to read-only mapped view
421 ViewSize = 0;
422 SectionOffset.QuadPart = 0;
423 Status = ZwMapViewOfSection(WriteSectionHandle, NtCurrentProcess(), &BaseAddress, 0, 0, &SectionOffset, &ViewSize, ViewUnmap, 0, PAGE_READONLY);
424 if (!skip(NT_SUCCESS(Status), "Error mapping view with READ priv. Error = %p\n", Status))
425 {
428
432
433 ZwUnmapViewOfSection(NtCurrentProcess(), BaseAddress);
434 }
435
436 //try to access forbidden memory
438 ViewSize = 0;
439 SectionOffset.QuadPart = 0;
440 Status = ZwMapViewOfSection(WriteSectionHandle, NtCurrentProcess(), &BaseAddress, 0, 0, &SectionOffset, &ViewSize, ViewUnmap, 0, PAGE_NOACCESS);
441 if (!skip(NT_SUCCESS(Status), "Error mapping view with PAGE_NOACCESS priv. Error = %p\n", Status))
442 {
446
447 ZwUnmapViewOfSection(NtCurrentProcess(), BaseAddress);
448 }
449
450 //try to access guarded memory
452 ViewSize = 0;
453 SectionOffset.QuadPart = 0;
454 Status = ZwMapViewOfSection(WriteSectionHandle, NtCurrentProcess(), &BaseAddress, 0, 0, &SectionOffset, &ViewSize, ViewUnmap, 0, PAGE_GUARD | PAGE_READWRITE);
455 if (!skip(NT_SUCCESS(Status), "Error mapping view with PAGE_GUARD priv. Error = %p\n", Status))
456 {
460
464
465 ZwUnmapViewOfSection(NtCurrentProcess(), BaseAddress);
466 }
467
468 ZwClose(WriteSectionHandle);
469
470 //section created with sec_reserve should not be commited.
472 ViewSize = 0;
473 SectionOffset.QuadPart = 0;
474 Status = ZwCreateSection(&WriteSectionHandle, SECTION_ALL_ACCESS, &ObjectAttributes, &MaximumSize, PAGE_READWRITE, SEC_RESERVE, FileHandleWriteOnly);
475 if (!skip(NT_SUCCESS(Status), "Error creating page file section. Error = %p\n", Status))
476 {
477 Status = ZwMapViewOfSection(WriteSectionHandle, NtCurrentProcess(), &BaseAddress, 0, TestStringSize, &SectionOffset, &ViewSize, ViewUnmap, MEM_RESERVE, PAGE_READWRITE);
478 if (!skip(NT_SUCCESS(Status), "Error mapping page file view. Error = %p\n", Status))
479 {
480 //check also the SEC_COMMIT flag
481 /* This test proves that MSDN is once again wrong
482 * msdn.microsoft.com/en-us/library/windows/hardware/aa366537.aspx states that SEC_RESERVE
483 * should cause the allocated memory for the view to be reserved but in fact it is always committed.
484 * It fails also on windows.
485 */
487 ZwUnmapViewOfSection(NtCurrentProcess(), BaseAddress);
488 }
489
490 ZwClose(WriteSectionHandle);
491 }
492}
493
494
495static
496VOID
498{
500 LARGE_INTEGER MaxSectionSize;
502 HANDLE PageFileSectionHandle;
505 SIZE_T Match;
508
509 MaxSectionSize.QuadPart = TestStringSize;
510 SectionOffset.QuadPart = 0;
511 PageFileSectionHandle = INVALID_HANDLE_VALUE;
515
516 //test memory sharing between 2 different processes
517 Status = ZwCreateSection(&PageFileSectionHandle, SECTION_ALL_ACCESS, &ObjectAttributes, &MaxSectionSize, PAGE_READWRITE, SEC_COMMIT, NULL);
518 if (!skip(NT_SUCCESS(Status), "Error creating page file section. Error = %p\n", Status))
519 {
520 CheckObject(PageFileSectionHandle, 3, 1);
521 Status = ZwMapViewOfSection(PageFileSectionHandle, NtCurrentProcess(), &BaseAddress, 0, TestStringSize, &SectionOffset, &ViewSize, ViewUnmap, 0, PAGE_READWRITE);
522 if (!skip(NT_SUCCESS(Status), "Error mapping page file view. Error = %p\n", Status))
523 {
524 HANDLE SysThreadHandle;
525
526 CheckObject(PageFileSectionHandle, 3, 1);
527
528 //check also the SEC_COMMIT flag
530
532
535
536 if (!skip(NT_SUCCESS(Status), "Error creating System thread. Error = %p\n", Status))
537 {
539 if (!skip(NT_SUCCESS(Status), "Error getting reference to System thread when testing pagefile-backed section\n"))
540 {
541 //wait until the system thread actually terminates
543
544 //no longer need the thread object
546
547 //test for bi-directional access to the shared page file
550 }
551 }
552 ZwUnmapViewOfSection(NtCurrentProcess(), BaseAddress);
553 }
554 ZwClose(PageFileSectionHandle);
555 }
556}
557
558
559START_TEST(ZwMapViewOfSection)
560{
561 HANDLE FileHandleReadOnly = NULL;
562 HANDLE FileHandleWriteOnly = NULL;
563 HANDLE ExecutableFileHandle = NULL;
564
568
569 KmtInitTestFiles(&FileHandleReadOnly, &FileHandleWriteOnly, &ExecutableFileHandle);
570
571 SimpleErrorChecks(FileHandleReadOnly, FileHandleWriteOnly, ExecutableFileHandle);
572 AdvancedErrorChecks(FileHandleReadOnly, FileHandleWriteOnly);
573 BehaviorChecks(FileHandleReadOnly, FileHandleWriteOnly);
575
576 if (FileHandleReadOnly)
577 ZwClose(FileHandleReadOnly);
578
579 if (FileHandleWriteOnly)
580 ZwClose(FileHandleWriteOnly);
581
582 if (ExecutableFileHandle)
583 ZwClose(ExecutableFileHandle);
584}
#define MmTestMapView(Object, ProcessHandle, BaseAddress2, ZeroBits, CommitSize, SectionOffset, ViewSize2, InheritDisposition, AllocationType, Win32Protect, MapStatus, UnmapStatus)
static OBJECT_ATTRIBUTES NtoskrnlFileObject
static VOID KmtInitTestFiles(PHANDLE ReadOnlyFile, PHANDLE WriteOnlyFile, PHANDLE ExecutableFile)
static VOID NTAPI SystemProcessWorker(PVOID StartContext)
static UNICODE_STRING FileReadOnlyPath
static VOID AdvancedErrorChecks(HANDLE FileHandleReadOnly, HANDLE FileHandleWriteOnly)
static SIZE_T CompareFileContents(HANDLE FileHandle, ULONG BufferLength, PVOID Buffer)
static UNICODE_STRING SharedSectionName
#define TestMapView(SectionHandle, ProcessHandle, BaseAddress2, ZeroBits, CommitSize, SectionOffset, ViewSize2, InheritDisposition, AllocationType, Win32Protect, MapStatus, UnmapStatus)
static VOID SimpleErrorChecks(HANDLE FileHandleReadOnly, HANDLE FileHandleWriteOnly, HANDLE ExecutableImg)
#define CheckObject(Handle, Pointers, Handles)
static UNICODE_STRING WritableFilePath
static VOID BehaviorChecks(HANDLE FileHandleReadOnly, HANDLE FileHandleWriteOnly)
#define NEW_CONTENT_LEN
const ULONG TestStringSize
#define NEW_CONTENT
static VOID PageFileBehaviorChecks()
#define IGNORE
static OBJECT_ATTRIBUTES KmtestFileObject
static OBJECT_ATTRIBUTES NtdllObject
static UNICODE_STRING NtosImgPath
#define ok_eq_hex(value, expected)
Definition: apitest.h:77
#define ok_eq_size(value, expected)
Definition: apitest.h:69
#define ok_eq_ulongptr(value, expected)
Definition: apitest.h:71
#define ok_eq_ulonglong(value, expected)
Definition: apitest.h:65
#define ok(value,...)
Definition: atltest.h:57
#define skip(...)
Definition: atltest.h:64
#define START_TEST(x)
Definition: atltest.h:75
LONG NTSTATUS
Definition: precomp.h:26
#define FILE_NON_DIRECTORY_FILE
Definition: constants.h:492
#define FILE_DELETE_ON_CLOSE
Definition: constants.h:494
_In_ PFCB _In_ LONGLONG FileOffset
Definition: cdprocs.h:160
Definition: bufpool.h:45
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:36
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define PAGE_READONLY
Definition: compat.h:138
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define GENERIC_READ
Definition: compat.h:135
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
#define FILE_SHARE_READ
Definition: compat.h:136
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define KeWaitForSingleObject(pEvt, foo, a, b, c)
Definition: env_spec_w32.h:478
#define RtlCompareMemory(s1, s2, l)
Definition: env_spec_w32.h:465
#define PAGE_SIZE
Definition: env_spec_w32.h:49
#define PagedPool
Definition: env_spec_w32.h:308
IN PDCB IN PCCB IN VBO IN OUT PULONG OUT PDIRENT OUT PBCB OUT PVBO ByteOffset
Definition: fatprocs.h:731
_Must_inspect_result_ _In_opt_ PFLT_INSTANCE _Out_ PHANDLE FileHandle
Definition: fltkernel.h:1231
#define FILE_OPEN
Definition: from_kernel.h:54
#define FILE_SUPERSEDE
Definition: from_kernel.h:53
_Must_inspect_result_ _Outptr_ PVOID * SectionObject
Definition: fsrtlfuncs.h:860
Status
Definition: gdiplustypes.h:25
#define OBJ_KERNEL_HANDLE
Definition: winternl.h:231
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
#define KmtStartSeh()
Definition: kmt_test.h:282
#define Test_NtQueryVirtualMemory(BaseAddress, Size, AllocationType, ProtectionType)
Definition: kmt_test.h:72
#define KmtEndSeh(ExpectedStatus)
Definition: kmt_test.h:288
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
static OUT PIO_STATUS_BLOCK IoStatusBlock
Definition: pipe.c:75
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
#define KernelMode
Definition: asm.h:34
#define MM_ALLOCATION_GRANULARITY
Definition: mmtypes.h:36
@ ThreadObject
Definition: ketypes.h:412
NTSYSAPI NTSTATUS NTAPI ZwOpenSection(_Out_ PHANDLE SectionHandle, _In_ ACCESS_MASK DesiredAccess, _In_ POBJECT_ATTRIBUTES ObjectAttributes)
_In_ ACCESS_MASK _In_opt_ POBJECT_ATTRIBUTES _In_opt_ PLARGE_INTEGER MaximumSize
Definition: mmfuncs.h:362
_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 SectionOffset
Definition: mmfuncs.h:407
_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
#define SEC_COMMIT
Definition: mmtypes.h:100
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
#define THREAD_ALL_ACCESS
Definition: nt_native.h:1339
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
#define SYNCHRONIZE
Definition: nt_native.h:61
#define PAGE_WRITECOPY
Definition: nt_native.h:1305
#define PAGE_READWRITE
Definition: nt_native.h:1304
#define PAGE_EXECUTE_READ
Definition: nt_native.h:1307
#define SECTION_ALL_ACCESS
Definition: nt_native.h:1293
#define PAGE_EXECUTE
Definition: nt_native.h:1306
#define SEC_RESERVE
Definition: nt_native.h:1323
#define FILE_CREATED
Definition: nt_native.h:770
#define NtCurrentProcess()
Definition: nt_native.h:1657
@ ViewUnmap
Definition: nt_native.h:1279
#define STANDARD_RIGHTS_ALL
Definition: nt_native.h:69
#define PAGE_EXECUTE_WRITECOPY
Definition: nt_native.h:1309
#define MEM_RESERVE
Definition: nt_native.h:1314
#define MEM_LARGE_PAGES
Definition: nt_native.h:1322
#define MEM_RELEASE
Definition: nt_native.h:1316
#define GENERIC_WRITE
Definition: nt_native.h:90
#define MEM_COMMIT
Definition: nt_native.h:1313
#define GENERIC_EXECUTE
Definition: nt_native.h:91
#define PAGE_NOACCESS
Definition: nt_native.h:1302
#define PAGE_GUARD
Definition: nt_native.h:1310
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
#define MmSystemRangeStart
Definition: mm.h:32
NTSTATUS NTAPI PsTerminateSystemThread(IN NTSTATUS ExitStatus)
Definition: kill.c:1145
POBJECT_TYPE PsThreadType
Definition: thread.c:20
NTSTATUS NTAPI PsCreateSystemThread(OUT PHANDLE ThreadHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, IN HANDLE ProcessHandle, IN PCLIENT_ID ClientId, IN PKSTART_ROUTINE StartRoutine, IN PVOID StartContext)
Definition: thread.c:602
PVOID *typedef PHANDLE
Definition: ntsecpkg.h:455
#define STATUS_INVALID_VIEW_SIZE
Definition: ntstatus.h:268
#define STATUS_MAPPED_ALIGNMENT
Definition: ntstatus.h:676
#define STATUS_INVALID_HANDLE
Definition: ntstatus.h:245
#define STATUS_SECTION_PROTECTION
Definition: ntstatus.h:314
#define STATUS_INVALID_PARAMETER_9
Definition: ntstatus.h:483
#define STATUS_INVALID_PARAMETER_4
Definition: ntstatus.h:478
#define STATUS_PENDING
Definition: ntstatus.h:82
#define STATUS_NO_MEMORY
Definition: ntstatus.h:260
#define STATUS_ACCESS_VIOLATION
Definition: ntstatus.h:242
#define STATUS_CONFLICTING_ADDRESSES
Definition: ntstatus.h:261
#define STATUS_INVALID_PAGE_PROTECTION
Definition: ntstatus.h:305
#define STATUS_GUARD_PAGE_VIOLATION
Definition: ntstatus.h:182
#define STATUS_INVALID_PARAMETER_3
Definition: ntstatus.h:477
#define STATUS_INVALID_PARAMETER_5
Definition: ntstatus.h:479
#define STATUS_OBJECT_TYPE_MISMATCH
Definition: ntstatus.h:273
#define L(x)
Definition: ntvdm.h:50
NTSTATUS NTAPI ObReferenceObjectByHandle(IN HANDLE Handle, IN ACCESS_MASK DesiredAccess, IN POBJECT_TYPE ObjectType, IN KPROCESSOR_MODE AccessMode, OUT PVOID *Object, OUT POBJECT_HANDLE_INFORMATION HandleInformation OPTIONAL)
Definition: obref.c:494
#define STATUS_SUCCESS
Definition: shellext.h:65
EH_STD::basic_string< char, EH_STD::char_traits< char >, eh_allocator(char) > TestString
Definition: test_string.cpp:30
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14
#define NTAPI
Definition: typedefs.h:36
void * PVOID
Definition: typedefs.h:50
ULONG_PTR SIZE_T
Definition: typedefs.h:80
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
uint32_t ULONG_PTR
Definition: typedefs.h:65
uint32_t ULONG
Definition: typedefs.h:59
LONGLONG QuadPart
Definition: typedefs.h:114
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG BufferLength
Definition: wdfdevice.h:3771
@ Executive
Definition: ketypes.h:415
#define ObDereferenceObject
Definition: obfuncs.h:203
#define PsGetCurrentProcess
Definition: psfuncs.h:17