#include <ntoskrnl.h>
#define NDEBUG
-#include <internal/debug.h>
+#include <debug.h>
/* FUNCTIONS *****************************************************************/
if (KeGetCurrentIrql() < APC_LEVEL) KeRaiseIrql(APC_LEVEL, &OldIrql);
/* Set up SEH to validate the context */
- _SEH_TRY
+ _SEH2_TRY
{
/* Check the previous mode */
if (PreviousMode != KernelMode)
KernelMode);
}
}
- _SEH_HANDLE
+ _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
/* Save the exception code */
- Status = _SEH_GetExceptionCode();
+ Status = _SEH2_GetExceptionCode();
}
- _SEH_END;
+ _SEH2_END;
/* Lower the IRQL if needed */
if (OldIrql < APC_LEVEL) KeLowerIrql(OldIrql);
CONTEXT LocalContext;
EXCEPTION_RECORD LocalExceptionRecord;
ULONG ParameterCount, Size;
- NTSTATUS Status = STATUS_SUCCESS;
- /* Set up SEH */
- _SEH_TRY
+ /* Check if we need to probe */
+ if (PreviousMode != KernelMode)
{
- /* Check the previous mode */
- if (PreviousMode != KernelMode)
+ /* Set up SEH */
+ _SEH2_TRY
{
-#if 0
/* Probe the context */
ProbeForRead(Context, sizeof(CONTEXT), sizeof(ULONG));
FIELD_OFFSET(EXCEPTION_RECORD, NumberParameters) +
sizeof(ULONG),
sizeof(ULONG));
-#endif
+
/* Validate the maximum parameters */
if ((ParameterCount = ExceptionRecord->NumberParameters) >
EXCEPTION_MAXIMUM_PARAMETERS)
{
/* Too large */
- Status = STATUS_INVALID_PARAMETER;
- _SEH_LEAVE;
+ _SEH2_YIELD(return STATUS_INVALID_PARAMETER);
}
/* Probe the entire parameters now*/
/* Update the parameter count */
ExceptionRecord->NumberParameters = ParameterCount;
}
+ _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+ {
+ /* Don't fail silently */
+ DPRINT1("KiRaiseException: Failed to Probe\n");
+ DbgBreakPoint();
+
+ /* Return the exception code */
+ _SEH2_YIELD(return _SEH2_GetExceptionCode());
+ }
+ _SEH2_END;
}
- _SEH_HANDLE
- {
- /* Get the exception code */
- Status = _SEH_GetExceptionCode();
- }
- _SEH_END;
- if (!NT_SUCCESS(Status)) return Status;
/* Convert the context record */
KeContextToTrapFrame(Context,
PreviousMode,
SearchFrames);
- /* Return the status */
- return Status;
+ /* We are done */
+ return STATUS_SUCCESS;
}
/* EOF */