Status = NtCreateSection(&SectionHandle, SECTION_ALL_ACCESS, 0, &MaxFileSize,
PAGE_READWRITE, SEC_COMMIT, Handle);
ok_eq_hex(Status, STATUS_INVALID_FILE_FOR_SECTION);
- NtClose(Handle);
+ if (NT_SUCCESS(Status)) NtClose(SectionHandle);
+ Status = NtClose(Handle);
+ ok_eq_hex(Status, STATUS_SUCCESS);
/* Test 1 */
InitializeObjectAttributes(&ObjectAttributes, &InitOnCreate, OBJ_CASE_INSENSITIVE, NULL, NULL);
memset(Buffer, 0xBA, 512);
KmtEndSeh(STATUS_SUCCESS);
- NtUnmapViewOfSection(NtCurrentProcess(), Buffer);
- NtClose(SectionHandle);
- NtClose(Handle);
+ Status = NtUnmapViewOfSection(NtCurrentProcess(), Buffer);
+ ok_eq_hex(Status, STATUS_SUCCESS);
+ Status = NtClose(SectionHandle);
+ ok_eq_hex(Status, STATUS_SUCCESS);
+ Status = NtClose(Handle);
+ ok_eq_hex(Status, STATUS_SUCCESS);
/* Test 2 */
InitializeObjectAttributes(&ObjectAttributes, &InitOnCreate, OBJ_CASE_INSENSITIVE, NULL, NULL);
memset(Buffer, 0xBA, 4096);
KmtEndSeh(STATUS_SUCCESS);
- NtUnmapViewOfSection(NtCurrentProcess(), Buffer);
- NtClose(SectionHandle);
- NtClose(Handle);
+ Status = NtUnmapViewOfSection(NtCurrentProcess(), Buffer);
+ ok_eq_hex(Status, STATUS_SUCCESS);
+ Status = NtClose(SectionHandle);
+ ok_eq_hex(Status, STATUS_SUCCESS);
+ Status = NtClose(Handle);
+ ok_eq_hex(Status, STATUS_SUCCESS);
/* Test 3 */
InitializeObjectAttributes(&ObjectAttributes, &InitOnRW, OBJ_CASE_INSENSITIVE, NULL, NULL);
memset(Buffer, 0xBA, 512);
KmtEndSeh(STATUS_SUCCESS);
- NtUnmapViewOfSection(NtCurrentProcess(), Buffer);
- NtClose(SectionHandle);
- NtClose(Handle);
+ Status = NtUnmapViewOfSection(NtCurrentProcess(), Buffer);
+ ok_eq_hex(Status, STATUS_SUCCESS);
+ Status = NtClose(SectionHandle);
+ ok_eq_hex(Status, STATUS_SUCCESS);
+ Status = NtClose(Handle);
+ ok_eq_hex(Status, STATUS_SUCCESS);
/* Test 4 */
InitializeObjectAttributes(&ObjectAttributes, &InitOnRW, OBJ_CASE_INSENSITIVE, NULL, NULL);
memset(Buffer, 0xBA, 4096);
KmtEndSeh(STATUS_SUCCESS);
- NtUnmapViewOfSection(NtCurrentProcess(), Buffer);
- NtClose(SectionHandle);
- NtClose(Handle);
+ Status = NtUnmapViewOfSection(NtCurrentProcess(), Buffer);
+ ok_eq_hex(Status, STATUS_SUCCESS);
+ Status = NtClose(SectionHandle);
+ ok_eq_hex(Status, STATUS_SUCCESS);
+ Status = NtClose(Handle);
+ ok_eq_hex(Status, STATUS_SUCCESS);
/* Test 10 */
InitializeObjectAttributes(&ObjectAttributes, &InvalidInit, OBJ_CASE_INSENSITIVE, NULL, NULL);
Status = NtCreateSection(&SectionHandle, SECTION_ALL_ACCESS, 0, &MaxFileSize,
PAGE_READWRITE, SEC_COMMIT, Handle);
ok_eq_hex(Status, STATUS_INVALID_FILE_FOR_SECTION);
- NtClose(Handle);
+ if (NT_SUCCESS(Status)) NtClose(SectionHandle);
+ Status = NtClose(Handle);
+ ok_eq_hex(Status, STATUS_SUCCESS);
/* Test 11 */
InitializeObjectAttributes(&ObjectAttributes, &InitOnCreate, OBJ_CASE_INSENSITIVE, NULL, NULL);
memset(Buffer, 0xBA, 512);
KmtEndSeh(STATUS_SUCCESS);
- NtUnmapViewOfSection(NtCurrentProcess(), Buffer);
- NtClose(SectionHandle);
- NtClose(Handle);
+ Status = NtUnmapViewOfSection(NtCurrentProcess(), Buffer);
+ ok_eq_hex(Status, STATUS_SUCCESS);
+ Status = NtClose(SectionHandle);
+ ok_eq_hex(Status, STATUS_SUCCESS);
+ Status = NtClose(Handle);
+ ok_eq_hex(Status, STATUS_SUCCESS);
/* Test 12 */
InitializeObjectAttributes(&ObjectAttributes, &InitOnCreate, OBJ_CASE_INSENSITIVE, NULL, NULL);
memset(Buffer, 0xBA, 4096);
KmtEndSeh(STATUS_SUCCESS);
- NtUnmapViewOfSection(NtCurrentProcess(), Buffer);
- NtClose(SectionHandle);
- NtClose(Handle);
+ Status = NtUnmapViewOfSection(NtCurrentProcess(), Buffer);
+ ok_eq_hex(Status, STATUS_SUCCESS);
+ Status = NtClose(SectionHandle);
+ ok_eq_hex(Status, STATUS_SUCCESS);
+ Status = NtClose(Handle);
+ ok_eq_hex(Status, STATUS_SUCCESS);
/* Test 13 */
InitializeObjectAttributes(&ObjectAttributes, &InitOnRW, OBJ_CASE_INSENSITIVE, NULL, NULL);
memset(Buffer, 0xBA, 512);
KmtEndSeh(STATUS_SUCCESS);
- NtUnmapViewOfSection(NtCurrentProcess(), Buffer);
- NtClose(SectionHandle);
- NtClose(Handle);
+ Status = NtUnmapViewOfSection(NtCurrentProcess(), Buffer);
+ ok_eq_hex(Status, STATUS_SUCCESS);
+ Status = NtClose(SectionHandle);
+ ok_eq_hex(Status, STATUS_SUCCESS);
+ Status = NtClose(Handle);
+ ok_eq_hex(Status, STATUS_SUCCESS);
/* Test 14 */
InitializeObjectAttributes(&ObjectAttributes, &InitOnRW, OBJ_CASE_INSENSITIVE, NULL, NULL);
memset(Buffer, 0xBA, 4096);
KmtEndSeh(STATUS_SUCCESS);
- NtUnmapViewOfSection(NtCurrentProcess(), Buffer);
- NtClose(SectionHandle);
- NtClose(Handle);
+ Status = NtUnmapViewOfSection(NtCurrentProcess(), Buffer);
+ ok_eq_hex(Status, STATUS_SUCCESS);
+ Status = NtClose(SectionHandle);
+ ok_eq_hex(Status, STATUS_SUCCESS);
+ Status = NtClose(Handle);
+ ok_eq_hex(Status, STATUS_SUCCESS);
KmtCloseDriver();
KmtUnloadDriver();