[RTL] Implement RtplUnwindInternal and wrap RtlUnwindEx and RtlDispatchException around it

Based on the description in this blog article: http://www.nynaeve.net/?p=106
This commit is contained in:
Timo Kreuzer 2018-03-01 14:43:05 +01:00
parent 1d58e84736
commit 3ec1ca9b46
2 changed files with 273 additions and 7 deletions

View file

@ -88,15 +88,49 @@ RtlpGetExceptionAddress(VOID)
return NULL;
}
BOOLEAN
NTAPI
RtplUnwindInternal(
_In_opt_ PVOID TargetFrame,
_In_opt_ PVOID TargetIp,
_In_ PEXCEPTION_RECORD ExceptionRecord,
_In_ PVOID ReturnValue,
_In_ PCONTEXT ContextRecord,
_In_opt_ struct _UNWIND_HISTORY_TABLE *HistoryTable,
_In_ ULONG Flags);
/*
* @unimplemented
*/
BOOLEAN
NTAPI
RtlDispatchException(IN PEXCEPTION_RECORD ExceptionRecord,
IN PCONTEXT Context)
RtlDispatchException(
_In_ PEXCEPTION_RECORD ExceptionRecord,
_In_ PCONTEXT ContextRecord)
{
__debugbreak();
UNIMPLEMENTED;
return FALSE;
BOOLEAN Handled;
/* Perform vectored exception handling for user mode */
if (RtlCallVectoredExceptionHandlers(ExceptionRecord, ContextRecord))
{
/* Exception handled, now call vectored continue handlers */
RtlCallVectoredContinueHandlers(ExceptionRecord, ContextRecord);
/* Continue execution */
return TRUE;
}
/* Call the internal unwind routine */
Handled = RtplUnwindInternal(NULL, // TargetFrame
NULL, // TargetIp
ExceptionRecord,
0, // ReturnValue
ContextRecord,
NULL, // HistoryTable
UNW_FLAG_EHANDLER);
/* In user mode, call any registered vectored continue handlers */
RtlCallVectoredContinueHandlers(ExceptionRecord, ContextRecord);
return Handled;
}