2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS NT Library
4 * FILE: dll/ntdll/dispatch/dispatch.c
5 * PURPOSE: User-Mode NT Dispatchers
6 * PROGRAMERS: Alex Ionescu (alex@relsoft.net)
7 * David Welch <welch@cwcom.net>
10 /* INCLUDES *****************************************************************/
16 typedef NTSTATUS (NTAPI
*USER_CALL
)(PVOID Argument
, ULONG ArgumentLength
);
18 /* FUNCTIONS ****************************************************************/
25 KiUserExceptionDispatcher(PEXCEPTION_RECORD ExceptionRecord
,
28 EXCEPTION_RECORD NestedExceptionRecord
;
31 /* Dispatch the exception and check the result */
32 if (RtlDispatchException(ExceptionRecord
, Context
))
34 /* Continue executing */
35 Status
= NtContinue(Context
, FALSE
);
39 /* Raise an exception */
40 Status
= NtRaiseException(ExceptionRecord
, Context
, FALSE
);
43 /* Setup the Exception record */
44 NestedExceptionRecord
.ExceptionCode
= Status
;
45 NestedExceptionRecord
.ExceptionFlags
= EXCEPTION_NONCONTINUABLE
;
46 NestedExceptionRecord
.ExceptionRecord
= ExceptionRecord
;
47 NestedExceptionRecord
.NumberParameters
= Status
;
49 /* Raise the exception */
50 RtlRaiseException(&NestedExceptionRecord
);
58 KiRaiseUserExceptionDispatcher(VOID
)
60 EXCEPTION_RECORD ExceptionRecord
;
62 /* Setup the exception record */
63 ExceptionRecord
.ExceptionCode
= ((PTEB
)NtCurrentTeb())->ExceptionCode
;
64 ExceptionRecord
.ExceptionFlags
= 0;
65 ExceptionRecord
.ExceptionRecord
= NULL
;
66 ExceptionRecord
.NumberParameters
= 0;
68 /* Raise the exception */
69 RtlRaiseException(&ExceptionRecord
);
77 KiUserCallbackDispatcher(ULONG Index
,
81 /* Return with the result of the callback function */
82 USER_CALL
*KernelCallbackTable
= NtCurrentPeb()->KernelCallbackTable
;
83 ZwCallbackReturn(NULL
,
85 KernelCallbackTable
[Index
](Argument
, ArgumentLength
));