ReactOS  0.4.14-dev-98-gb0d4763
GuardedMemory.c File Reference
#include <kmt_test.h>
Include dependency graph for GuardedMemory.c:

Go to the source code of this file.

Functions

 START_TEST (GuardedMemory)
 

Function Documentation

◆ START_TEST()

START_TEST ( GuardedMemory  )

Definition at line 14 of file GuardedMemory.c.

15 {
17  SIZE_T Size = 123;
18  PCHAR *Buffer;
19 
20  /* access some invalid memory to test SEH */
22  _SEH2_TRY
23  {
24  RtlFillMemory(NULL, 1, 0);
25  }
27  {
29  } _SEH2_END;
31 
32  /* get guarded mem */
34 
35  if (skip(Buffer != NULL, "Failed to allocate guarded memory\n"))
36  return;
37 
38  /* access to guarded mem should be fine */
40  _SEH2_TRY
41  {
43  }
45  {
47  } _SEH2_END;
49 
50  /* access one byte behind guarded mem must cause an access violation! */
52  _SEH2_TRY
53  {
54  RtlFillMemory(Buffer + Size, 1, 0);
55  }
57  {
59  } _SEH2_END;
61 
63 }
signed char * PCHAR
Definition: retypes.h:7
BOOLEAN BOOLEAN VOID VOID BOOLEAN BOOLEAN PVOID KmtAllocateGuarded(SIZE_T SizeRequested)
LONG NTSTATUS
Definition: precomp.h:26
_SEH2_TRY
Definition: create.c:4250
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
Status
Definition: gdiplustypes.h:24
ULONG_PTR SIZE_T
Definition: typedefs.h:78
_SEH2_END
Definition: create.c:4424
#define STATUS_ACCESS_VIOLATION
Definition: ntstatus.h:228
#define skip(...)
Definition: atltest.h:64
VOID KmtFreeGuarded(PVOID Pointer)
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define ok_eq_hex(value, expected)
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
return STATUS_SUCCESS
Definition: btrfs.c:2966
#define RtlFillMemory(Dest, Length, Fill)
Definition: winternl.h:593