ReactOS  0.4.15-dev-2961-gecb0c09
dispatch.c File Reference
#include <ntdll.h>
#include <debug.h>
Include dependency graph for dispatch.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Typedefs

typedef NTSTATUS(NTAPIUSER_CALL) (PVOID Argument, ULONG ArgumentLength)
 

Functions

VOID NTAPI KiUserExceptionDispatcher (PEXCEPTION_RECORD ExceptionRecord, PCONTEXT Context)
 
VOID NTAPI KiRaiseUserExceptionDispatcher (VOID)
 
VOID NTAPI KiUserCallbackDispatcher (ULONG Index, PVOID Argument, ULONG ArgumentLength)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 14 of file dispatch.c.

Typedef Documentation

◆ USER_CALL

typedef NTSTATUS(NTAPI * USER_CALL) (PVOID Argument, ULONG ArgumentLength)

Definition at line 17 of file dispatch.c.

Function Documentation

◆ KiRaiseUserExceptionDispatcher()

VOID NTAPI KiRaiseUserExceptionDispatcher ( VOID  )

Definition at line 59 of file dispatch.c.

60 {
61  EXCEPTION_RECORD ExceptionRecord;
62 
63  /* Setup the exception record */
64  ExceptionRecord.ExceptionCode = ((PTEB)NtCurrentTeb())->ExceptionCode;
65  ExceptionRecord.ExceptionFlags = 0;
66  ExceptionRecord.ExceptionRecord = NULL;
67  ExceptionRecord.NumberParameters = 0;
68 
69  /* Raise the exception */
70  RtlRaiseException(&ExceptionRecord);
71 }
_Inout_ PIRP _In_ NTSTATUS ExceptionCode
Definition: cdprocs.h:1772
NTSYSAPI VOID NTAPI RtlRaiseException(_In_ PEXCEPTION_RECORD ExceptionRecord)
DWORD ExceptionCode
Definition: compat.h:208
struct _EXCEPTION_RECORD * ExceptionRecord
Definition: compat.h:210
FORCEINLINE struct _TEB * NtCurrentTeb(VOID)
Definition: psfuncs.h:420
struct _TEB * PTEB
#define NULL
Definition: types.h:112
DWORD ExceptionFlags
Definition: compat.h:209
DWORD NumberParameters
Definition: compat.h:212

◆ KiUserCallbackDispatcher()

VOID NTAPI KiUserCallbackDispatcher ( ULONG  Index,
PVOID  Argument,
ULONG  ArgumentLength 
)

Definition at line 78 of file dispatch.c.

81 {
82  /* Return with the result of the callback function */
83  USER_CALL *KernelCallbackTable = NtCurrentPeb()->KernelCallbackTable;
85  0,
86  KernelCallbackTable[Index](Argument, ArgumentLength));
87 }
NTSYSAPI NTSTATUS NTAPI ZwCallbackReturn(_In_ PVOID Result, _In_ ULONG ResultLength, _In_ NTSTATUS Status)
_In_ WDFCOLLECTION _In_ ULONG Index
#define NtCurrentPeb()
Definition: FLS.c:22
#define NULL
Definition: types.h:112
NTSTATUS(NTAPI * USER_CALL)(PVOID Argument, ULONG ArgumentLength)
Definition: dispatch.c:17

◆ KiUserExceptionDispatcher()

VOID NTAPI KiUserExceptionDispatcher ( PEXCEPTION_RECORD  ExceptionRecord,
PCONTEXT  Context 
)

Definition at line 26 of file dispatch.c.

28 {
29  EXCEPTION_RECORD NestedExceptionRecord;
31 
32  /* Dispatch the exception and check the result */
33  if (RtlDispatchException(ExceptionRecord, Context))
34  {
35  /* Continue executing */
37  }
38  else
39  {
40  /* Raise an exception */
41  Status = NtRaiseException(ExceptionRecord, Context, FALSE);
42  }
43 
44  /* Setup the Exception record */
45  NestedExceptionRecord.ExceptionCode = Status;
46  NestedExceptionRecord.ExceptionFlags = EXCEPTION_NONCONTINUABLE;
47  NestedExceptionRecord.ExceptionRecord = ExceptionRecord;
48  NestedExceptionRecord.NumberParameters = Status;
49 
50  /* Raise the exception */
51  RtlRaiseException(&NestedExceptionRecord);
52 }
LONG NTSTATUS
Definition: precomp.h:26
#define EXCEPTION_NONCONTINUABLE
Definition: rtltypes.h:154
NTSYSAPI VOID NTAPI RtlRaiseException(_In_ PEXCEPTION_RECORD ExceptionRecord)
DWORD ExceptionCode
Definition: compat.h:208
#define FALSE
Definition: types.h:117
NTSTATUS NTAPI NtContinue(IN PCONTEXT Context, IN BOOLEAN TestAlert)
Definition: except.c:212
NTSTATUS NTAPI NtRaiseException(IN PEXCEPTION_RECORD ExceptionRecord, IN PCONTEXT Context, IN BOOLEAN FirstChance)
Definition: except.c:171
Status
Definition: gdiplustypes.h:24
NTSYSAPI BOOLEAN NTAPI RtlDispatchException(_In_ PEXCEPTION_RECORD ExceptionRecord, _In_ PCONTEXT Context)
Definition: except.c:87
struct _EXCEPTION_RECORD * ExceptionRecord
Definition: compat.h:210
DWORD ExceptionFlags
Definition: compat.h:209
DWORD NumberParameters
Definition: compat.h:212