My Project
Loading...
Searching...
No Matches
exception.h File Reference
#include <stdint.h>
#include <stddef.h>
#include "me.h"
#include "core.h"

Go to the source code of this file.

Data Structures

struct  _EXCEPTION_RECORD
struct  _CONTEXT
struct  _EXCEPTION_REGISTRATION_RECORD
struct  _EX_FRAME_REGISTRATION

Macros

#define EXCEPTION_MAXIMUM_PARAMETERS   15
#define _try
#define _except(FilterExpression)
#define _end_except

Typedefs

typedef struct _EXCEPTION_RECORD EXCEPTION_RECORD
typedef struct _EXCEPTION_RECORDPEXCEPTION_RECORD
typedef enum _EXCEPTION_DISPOSITION EXCEPTION_DISPOSITION
typedef struct _CONTEXT CONTEXT
typedef struct _CONTEXTPCONTEXT
typedef struct _EXCEPTION_REGISTRATION_RECORD EXCEPTION_REGISTRATION_RECORD
typedef struct _EX_FRAME_REGISTRATION EX_FRAME_REGISTRATION

Enumerations

enum  _EXCEPTION_DISPOSITION { ExceptionContinueExecution = 0 , ExceptionContinueSearch = 1 , ExceptionNestedException = 2 , ExceptionCollidedUnwind = 3 }

Functions

PETHREAD PsGetCurrentThread (void)
bool ExpCaptureContext (IN PCONTEXT Context)
EXCEPTION_DISPOSITION MeStandardHandler (PEXCEPTION_RECORD ExceptionRecord, void *EstablisherFrame, PCONTEXT ContextRecord, void *DispatcherContext)
bool ExpIsExceptionHandlerPresent (IN PETHREAD Thread)
void ExpDispatchException (IN PTRAP_FRAME TrapFrame, IN PCONTEXT ContextRecord, IN PEXCEPTION_RECORD ExceptionRecord)

Macro Definition Documentation

◆ _end_except

#define _end_except
Value:
} \
} \
}

Definition at line 121 of file exception.h.

◆ _except

#define _except ( FilterExpression)
Value:
/* Success path: Unlink frame */ \
_CurrentThread->ExceptionList = _MyFrame.Next; \
} else { \
/* Crash path: We just "landed" here from the handler! */ \
/* Unlink frame (safe to do again) */ \
_CurrentThread->ExceptionList = _MyFrame.Next; \
/* You can access _MyFrame.ExceptionCode here if needed */ \
{ \
/* User Code inside except block */

Definition at line 110 of file exception.h.

◆ _try

#define _try
Value:
{ \
PETHREAD _CurrentThread = PsGetCurrentThread(); \
ME_EXCEPTION_FRAME _MyFrame; \
_MyFrame.Next = (PME_EXCEPTION_FRAME)_CurrentThread->ExceptionList; \
_MyFrame.Handler = MeStandardHandler; \
_CurrentThread->ExceptionList = &_MyFrame; \
/* Save Context. Returns 0 initially. Returns 1 if we crashed. */ \
if (ExpCaptureContext(&_MyFrame) == 0) { \
ETHREAD * PETHREAD
Definition core.h:42
bool ExpCaptureContext(IN PCONTEXT Context)
EXCEPTION_DISPOSITION MeStandardHandler(PEXCEPTION_RECORD ExceptionRecord, void *EstablisherFrame, PCONTEXT ContextRecord, void *DispatcherContext)
PETHREAD PsGetCurrentThread(void)
Definition thread.c:191

Definition at line 100 of file exception.h.

◆ EXCEPTION_MAXIMUM_PARAMETERS

#define EXCEPTION_MAXIMUM_PARAMETERS   15

Definition at line 34 of file exception.h.

Typedef Documentation

◆ CONTEXT

typedef struct _CONTEXT CONTEXT

◆ EX_FRAME_REGISTRATION

◆ EXCEPTION_DISPOSITION

◆ EXCEPTION_RECORD

◆ EXCEPTION_REGISTRATION_RECORD

◆ PCONTEXT

typedef struct _CONTEXT * PCONTEXT

◆ PEXCEPTION_RECORD

Enumeration Type Documentation

◆ _EXCEPTION_DISPOSITION

Enumerator
ExceptionContinueExecution 
ExceptionContinueSearch 
ExceptionNestedException 
ExceptionCollidedUnwind 

Definition at line 43 of file exception.h.

Function Documentation

◆ ExpCaptureContext()

bool ExpCaptureContext ( IN PCONTEXT Context)
extern

◆ ExpDispatchException()

void ExpDispatchException ( IN PTRAP_FRAME TrapFrame,
IN PCONTEXT ContextRecord,
IN PEXCEPTION_RECORD ExceptionRecord )

Definition at line 56 of file exception.c.

◆ ExpIsExceptionHandlerPresent()

bool ExpIsExceptionHandlerPresent ( IN PETHREAD Thread)

Definition at line 23 of file exception.c.

◆ MeStandardHandler()

EXCEPTION_DISPOSITION MeStandardHandler ( PEXCEPTION_RECORD ExceptionRecord,
void * EstablisherFrame,
PCONTEXT ContextRecord,
void * DispatcherContext )

◆ PsGetCurrentThread()

PETHREAD PsGetCurrentThread ( void )
extern

Definition at line 191 of file thread.c.