ReactOS  0.4.15-dev-5112-g22d8c0f
seh0011.c File Reference
#include <windows.h>
#include "seh.h"
Include dependency graph for seh0011.c:

Go to the source code of this file.

Functions

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

Variables

char test [] = "SEH0011.c"
 

Function Documentation

◆ AccessViolation()

void AccessViolation ( PLONG  BlackHole,
PLONG  BadAddress 
)

Definition at line 10 of file seh0011.c.

10  {
11  *BlackHole += *BadAddress;
12  return;
13 }

Referenced by tfAccessViolation().

◆ main()

int main ( void  )

Definition at line 34 of file seh0011.c.

34  {
35  PLONG BadAddress;
36  PLONG BlackHole;
37  LONG Counter;
38 
39  BadAddress = (PLONG)((PVOID)0);
40  BlackHole = &Counter;
41 
42  Counter = 0;
43 
44  try {
45  tfAccessViolation(BlackHole, BadAddress, &Counter);
46  }
48  /*
49  * acception raised was 0xC00000005L (ACCESS VIOLATION)
50  * execute handler
51  */
52  {
53  Counter -= 1;
54  }
55  endtry
56 
57  if (Counter != 98) {
58  printf("TEST 11 FAILED. Counter = %d\n\r", Counter);
59  return -1;
60  }
61 
62  return 0;
63 }
#define endtry
Definition: seh.h:24
long LONG
Definition: pedump.c:60
#define printf
Definition: freeldr.h:94
void tfAccessViolation(PLONG BlackHole, PLONG BadAddress, PLONG Counter)
Definition: seh0011.c:15
#define except(x)
Definition: btrfs_drv.h:136
#define STATUS_ACCESS_VIOLATION
Definition: ntstatus.h:242
static LARGE_INTEGER Counter
Definition: clock.c:43
#define GetExceptionCode()
Definition: seh.h:27
signed int * PLONG
Definition: retypes.h:5

◆ tfAccessViolation()

void tfAccessViolation ( PLONG  BlackHole,
PLONG  BadAddress,
PLONG  Counter 
)

Definition at line 15 of file seh0011.c.

15  {
16  try {
17  AccessViolation(BlackHole, BadAddress);
18  }
19  finally {
20  if (abnormal_termination() != 0)
21  /*
22  * not abnormal termination
23  * counter should equal 99
24  */
25  {
26  *Counter = 99;
27  } else {
28  *Counter = 100;
29  }
30  } endtry
31  return;
32 }
#define endtry
Definition: seh.h:24
void AccessViolation(PLONG BlackHole, PLONG BadAddress)
Definition: seh0011.c:10
static LARGE_INTEGER Counter
Definition: clock.c:43
#define abnormal_termination
Definition: seh.h:25

Referenced by main().

Variable Documentation

◆ test

char test[] = "SEH0011.c"

Definition at line 8 of file seh0011.c.