ReactOS 0.4.16-dev-1494-gd054f63
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#define IsInvalidParamStatus(Status) \
14 (Status == STATUS_INVALID_PARAMETER || Status == STATUS_INVALID_PARAMETER_MIX || \
15 (Status >= STATUS_INVALID_PARAMETER_1 && Status <= STATUS_INVALID_PARAMETER_12))
16#define ok_invalid_parameter(Status) ok(IsInvalidParamStatus(Status), "Invalid status code (0x%X)\n", Status)
17
18static UNICODE_STRING FileReadOnlyPath = RTL_CONSTANT_STRING(L"\\SystemRoot\\system32\\ntdll.dll");
19static UNICODE_STRING NtosImgPath = RTL_CONSTANT_STRING(L"\\SystemRoot\\system32\\ntoskrnl.exe");
20static UNICODE_STRING WritableFilePath = RTL_CONSTANT_STRING(L"\\SystemRoot\\kmtest-MmSection.txt");
21static UNICODE_STRING SharedSectionName = RTL_CONSTANT_STRING(L"\\BaseNamedObjects\\kmtest-SharedSection");
22extern const char TestString[];
23extern const ULONG TestStringSize;
27
28#define TestMapView(SectionHandle, ProcessHandle, BaseAddress2, ZeroBits, CommitSize, SectionOffset, ViewSize2, InheritDisposition, AllocationType, Win32Protect, MapStatus, UnmapStatus) do \
29 { \
30 Status = ZwMapViewOfSection(SectionHandle, ProcessHandle, BaseAddress2, ZeroBits, CommitSize, SectionOffset, ViewSize2, InheritDisposition, AllocationType, Win32Protect); \
31 if (GetNTVersion() >= _WIN32_WINNT_WIN10 && IsInvalidParamStatus(MapStatus)) \
32 ok_invalid_parameter(MapStatus); \
33 else \
34 ok_eq_hex(Status, MapStatus); \
35 if (NT_SUCCESS(Status)) \
36 { \
37 Status = ZwUnmapViewOfSection(ProcessHandle, BaseAddress); \
38 if (UnmapStatus != IGNORE) ok_eq_hex(Status, UnmapStatus); \
39 *BaseAddress2 = NULL; \
40 *ViewSize2 = 0; \
41 } \
42 } while (0) \
43
44#define MmTestMapView(Object, ProcessHandle, BaseAddress2, ZeroBits, CommitSize, SectionOffset, ViewSize2, InheritDisposition, AllocationType, Win32Protect, MapStatus, UnmapStatus) do \
45 { \
46 Status = MmMapViewOfSection(Object, ProcessHandle, BaseAddress2, ZeroBits, CommitSize, SectionOffset, ViewSize2, InheritDisposition, AllocationType, Win32Protect); \
47 ok_eq_hex(Status, MapStatus); \
48 if (NT_SUCCESS(Status)) \
49 { \
50 Status = MmUnmapViewOfSection(ProcessHandle, BaseAddress); \
51 if (UnmapStatus != IGNORE) ok_eq_hex(Status, UnmapStatus); \
52 *BaseAddress2 = NULL; \
53 *ViewSize2 = 0; \
54 } \
55 } while (0) \
56
57#define CheckObject(Handle, Pointers, Handles) do \
58{ \
59 PUBLIC_OBJECT_BASIC_INFORMATION ObjectInfo; \
60 Status = ZwQueryObject(Handle, ObjectBasicInformation, \
61 &ObjectInfo, sizeof ObjectInfo, NULL); \
62 ok_eq_hex(Status, STATUS_SUCCESS); \
63 ok_eq_ulong(ObjectInfo.PointerCount, Pointers); \
64 ok_eq_ulong(ObjectInfo.HandleCount, Handles); \
65} while (0) \
66
67static
68VOID
69KmtInitTestFiles(PHANDLE ReadOnlyFile, PHANDLE WriteOnlyFile, PHANDLE ExecutableFile)
70{
74
75 //INIT THE READ-ONLY FILE
78 ok(*ReadOnlyFile != NULL, "Couldn't acquire READONLY handle\n");
79
80 //INIT THE EXECUTABLE FILE
83 ok(*ExecutableFile != NULL, "Couldn't acquire EXECUTE handle\n");
84
85 //INIT THE WRITE-ONLY FILE
86 //TODO: Delete the file when the tests are all executed
90 ok(*WriteOnlyFile != NULL, "WriteOnlyFile is NULL\n");
91 if (!skip(*WriteOnlyFile != NULL, "No WriteOnlyFile\n"))
92 {
93 FileOffset.QuadPart = 0;
94 Status = ZwWriteFile(*WriteOnlyFile, NULL, NULL, NULL, &IoStatusBlock, (PVOID)TestString, TestStringSize, &FileOffset, NULL);
95 ok(Status == STATUS_SUCCESS || Status == STATUS_PENDING, "Status = 0x%08lx\n", Status);
96 Status = ZwWaitForSingleObject(*WriteOnlyFile, FALSE, NULL);
99 }
100}
101
102static
103VOID
104SimpleErrorChecks(HANDLE FileHandleReadOnly, HANDLE FileHandleWriteOnly, HANDLE ExecutableImg)
105{
107 HANDLE WriteSectionHandle;
108 HANDLE ReadOnlySection;
109 HANDLE PageFileSectionHandle;
112 SIZE_T AllocSize = TestStringSize;
113 SIZE_T ViewSize = 0;
115 PVOID AllocBase = NULL;
116 MaximumSize.QuadPart = TestStringSize;
117
118 //Used for parameters working on file-based section
119 Status = ZwCreateSection(&WriteSectionHandle, SECTION_ALL_ACCESS, NULL, &MaximumSize, PAGE_READWRITE, SEC_COMMIT, FileHandleWriteOnly);
121
122 Status = ZwCreateSection(&ReadOnlySection, SECTION_ALL_ACCESS, NULL, &MaximumSize, PAGE_READONLY, SEC_COMMIT, FileHandleReadOnly);
124
125 //Used for parameters taking effect only on page-file backed section
127 Status = ZwCreateSection(&PageFileSectionHandle, SECTION_ALL_ACCESS, NULL, &MaximumSize, PAGE_READWRITE, SEC_COMMIT, NULL);
129
130 MaximumSize.QuadPart = TestStringSize;
131
132 //section handle
137
138 //process handle
139 TestMapView(WriteSectionHandle, (HANDLE)(ULONG_PTR)0xDEADBEEFDEADBEEFull, &BaseAddress, 0, 0, NULL, &ViewSize, ViewUnmap, 0, PAGE_READWRITE, STATUS_INVALID_HANDLE, IGNORE);
141
142 //base address
143 BaseAddress = (PVOID)(ULONG_PTR)0x00567A20;
145
146 BaseAddress = (PVOID)(ULONG_PTR)0x60000000;
148
149 BaseAddress = (PVOID)((char *)MmSystemRangeStart + 200);
151
152 //invalid section handle AND unaligned base address
153 BaseAddress = (PVOID)(ULONG_PTR)0x00567A20;
155
156 //invalid process handle AND unaligned base address
157 BaseAddress = (PVOID)(ULONG_PTR)0x00567A20;
158 TestMapView(WriteSectionHandle, (HANDLE)(ULONG_PTR)0xDEADBEEFDEADBEEFull, &BaseAddress, 0, 0, NULL, &ViewSize, ViewUnmap, 0, PAGE_READWRITE, STATUS_INVALID_HANDLE, IGNORE);
159
160 //try mapping section to an already mapped address
161 Status = ZwAllocateVirtualMemory(NtCurrentProcess(), &AllocBase, 0, &AllocSize, MEM_COMMIT, PAGE_READWRITE);
162 if (!skip(NT_SUCCESS(Status), "Cannot allocate memory\n"))
163 {
164 BaseAddress = AllocBase;
166 Status = ZwFreeVirtualMemory(NtCurrentProcess(), &AllocBase, &AllocSize, MEM_RELEASE);
168 }
169
170 //zero bits
171#ifdef _M_IX86
175#else
179#endif
183
184 //commit size
191
192 //section offset
193 SectionOffset.QuadPart = 0;
195 ok_eq_ulonglong(SectionOffset.QuadPart, 0);
196
197 SectionOffset.QuadPart = 0x00040211; //MSDN is wrong, in w2k3 the ZwMapViewOfSection doesn't align offsets automatically
199
200 SectionOffset.QuadPart = -1;
202
203 //View Size
205
206 ViewSize = -1;
208
212
215
218
219 //allocation type
224
225 //win32protect
237
238 ZwClose(WriteSectionHandle);
239 ZwClose(PageFileSectionHandle);
240 ZwClose(ReadOnlySection);
241}
242
243
244static
245VOID
246AdvancedErrorChecks(HANDLE FileHandleReadOnly, HANDLE FileHandleWriteOnly)
247{
250 HANDLE FileSectionHandle;
253 SIZE_T ViewSize = 0;
255
256 MaximumSize.QuadPart = TestStringSize;
257 //Used for parameters working on file-based section
258 Status = ZwCreateSection(&FileSectionHandle, SECTION_ALL_ACCESS, NULL, &MaximumSize, PAGE_READWRITE, SEC_COMMIT, FileHandleWriteOnly);
260
261 Status = ObReferenceObjectByHandle(FileSectionHandle,
263 NULL,
266 NULL);
267
269
270 //Bypassing Zw function calls mean bypassing the alignment checks which are not crucial for the branches being tested here
271
272 //test first conditional branch
273 ViewSize = -1;
274#ifdef _M_IX86
275 NTSTATUS MapStatus;
276
277 switch (GetNTVersion())
278 {
281 MapStatus = STATUS_INVALID_VIEW_SIZE;
282 break;
285 break;
286 default:
287 MapStatus = STATUS_SUCCESS;
288 break;
289 }
290
293#else
296#endif
297
298 //test second conditional branch
299 ViewSize = 1;
300 SectionOffset.QuadPart = TestStringSize;
302
304 ZwClose(FileSectionHandle);
305}
306
307static
308SIZE_T
310{
314 PVOID FileContent;
315 SIZE_T Match;
316
317 Match = 0;
318 ByteOffset.QuadPart = 0;
319
320 FileContent = ExAllocatePoolWithTag(PagedPool, BufferLength, 'Test');
321 if (!skip((FileContent != NULL), "Error allocating memory for FileContent\n"))
322 {
323 Status = ZwReadFile(FileHandle, NULL, NULL, NULL, &IoStatusBlock, FileContent, BufferLength, &ByteOffset, NULL);
324 ok(Status == STATUS_SUCCESS || Status == STATUS_PENDING, "Unexpected status (0x%X).\n", Status);
326
327 Match = 0;
328 Match = RtlCompareMemory(FileContent, Buffer, BufferLength);
329 ExFreePoolWithTag(FileContent, 'Test');
330 }
331
332 return Match;
333}
334
335
336static
337VOID
338NTAPI
340{
343 HANDLE SectionHandle;
345 SIZE_T Match;
348 ULONG PtrCnt;
349
350 UNREFERENCED_PARAMETER(StartContext);
351
353#ifdef _M_IX86
354 PtrCnt = 64;
355#else
356 PtrCnt = 65536;
357#endif
358 else
359 PtrCnt = 4;
360
363 SectionOffset.QuadPart = 0;
364
367 if (!skip(NT_SUCCESS(Status), "Error acquiring handle to section. Error = %p\n", Status))
368 {
369 CheckObject(SectionHandle, PtrCnt, 2);
370 Status = ZwMapViewOfSection(SectionHandle, NtCurrentProcess(), &BaseAddress, 0, TestStringSize, &SectionOffset, &ViewSize, ViewUnmap, 0, PAGE_READWRITE);
372 PtrCnt -= 2;
373
374 //make sure ZwMapViewofSection doesn't touch the section ref counts.
375 CheckObject(SectionHandle, PtrCnt, 2);
377 PtrCnt--;
378
379 if (!skip(NT_SUCCESS(Status), "Error mapping page file view in system process. Error = %p\n", Status))
380 {
383
385 ZwUnmapViewOfSection(NtCurrentProcess(), BaseAddress);
386
387 //make sure ZwMapViewofSection doesn't touch the section ref counts.
388 CheckObject(SectionHandle, PtrCnt, 2);
389 }
390
391 ZwClose(SectionHandle);
392 }
393
395}
396
397
398static
399VOID
400BehaviorChecks(HANDLE FileHandleReadOnly, HANDLE FileHandleWriteOnly)
401{
405 HANDLE WriteSectionHandle;
406 HANDLE SysThreadHandle;
410 SIZE_T Match;
411 SIZE_T ViewSize = 0;
412 ULONG PtrCnt;
413
415#ifdef _M_IX86
416 PtrCnt = 34;
417#else
418 PtrCnt = 32770;
419#endif
420 else
421 PtrCnt = 3;
422
424 MaximumSize.QuadPart = TestStringSize;
425 SectionOffset.QuadPart = 0;
426
427 Status = ZwCreateSection(&WriteSectionHandle, SECTION_ALL_ACCESS, &ObjectAttributes, &MaximumSize, PAGE_READWRITE, SEC_COMMIT, FileHandleWriteOnly);
428 CheckObject(WriteSectionHandle, PtrCnt, 1);
430 PtrCnt -= 2;
431 ok(NT_SUCCESS(Status), "Error creating write section from file. Error = %p\n", Status);
432
433 //check for section reading/writing by comparing section content to a well-known value.
434 Status = ZwMapViewOfSection(WriteSectionHandle, NtCurrentProcess() ,&BaseAddress, 0, 0, &SectionOffset, &ViewSize, ViewUnmap, 0, PAGE_READWRITE);
435 CheckObject(WriteSectionHandle, PtrCnt, 1);
436 if (!skip(NT_SUCCESS(Status), "Error mapping view with READ/WRITE priv. Error = %p\n", Status))
437 {
440
441 //now check writing to section
443
446
447 //check to see if the contents have been flushed to the actual file on disk.
448 Match = CompareFileContents(FileHandleWriteOnly, NEW_CONTENT_LEN, NEW_CONTENT);
450
451 //bring everything back to normal
453
454 //Initiate an external thread to modify the file
457 if (!skip(NT_SUCCESS(Status), "Error creating System thread. Error = %p\n", Status))
458 {
460 if (!skip(NT_SUCCESS(Status), "Error getting reference to System thread when testing file-backed section\n"))
461 {
462 //wait until the system thread actually terminates
464
465 //no longer need the thread object
467
468 //test for bi-directional access to the shared page file
471
472 //bring everything back to normal, again
474 }
475 }
476
477 ZwUnmapViewOfSection(NtCurrentProcess(), BaseAddress);
478 }
479
480 //Try to write to read-only mapped view
482 ViewSize = 0;
483 SectionOffset.QuadPart = 0;
484 Status = ZwMapViewOfSection(WriteSectionHandle, NtCurrentProcess(), &BaseAddress, 0, 0, &SectionOffset, &ViewSize, ViewUnmap, 0, PAGE_READONLY);
485 if (!skip(NT_SUCCESS(Status), "Error mapping view with READ priv. Error = %p\n", Status))
486 {
489
493
494 ZwUnmapViewOfSection(NtCurrentProcess(), BaseAddress);
495 }
496
497 //try to access forbidden memory
499 ViewSize = 0;
500 SectionOffset.QuadPart = 0;
501 Status = ZwMapViewOfSection(WriteSectionHandle, NtCurrentProcess(), &BaseAddress, 0, 0, &SectionOffset, &ViewSize, ViewUnmap, 0, PAGE_NOACCESS);
502 if (!skip(NT_SUCCESS(Status), "Error mapping view with PAGE_NOACCESS priv. Error = %p\n", Status))
503 {
507
508 ZwUnmapViewOfSection(NtCurrentProcess(), BaseAddress);
509 }
510
511 //try to access guarded memory
513 ViewSize = 0;
514 SectionOffset.QuadPart = 0;
515 Status = ZwMapViewOfSection(WriteSectionHandle, NtCurrentProcess(), &BaseAddress, 0, 0, &SectionOffset, &ViewSize, ViewUnmap, 0, PAGE_GUARD | PAGE_READWRITE);
516 if (!skip(NT_SUCCESS(Status), "Error mapping view with PAGE_GUARD priv. Error = %p\n", Status))
517 {
521
525
526 ZwUnmapViewOfSection(NtCurrentProcess(), BaseAddress);
527 }
528
529 ZwClose(WriteSectionHandle);
530
531 //section created with sec_reserve should not be commited.
533 ViewSize = 0;
534 SectionOffset.QuadPart = 0;
535 Status = ZwCreateSection(&WriteSectionHandle, SECTION_ALL_ACCESS, &ObjectAttributes, &MaximumSize, PAGE_READWRITE, SEC_RESERVE, FileHandleWriteOnly);
536 if (!skip(NT_SUCCESS(Status), "Error creating page file section. Error = %p\n", Status))
537 {
538 Status = ZwMapViewOfSection(WriteSectionHandle, NtCurrentProcess(), &BaseAddress, 0, TestStringSize, &SectionOffset, &ViewSize, ViewUnmap, MEM_RESERVE, PAGE_READWRITE);
539 if (!skip(NT_SUCCESS(Status), "Error mapping page file view. Error = %p\n", Status))
540 {
541 //check also the SEC_COMMIT flag
542 /* This test proves that MSDN is once again wrong
543 * https://learn.microsoft.com/en-us/windows/win32/api/memoryapi/nf-memoryapi-createfilemappingw states that SEC_RESERVE
544 * should cause the allocated memory for the view to be reserved but in fact it is always committed.
545 * It fails also on windows.
546 */
548 ZwUnmapViewOfSection(NtCurrentProcess(), BaseAddress);
549 }
550
551 ZwClose(WriteSectionHandle);
552 }
553}
554
555
556static
557VOID
559{
561 LARGE_INTEGER MaxSectionSize;
563 HANDLE PageFileSectionHandle;
566 SIZE_T Match;
569 ULONG PtrCnt;
570
572#ifdef _M_IX86
573 PtrCnt = 34;
574#else
575 PtrCnt = 32770;
576#endif
577 else
578 PtrCnt = 3;
579
580 MaxSectionSize.QuadPart = TestStringSize;
581 SectionOffset.QuadPart = 0;
582 PageFileSectionHandle = INVALID_HANDLE_VALUE;
586
587 //test memory sharing between 2 different processes
588 Status = ZwCreateSection(&PageFileSectionHandle, SECTION_ALL_ACCESS, &ObjectAttributes, &MaxSectionSize, PAGE_READWRITE, SEC_COMMIT, NULL);
589 if (!skip(NT_SUCCESS(Status), "Error creating page file section. Error = %p\n", Status))
590 {
591 CheckObject(PageFileSectionHandle, PtrCnt, 1);
592 Status = ZwMapViewOfSection(PageFileSectionHandle, NtCurrentProcess(), &BaseAddress, 0, TestStringSize, &SectionOffset, &ViewSize, ViewUnmap, 0, PAGE_READWRITE);
594 PtrCnt -= 2;
595 if (!skip(NT_SUCCESS(Status), "Error mapping page file view. Error = %p\n", Status))
596 {
597 HANDLE SysThreadHandle;
598
599 CheckObject(PageFileSectionHandle, PtrCnt, 1);
600
601 //check also the SEC_COMMIT flag
603
605
608
609 if (!skip(NT_SUCCESS(Status), "Error creating System thread. Error = %p\n", Status))
610 {
612 if (!skip(NT_SUCCESS(Status), "Error getting reference to System thread when testing pagefile-backed section\n"))
613 {
614 //wait until the system thread actually terminates
616
617 //no longer need the thread object
619
620 //test for bi-directional access to the shared page file
623 }
624 }
625 ZwUnmapViewOfSection(NtCurrentProcess(), BaseAddress);
626 }
627 ZwClose(PageFileSectionHandle);
628 }
629}
630
631
632START_TEST(ZwMapViewOfSection)
633{
634 HANDLE FileHandleReadOnly = NULL;
635 HANDLE FileHandleWriteOnly = NULL;
636 HANDLE ExecutableFileHandle = NULL;
637
641
642 KmtInitTestFiles(&FileHandleReadOnly, &FileHandleWriteOnly, &ExecutableFileHandle);
643
644 SimpleErrorChecks(FileHandleReadOnly, FileHandleWriteOnly, ExecutableFileHandle);
645 AdvancedErrorChecks(FileHandleReadOnly, FileHandleWriteOnly);
646 BehaviorChecks(FileHandleReadOnly, FileHandleWriteOnly);
648
649 if (FileHandleReadOnly)
650 ZwClose(FileHandleReadOnly);
651
652 if (FileHandleWriteOnly)
653 ZwClose(FileHandleWriteOnly);
654
655 if (ExecutableFileHandle)
656 ZwClose(ExecutableFileHandle);
657}
#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:62
#define GetNTVersion()
Definition: apitest.h:17
#define ok_eq_size(value, expected)
Definition: apitest.h:54
#define ok_eq_ulongptr(value, expected)
Definition: apitest.h:56
#define ok_eq_ulonglong(value, expected)
Definition: apitest.h:50
#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 STATUS_INVALID_HANDLE
Definition: d3dkmdt.h:40
#define STATUS_PENDING
Definition: d3dkmdt.h:43
#define STATUS_NO_MEMORY
Definition: d3dkmdt.h:51
#define STATUS_OBJECT_TYPE_MISMATCH
Definition: d3dkmdt.h:46
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
#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 L(x)
Definition: resources.c:13
#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:732
_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:285
#define Test_NtQueryVirtualMemory(BaseAddress, Size, AllocationType, ProtectionType)
Definition: kmt_test.h:74
#define KmtEndSeh(ExpectedStatus)
Definition: kmt_test.h:291
#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 MM_ALLOCATION_GRANULARITY
Definition: mmtypes.h:36
#define KernelMode
Definition: asm.h:38
@ 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:329
#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_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_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
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 _WIN32_WINNT_WIN10
Definition: sdkddkver.h:32
#define _WIN32_WINNT_WINBLUE
Definition: sdkddkver.h:30
#define _WIN32_WINNT_WIN8
Definition: sdkddkver.h:29
#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
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
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