11#define NO_HANDLE_CLOSE -998
22#define CREATE_SECTION(Handle, DesiredAccess, Attributes, Size, SectionPageProtection, AllocationAttributes, FileHandle, RetStatus, CloseRetStatus) do \
24 Status = ZwCreateSection(&Handle, DesiredAccess, Attributes, &Size, SectionPageProtection, AllocationAttributes, FileHandle); \
25 ok_eq_hex(Status, RetStatus); \
26 if (NT_SUCCESS(Status)) \
28 if (CloseRetStatus != NO_HANDLE_CLOSE) \
30 Status = ZwClose(Handle); \
32 if (CloseRetStatus != IGNORE) ok_eq_hex(Status, CloseRetStatus); \
37#define TestMapView(SectionHandle, ProcessHandle, BaseAddress2, ZeroBits, CommitSize, SectionOffset, ViewSize2, InheritDisposition, AllocationType, Win32Protect, MapStatus, UnmapStatus) do \
39 Status = ZwMapViewOfSection(SectionHandle, ProcessHandle, BaseAddress2, ZeroBits, CommitSize, SectionOffset, ViewSize2, InheritDisposition, AllocationType, Win32Protect); \
40 ok_eq_hex(Status, MapStatus); \
41 if (NT_SUCCESS(Status)) \
43 Status = ZwUnmapViewOfSection(ProcessHandle, BaseAddress); \
44 if (UnmapStatus != IGNORE) ok_eq_hex(Status, UnmapStatus); \
45 *BaseAddress2 = NULL; \
50#define CheckObject(Handle, Pointers, Handles) do \
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); \
61#define CheckSection(SectionHandle, SectionFlag, SectionSize, RetStatus) do \
63 SECTION_BASIC_INFORMATION Sbi; \
65 Status = ZwQuerySection(SectionHandle, SectionBasicInformation, \
66 &Sbi, sizeof Sbi, NULL); \
67 ok_eq_hex(Status, RetStatus); \
68 if (RetStatus == STATUS_SUCCESS && NT_SUCCESS(Status)) \
70 ok_eq_pointer(Sbi.BaseAddress, NULL); \
71 ok_eq_longlong(Sbi.Size.QuadPart, SectionSize); \
72 ok_eq_hex(Sbi.Attributes, SectionFlag | SEC_FILE); \
90 TestMapView(SectionHandle,
ZwCurrentProcess(), &
BaseAddress, 0, 0,
NULL, &
ViewSize,
ViewUnmap, 0,
PAGE_READWRITE,
STATUS_SECTION_PROTECTION,
STATUS_SUCCESS);
91 TestMapView(SectionHandle,
ZwCurrentProcess(), &
BaseAddress, 0, 0,
NULL, &
ViewSize,
ViewUnmap, 0,
PAGE_READONLY,
STATUS_SUCCESS,
STATUS_SUCCESS);
92 TestMapView(SectionHandle,
ZwCurrentProcess(), &
BaseAddress, 0, 0,
NULL, &
ViewSize,
ViewUnmap, 0,
PAGE_EXECUTE,
STATUS_SECTION_PROTECTION,
STATUS_SUCCESS);
96 TestMapView(SectionHandle,
ZwCurrentProcess(), &
BaseAddress, 0, 0,
NULL, &
ViewSize,
ViewUnmap, 0,
PAGE_READWRITE,
STATUS_SUCCESS,
STATUS_SUCCESS);
97 TestMapView(SectionHandle,
ZwCurrentProcess(), &
BaseAddress, 0, 0,
NULL, &
ViewSize,
ViewUnmap, 0,
PAGE_READONLY,
STATUS_SUCCESS,
STATUS_SUCCESS);
98 TestMapView(SectionHandle,
ZwCurrentProcess(), &
BaseAddress, 0, 0,
NULL, &
ViewSize,
ViewUnmap, 0,
PAGE_EXECUTE,
STATUS_SECTION_PROTECTION,
STATUS_SUCCESS);
102 TestMapView(SectionHandle,
ZwCurrentProcess(), &
BaseAddress, 0, 0,
NULL, &
ViewSize,
ViewUnmap, 0,
PAGE_READWRITE,
STATUS_SECTION_PROTECTION,
STATUS_SUCCESS);
103 TestMapView(SectionHandle,
ZwCurrentProcess(), &
BaseAddress, 0, 0,
NULL, &
ViewSize,
ViewUnmap, 0,
PAGE_READONLY,
STATUS_SECTION_PROTECTION,
STATUS_SUCCESS);
104 TestMapView(SectionHandle,
ZwCurrentProcess(), &
BaseAddress, 0, 0,
NULL, &
ViewSize,
ViewUnmap, 0,
PAGE_EXECUTE,
STATUS_SUCCESS,
STATUS_SUCCESS);
108 TestMapView(SectionHandle,
ZwCurrentProcess(), &
BaseAddress, 0, 0,
NULL, &
ViewSize,
ViewUnmap, 0,
PAGE_READWRITE,
STATUS_SECTION_PROTECTION,
STATUS_SUCCESS);
109 TestMapView(SectionHandle,
ZwCurrentProcess(), &
BaseAddress, 0, 0,
NULL, &
ViewSize,
ViewUnmap, 0,
PAGE_READONLY,
STATUS_SUCCESS,
STATUS_SUCCESS);
110 TestMapView(SectionHandle,
ZwCurrentProcess(), &
BaseAddress, 0, 0,
NULL, &
ViewSize,
ViewUnmap, 0,
PAGE_EXECUTE,
STATUS_SECTION_PROTECTION,
STATUS_SUCCESS);
114 TestMapView(SectionHandle,
ZwCurrentProcess(), &
BaseAddress, 0, 0,
NULL, &
ViewSize,
ViewUnmap, 0,
PAGE_READWRITE,
STATUS_SECTION_PROTECTION,
STATUS_SUCCESS);
115 TestMapView(SectionHandle,
ZwCurrentProcess(), &
BaseAddress, 0, 0,
NULL, &
ViewSize,
ViewUnmap, 0,
PAGE_READONLY,
STATUS_SUCCESS,
STATUS_SUCCESS);
116 TestMapView(SectionHandle,
ZwCurrentProcess(), &
BaseAddress, 0, 0,
NULL, &
ViewSize,
ViewUnmap, 0,
PAGE_EXECUTE,
STATUS_SECTION_PROTECTION,
STATUS_SUCCESS);
120 TestMapView(SectionHandle,
ZwCurrentProcess(), &
BaseAddress, 0, 0,
NULL, &
ViewSize,
ViewUnmap, 0,
PAGE_READWRITE,
STATUS_SUCCESS,
STATUS_SUCCESS);
121 TestMapView(SectionHandle,
ZwCurrentProcess(), &
BaseAddress, 0, 0,
NULL, &
ViewSize,
ViewUnmap, 0,
PAGE_READONLY,
STATUS_SUCCESS,
STATUS_SUCCESS);
122 TestMapView(SectionHandle,
ZwCurrentProcess(), &
BaseAddress, 0, 0,
NULL, &
ViewSize,
ViewUnmap, 0,
PAGE_EXECUTE,
STATUS_SECTION_PROTECTION,
STATUS_SUCCESS);
126 TestMapView(SectionHandle,
ZwCurrentProcess(), &
BaseAddress, 0, 0,
NULL, &
ViewSize,
ViewUnmap, 0,
PAGE_READWRITE,
STATUS_SECTION_PROTECTION,
STATUS_SUCCESS);
127 TestMapView(SectionHandle,
ZwCurrentProcess(), &
BaseAddress, 0, 0,
NULL, &
ViewSize,
ViewUnmap, 0,
PAGE_READONLY,
STATUS_SECTION_PROTECTION,
STATUS_SUCCESS);
128 TestMapView(SectionHandle,
ZwCurrentProcess(), &
BaseAddress, 0, 0,
NULL, &
ViewSize,
ViewUnmap, 0,
PAGE_EXECUTE,
STATUS_SUCCESS,
STATUS_SUCCESS);
132 TestMapView(SectionHandle,
ZwCurrentProcess(), &
BaseAddress, 0, 0,
NULL, &
ViewSize,
ViewUnmap, 0,
PAGE_READWRITE,
STATUS_SECTION_PROTECTION,
STATUS_SUCCESS);
133 TestMapView(SectionHandle,
ZwCurrentProcess(), &
BaseAddress, 0, 0,
NULL, &
ViewSize,
ViewUnmap, 0,
PAGE_READONLY,
STATUS_SUCCESS,
STATUS_SUCCESS);
134 TestMapView(SectionHandle,
ZwCurrentProcess(), &
BaseAddress, 0, 0,
NULL, &
ViewSize,
ViewUnmap, 0,
PAGE_EXECUTE,
STATUS_SECTION_PROTECTION,
STATUS_SUCCESS);
138 TestMapView(SectionHandle,
ZwCurrentProcess(), &
BaseAddress, 0, 0,
NULL, &
ViewSize,
ViewUnmap, 0,
PAGE_READWRITE,
STATUS_SECTION_PROTECTION,
STATUS_SUCCESS);
139 TestMapView(SectionHandle,
ZwCurrentProcess(), &
BaseAddress, 0, 0,
NULL, &
ViewSize,
ViewUnmap, 0,
PAGE_READONLY,
STATUS_SUCCESS,
STATUS_SUCCESS);
140 TestMapView(SectionHandle,
ZwCurrentProcess(), &
BaseAddress, 0, 0,
NULL, &
ViewSize,
ViewUnmap, 0,
PAGE_EXECUTE,
STATUS_SECTION_PROTECTION,
STATUS_SUCCESS);
144 TestMapView(SectionHandle,
ZwCurrentProcess(), &
BaseAddress, 0, 0,
NULL, &
ViewSize,
ViewUnmap, 0,
PAGE_READWRITE,
STATUS_SUCCESS,
STATUS_SUCCESS);
145 TestMapView(SectionHandle,
ZwCurrentProcess(), &
BaseAddress, 0, 0,
NULL, &
ViewSize,
ViewUnmap, 0,
PAGE_READONLY,
STATUS_SUCCESS,
STATUS_SUCCESS);
146 TestMapView(SectionHandle,
ZwCurrentProcess(), &
BaseAddress, 0, 0,
NULL, &
ViewSize,
ViewUnmap, 0,
PAGE_EXECUTE,
STATUS_SECTION_PROTECTION,
STATUS_SUCCESS);
150 TestMapView(SectionHandle,
ZwCurrentProcess(), &
BaseAddress, 0, 0,
NULL, &
ViewSize,
ViewUnmap, 0,
PAGE_READWRITE,
STATUS_SECTION_PROTECTION,
STATUS_SUCCESS);
151 TestMapView(SectionHandle,
ZwCurrentProcess(), &
BaseAddress, 0, 0,
NULL, &
ViewSize,
ViewUnmap, 0,
PAGE_READONLY,
STATUS_SECTION_PROTECTION,
STATUS_SUCCESS);
152 TestMapView(SectionHandle,
ZwCurrentProcess(), &
BaseAddress, 0, 0,
NULL, &
ViewSize,
ViewUnmap, 0,
PAGE_EXECUTE,
STATUS_SUCCESS,
STATUS_SUCCESS);
156 TestMapView(SectionHandle,
ZwCurrentProcess(), &
BaseAddress, 0, 0,
NULL, &
ViewSize,
ViewUnmap, 0,
PAGE_READWRITE,
STATUS_SECTION_PROTECTION,
STATUS_SUCCESS);
157 TestMapView(SectionHandle,
ZwCurrentProcess(), &
BaseAddress, 0, 0,
NULL, &
ViewSize,
ViewUnmap, 0,
PAGE_READONLY,
STATUS_SUCCESS,
STATUS_SUCCESS);
158 TestMapView(SectionHandle,
ZwCurrentProcess(), &
BaseAddress, 0, 0,
NULL, &
ViewSize,
ViewUnmap, 0,
PAGE_EXECUTE,
STATUS_SECTION_PROTECTION,
STATUS_SUCCESS);
163 TestMapView(SectionHandle,
ZwCurrentProcess(), &
BaseAddress, 0, 0,
NULL, &
ViewSize,
ViewUnmap, 0,
PAGE_READWRITE,
STATUS_SECTION_PROTECTION,
STATUS_SUCCESS);
164 TestMapView(SectionHandle,
ZwCurrentProcess(), &
BaseAddress, 0, 0,
NULL, &
ViewSize,
ViewUnmap, 0,
PAGE_READONLY,
STATUS_SUCCESS,
STATUS_SUCCESS);
165 TestMapView(SectionHandle,
ZwCurrentProcess(), &
BaseAddress, 0, 0,
NULL, &
ViewSize,
ViewUnmap, 0,
PAGE_EXECUTE,
STATUS_SECTION_PROTECTION,
STATUS_SUCCESS);
169 TestMapView(SectionHandle,
ZwCurrentProcess(), &
BaseAddress, 0, 0,
NULL, &
ViewSize,
ViewUnmap, 0,
PAGE_READWRITE,
STATUS_SUCCESS,
STATUS_SUCCESS);
170 TestMapView(SectionHandle,
ZwCurrentProcess(), &
BaseAddress, 0, 0,
NULL, &
ViewSize,
ViewUnmap, 0,
PAGE_READONLY,
STATUS_SUCCESS,
STATUS_SUCCESS);
171 TestMapView(SectionHandle,
ZwCurrentProcess(), &
BaseAddress, 0, 0,
NULL, &
ViewSize,
ViewUnmap, 0,
PAGE_EXECUTE,
STATUS_SECTION_PROTECTION,
STATUS_SUCCESS);
175 TestMapView(SectionHandle,
ZwCurrentProcess(), &
BaseAddress, 0, 0,
NULL, &
ViewSize,
ViewUnmap, 0,
PAGE_READWRITE,
STATUS_SECTION_PROTECTION,
STATUS_SUCCESS);
176 TestMapView(SectionHandle,
ZwCurrentProcess(), &
BaseAddress, 0, 0,
NULL, &
ViewSize,
ViewUnmap, 0,
PAGE_READONLY,
STATUS_SECTION_PROTECTION,
STATUS_SUCCESS);
177 TestMapView(SectionHandle,
ZwCurrentProcess(), &
BaseAddress, 0, 0,
NULL, &
ViewSize,
ViewUnmap, 0,
PAGE_EXECUTE,
STATUS_SUCCESS,
STATUS_SUCCESS);
181 TestMapView(SectionHandle,
ZwCurrentProcess(), &
BaseAddress, 0, 0,
NULL, &
ViewSize,
ViewUnmap, 0,
PAGE_READWRITE,
STATUS_SECTION_PROTECTION,
STATUS_SUCCESS);
182 TestMapView(SectionHandle,
ZwCurrentProcess(), &
BaseAddress, 0, 0,
NULL, &
ViewSize,
ViewUnmap, 0,
PAGE_READONLY,
STATUS_SUCCESS,
STATUS_SUCCESS);
183 TestMapView(SectionHandle,
ZwCurrentProcess(), &
BaseAddress, 0, 0,
NULL, &
ViewSize,
ViewUnmap, 0,
PAGE_EXECUTE,
STATUS_SECTION_PROTECTION,
STATUS_SUCCESS);
187 TestMapView(SectionHandle,
ZwCurrentProcess(), &
BaseAddress, 0, 0,
NULL, &
ViewSize,
ViewUnmap, 0,
PAGE_READWRITE,
STATUS_SECTION_PROTECTION,
STATUS_SUCCESS);
188 TestMapView(SectionHandle,
ZwCurrentProcess(), &
BaseAddress, 0, 0,
NULL, &
ViewSize,
ViewUnmap, 0,
PAGE_READONLY,
STATUS_SUCCESS,
STATUS_SUCCESS);
189 TestMapView(SectionHandle,
ZwCurrentProcess(), &
BaseAddress, 0, 0,
NULL, &
ViewSize,
ViewUnmap, 0,
PAGE_EXECUTE,
STATUS_SECTION_PROTECTION,
STATUS_SUCCESS);
193 TestMapView(SectionHandle,
ZwCurrentProcess(), &
BaseAddress, 0, 0,
NULL, &
ViewSize,
ViewUnmap, 0,
PAGE_READWRITE,
STATUS_SUCCESS,
STATUS_SUCCESS);
194 TestMapView(SectionHandle,
ZwCurrentProcess(), &
BaseAddress, 0, 0,
NULL, &
ViewSize,
ViewUnmap, 0,
PAGE_READONLY,
STATUS_SUCCESS,
STATUS_SUCCESS);
195 TestMapView(SectionHandle,
ZwCurrentProcess(), &
BaseAddress, 0, 0,
NULL, &
ViewSize,
ViewUnmap, 0,
PAGE_EXECUTE,
STATUS_SECTION_PROTECTION,
STATUS_SUCCESS);
199 TestMapView(SectionHandle,
ZwCurrentProcess(), &
BaseAddress, 0, 0,
NULL, &
ViewSize,
ViewUnmap, 0,
PAGE_READWRITE,
STATUS_SECTION_PROTECTION,
STATUS_SUCCESS);
200 TestMapView(SectionHandle,
ZwCurrentProcess(), &
BaseAddress, 0, 0,
NULL, &
ViewSize,
ViewUnmap, 0,
PAGE_READONLY,
STATUS_SECTION_PROTECTION,
STATUS_SUCCESS);
201 TestMapView(SectionHandle,
ZwCurrentProcess(), &
BaseAddress, 0, 0,
NULL, &
ViewSize,
ViewUnmap, 0,
PAGE_EXECUTE,
STATUS_SUCCESS,
STATUS_SUCCESS);
205 TestMapView(SectionHandle,
ZwCurrentProcess(), &
BaseAddress, 0, 0,
NULL, &
ViewSize,
ViewUnmap, 0,
PAGE_READWRITE,
STATUS_SECTION_PROTECTION,
STATUS_SUCCESS);
206 TestMapView(SectionHandle,
ZwCurrentProcess(), &
BaseAddress, 0, 0,
NULL, &
ViewSize,
ViewUnmap, 0,
PAGE_READONLY,
STATUS_SUCCESS,
STATUS_SUCCESS);
207 TestMapView(SectionHandle,
ZwCurrentProcess(), &
BaseAddress, 0, 0,
NULL, &
ViewSize,
ViewUnmap, 0,
PAGE_EXECUTE,
STATUS_SECTION_PROTECTION,
STATUS_SUCCESS);
211 TestMapView(SectionHandle,
ZwCurrentProcess(), &
BaseAddress, 0, 0,
NULL, &
ViewSize,
ViewUnmap, 0,
PAGE_READWRITE,
STATUS_SECTION_PROTECTION,
STATUS_SUCCESS);
212 TestMapView(SectionHandle,
ZwCurrentProcess(), &
BaseAddress, 0, 0,
NULL, &
ViewSize,
ViewUnmap, 0,
PAGE_READONLY,
STATUS_SUCCESS,
STATUS_SUCCESS);
213 TestMapView(SectionHandle,
ZwCurrentProcess(), &
BaseAddress, 0, 0,
NULL, &
ViewSize,
ViewUnmap, 0,
PAGE_EXECUTE,
STATUS_SECTION_PROTECTION,
STATUS_SUCCESS);
217 TestMapView(SectionHandle,
ZwCurrentProcess(), &
BaseAddress, 0, 0,
NULL, &
ViewSize,
ViewUnmap, 0,
PAGE_READWRITE,
STATUS_SUCCESS,
STATUS_SUCCESS);
218 TestMapView(SectionHandle,
ZwCurrentProcess(), &
BaseAddress, 0, 0,
NULL, &
ViewSize,
ViewUnmap, 0,
PAGE_READONLY,
STATUS_SUCCESS,
STATUS_SUCCESS);
219 TestMapView(SectionHandle,
ZwCurrentProcess(), &
BaseAddress, 0, 0,
NULL, &
ViewSize,
ViewUnmap, 0,
PAGE_EXECUTE,
STATUS_SECTION_PROTECTION,
STATUS_SUCCESS);
223 TestMapView(SectionHandle,
ZwCurrentProcess(), &
BaseAddress, 0, 0,
NULL, &
ViewSize,
ViewUnmap, 0,
PAGE_READWRITE,
STATUS_SECTION_PROTECTION,
STATUS_SUCCESS);
224 TestMapView(SectionHandle,
ZwCurrentProcess(), &
BaseAddress, 0, 0,
NULL, &
ViewSize,
ViewUnmap, 0,
PAGE_READONLY,
STATUS_SECTION_PROTECTION,
STATUS_SUCCESS);
225 TestMapView(SectionHandle,
ZwCurrentProcess(), &
BaseAddress, 0, 0,
NULL, &
ViewSize,
ViewUnmap, 0,
PAGE_EXECUTE,
STATUS_SUCCESS,
STATUS_SUCCESS);
229 TestMapView(SectionHandle,
ZwCurrentProcess(), &
BaseAddress, 0, 0,
NULL, &
ViewSize,
ViewUnmap, 0,
PAGE_READWRITE,
STATUS_SECTION_PROTECTION,
STATUS_SUCCESS);
230 TestMapView(SectionHandle,
ZwCurrentProcess(), &
BaseAddress, 0, 0,
NULL, &
ViewSize,
ViewUnmap, 0,
PAGE_READONLY,
STATUS_SUCCESS,
STATUS_SUCCESS);
231 TestMapView(SectionHandle,
ZwCurrentProcess(), &
BaseAddress, 0, 0,
NULL, &
ViewSize,
ViewUnmap, 0,
PAGE_EXECUTE,
STATUS_SECTION_PROTECTION,
STATUS_SUCCESS);
260 Status = ZwCreateFile(ReadOnlyFile, (
GENERIC_READ |
GENERIC_EXECUTE ), &
NtdllObject, &
IoStatusBlock,
NULL,
FILE_ATTRIBUTE_NORMAL,
FILE_SHARE_READ,
FILE_OPEN,
FILE_NON_DIRECTORY_FILE,
NULL, 0);
262 ok(*ReadOnlyFile !=
NULL,
"Couldn't acquire READONLY handle\n");
265 Status = ZwCreateFile(ExecutableFile,
GENERIC_EXECUTE, &
CalcFileObject, &
IoStatusBlock,
NULL,
FILE_ATTRIBUTE_NORMAL,
FILE_SHARE_READ,
FILE_OPEN,
FILE_NON_DIRECTORY_FILE,
NULL, 0);
267 ok(*ExecutableFile !=
NULL,
"Couldn't acquire EXECUTE handle\n");
271 Status = ZwCreateFile(WriteOnlyFile, (
GENERIC_WRITE |
SYNCHRONIZE), &
KmtestFileObject, &
IoStatusBlock,
NULL,
FILE_ATTRIBUTE_NORMAL,
FILE_SHARE_WRITE,
FILE_SUPERSEDE,
FILE_NON_DIRECTORY_FILE,
NULL, 0);
274 ok(*WriteOnlyFile !=
NULL,
"WriteOnlyFile is NULL\n");
275 if (!
skip(*WriteOnlyFile !=
NULL,
"No WriteOnlyFile\n"))
504 KmtInitTestFiles(&FileHandleReadOnly, &FileHandleWriteOnly, &FileHandleExecuteOnly);
506 if (!
skip(FileHandleReadOnly && FileHandleWriteOnly && FileHandleExecuteOnly,
"Missing one or more file handles\n"))
509 SimpleErrorChecks(FileHandleReadOnly, FileHandleWriteOnly, FileHandleExecuteOnly);
513 if (FileHandleReadOnly)
516 if (FileHandleWriteOnly)
522 if (FileHandleExecuteOnly)
523 ZwClose(FileHandleExecuteOnly);
#define CheckSection(SectionHandle, SectionFlag, SectionSize, RetStatus)
static OBJECT_ATTRIBUTES CalcFileObject
static VOID KmtInitTestFiles(PHANDLE ReadOnlyFile, PHANDLE WriteOnlyFile, PHANDLE ExecutableFile)
static UNICODE_STRING FileReadOnlyPath
static VOID BasicBehaviorChecks(HANDLE FileHandle)
#define TestMapView(SectionHandle, ProcessHandle, BaseAddress2, ZeroBits, CommitSize, SectionOffset, ViewSize2, InheritDisposition, AllocationType, Win32Protect, MapStatus, UnmapStatus)
#define CheckObject(Handle, Pointers, Handles)
static VOID SimpleErrorChecks(HANDLE FileHandleReadOnly, HANDLE FileHandleWriteOnly, HANDLE FileHandleExecuteOnly)
static UNICODE_STRING WritableFilePath
const ULONG TestStringSize
#define CREATE_SECTION(Handle, DesiredAccess, Attributes, Size, SectionPageProtection, AllocationAttributes, FileHandle, RetStatus, CloseRetStatus)
static OBJECT_ATTRIBUTES KmtestFileObject
static UNICODE_STRING CalcImgPath
static VOID FileSectionViewPermissionCheck(HANDLE ReadOnlyFile, HANDLE WriteOnlyFile, HANDLE ExecutableFile)
static OBJECT_ATTRIBUTES NtdllObject
#define ok_eq_hex(value, expected)
#define ok_eq_ulongptr(value, expected)
#define FILE_NON_DIRECTORY_FILE
_In_ PFCB _In_ LONGLONG FileOffset
#define NT_SUCCESS(StatCode)
#define FILE_ATTRIBUTE_NORMAL
_Must_inspect_result_ _In_opt_ PFLT_INSTANCE _Out_ PHANDLE FileHandle
#define OBJ_KERNEL_HANDLE
#define OBJ_CASE_INSENSITIVE
POBJECT_TYPE IoFileObjectType
static OUT PIO_STATUS_BLOCK IoStatusBlock
#define InitializeObjectAttributes(p, n, a, r, s)
NTSYSAPI NTSTATUS NTAPI ZwDeleteFile(_In_ POBJECT_ATTRIBUTES ObjectAttributes)
_In_ ACCESS_MASK _In_opt_ POBJECT_ATTRIBUTES _In_opt_ PLARGE_INTEGER MaximumSize
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID * BaseAddress
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID _In_ ULONG_PTR _In_ SIZE_T _Inout_opt_ PLARGE_INTEGER _Inout_ PSIZE_T ViewSize
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
#define SECTION_MAP_EXECUTE
#define SECTION_MAP_WRITE
#define PAGE_EXECUTE_READ
#define SECTION_ALL_ACCESS
#define STANDARD_RIGHTS_ALL
#define PAGE_EXECUTE_WRITECOPY
#define PAGE_EXECUTE_READWRITE
_In_ ULONG _In_ ULONG _In_ ULONG Length
#define STATUS_SECTION_PROTECTION
#define STATUS_OBJECT_PATH_SYNTAX_BAD
#define STATUS_INVALID_PARAMETER_4
#define STATUS_INVALID_IMAGE_NOT_MZ
#define STATUS_INVALID_FILE_FOR_SECTION
#define STATUS_INVALID_PARAMETER_6
#define STATUS_INVALID_PAGE_PROTECTION
#define STATUS_SECTION_TOO_BIG
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)
#define FileStandardInformation
EH_STD::basic_string< char, EH_STD::char_traits< char >, eh_allocator(char) > TestString
#define RTL_CONSTANT_STRING(s)
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
#define ObDereferenceObject
#define ZwCurrentProcess()