ReactOS  0.4.15-dev-5112-g22d8c0f
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;
22  LONG Counter;
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 }
signed char * PCHAR
Definition: retypes.h:7
_Inout_ PIRP _In_ NTSTATUS ExceptionCode
Definition: cdprocs.h:1772
#define endtry
Definition: seh.h:24
long LONG
Definition: pedump.c:60
#define PCHAR
Definition: match.c:90
#define printf
Definition: freeldr.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
#define except(x)
Definition: btrfs_drv.h:136
void AccessViolation(PLONG BlackHole, PLONG BadAddress)
Definition: seh0029.c:14
#define STATUS_ACCESS_VIOLATION
Definition: ntstatus.h:242
static LARGE_INTEGER Counter
Definition: clock.c:43
#define STATUS_DATATYPE_MISALIGNMENT
Definition: ntstatus.h:183
#define GetExceptionCode()
Definition: seh.h:27
signed int * PLONG
Definition: retypes.h:5

Variable Documentation

◆ test

char test[] = "SEH0029.c"

Definition at line 12 of file seh0029.c.