mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 21:12:59 +00:00
[KMTESTS]
- Centralize frequently used macros svn path=/trunk/; revision=56733
This commit is contained in:
parent
e04fd2b536
commit
3acf3b9507
4 changed files with 136 additions and 132 deletions
|
@ -7,9 +7,6 @@
|
|||
|
||||
#include <kmt_test.h>
|
||||
|
||||
#define StartSeh() ExceptionStatus = STATUS_SUCCESS; _SEH2_TRY {
|
||||
#define EndSeh(ExpectedStatus) } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { ExceptionStatus = _SEH2_GetExceptionCode(); } _SEH2_END; ok_eq_hex(ExceptionStatus, ExpectedStatus)
|
||||
|
||||
START_TEST(RtlException)
|
||||
{
|
||||
NTSTATUS ExceptionStatus;
|
||||
|
@ -17,38 +14,38 @@ START_TEST(RtlException)
|
|||
CHAR Value;
|
||||
|
||||
/* Access a valid pointer - must not trigger SEH */
|
||||
StartSeh()
|
||||
KmtStartSeh()
|
||||
RtlFillMemory(Buffer, sizeof(Buffer), 0x12);
|
||||
EndSeh(STATUS_SUCCESS);
|
||||
KmtEndSeh(STATUS_SUCCESS);
|
||||
|
||||
/* Read from a NULL pointer - must cause an access violation */
|
||||
StartSeh()
|
||||
KmtStartSeh()
|
||||
Value = *(volatile CHAR *)NULL;
|
||||
EndSeh(STATUS_ACCESS_VIOLATION);
|
||||
KmtEndSeh(STATUS_ACCESS_VIOLATION);
|
||||
|
||||
/* Write to a NULL pointer - must cause an access violation */
|
||||
StartSeh()
|
||||
KmtStartSeh()
|
||||
*(volatile CHAR *)NULL = 5;
|
||||
EndSeh(STATUS_ACCESS_VIOLATION);
|
||||
KmtEndSeh(STATUS_ACCESS_VIOLATION);
|
||||
|
||||
/* TODO: Find where MmBadPointer is defined - gives an unresolved external */
|
||||
#if 0 //def KMT_KERNEL_MODE
|
||||
/* Read from MmBadPointer - must cause an access violation */
|
||||
StartSeh()
|
||||
KmtStartSeh()
|
||||
Value = *(volatile CHAR *)MmBadPointer;
|
||||
EndSeh(STATUS_ACCESS_VIOLATION);
|
||||
KmtEndSeh(STATUS_ACCESS_VIOLATION);
|
||||
|
||||
/* Write to MmBadPointer - must cause an access violation */
|
||||
StartSeh()
|
||||
KmtStartSeh()
|
||||
*(volatile CHAR *)MmBadPointer = 5;
|
||||
EndSeh(STATUS_ACCESS_VIOLATION);
|
||||
KmtEndSeh(STATUS_ACCESS_VIOLATION);
|
||||
#endif
|
||||
|
||||
/* We cannot test this in kernel mode easily - the stack is just "somewhere"
|
||||
* in system space, and there's no guard page below it */
|
||||
#ifdef KMT_USER_MODE
|
||||
/* Overflow the stack - must cause a special exception */
|
||||
StartSeh()
|
||||
KmtStartSeh()
|
||||
PCHAR Pointer;
|
||||
|
||||
while (1)
|
||||
|
@ -56,6 +53,6 @@ START_TEST(RtlException)
|
|||
Pointer = _alloca(1024);
|
||||
*Pointer = 5;
|
||||
}
|
||||
EndSeh(STATUS_STACK_OVERFLOW);
|
||||
KmtEndSeh(STATUS_STACK_OVERFLOW);
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue