1 /* COPYRIGHT: See COPYING in the top level directory
2 * PROJECT: ReactOS NT Library
3 * FILE: lib/ntdll/main/dispatch.c
4 * PURPOSE: User-Mode NT Dispatchers
5 * PROGRAMERS: Alex Ionescu (alex@relsoft.net)
6 * David Welch <welch@cwcom.net>
9 /* INCLUDES *****************************************************************/
15 typedef NTSTATUS (NTAPI
*USER_CALL
)(PVOID Argument
, ULONG ArgumentLength
);
17 EXCEPTION_DISPOSITION NTAPI
18 RtlpExecuteVectoredExceptionHandlers(IN PEXCEPTION_RECORD ExceptionRecord
,
21 /* FUNCTIONS ****************************************************************/
28 KiUserExceptionDispatcher(PEXCEPTION_RECORD ExceptionRecord
,
31 EXCEPTION_RECORD NestedExceptionRecord
;
34 /* call the vectored exception handlers */
35 if(RtlpExecuteVectoredExceptionHandlers(ExceptionRecord
,
36 Context
) != ExceptionContinueExecution
)
38 goto ContinueExecution
;
42 /* Dispatch the exception and check the result */
43 if(RtlDispatchException(ExceptionRecord
, Context
))
46 /* Continue executing */
47 Status
= NtContinue(Context
, FALSE
);
51 /* Raise an exception */
52 Status
= NtRaiseException(ExceptionRecord
, Context
, FALSE
);
56 /* Setup the Exception record */
57 NestedExceptionRecord
.ExceptionCode
= Status
;
58 NestedExceptionRecord
.ExceptionFlags
= EXCEPTION_NONCONTINUABLE
;
59 NestedExceptionRecord
.ExceptionRecord
= ExceptionRecord
;
60 NestedExceptionRecord
.NumberParameters
= Status
;
62 /* Raise the exception */
63 RtlRaiseException(&NestedExceptionRecord
);
71 KiRaiseUserExceptionDispatcher(VOID
)
73 EXCEPTION_RECORD ExceptionRecord
;
75 /* Setup the exception record */
76 ExceptionRecord
.ExceptionCode
= ((PTEB
)NtCurrentTeb())->ExceptionCode
;
77 ExceptionRecord
.ExceptionFlags
= 0;
78 ExceptionRecord
.ExceptionRecord
= NULL
;
79 ExceptionRecord
.NumberParameters
= 0;
81 /* Raise the exception */
82 RtlRaiseException(&ExceptionRecord
);
90 KiUserCallbackDispatcher(ULONG Index
,
94 /* Return with the result of the callback function */
95 ZwCallbackReturn(NULL
,
97 ((USER_CALL
)(NtCurrentPeb()->KernelCallbackTable
[Index
]))
98 (Argument
, ArgumentLength
));