mirror of
https://github.com/reactos/reactos.git
synced 2025-08-07 07:33:27 +00:00
- Use _SEH2_YIELD when returning from an exception instead of returning outside the SEH block. Avoids unnecessary status checks for the most common case (no exception). Move the cleanup code into the handler too in favor of the no-exception case. Futhermore, don't call ExSystemExceptionFilter when we know we are called from user mode. Finally, only enter SEH if we need to do any probing.
- Re-enable user mode probes in KiRaiseException; they do not seem to be an issue anymore -- booting and running the ntdll exception Winetest didn't reveal any issue. Put a breakpoint there in case this code is ever hit (unlikely). svn path=/trunk/; revision=42923
This commit is contained in:
parent
87db4c425c
commit
f022f9092b
11 changed files with 68 additions and 110 deletions
|
@ -54,7 +54,7 @@ vDbgPrintExWithPrefixInternal(IN LPCSTR Prefix,
|
||||||
IN va_list ap,
|
IN va_list ap,
|
||||||
IN BOOLEAN HandleBreakpoint)
|
IN BOOLEAN HandleBreakpoint)
|
||||||
{
|
{
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status;
|
||||||
ANSI_STRING DebugString;
|
ANSI_STRING DebugString;
|
||||||
CHAR Buffer[512];
|
CHAR Buffer[512];
|
||||||
ULONG Length, PrefixLength;
|
ULONG Length, PrefixLength;
|
||||||
|
@ -65,11 +65,11 @@ vDbgPrintExWithPrefixInternal(IN LPCSTR Prefix,
|
||||||
!(NtQueryDebugFilterState(ComponentId, Level)))
|
!(NtQueryDebugFilterState(ComponentId, Level)))
|
||||||
{
|
{
|
||||||
/* This message is masked */
|
/* This message is masked */
|
||||||
return Status;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* For user mode, don't recursively DbgPrint */
|
/* For user mode, don't recursively DbgPrint */
|
||||||
if (RtlpSetInDbgPrint(TRUE)) return Status;
|
if (RtlpSetInDbgPrint(TRUE)) return STATUS_SUCCESS;
|
||||||
|
|
||||||
/* Guard against incorrect pointers */
|
/* Guard against incorrect pointers */
|
||||||
_SEH2_TRY
|
_SEH2_TRY
|
||||||
|
@ -91,10 +91,9 @@ vDbgPrintExWithPrefixInternal(IN LPCSTR Prefix,
|
||||||
{
|
{
|
||||||
/* Fail */
|
/* Fail */
|
||||||
Length = PrefixLength = 0;
|
Length = PrefixLength = 0;
|
||||||
Status = _SEH2_GetExceptionCode();
|
_SEH2_YIELD(return _SEH2_GetExceptionCode());
|
||||||
}
|
}
|
||||||
_SEH2_END;
|
_SEH2_END;
|
||||||
if (!NT_SUCCESS(Status)) return Status;
|
|
||||||
|
|
||||||
/* Check if we went past the buffer */
|
/* Check if we went past the buffer */
|
||||||
if (Length == -1U)
|
if (Length == -1U)
|
||||||
|
|
|
@ -27,7 +27,7 @@ NtCreateKey(OUT PHANDLE KeyHandle,
|
||||||
IN ULONG CreateOptions,
|
IN ULONG CreateOptions,
|
||||||
OUT PULONG Disposition OPTIONAL)
|
OUT PULONG Disposition OPTIONAL)
|
||||||
{
|
{
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status;
|
||||||
KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
|
KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
|
||||||
CM_PARSE_CONTEXT ParseContext = {0};
|
CM_PARSE_CONTEXT ParseContext = {0};
|
||||||
HANDLE Handle;
|
HANDLE Handle;
|
||||||
|
@ -63,11 +63,10 @@ NtCreateKey(OUT PHANDLE KeyHandle,
|
||||||
}
|
}
|
||||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||||
{
|
{
|
||||||
/* Get the error code */
|
/* Return the exception code */
|
||||||
Status = _SEH2_GetExceptionCode();
|
_SEH2_YIELD(return _SEH2_GetExceptionCode());
|
||||||
}
|
}
|
||||||
_SEH2_END;
|
_SEH2_END;
|
||||||
if(!NT_SUCCESS(Status)) return Status;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -113,7 +112,7 @@ NtOpenKey(OUT PHANDLE KeyHandle,
|
||||||
{
|
{
|
||||||
CM_PARSE_CONTEXT ParseContext = {0};
|
CM_PARSE_CONTEXT ParseContext = {0};
|
||||||
HANDLE Handle;
|
HANDLE Handle;
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status;
|
||||||
KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
|
KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
DPRINT("NtOpenKey(OB 0x%wZ)\n", ObjectAttributes->ObjectName);
|
DPRINT("NtOpenKey(OB 0x%wZ)\n", ObjectAttributes->ObjectName);
|
||||||
|
@ -135,11 +134,10 @@ NtOpenKey(OUT PHANDLE KeyHandle,
|
||||||
}
|
}
|
||||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||||
{
|
{
|
||||||
/* Get the status */
|
/* Return the exception code */
|
||||||
Status = _SEH2_GetExceptionCode();
|
_SEH2_YIELD(return _SEH2_GetExceptionCode());
|
||||||
}
|
}
|
||||||
_SEH2_END;
|
_SEH2_END;
|
||||||
if(!NT_SUCCESS(Status)) return Status;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Just let the object manager handle this */
|
/* Just let the object manager handle this */
|
||||||
|
@ -267,17 +265,12 @@ NtEnumerateKey(IN HANDLE KeyHandle,
|
||||||
sizeof(ULONG));
|
sizeof(ULONG));
|
||||||
}
|
}
|
||||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||||
{
|
|
||||||
Status = _SEH2_GetExceptionCode();
|
|
||||||
}
|
|
||||||
_SEH2_END;
|
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
{
|
||||||
/* Dereference and return status */
|
/* Dereference and return status */
|
||||||
ObDereferenceObject(KeyObject);
|
ObDereferenceObject(KeyObject);
|
||||||
return Status;
|
_SEH2_YIELD(return _SEH2_GetExceptionCode());
|
||||||
}
|
}
|
||||||
|
_SEH2_END;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Setup the callback */
|
/* Setup the callback */
|
||||||
|
@ -356,17 +349,12 @@ NtEnumerateValueKey(IN HANDLE KeyHandle,
|
||||||
sizeof(ULONG));
|
sizeof(ULONG));
|
||||||
}
|
}
|
||||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||||
{
|
|
||||||
Status = _SEH2_GetExceptionCode();
|
|
||||||
}
|
|
||||||
_SEH2_END;
|
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
{
|
||||||
/* Dereference and return status */
|
/* Dereference and return status */
|
||||||
ObDereferenceObject(KeyObject);
|
ObDereferenceObject(KeyObject);
|
||||||
return Status;
|
_SEH2_YIELD(return _SEH2_GetExceptionCode());
|
||||||
}
|
}
|
||||||
|
_SEH2_END;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Setup the callback */
|
/* Setup the callback */
|
||||||
|
@ -475,17 +463,12 @@ NtQueryKey(IN HANDLE KeyHandle,
|
||||||
sizeof(ULONG));
|
sizeof(ULONG));
|
||||||
}
|
}
|
||||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||||
{
|
|
||||||
Status = _SEH2_GetExceptionCode();
|
|
||||||
}
|
|
||||||
_SEH2_END;
|
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
{
|
||||||
/* Dereference and return status */
|
/* Dereference and return status */
|
||||||
ObDereferenceObject(KeyObject);
|
ObDereferenceObject(KeyObject);
|
||||||
return Status;
|
_SEH2_YIELD(return _SEH2_GetExceptionCode());
|
||||||
}
|
}
|
||||||
|
_SEH2_END;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Setup the callback */
|
/* Setup the callback */
|
||||||
|
@ -555,17 +538,12 @@ NtQueryValueKey(IN HANDLE KeyHandle,
|
||||||
sizeof(ULONG));
|
sizeof(ULONG));
|
||||||
}
|
}
|
||||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||||
{
|
|
||||||
Status = _SEH2_GetExceptionCode();
|
|
||||||
}
|
|
||||||
_SEH2_END;
|
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
{
|
||||||
/* Dereference and return status */
|
/* Dereference and return status */
|
||||||
ObDereferenceObject(KeyObject);
|
ObDereferenceObject(KeyObject);
|
||||||
return Status;
|
_SEH2_YIELD(return _SEH2_GetExceptionCode());
|
||||||
}
|
}
|
||||||
|
_SEH2_END;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make sure the name is aligned properly */
|
/* Make sure the name is aligned properly */
|
||||||
|
@ -1131,7 +1109,7 @@ NtUnloadKey2(IN POBJECT_ATTRIBUTES TargetKey,
|
||||||
IN ULONG Flags)
|
IN ULONG Flags)
|
||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status;
|
||||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||||
UNICODE_STRING ObjectName;
|
UNICODE_STRING ObjectName;
|
||||||
CM_PARSE_CONTEXT ParseContext = {0};
|
CM_PARSE_CONTEXT ParseContext = {0};
|
||||||
|
@ -1175,11 +1153,10 @@ NtUnloadKey2(IN POBJECT_ATTRIBUTES TargetKey,
|
||||||
}
|
}
|
||||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||||
{
|
{
|
||||||
/* Get the error code */
|
/* Return the exception code */
|
||||||
Status = _SEH2_GetExceptionCode();
|
_SEH2_YIELD(return _SEH2_GetExceptionCode());
|
||||||
}
|
}
|
||||||
_SEH2_END;
|
_SEH2_END;
|
||||||
if(!NT_SUCCESS(Status)) return Status;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -1517,7 +1517,7 @@ NtCreateDebugObject(OUT PHANDLE DebugHandle,
|
||||||
KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
|
KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
|
||||||
PDEBUG_OBJECT DebugObject;
|
PDEBUG_OBJECT DebugObject;
|
||||||
HANDLE hDebug;
|
HANDLE hDebug;
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status;
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
/* Check if we were called from user mode*/
|
/* Check if we were called from user mode*/
|
||||||
|
@ -1531,10 +1531,9 @@ NtCreateDebugObject(OUT PHANDLE DebugHandle,
|
||||||
}
|
}
|
||||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||||
{
|
{
|
||||||
/* Get exception error */
|
/* Return the exception code */
|
||||||
Status = _SEH2_GetExceptionCode();
|
_SEH2_YIELD(return _SEH2_GetExceptionCode());
|
||||||
} _SEH2_END;
|
} _SEH2_END;
|
||||||
if (!NT_SUCCESS(Status)) return Status;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check for invalid flags */
|
/* Check for invalid flags */
|
||||||
|
@ -1610,7 +1609,7 @@ NtDebugContinue(IN HANDLE DebugHandle,
|
||||||
{
|
{
|
||||||
KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
|
KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
|
||||||
PDEBUG_OBJECT DebugObject;
|
PDEBUG_OBJECT DebugObject;
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status;
|
||||||
PDEBUG_EVENT DebugEvent = NULL, DebugEventToWake = NULL;
|
PDEBUG_EVENT DebugEvent = NULL, DebugEventToWake = NULL;
|
||||||
PLIST_ENTRY ListHead, NextEntry;
|
PLIST_ENTRY ListHead, NextEntry;
|
||||||
BOOLEAN NeedsWake = FALSE;
|
BOOLEAN NeedsWake = FALSE;
|
||||||
|
@ -1632,10 +1631,9 @@ NtDebugContinue(IN HANDLE DebugHandle,
|
||||||
}
|
}
|
||||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||||
{
|
{
|
||||||
/* Get exception error */
|
/* Return the exception code */
|
||||||
Status = _SEH2_GetExceptionCode();
|
_SEH2_YIELD(return _SEH2_GetExceptionCode());
|
||||||
} _SEH2_END;
|
} _SEH2_END;
|
||||||
if (!NT_SUCCESS(Status)) return Status;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make sure that the status is valid */
|
/* Make sure that the status is valid */
|
||||||
|
@ -1869,7 +1867,7 @@ NtSetInformationDebugObject(IN HANDLE DebugHandle,
|
||||||
{
|
{
|
||||||
PDEBUG_OBJECT DebugObject;
|
PDEBUG_OBJECT DebugObject;
|
||||||
KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
|
KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status;
|
||||||
PDEBUG_OBJECT_KILL_PROCESS_ON_EXIT_INFORMATION DebugInfo = DebugInformation;
|
PDEBUG_OBJECT_KILL_PROCESS_ON_EXIT_INFORMATION DebugInfo = DebugInformation;
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
|
@ -1881,6 +1879,7 @@ NtSetInformationDebugObject(IN HANDLE DebugHandle,
|
||||||
DebugInformation,
|
DebugInformation,
|
||||||
DebugInformationLength,
|
DebugInformationLength,
|
||||||
PreviousMode);
|
PreviousMode);
|
||||||
|
if (!NT_SUCCESS(Status)) return Status;
|
||||||
|
|
||||||
/* Check if the caller wanted the return length */
|
/* Check if the caller wanted the return length */
|
||||||
if (ReturnLength)
|
if (ReturnLength)
|
||||||
|
@ -1894,12 +1893,11 @@ NtSetInformationDebugObject(IN HANDLE DebugHandle,
|
||||||
}
|
}
|
||||||
_SEH2_EXCEPT(ExSystemExceptionFilter())
|
_SEH2_EXCEPT(ExSystemExceptionFilter())
|
||||||
{
|
{
|
||||||
/* Get SEH Exception code */
|
/* Return the exception code */
|
||||||
Status = _SEH2_GetExceptionCode();
|
_SEH2_YIELD(return _SEH2_GetExceptionCode());
|
||||||
}
|
}
|
||||||
_SEH2_END;
|
_SEH2_END;
|
||||||
}
|
}
|
||||||
if (!NT_SUCCESS(Status)) return Status;
|
|
||||||
|
|
||||||
/* Open the Object */
|
/* Open the Object */
|
||||||
Status = ObReferenceObjectByHandle(DebugHandle,
|
Status = ObReferenceObjectByHandle(DebugHandle,
|
||||||
|
@ -1955,7 +1953,7 @@ NtWaitForDebugEvent(IN HANDLE DebugHandle,
|
||||||
LARGE_INTEGER NewTime;
|
LARGE_INTEGER NewTime;
|
||||||
PDEBUG_OBJECT DebugObject;
|
PDEBUG_OBJECT DebugObject;
|
||||||
DBGUI_WAIT_STATE_CHANGE WaitStateChange;
|
DBGUI_WAIT_STATE_CHANGE WaitStateChange;
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status;
|
||||||
PDEBUG_EVENT DebugEvent = NULL, DebugEvent2;
|
PDEBUG_EVENT DebugEvent = NULL, DebugEvent2;
|
||||||
PLIST_ENTRY ListHead, NextEntry, NextEntry2;
|
PLIST_ENTRY ListHead, NextEntry, NextEntry2;
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
@ -1987,11 +1985,10 @@ NtWaitForDebugEvent(IN HANDLE DebugHandle,
|
||||||
}
|
}
|
||||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||||
{
|
{
|
||||||
/* Get the exception code */
|
/* Return the exception code */
|
||||||
Status = _SEH2_GetExceptionCode();
|
_SEH2_YIELD(return _SEH2_GetExceptionCode());
|
||||||
}
|
}
|
||||||
_SEH2_END;
|
_SEH2_END;
|
||||||
if (!NT_SUCCESS(Status)) return Status;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -97,13 +97,12 @@ KiRaiseException(IN PEXCEPTION_RECORD ExceptionRecord,
|
||||||
ULONG ParameterCount, Size;
|
ULONG ParameterCount, Size;
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
|
|
||||||
|
/* Check if we need to probe */
|
||||||
|
if (PreviousMode != KernelMode)
|
||||||
|
{
|
||||||
/* Set up SEH */
|
/* Set up SEH */
|
||||||
_SEH2_TRY
|
_SEH2_TRY
|
||||||
{
|
{
|
||||||
/* Check the previous mode */
|
|
||||||
if (PreviousMode != KernelMode)
|
|
||||||
{
|
|
||||||
#if 0
|
|
||||||
/* Probe the context */
|
/* Probe the context */
|
||||||
ProbeForRead(Context, sizeof(CONTEXT), sizeof(ULONG));
|
ProbeForRead(Context, sizeof(CONTEXT), sizeof(ULONG));
|
||||||
|
|
||||||
|
@ -112,7 +111,7 @@ KiRaiseException(IN PEXCEPTION_RECORD ExceptionRecord,
|
||||||
FIELD_OFFSET(EXCEPTION_RECORD, NumberParameters) +
|
FIELD_OFFSET(EXCEPTION_RECORD, NumberParameters) +
|
||||||
sizeof(ULONG),
|
sizeof(ULONG),
|
||||||
sizeof(ULONG));
|
sizeof(ULONG));
|
||||||
#endif
|
|
||||||
/* Validate the maximum parameters */
|
/* Validate the maximum parameters */
|
||||||
if ((ParameterCount = ExceptionRecord->NumberParameters) >
|
if ((ParameterCount = ExceptionRecord->NumberParameters) >
|
||||||
EXCEPTION_MAXIMUM_PARAMETERS)
|
EXCEPTION_MAXIMUM_PARAMETERS)
|
||||||
|
@ -136,14 +135,15 @@ KiRaiseException(IN PEXCEPTION_RECORD ExceptionRecord,
|
||||||
/* Update the parameter count */
|
/* Update the parameter count */
|
||||||
ExceptionRecord->NumberParameters = ParameterCount;
|
ExceptionRecord->NumberParameters = ParameterCount;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||||
{
|
{
|
||||||
/* Get the exception code */
|
DbgBreakPoint();
|
||||||
Status = _SEH2_GetExceptionCode();
|
|
||||||
|
/* Return the exception code */
|
||||||
|
_SEH2_YIELD(return _SEH2_GetExceptionCode());
|
||||||
}
|
}
|
||||||
_SEH2_END;
|
_SEH2_END;
|
||||||
if (!NT_SUCCESS(Status)) return Status;
|
}
|
||||||
|
|
||||||
/* Convert the context record */
|
/* Convert the context record */
|
||||||
KeContextToTrapFrame(Context,
|
KeContextToTrapFrame(Context,
|
||||||
|
|
|
@ -1072,7 +1072,6 @@ NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
KeRaiseUserException(IN NTSTATUS ExceptionCode)
|
KeRaiseUserException(IN NTSTATUS ExceptionCode)
|
||||||
{
|
{
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
|
||||||
ULONG OldEip;
|
ULONG OldEip;
|
||||||
PTEB Teb = KeGetCurrentThread()->Teb;
|
PTEB Teb = KeGetCurrentThread()->Teb;
|
||||||
PKTRAP_FRAME TrapFrame = KeGetCurrentThread()->TrapFrame;
|
PKTRAP_FRAME TrapFrame = KeGetCurrentThread()->TrapFrame;
|
||||||
|
@ -1085,11 +1084,10 @@ KeRaiseUserException(IN NTSTATUS ExceptionCode)
|
||||||
}
|
}
|
||||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||||
{
|
{
|
||||||
/* Save exception code */
|
/* Return the exception code */
|
||||||
Status = ExceptionCode;
|
_SEH2_YIELD(return _SEH2_GetExceptionCode());
|
||||||
}
|
}
|
||||||
_SEH2_END;
|
_SEH2_END;
|
||||||
if (!NT_SUCCESS(Status)) return Status;
|
|
||||||
|
|
||||||
/* Get the old EIP */
|
/* Get the old EIP */
|
||||||
OldEip = TrapFrame->Eip;
|
OldEip = TrapFrame->Eip;
|
||||||
|
|
|
@ -135,7 +135,7 @@ KeUserModeCallback(IN ULONG RoutineIndex,
|
||||||
{
|
{
|
||||||
ULONG_PTR NewStack, OldStack;
|
ULONG_PTR NewStack, OldStack;
|
||||||
PULONG UserEsp;
|
PULONG UserEsp;
|
||||||
NTSTATUS CallbackStatus = STATUS_SUCCESS;
|
NTSTATUS CallbackStatus;
|
||||||
PEXCEPTION_REGISTRATION_RECORD ExceptionList;
|
PEXCEPTION_REGISTRATION_RECORD ExceptionList;
|
||||||
PTEB Teb;
|
PTEB Teb;
|
||||||
ULONG GdiBatchCount = 0;
|
ULONG GdiBatchCount = 0;
|
||||||
|
@ -192,10 +192,9 @@ KeUserModeCallback(IN ULONG RoutineIndex,
|
||||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||||
{
|
{
|
||||||
/* Get the SEH exception */
|
/* Get the SEH exception */
|
||||||
CallbackStatus = _SEH2_GetExceptionCode();
|
_SEH2_YIELD(return _SEH2_GetExceptionCode());
|
||||||
}
|
}
|
||||||
_SEH2_END;
|
_SEH2_END;
|
||||||
if (!NT_SUCCESS(CallbackStatus)) return CallbackStatus;
|
|
||||||
|
|
||||||
/* Check if we have GDI Batch operations */
|
/* Check if we have GDI Batch operations */
|
||||||
if (GdiBatchCount)
|
if (GdiBatchCount)
|
||||||
|
|
|
@ -849,10 +849,10 @@ NtDelayExecution(IN BOOLEAN Alertable,
|
||||||
{
|
{
|
||||||
KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
|
KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
|
||||||
LARGE_INTEGER SafeInterval;
|
LARGE_INTEGER SafeInterval;
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status;
|
||||||
|
|
||||||
/* Check the previous mode */
|
/* Check the previous mode */
|
||||||
if(PreviousMode != KernelMode)
|
if (PreviousMode != KernelMode)
|
||||||
{
|
{
|
||||||
/* Enter SEH for probing */
|
/* Enter SEH for probing */
|
||||||
_SEH2_TRY
|
_SEH2_TRY
|
||||||
|
@ -863,11 +863,10 @@ NtDelayExecution(IN BOOLEAN Alertable,
|
||||||
}
|
}
|
||||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||||
{
|
{
|
||||||
/* Get SEH exception */
|
/* Return the exception code */
|
||||||
Status = _SEH2_GetExceptionCode();
|
_SEH2_YIELD(return _SEH2_GetExceptionCode());
|
||||||
}
|
}
|
||||||
_SEH2_END;
|
_SEH2_END;
|
||||||
if (!NT_SUCCESS(Status)) return Status;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Call the Kernel Function */
|
/* Call the Kernel Function */
|
||||||
|
|
|
@ -160,7 +160,7 @@ NtReplyWaitReceivePortEx(IN HANDLE PortHandle,
|
||||||
{
|
{
|
||||||
PLPCP_PORT_OBJECT Port, ReceivePort, ConnectionPort = NULL;
|
PLPCP_PORT_OBJECT Port, ReceivePort, ConnectionPort = NULL;
|
||||||
KPROCESSOR_MODE PreviousMode = KeGetPreviousMode(), WaitMode = PreviousMode;
|
KPROCESSOR_MODE PreviousMode = KeGetPreviousMode(), WaitMode = PreviousMode;
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status;
|
||||||
PLPCP_MESSAGE Message;
|
PLPCP_MESSAGE Message;
|
||||||
PETHREAD Thread = PsGetCurrentThread(), WakeupThread;
|
PETHREAD Thread = PsGetCurrentThread(), WakeupThread;
|
||||||
PLPCP_CONNECTION_MESSAGE ConnectMessage;
|
PLPCP_CONNECTION_MESSAGE ConnectMessage;
|
||||||
|
@ -201,13 +201,9 @@ NtReplyWaitReceivePortEx(IN HANDLE PortHandle,
|
||||||
{
|
{
|
||||||
DPRINT1("SEH crash [1]\n");
|
DPRINT1("SEH crash [1]\n");
|
||||||
DbgBreakPoint();
|
DbgBreakPoint();
|
||||||
Status = _SEH2_GetExceptionCode();
|
_SEH2_YIELD(return _SEH2_GetExceptionCode());
|
||||||
}
|
}
|
||||||
_SEH2_END;
|
_SEH2_END;
|
||||||
|
|
||||||
/* Bail out if pointer was invalid */
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
return Status;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -544,6 +544,7 @@ NtRequestWaitReplyPort(IN HANDLE PortHandle,
|
||||||
/* No callback, just copy the message */
|
/* No callback, just copy the message */
|
||||||
_SEH2_TRY
|
_SEH2_TRY
|
||||||
{
|
{
|
||||||
|
/* Copy it */
|
||||||
LpcpMoveMessage(&Message->Request,
|
LpcpMoveMessage(&Message->Request,
|
||||||
LpcRequest,
|
LpcRequest,
|
||||||
LpcRequest + 1,
|
LpcRequest + 1,
|
||||||
|
@ -552,16 +553,12 @@ NtRequestWaitReplyPort(IN HANDLE PortHandle,
|
||||||
}
|
}
|
||||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||||
{
|
{
|
||||||
Status = _SEH2_GetExceptionCode();
|
/* Fail */
|
||||||
}
|
|
||||||
_SEH2_END;
|
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
LpcpFreeToPortZone(Message, 0);
|
LpcpFreeToPortZone(Message, 0);
|
||||||
ObDereferenceObject(Port);
|
ObDereferenceObject(Port);
|
||||||
return Status;
|
_SEH2_YIELD(return _SEH2_GetExceptionCode());
|
||||||
}
|
}
|
||||||
|
_SEH2_END;
|
||||||
|
|
||||||
/* Acquire the LPC lock */
|
/* Acquire the LPC lock */
|
||||||
KeAcquireGuardedMutex(&LpcpLock);
|
KeAcquireGuardedMutex(&LpcpLock);
|
||||||
|
|
|
@ -609,7 +609,7 @@ NtSetThreadExecutionState(IN EXECUTION_STATE esFlags,
|
||||||
/* Check if the pointer is valid */
|
/* Check if the pointer is valid */
|
||||||
ProbeForWriteUlong(PreviousFlags);
|
ProbeForWriteUlong(PreviousFlags);
|
||||||
}
|
}
|
||||||
_SEH2_EXCEPT(ExSystemExceptionFilter())
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||||
{
|
{
|
||||||
/* It isn't -- fail */
|
/* It isn't -- fail */
|
||||||
_SEH2_YIELD(return _SEH2_GetExceptionCode());
|
_SEH2_YIELD(return _SEH2_GetExceptionCode());
|
||||||
|
|
|
@ -120,25 +120,21 @@ VdmpInitialize(PVOID ControlData)
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now, copy the first physical page into the first virtual page */
|
/* Enter SEH */
|
||||||
_SEH2_TRY
|
_SEH2_TRY
|
||||||
{
|
{
|
||||||
|
/* Copy the first physical page into the first virtual page */
|
||||||
RtlMoveMemory(NullAddress, BaseAddress, ViewSize);
|
RtlMoveMemory(NullAddress, BaseAddress, ViewSize);
|
||||||
}
|
}
|
||||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||||
{
|
{
|
||||||
/* Get the status */
|
/* Fail */
|
||||||
Status = _SEH2_GetExceptionCode();
|
|
||||||
}
|
|
||||||
_SEH2_END;
|
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
DPRINT1("Couldn't copy first page (%x)\n", Status);
|
DPRINT1("Couldn't copy first page (%x)\n", Status);
|
||||||
ZwClose(PhysMemHandle);
|
ZwClose(PhysMemHandle);
|
||||||
ZwUnmapViewOfSection(NtCurrentProcess(), BaseAddress);
|
ZwUnmapViewOfSection(NtCurrentProcess(), BaseAddress);
|
||||||
return Status;
|
_SEH2_YIELD(return _SEH2_GetExceptionCode());
|
||||||
}
|
}
|
||||||
|
_SEH2_END;
|
||||||
|
|
||||||
/* Close physical memory section handle */
|
/* Close physical memory section handle */
|
||||||
ZwClose(PhysMemHandle);
|
ZwClose(PhysMemHandle);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue