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 <thomas.faber@reactos.org>
10 START_TEST(RtlException
)
14 /* Access a valid pointer - must not trigger SEH */
16 RtlFillMemory(Buffer
, sizeof(Buffer
), 0x12);
17 KmtEndSeh(STATUS_SUCCESS
);
19 /* Read from a NULL pointer - must cause an access violation */
21 (void)*(volatile CHAR
*)NULL
;
22 KmtEndSeh(STATUS_ACCESS_VIOLATION
);
24 /* Write to a NULL pointer - must cause an access violation */
26 *(volatile CHAR
*)NULL
= 5;
27 KmtEndSeh(STATUS_ACCESS_VIOLATION
);
29 /* TODO: Find where MmBadPointer is defined - gives an unresolved external */
30 #if 0 //def KMT_KERNEL_MODE
31 /* Read from MmBadPointer - must cause an access violation */
33 (void)*(volatile CHAR
*)MmBadPointer
;
34 KmtEndSeh(STATUS_ACCESS_VIOLATION
);
36 /* Write to MmBadPointer - must cause an access violation */
38 *(volatile CHAR
*)MmBadPointer
= 5;
39 KmtEndSeh(STATUS_ACCESS_VIOLATION
);
42 /* We cannot test this in kernel mode easily - the stack is just "somewhere"
43 * in system space, and there's no guard page below it */
44 #if CORE_6640_IS_FIXED
46 /* Overflow the stack - must cause a special exception */
52 Pointer
= _alloca(1024);
55 KmtEndSeh(STATUS_STACK_OVERFLOW
);
57 #endif /* CORE_6640_IS_FIXED */