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

Go to the source code of this file.

Functions

void rtlRaiseStatus (DWORD Status)
 
ULONG except3 (PEXCEPTION_POINTERS ExceptionPointers, PLONG Counter)
 
void except1 (PLONG Counter)
 
ULONG except2 (PEXCEPTION_POINTERS ExceptionPointers, PLONG Counter)
 
int main ()
 

Variables

char test [] = "SEH0027.c"
 

Function Documentation

◆ except1()

void except1 ( PLONG  Counter)

Definition at line 36 of file seh0027.c.

36  {
37  try {
38  /* set counter = 6 */
39  *Counter += 5;
40  RaiseException(EXCEPTION_INT_OVERFLOW, 0, /*no flags*/ 0, 0);
41  }
43  endtry
44  /* set counter = 59 */
45  *Counter += 9;
46  return;
47 }
#define GetExceptionInformation()
Definition: seh.h:26
#define endtry
Definition: seh.h:24
#define EXCEPTION_INT_OVERFLOW
Definition: winbase.h:321
#define except(x)
Definition: btrfs_drv.h:136
ULONG except3(PEXCEPTION_POINTERS ExceptionPointers, PLONG Counter)
Definition: seh0027.c:15
VOID WINAPI RaiseException(IN DWORD dwExceptionCode, IN DWORD dwExceptionFlags, IN DWORD nNumberOfArguments, IN CONST ULONG_PTR *lpArguments OPTIONAL)
Definition: except.c:700
static LARGE_INTEGER Counter
Definition: clock.c:43

Referenced by main().

◆ except2()

ULONG except2 ( PEXCEPTION_POINTERS  ExceptionPointers,
PLONG  Counter 
)

Definition at line 49 of file seh0027.c.

49  {
50  PEXCEPTION_RECORD ExceptionRecord;
51 
52  ExceptionRecord = ExceptionPointers->ExceptionRecord;
53  if ((ExceptionRecord->ExceptionCode == EXCEPTION_EXECUTE_HANDLER) &&
54  ((ExceptionRecord->ExceptionFlags & 0x10) == 0)) {
55  /* set counter = 53 */
56  *Counter += 11;
57  return 1;
58  } else {
59  *Counter += 13;
60  return 0;
61  }
62 }
DWORD ExceptionCode
Definition: compat.h:208
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
static LARGE_INTEGER Counter
Definition: clock.c:43
DWORD ExceptionFlags
Definition: compat.h:209
PEXCEPTION_RECORD ExceptionRecord
Definition: rtltypes.h:200

Referenced by main().

◆ except3()

ULONG except3 ( PEXCEPTION_POINTERS  ExceptionPointers,
PLONG  Counter 
)

Definition at line 15 of file seh0027.c.

15  {
16  PEXCEPTION_RECORD ExceptionRecord;
17 
18  ExceptionRecord = ExceptionPointers->ExceptionRecord;
19  if ((ExceptionRecord->ExceptionCode == (STATUS_INTEGER_OVERFLOW)) &&
20  ((ExceptionRecord->ExceptionFlags & 0x10) == 0)) {
21  /* set counter = 23 */
22  *Counter += 17;
24  } else if ((ExceptionRecord->ExceptionCode == EXCEPTION_EXECUTE_HANDLER) &&
25  ((ExceptionRecord->ExceptionFlags & 0x10) != 0)) {
26  /* set counter = 42 */
27  *Counter += 19;
28  /* return COTINUE SEARCH */
29  return 0;
30  }
31  /* never gets here due to exception being rasied */
32  *Counter += 23;
33  return 1;
34 }
DWORD ExceptionCode
Definition: compat.h:208
#define STATUS_INTEGER_OVERFLOW
Definition: ntstatus.h:385
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
static LARGE_INTEGER Counter
Definition: clock.c:43
DWORD ExceptionFlags
Definition: compat.h:209
PEXCEPTION_RECORD ExceptionRecord
Definition: rtltypes.h:200
void rtlRaiseStatus(DWORD Status)
Definition: seh0027.c:10

Referenced by except1().

◆ main()

int main ( void  )

Definition at line 64 of file seh0027.c.

64  {
65  LONG Counter;
66 
67  Counter = 0;
68 
69  try {
70  try {
71  /* set counter = 1 */
72  Counter += 1;
73  except1(&Counter);
74  }
76  /* set counter = 55 */
77  Counter += 2;
78  }
79  endtry
80  }
81  except(1) { Counter += 3; }
82  endtry
83 
84  if (Counter != 55) {
85  printf("TEST 27 FAILED. Counter = %d\n\r", Counter);
86  return -1;
87  }
88 
89  return 0;
90 }
#define GetExceptionInformation()
Definition: seh.h:26
#define endtry
Definition: seh.h:24
ULONG except2(PEXCEPTION_POINTERS ExceptionPointers, PLONG Counter)
Definition: seh0027.c:49
long LONG
Definition: pedump.c:60
#define printf
Definition: freeldr.h:94
void except1(PLONG Counter)
Definition: seh0027.c:36
#define except(x)
Definition: btrfs_drv.h:136
static LARGE_INTEGER Counter
Definition: clock.c:43

◆ rtlRaiseStatus()

void rtlRaiseStatus ( DWORD  Status)

Definition at line 10 of file seh0027.c.

10  {
11  RaiseException(Status, 0, /*no flags*/ 0, 0);
12  return;
13 }
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 except3().

Variable Documentation

◆ test

char test[] = "SEH0027.c"

Definition at line 8 of file seh0027.c.