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 *****************************************************************/
17 typedef NTSTATUS (NTAPI
*USER_CALL
)(PVOID Argument
, ULONG ArgumentLength
);
19 /* FUNCTIONS ****************************************************************/
26 KiUserExceptionDispatcher(PEXCEPTION_RECORD ExceptionRecord
,
29 EXCEPTION_RECORD NestedExceptionRecord
;
32 /* Dispatch the exception and check the result */
33 if (RtlDispatchException(ExceptionRecord
, Context
))
35 /* Continue executing */
36 Status
= NtContinue(Context
, FALSE
);
40 /* Raise an exception */
41 Status
= NtRaiseException(ExceptionRecord
, Context
, FALSE
);
44 /* Setup the Exception record */
45 NestedExceptionRecord
.ExceptionCode
= Status
;
46 NestedExceptionRecord
.ExceptionFlags
= EXCEPTION_NONCONTINUABLE
;
47 NestedExceptionRecord
.ExceptionRecord
= ExceptionRecord
;
48 NestedExceptionRecord
.NumberParameters
= Status
;
50 /* Raise the exception */
51 RtlRaiseException(&NestedExceptionRecord
);
59 KiRaiseUserExceptionDispatcher(VOID
)
61 EXCEPTION_RECORD ExceptionRecord
;
63 /* Setup the exception record */
64 ExceptionRecord
.ExceptionCode
= ((PTEB
)NtCurrentTeb())->ExceptionCode
;
65 ExceptionRecord
.ExceptionFlags
= 0;
66 ExceptionRecord
.ExceptionRecord
= NULL
;
67 ExceptionRecord
.NumberParameters
= 0;
69 /* Raise the exception */
70 RtlRaiseException(&ExceptionRecord
);
78 KiUserCallbackDispatcher(ULONG Index
,
82 /* Return with the result of the callback function */
83 USER_CALL
*KernelCallbackTable
= NtCurrentPeb()->KernelCallbackTable
;
84 ZwCallbackReturn(NULL
,
86 KernelCallbackTable
[Index
](Argument
, ArgumentLength
));