Author: hbelusca Date: Sun Sep 22 19:28:21 2013 New Revision: 60320
URL: http://svn.reactos.org/svn/reactos?rev=60320&view=rev Log: [KMTESTS] No need now to declare a NTSTATUS ExceptionStatus; variable to be able to use KmtStartSeh() / KmtEndSeh() macros; this is done automagically.
Modified: trunk/rostests/kmtests/include/kmt_test.h trunk/rostests/kmtests/ntos_ex/ExPools.c trunk/rostests/kmtests/ntos_io/IoEvent.c trunk/rostests/kmtests/ntos_mm/MmSection.c trunk/rostests/kmtests/ntos_mm/ZwAllocateVirtualMemory.c trunk/rostests/kmtests/ntos_mm/ZwMapViewOfSection.c trunk/rostests/kmtests/ntos_ob/ObReference.c trunk/rostests/kmtests/rtl/RtlException.c trunk/rostests/kmtests/rtl/RtlUnicodeString.c
Modified: trunk/rostests/kmtests/include/kmt_test.h URL: http://svn.reactos.org/svn/reactos/trunk/rostests/kmtests/include/kmt_test.h... ============================================================================== --- trunk/rostests/kmtests/include/kmt_test.h [iso-8859-1] (original) +++ trunk/rostests/kmtests/include/kmt_test.h [iso-8859-1] Sun Sep 22 19:28:21 2013 @@ -218,19 +218,24 @@ #define MILLISECOND (1000 * MICROSECOND) #define SECOND (1000 * MILLISECOND)
+/* See apitests/include/apitest.h */ #define KmtInvalidPointer ((PVOID)0x5555555555555555ULL)
#define KmtStartSeh() \ - ExceptionStatus = STATUS_SUCCESS; \ +{ \ + NTSTATUS ExceptionStatus = STATUS_SUCCESS; \ _SEH2_TRY \ { + #define KmtEndSeh(ExpectedStatus) \ } \ _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) \ { \ ExceptionStatus = _SEH2_GetExceptionCode(); \ - } _SEH2_END; \ - ok_eq_hex(ExceptionStatus, ExpectedStatus) + } \ + _SEH2_END; \ + ok_eq_hex(ExceptionStatus, (ExpectedStatus)); \ +}
#if defined KMT_DEFINE_TEST_FUNCTIONS
Modified: trunk/rostests/kmtests/ntos_ex/ExPools.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/kmtests/ntos_ex/ExPools.c?... ============================================================================== --- trunk/rostests/kmtests/ntos_ex/ExPools.c [iso-8859-1] (original) +++ trunk/rostests/kmtests/ntos_ex/ExPools.c [iso-8859-1] Sun Sep 22 19:28:21 2013 @@ -194,7 +194,6 @@ LONG InitialRefCount; LONG RefCount; USHORT PoolType; - NTSTATUS ExceptionStatus;
InitialRefCount = GetRefCount(Process);
Modified: trunk/rostests/kmtests/ntos_io/IoEvent.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/kmtests/ntos_io/IoEvent.c?... ============================================================================== --- trunk/rostests/kmtests/ntos_io/IoEvent.c [iso-8859-1] (original) +++ trunk/rostests/kmtests/ntos_io/IoEvent.c [iso-8859-1] Sun Sep 22 19:28:21 2013 @@ -35,7 +35,6 @@ EVENT_TYPE Type) { NTSTATUS Status; - NTSTATUS ExceptionStatus; PKEVENT Event, Event2; HANDLE EventHandle, EventHandle2; LONG State;
Modified: trunk/rostests/kmtests/ntos_mm/MmSection.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/kmtests/ntos_mm/MmSection.... ============================================================================== --- trunk/rostests/kmtests/ntos_mm/MmSection.c [iso-8859-1] (original) +++ trunk/rostests/kmtests/ntos_mm/MmSection.c [iso-8859-1] Sun Sep 22 19:28:21 2013 @@ -77,7 +77,6 @@ IN PFILE_OBJECT FileObject2) { NTSTATUS Status = STATUS_SUCCESS; - NTSTATUS ExceptionStatus; PVOID SectionObject; LARGE_INTEGER MaximumSize; ULONG PointerCount1, PointerCount2;
Modified: trunk/rostests/kmtests/ntos_mm/ZwAllocateVirtualMemory.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/kmtests/ntos_mm/ZwAllocate... ============================================================================== --- trunk/rostests/kmtests/ntos_mm/ZwAllocateVirtualMemory.c [iso-8859-1] (original) +++ trunk/rostests/kmtests/ntos_mm/ZwAllocateVirtualMemory.c [iso-8859-1] Sun Sep 22 19:28:21 2013 @@ -64,7 +64,6 @@ SIZE_T CheckBufferRead(CONST VOID *Source, CONST VOID *Destination, SIZE_T Length, NTSTATUS ExpectedStatus) { - NTSTATUS ExceptionStatus; SIZE_T Match = 0;
KmtStartSeh() @@ -79,7 +78,6 @@ CheckBufferReadWrite(PVOID Destination, CONST VOID *Source, SIZE_T Length, NTSTATUS ExpectedStatus) { //do a little bit of writing/reading to memory - NTSTATUS ExceptionStatus; SIZE_T Match = 0;
KmtStartSeh() @@ -167,7 +165,6 @@ SimpleAllocation(VOID) { NTSTATUS Status; - NTSTATUS ExceptionStatus; PVOID Base = NULL; SIZE_T RegionSize = DEFAULT_ALLOC_SIZE;
Modified: trunk/rostests/kmtests/ntos_mm/ZwMapViewOfSection.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/kmtests/ntos_mm/ZwMapViewO... ============================================================================== --- trunk/rostests/kmtests/ntos_mm/ZwMapViewOfSection.c [iso-8859-1] (original) +++ trunk/rostests/kmtests/ntos_mm/ZwMapViewOfSection.c [iso-8859-1] Sun Sep 22 19:28:21 2013 @@ -418,8 +418,6 @@ Status = ZwMapViewOfSection(WriteSectionHandle, NtCurrentProcess(), &BaseAddress, 0, 0, &SectionOffset, &ViewSize, ViewUnmap, 0, PAGE_READONLY); if (!skip(NT_SUCCESS(Status), "Error mapping view with READ priv. Error = %p\n", Status)) { - NTSTATUS ExceptionStatus; - Match = RtlCompareMemory(BaseAddress, TestString, TestStringSize); ok_eq_size(Match, TestStringSize);
@@ -439,8 +437,6 @@ Status = ZwMapViewOfSection(WriteSectionHandle, NtCurrentProcess(), &BaseAddress, 0, 0, &SectionOffset, &ViewSize, ViewUnmap, 0, PAGE_NOACCESS); if (!skip(NT_SUCCESS(Status), "Error mapping view with PAGE_NOACCESS priv. Error = %p\n", Status)) { - NTSTATUS ExceptionStatus; - KmtStartSeh() RtlCompareMemory(BaseAddress, TestString, TestStringSize); KmtEndSeh(STATUS_ACCESS_VIOLATION);
Modified: trunk/rostests/kmtests/ntos_ob/ObReference.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/kmtests/ntos_ob/ObReferenc... ============================================================================== --- trunk/rostests/kmtests/ntos_ob/ObReference.c [iso-8859-1] (original) +++ trunk/rostests/kmtests/ntos_ob/ObReference.c [iso-8859-1] Sun Sep 22 19:28:21 2013 @@ -142,7 +142,6 @@ START_TEST(ObReference) { NTSTATUS Status; - NTSTATUS ExceptionStatus; HANDLE DirectoryHandle = NULL; OBJECT_ATTRIBUTES ObjectAttributes; UNICODE_STRING Name, *pName; @@ -240,8 +239,7 @@ Status = ObReferenceObjectByPointer(NULL, 0, NULL, UserMode); Status = ObReferenceObjectByPointer(NULL, 0, NULL, KernelMode);*/
- ExceptionStatus = STATUS_SUCCESS; - _SEH2_TRY { + KmtStartSeh() /* TODO: this belongs in an ObHandle test if we ever have one */ /* NtClose must accept everything */ DPRINT("Closing null handle (NtClose)\n"); @@ -314,10 +312,7 @@ /* INVALID_KERNEL_HANDLE, 0x7B, 1, 0, 0 Status = ObCloseHandle((HANDLE)123, KernelMode); Status = ObCloseHandle((HANDLE)(123 | 0x80000000), KernelMode);*/ - } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { - ExceptionStatus = _SEH2_GetExceptionCode(); - } _SEH2_END; - ok_eq_hex(ExceptionStatus, STATUS_SUCCESS); + KmtEndSeh(STATUS_SUCCESS);
if (ObDirectoryObjectType) {
Modified: trunk/rostests/kmtests/rtl/RtlException.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/kmtests/rtl/RtlException.c... ============================================================================== --- trunk/rostests/kmtests/rtl/RtlException.c [iso-8859-1] (original) +++ trunk/rostests/kmtests/rtl/RtlException.c [iso-8859-1] Sun Sep 22 19:28:21 2013 @@ -9,7 +9,6 @@
START_TEST(RtlException) { - NTSTATUS ExceptionStatus; PCHAR Buffer[128];
/* Access a valid pointer - must not trigger SEH */
Modified: trunk/rostests/kmtests/rtl/RtlUnicodeString.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/kmtests/rtl/RtlUnicodeStri... ============================================================================== --- trunk/rostests/kmtests/rtl/RtlUnicodeString.c [iso-8859-1] (original) +++ trunk/rostests/kmtests/rtl/RtlUnicodeString.c [iso-8859-1] Sun Sep 22 19:28:21 2013 @@ -13,7 +13,6 @@ TestFindCharInUnicodeString(VOID) { #ifdef KMT_USER_MODE - NTSTATUS ExceptionStatus; NTSTATUS Status; UNICODE_STRING String = RTL_CONSTANT_STRING(L"I am a string"); UNICODE_STRING Chars = RTL_CONSTANT_STRING(L"a");