Author: sginsberg
Date: Mon Aug 24 22:39:23 2009
New Revision: 42929
URL:
http://svn.reactos.org/svn/reactos?rev=42929&view=rev
Log:
- Make use of _SEH2_YIELD in Mm
Modified:
trunk/reactos/ntoskrnl/mm/anonmem.c
trunk/reactos/ntoskrnl/mm/pagefile.c
trunk/reactos/ntoskrnl/mm/section.c
trunk/reactos/ntoskrnl/mm/virtual.c
Modified: trunk/reactos/ntoskrnl/mm/anonmem.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/anonmem.c?rev=…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/anonmem.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/anonmem.c [iso-8859-1] Mon Aug 24 22:39:23 2009
@@ -659,9 +659,8 @@
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
- /* Get the exception code */
- Status = _SEH2_GetExceptionCode();
- _SEH2_YIELD(return Status);
+ /* Return the exception code */
+ _SEH2_YIELD(return _SEH2_GetExceptionCode());
}
_SEH2_END;
@@ -949,7 +948,7 @@
*/
{
MEMORY_AREA* MemoryArea;
- NTSTATUS Status = STATUS_SUCCESS;
+ NTSTATUS Status;
PEPROCESS Process;
PMMSUPPORT AddressSpace;
PVOID BaseAddress;
@@ -967,7 +966,7 @@
return STATUS_INVALID_PARAMETER_4;
}
- if(ExGetPreviousMode() != KernelMode)
+ if (ExGetPreviousMode() != KernelMode)
{
_SEH2_TRY
{
@@ -977,11 +976,10 @@
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
- /* Get exception code */
- Status = _SEH2_GetExceptionCode();
+ /* Return the exception code */
+ _SEH2_YIELD(return _SEH2_GetExceptionCode());
}
_SEH2_END;
- if (!NT_SUCCESS(Status)) return Status;
}
BaseAddress = (PVOID)PAGE_ROUND_DOWN((*PBaseAddress));
Modified: trunk/reactos/ntoskrnl/mm/pagefile.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/pagefile.c?rev…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/pagefile.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/pagefile.c [iso-8859-1] Mon Aug 24 22:39:23 2009
@@ -519,7 +519,7 @@
IN PLARGE_INTEGER MaximumSize,
IN ULONG Reserved)
{
- NTSTATUS Status = STATUS_SUCCESS;
+ NTSTATUS Status;
OBJECT_ATTRIBUTES ObjectAttributes;
HANDLE FileHandle;
IO_STATUS_BLOCK IoStatus;
@@ -560,14 +560,10 @@
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
- Status = _SEH2_GetExceptionCode();
+ /* Return the exception code */
+ _SEH2_YIELD(return _SEH2_GetExceptionCode());
}
_SEH2_END;
-
- if (!NT_SUCCESS(Status))
- {
- return Status;
- }
}
else
{
Modified: trunk/reactos/ntoskrnl/mm/section.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/section.c?rev=…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/section.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/section.c [iso-8859-1] Mon Aug 24 22:39:23 2009
@@ -3496,7 +3496,7 @@
LARGE_INTEGER SafeMaximumSize;
PVOID SectionObject;
KPROCESSOR_MODE PreviousMode;
- NTSTATUS Status = STATUS_SUCCESS;
+ NTSTATUS Status;
PreviousMode = ExGetPreviousMode();
@@ -3514,14 +3514,10 @@
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
- Status = _SEH2_GetExceptionCode();
+ /* Return the exception code */
+ _SEH2_YIELD(return _SEH2_GetExceptionCode());
}
_SEH2_END;
-
- if(!NT_SUCCESS(Status))
- {
- return Status;
- }
}
Status = MmCreateSection(&SectionObject,
@@ -3570,7 +3566,7 @@
{
HANDLE hSection;
KPROCESSOR_MODE PreviousMode;
- NTSTATUS Status = STATUS_SUCCESS;
+ NTSTATUS Status;
PreviousMode = ExGetPreviousMode();
@@ -3582,14 +3578,10 @@
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
- Status = _SEH2_GetExceptionCode();
+ /* Return the exception code */
+ _SEH2_YIELD(return _SEH2_GetExceptionCode());
}
_SEH2_END;
-
- if(!NT_SUCCESS(Status))
- {
- return Status;
- }
}
Status = ObOpenObjectByName(ObjectAttributes,
@@ -3729,7 +3721,7 @@
PEPROCESS Process;
KPROCESSOR_MODE PreviousMode;
PMMSUPPORT AddressSpace;
- NTSTATUS Status = STATUS_SUCCESS;
+ NTSTATUS Status;
ULONG tmpProtect;
ACCESS_MASK DesiredAccess;
@@ -3779,14 +3771,10 @@
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
- Status = _SEH2_GetExceptionCode();
+ /* Return the exception code */
+ _SEH2_YIELD(return _SEH2_GetExceptionCode());
}
_SEH2_END;
-
- if(!NT_SUCCESS(Status))
- {
- return Status;
- }
}
else
{
@@ -4263,7 +4251,7 @@
{
PROS_SECTION_OBJECT Section;
KPROCESSOR_MODE PreviousMode;
- NTSTATUS Status = STATUS_SUCCESS;
+ NTSTATUS Status;
PAGED_CODE();
PreviousMode = ExGetPreviousMode();
@@ -4392,7 +4380,7 @@
LARGE_INTEGER SafeNewMaximumSize;
PROS_SECTION_OBJECT Section;
KPROCESSOR_MODE PreviousMode;
- NTSTATUS Status = STATUS_SUCCESS;
+ NTSTATUS Status;
PreviousMode = ExGetPreviousMode();
@@ -4406,14 +4394,10 @@
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
- Status = _SEH2_GetExceptionCode();
+ /* Return the exception code */
+ _SEH2_YIELD(return _SEH2_GetExceptionCode());
}
_SEH2_END;
-
- if(!NT_SUCCESS(Status))
- {
- return Status;
- }
}
Status = ObReferenceObjectByHandle(SectionHandle,
Modified: trunk/reactos/ntoskrnl/mm/virtual.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/virtual.c?rev=…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/virtual.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/virtual.c [iso-8859-1] Mon Aug 24 22:39:23 2009
@@ -70,7 +70,6 @@
KAPC_STATE ApcState;
BOOLEAN HaveBadAddress;
ULONG_PTR BadAddress;
- NTSTATUS Status = STATUS_SUCCESS;
PAGED_CODE();
/* Calculate the maximum amount of data to move */
@@ -165,8 +164,7 @@
if ((FailedInProbe) || (FailedInMapping))
{
/* Exit */
- Status = _SEH2_GetExceptionCode();
- _SEH2_YIELD(return Status);
+ _SEH2_YIELD(return _SEH2_GetExceptionCode());
}
/* Otherwise, we failed probably during the move */
@@ -182,12 +180,9 @@
}
/* Return partial copy */
- Status = STATUS_PARTIAL_COPY;
+ _SEH2_YIELD(return STATUS_PARTIAL_COPY);
}
_SEH2_END;
-
- /* Check for SEH status */
- if (Status != STATUS_SUCCESS) return Status;
/* Detach from target */
KeUnstackDetachProcess(&ApcState);
@@ -225,7 +220,6 @@
KAPC_STATE ApcState;
BOOLEAN HaveBadAddress;
ULONG_PTR BadAddress;
- NTSTATUS Status = STATUS_SUCCESS;
PAGED_CODE();
/* Calculate the maximum amount of data to move */
@@ -313,8 +307,7 @@
if (FailedInProbe)
{
/* Exit */
- Status = _SEH2_GetExceptionCode();
- _SEH2_YIELD(return Status);
+ _SEH2_YIELD(return _SEH2_GetExceptionCode());
}
/* Otherwise, we failed probably during the move */
@@ -330,12 +323,9 @@
}
/* Return partial copy */
- Status = STATUS_PARTIAL_COPY;
+ _SEH2_YIELD(return STATUS_PARTIAL_COPY);
}
_SEH2_END;
-
- /* Check for SEH status */
- if (Status != STATUS_SUCCESS) return Status;
/* Detach from target */
KeUnstackDetachProcess(&ApcState);
@@ -779,7 +769,7 @@
{
KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
PEPROCESS Process;
- NTSTATUS Status = STATUS_SUCCESS;
+ NTSTATUS Status;
SIZE_T BytesRead = 0;
PAGED_CODE();
@@ -804,13 +794,10 @@
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
- /* Get exception code */
- Status = _SEH2_GetExceptionCode();
+ /* Return the exception code */
+ _SEH2_YIELD(return _SEH2_GetExceptionCode());
}
_SEH2_END;
-
- /* Return if we failed */
- if (!NT_SUCCESS(Status)) return Status;
}
/* Reference the process */
@@ -866,7 +853,7 @@
{
KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
PEPROCESS Process;
- NTSTATUS Status = STATUS_SUCCESS;
+ NTSTATUS Status;
ULONG BytesWritten = 0;
PAGED_CODE();
@@ -891,13 +878,10 @@
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
- /* Get exception code */
- Status = _SEH2_GetExceptionCode();
+ /* Return the exception code */
+ _SEH2_YIELD(return _SEH2_GetExceptionCode());
}
_SEH2_END;
-
- /* Return if we failed */
- if (!NT_SUCCESS(Status)) return Status;
}
/* Reference the process */
@@ -957,7 +941,7 @@
PVOID BaseAddress = NULL;
SIZE_T NumberOfBytesToProtect = 0;
KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
- NTSTATUS Status = STATUS_SUCCESS;
+ NTSTATUS Status;
PAGED_CODE();
/* Check for valid protection flags */
@@ -991,13 +975,10 @@
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
- /* Get exception code */
- Status = _SEH2_GetExceptionCode();
+ /* Return the exception code */
+ _SEH2_YIELD(return _SEH2_GetExceptionCode());
}
_SEH2_END;
-
- /* Return on exception */
- if (!NT_SUCCESS(Status)) return Status;
}
else
{
@@ -1065,7 +1046,7 @@
IN SIZE_T Length,
OUT PSIZE_T UnsafeResultLength)
{
- NTSTATUS Status = STATUS_SUCCESS;
+ NTSTATUS Status;
SIZE_T ResultLength = 0;
KPROCESSOR_MODE PreviousMode;
WCHAR ModuleFileNameBuffer[MAX_PATH] = {0};
@@ -1098,14 +1079,10 @@
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
- Status = _SEH2_GetExceptionCode();
+ /* Return the exception code */
+ _SEH2_YIELD(return _SEH2_GetExceptionCode());
}
_SEH2_END;
-
- if (!NT_SUCCESS(Status))
- {
- return Status;
- }
}
if (Address >= MmSystemRangeStart)