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
;
15 /* Access a valid pointer - must not trigger SEH */
17 RtlFillMemory(Buffer
, sizeof(Buffer
), 0x12);
18 KmtEndSeh(STATUS_SUCCESS
);
20 /* Read from a NULL pointer - must cause an access violation */
22 (void)*(volatile CHAR
*)NULL
;
23 KmtEndSeh(STATUS_ACCESS_VIOLATION
);
25 /* Write to a NULL pointer - must cause an access violation */
27 *(volatile CHAR
*)NULL
= 5;
28 KmtEndSeh(STATUS_ACCESS_VIOLATION
);
30 /* TODO: Find where MmBadPointer is defined - gives an unresolved external */
31 #if 0 //def KMT_KERNEL_MODE
32 /* Read from MmBadPointer - must cause an access violation */
34 (void)*(volatile CHAR
*)MmBadPointer
;
35 KmtEndSeh(STATUS_ACCESS_VIOLATION
);
37 /* Write to MmBadPointer - must cause an access violation */
39 *(volatile CHAR
*)MmBadPointer
= 5;
40 KmtEndSeh(STATUS_ACCESS_VIOLATION
);
43 /* We cannot test this in kernel mode easily - the stack is just "somewhere"
44 * in system space, and there's no guard page below it */
45 #if CORE_6640_IS_FIXED
47 /* Overflow the stack - must cause a special exception */
53 Pointer
= _alloca(1024);
56 KmtEndSeh(STATUS_STACK_OVERFLOW
);
58 #endif /* CORE_6640_IS_FIXED */