mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 18:25:58 +00:00
[KMTESTS]
No need now to declare a NTSTATUS ExceptionStatus; variable to be able to use KmtStartSeh() / KmtEndSeh() macros; this is done automagically. svn path=/trunk/; revision=60320
This commit is contained in:
parent
fe6644f895
commit
2c7388a0b1
9 changed files with 10 additions and 22 deletions
|
@ -218,19 +218,24 @@ VOID KmtFreeGuarded(PVOID Pointer);
|
||||||
#define MILLISECOND (1000 * MICROSECOND)
|
#define MILLISECOND (1000 * MICROSECOND)
|
||||||
#define SECOND (1000 * MILLISECOND)
|
#define SECOND (1000 * MILLISECOND)
|
||||||
|
|
||||||
|
/* See apitests/include/apitest.h */
|
||||||
#define KmtInvalidPointer ((PVOID)0x5555555555555555ULL)
|
#define KmtInvalidPointer ((PVOID)0x5555555555555555ULL)
|
||||||
|
|
||||||
#define KmtStartSeh() \
|
#define KmtStartSeh() \
|
||||||
ExceptionStatus = STATUS_SUCCESS; \
|
{ \
|
||||||
|
NTSTATUS ExceptionStatus = STATUS_SUCCESS; \
|
||||||
_SEH2_TRY \
|
_SEH2_TRY \
|
||||||
{
|
{
|
||||||
|
|
||||||
#define KmtEndSeh(ExpectedStatus) \
|
#define KmtEndSeh(ExpectedStatus) \
|
||||||
} \
|
} \
|
||||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) \
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) \
|
||||||
{ \
|
{ \
|
||||||
ExceptionStatus = _SEH2_GetExceptionCode(); \
|
ExceptionStatus = _SEH2_GetExceptionCode(); \
|
||||||
} _SEH2_END; \
|
} \
|
||||||
ok_eq_hex(ExceptionStatus, ExpectedStatus)
|
_SEH2_END; \
|
||||||
|
ok_eq_hex(ExceptionStatus, (ExpectedStatus)); \
|
||||||
|
}
|
||||||
|
|
||||||
#if defined KMT_DEFINE_TEST_FUNCTIONS
|
#if defined KMT_DEFINE_TEST_FUNCTIONS
|
||||||
|
|
||||||
|
|
|
@ -194,7 +194,6 @@ TestPoolQuota(VOID)
|
||||||
LONG InitialRefCount;
|
LONG InitialRefCount;
|
||||||
LONG RefCount;
|
LONG RefCount;
|
||||||
USHORT PoolType;
|
USHORT PoolType;
|
||||||
NTSTATUS ExceptionStatus;
|
|
||||||
|
|
||||||
InitialRefCount = GetRefCount(Process);
|
InitialRefCount = GetRefCount(Process);
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,6 @@ TestCreateEvent(
|
||||||
EVENT_TYPE Type)
|
EVENT_TYPE Type)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
NTSTATUS ExceptionStatus;
|
|
||||||
PKEVENT Event, Event2;
|
PKEVENT Event, Event2;
|
||||||
HANDLE EventHandle, EventHandle2;
|
HANDLE EventHandle, EventHandle2;
|
||||||
LONG State;
|
LONG State;
|
||||||
|
|
|
@ -77,7 +77,6 @@ TestCreateSection(
|
||||||
IN PFILE_OBJECT FileObject2)
|
IN PFILE_OBJECT FileObject2)
|
||||||
{
|
{
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
NTSTATUS ExceptionStatus;
|
|
||||||
PVOID SectionObject;
|
PVOID SectionObject;
|
||||||
LARGE_INTEGER MaximumSize;
|
LARGE_INTEGER MaximumSize;
|
||||||
ULONG PointerCount1, PointerCount2;
|
ULONG PointerCount1, PointerCount2;
|
||||||
|
|
|
@ -64,7 +64,6 @@ static
|
||||||
SIZE_T
|
SIZE_T
|
||||||
CheckBufferRead(CONST VOID *Source, CONST VOID *Destination, SIZE_T Length, NTSTATUS ExpectedStatus)
|
CheckBufferRead(CONST VOID *Source, CONST VOID *Destination, SIZE_T Length, NTSTATUS ExpectedStatus)
|
||||||
{
|
{
|
||||||
NTSTATUS ExceptionStatus;
|
|
||||||
SIZE_T Match = 0;
|
SIZE_T Match = 0;
|
||||||
|
|
||||||
KmtStartSeh()
|
KmtStartSeh()
|
||||||
|
@ -79,7 +78,6 @@ VOID
|
||||||
CheckBufferReadWrite(PVOID Destination, CONST VOID *Source, SIZE_T Length, NTSTATUS ExpectedStatus)
|
CheckBufferReadWrite(PVOID Destination, CONST VOID *Source, SIZE_T Length, NTSTATUS ExpectedStatus)
|
||||||
{
|
{
|
||||||
//do a little bit of writing/reading to memory
|
//do a little bit of writing/reading to memory
|
||||||
NTSTATUS ExceptionStatus;
|
|
||||||
SIZE_T Match = 0;
|
SIZE_T Match = 0;
|
||||||
|
|
||||||
KmtStartSeh()
|
KmtStartSeh()
|
||||||
|
@ -167,7 +165,6 @@ NTSTATUS
|
||||||
SimpleAllocation(VOID)
|
SimpleAllocation(VOID)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
NTSTATUS ExceptionStatus;
|
|
||||||
PVOID Base = NULL;
|
PVOID Base = NULL;
|
||||||
SIZE_T RegionSize = DEFAULT_ALLOC_SIZE;
|
SIZE_T RegionSize = DEFAULT_ALLOC_SIZE;
|
||||||
|
|
||||||
|
|
|
@ -418,8 +418,6 @@ BehaviorChecks(HANDLE FileHandleReadOnly, HANDLE FileHandleWriteOnly)
|
||||||
Status = ZwMapViewOfSection(WriteSectionHandle, NtCurrentProcess(), &BaseAddress, 0, 0, &SectionOffset, &ViewSize, ViewUnmap, 0, PAGE_READONLY);
|
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))
|
if (!skip(NT_SUCCESS(Status), "Error mapping view with READ priv. Error = %p\n", Status))
|
||||||
{
|
{
|
||||||
NTSTATUS ExceptionStatus;
|
|
||||||
|
|
||||||
Match = RtlCompareMemory(BaseAddress, TestString, TestStringSize);
|
Match = RtlCompareMemory(BaseAddress, TestString, TestStringSize);
|
||||||
ok_eq_size(Match, TestStringSize);
|
ok_eq_size(Match, TestStringSize);
|
||||||
|
|
||||||
|
@ -439,8 +437,6 @@ BehaviorChecks(HANDLE FileHandleReadOnly, HANDLE FileHandleWriteOnly)
|
||||||
Status = ZwMapViewOfSection(WriteSectionHandle, NtCurrentProcess(), &BaseAddress, 0, 0, &SectionOffset, &ViewSize, ViewUnmap, 0, PAGE_NOACCESS);
|
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))
|
if (!skip(NT_SUCCESS(Status), "Error mapping view with PAGE_NOACCESS priv. Error = %p\n", Status))
|
||||||
{
|
{
|
||||||
NTSTATUS ExceptionStatus;
|
|
||||||
|
|
||||||
KmtStartSeh()
|
KmtStartSeh()
|
||||||
RtlCompareMemory(BaseAddress, TestString, TestStringSize);
|
RtlCompareMemory(BaseAddress, TestString, TestStringSize);
|
||||||
KmtEndSeh(STATUS_ACCESS_VIOLATION);
|
KmtEndSeh(STATUS_ACCESS_VIOLATION);
|
||||||
|
|
|
@ -142,7 +142,6 @@ TestReference(
|
||||||
START_TEST(ObReference)
|
START_TEST(ObReference)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
NTSTATUS ExceptionStatus;
|
|
||||||
HANDLE DirectoryHandle = NULL;
|
HANDLE DirectoryHandle = NULL;
|
||||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||||
UNICODE_STRING Name, *pName;
|
UNICODE_STRING Name, *pName;
|
||||||
|
@ -240,8 +239,7 @@ START_TEST(ObReference)
|
||||||
Status = ObReferenceObjectByPointer(NULL, 0, NULL, UserMode);
|
Status = ObReferenceObjectByPointer(NULL, 0, NULL, UserMode);
|
||||||
Status = ObReferenceObjectByPointer(NULL, 0, NULL, KernelMode);*/
|
Status = ObReferenceObjectByPointer(NULL, 0, NULL, KernelMode);*/
|
||||||
|
|
||||||
ExceptionStatus = STATUS_SUCCESS;
|
KmtStartSeh()
|
||||||
_SEH2_TRY {
|
|
||||||
/* TODO: this belongs in an ObHandle test if we ever have one */
|
/* TODO: this belongs in an ObHandle test if we ever have one */
|
||||||
/* NtClose must accept everything */
|
/* NtClose must accept everything */
|
||||||
DPRINT("Closing null handle (NtClose)\n");
|
DPRINT("Closing null handle (NtClose)\n");
|
||||||
|
@ -314,10 +312,7 @@ START_TEST(ObReference)
|
||||||
/* INVALID_KERNEL_HANDLE, 0x7B, 1, 0, 0
|
/* INVALID_KERNEL_HANDLE, 0x7B, 1, 0, 0
|
||||||
Status = ObCloseHandle((HANDLE)123, KernelMode);
|
Status = ObCloseHandle((HANDLE)123, KernelMode);
|
||||||
Status = ObCloseHandle((HANDLE)(123 | 0x80000000), KernelMode);*/
|
Status = ObCloseHandle((HANDLE)(123 | 0x80000000), KernelMode);*/
|
||||||
} _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) {
|
KmtEndSeh(STATUS_SUCCESS);
|
||||||
ExceptionStatus = _SEH2_GetExceptionCode();
|
|
||||||
} _SEH2_END;
|
|
||||||
ok_eq_hex(ExceptionStatus, STATUS_SUCCESS);
|
|
||||||
|
|
||||||
if (ObDirectoryObjectType)
|
if (ObDirectoryObjectType)
|
||||||
{
|
{
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
|
|
||||||
START_TEST(RtlException)
|
START_TEST(RtlException)
|
||||||
{
|
{
|
||||||
NTSTATUS ExceptionStatus;
|
|
||||||
PCHAR Buffer[128];
|
PCHAR Buffer[128];
|
||||||
|
|
||||||
/* Access a valid pointer - must not trigger SEH */
|
/* Access a valid pointer - must not trigger SEH */
|
||||||
|
|
|
@ -13,7 +13,6 @@ VOID
|
||||||
TestFindCharInUnicodeString(VOID)
|
TestFindCharInUnicodeString(VOID)
|
||||||
{
|
{
|
||||||
#ifdef KMT_USER_MODE
|
#ifdef KMT_USER_MODE
|
||||||
NTSTATUS ExceptionStatus;
|
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
UNICODE_STRING String = RTL_CONSTANT_STRING(L"I am a string");
|
UNICODE_STRING String = RTL_CONSTANT_STRING(L"I am a string");
|
||||||
UNICODE_STRING Chars = RTL_CONSTANT_STRING(L"a");
|
UNICODE_STRING Chars = RTL_CONSTANT_STRING(L"a");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue