59e30c7a69071ca0f643dda00587968e0eeb15ed
2 * PROJECT: ReactOS kernel-mode tests
3 * LICENSE: GPLv2+ - See COPYING in the top level directory
4 * PURPOSE: Kernel-Mode Test Suite Exception test
5 * PROGRAMMER: Thomas Faber <thfabba@gmx.de>
10 START_TEST(RtlException
)
12 NTSTATUS ExceptionStatus
;
16 /* Access a valid pointer - must not trigger SEH */
18 RtlFillMemory(Buffer
, sizeof(Buffer
), 0x12);
19 KmtEndSeh(STATUS_SUCCESS
);
21 /* Read from a NULL pointer - must cause an access violation */
23 Value
= *(volatile CHAR
*)NULL
;
24 KmtEndSeh(STATUS_ACCESS_VIOLATION
);
26 /* Write to a NULL pointer - must cause an access violation */
28 *(volatile CHAR
*)NULL
= 5;
29 KmtEndSeh(STATUS_ACCESS_VIOLATION
);
31 /* TODO: Find where MmBadPointer is defined - gives an unresolved external */
32 #if 0 //def KMT_KERNEL_MODE
33 /* Read from MmBadPointer - must cause an access violation */
35 Value
= *(volatile CHAR
*)MmBadPointer
;
36 KmtEndSeh(STATUS_ACCESS_VIOLATION
);
38 /* Write to MmBadPointer - must cause an access violation */
40 *(volatile CHAR
*)MmBadPointer
= 5;
41 KmtEndSeh(STATUS_ACCESS_VIOLATION
);
44 /* We cannot test this in kernel mode easily - the stack is just "somewhere"
45 * in system space, and there's no guard page below it */
47 /* Overflow the stack - must cause a special exception */
53 Pointer
= _alloca(1024);
56 KmtEndSeh(STATUS_STACK_OVERFLOW
);