ReactOS 0.4.15-dev-7931-gfd331f1
seh0029.c File Reference
#include <windows.h>
#include "seh.h"
Include dependency graph for seh0029.c:

Go to the source code of this file.

Macros

#define faill()
 
#define startest()
 
#define finish()
 

Functions

void AccessViolation (PLONG BlackHole, PLONG BadAddress)
 
int main ()
 

Variables

char test [] = "SEH0029.c"
 

Macro Definition Documentation

◆ faill

#define faill ( )

Definition at line 8 of file seh0029.c.

◆ finish

#define finish ( )

Definition at line 10 of file seh0029.c.

◆ startest

#define startest ( )

Definition at line 9 of file seh0029.c.

Function Documentation

◆ AccessViolation()

void AccessViolation ( PLONG  BlackHole,
PLONG  BadAddress 
)

Definition at line 14 of file seh0029.c.

14 {
15 *BlackHole += *BadAddress;
16 return;
17}

Referenced by main().

◆ main()

int main ( void  )

Definition at line 19 of file seh0029.c.

19 {
20 PCHAR BadByte;
21 PLONG BlackHole;
24
25 BadByte = (PCHAR)((PVOID)0);
26 BadByte += 1;
27 BlackHole = &Counter;
28
29 Counter = 0;
30
31 try {
32 /* set counter = 1 */
33 Counter += 1;
34 /*
35 * create a DATA MISALIGNMENT ERROR by passing
36 * a Byte into a LONG. Passing (PLONG)1.
37 */
38 AccessViolation(BlackHole, (PLONG)BadByte);
39 }
42 ? 1
43 : ((ExceptionCode == STATUS_ACCESS_VIOLATION) ? 1 : 0))) {
44 Counter += 1;
45 }
46 endtry
47
48 if (Counter != 2) {
49 printf("TEST 29 FAILED. Counter = %d\n\r", Counter);
50 return -1;
51 } else {
52 /*
53 ISSUE-REVIEW:a-sibyvi-2003/10/20
54 This test was expecting STATUS_DATATYPE_MISALIGNMENT
55 which is no longer true for UTC and Phoenix. So changing the test
56 to expect Acces Violation instead.
57 ISSUE-REVIEW:v-simwal-2011-01-25 Either MISALIGNMENT or ACCESS VIOLATION
58 counts as a pass.
59 */
62 printf(
63 "TEST 29 FAILED. Expected ACCESS_VIOLATION, got exception = %d\n\r",
65 return -1;
66 }
67 }
68 return 0;
69}
#define except(x)
Definition: btrfs_drv.h:136
_Inout_ PIRP _In_ NTSTATUS ExceptionCode
Definition: cdprocs.h:1774
unsigned long DWORD
Definition: ntddk_ex.h:95
#define printf
Definition: freeldr.h:97
#define PCHAR
Definition: match.c:90
#define STATUS_ACCESS_VIOLATION
Definition: ntstatus.h:242
#define STATUS_DATATYPE_MISALIGNMENT
Definition: ntstatus.h:183
long LONG
Definition: pedump.c:60
void AccessViolation(PLONG BlackHole, PLONG BadAddress)
Definition: seh0029.c:14
#define endtry
Definition: seh.h:24
#define GetExceptionCode()
Definition: seh.h:27
static LARGE_INTEGER Counter
Definition: clock.c:43
int32_t * PLONG
Definition: typedefs.h:58
char * PCHAR
Definition: typedefs.h:51

Variable Documentation

◆ test

char test[] = "SEH0029.c"

Definition at line 12 of file seh0029.c.