ReactOS  0.4.15-dev-5097-g328cc41
seh0013.c File Reference
#include <setjmp.h>
#include <windows.h>
#include "seh.h"
Include dependency graph for seh0013.c:

Go to the source code of this file.

Functions

void rtlRaiseException (DWORD Status)
 
void AccessViolation (PLONG BlackHole, PLONG BadAddress)
 
int main ()
 

Variables

char test [] = "SEH0013.c"
 

Function Documentation

◆ AccessViolation()

void AccessViolation ( PLONG  BlackHole,
PLONG  BadAddress 
)

Definition at line 16 of file seh0013.c.

16  {
17  *BlackHole += *BadAddress;
18  return;
19 }

Referenced by main().

◆ main()

int main ( void  )

Definition at line 21 of file seh0013.c.

21  {
22  PLONG BadAddress;
23  PCHAR BadByte;
24  PLONG BlackHole;
25  ULONG Index2 = 1;
26  LONG Counter;
27 
28  BadAddress = (PLONG)((PVOID)0);
29  BadByte = (PCHAR)((PVOID)0);
30  BadByte += 1;
31  BlackHole = &Counter;
32 
33  Counter = 0;
34 
35  try {
36  AccessViolation(BlackHole, BadAddress);
37  }
39  /*
40  * exception handler should gete executed
41  * setting Counter to 1
42  */
43  {
44  Counter += 1;
45  try {
47  }
49  /* exception handler should get executed */
50  {
51  if (Counter != 1) {
52  printf("TEST 13 FAILED. Counter = %d\n\r", Counter);
53  return -1;
54  }
55  /* set's counter to 2 */
56  Counter += 1;
57  }
58  endtry
59  }
60  endtry
61 
62  if (Counter != 2) {
63  printf("TEST 13 FAILED. Counter= %d\n\r", Counter);
64  return -1;
65  }
66 
67  return 0;
68 }
signed char * PCHAR
Definition: retypes.h:7
void AccessViolation(PLONG BlackHole, PLONG BadAddress)
Definition: seh0013.c:16
#define endtry
Definition: seh.h:24
long LONG
Definition: pedump.c:60
#define PCHAR
Definition: match.c:90
#define printf
Definition: freeldr.h:94
void rtlRaiseException(DWORD Status)
Definition: seh0013.c:11
#define except(x)
Definition: btrfs_drv.h:136
#define EXCEPTION_CONTINUE_SEARCH
Definition: excpt.h:86
#define STATUS_ACCESS_VIOLATION
Definition: ntstatus.h:242
static LARGE_INTEGER Counter
Definition: clock.c:43
unsigned int ULONG
Definition: retypes.h:1
#define GetExceptionCode()
Definition: seh.h:27
signed int * PLONG
Definition: retypes.h:5

◆ rtlRaiseException()

void rtlRaiseException ( DWORD  Status)

Definition at line 11 of file seh0013.c.

11  {
12  RaiseException(Status, 0, /*no flags*/ 0, 0);
13  return;
14 }
Status
Definition: gdiplustypes.h:24
VOID WINAPI RaiseException(IN DWORD dwExceptionCode, IN DWORD dwExceptionFlags, IN DWORD nNumberOfArguments, IN CONST ULONG_PTR *lpArguments OPTIONAL)
Definition: except.c:700

Referenced by main().

Variable Documentation

◆ test

char test[] = "SEH0013.c"

Definition at line 9 of file seh0013.c.