Commit in reactos/ntoskrnl/mm on MAIN
virtual.c+14-31.86 -> 1.87
Added SEH support to NtReadVirtualMemory. Allows OllyDbg to load (and probably a load of other applications too).

reactos/ntoskrnl/mm
virtual.c 1.86 -> 1.87
diff -u -r1.86 -r1.87
--- virtual.c	22 Dec 2004 05:17:44 -0000	1.86
+++ virtual.c	30 Dec 2004 18:30:44 -0000	1.87
@@ -16,7 +16,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-/* $Id: virtual.c,v 1.86 2004/12/22 05:17:44 royce Exp $
+/* $Id: virtual.c,v 1.87 2004/12/30 18:30:44 ion Exp $
  *
  * PROJECT:     ReactOS kernel
  * FILE:        ntoskrnl/mm/virtual.c
@@ -27,6 +27,7 @@
 /* INCLUDE *****************************************************************/
 
 #include <ntoskrnl.h>
+#include <pseh.h>
 
 #define NDEBUG
 #include <internal/debug.h>
@@ -491,7 +492,17 @@
       KeAttachProcess(&Process->Pcb);
 
       SystemAddress = MmGetSystemAddressForMdl(Mdl);
-      memcpy(SystemAddress, BaseAddress, NumberOfBytesToRead);
+
+        Status = STATUS_SUCCESS;
+        _SEH_TRY {
+            ProbeForRead(BaseAddress, NumberOfBytesToRead, 1);
+            Status = STATUS_PARTIAL_COPY;
+            memcpy(SystemAddress, BaseAddress, NumberOfBytesToRead);
+            Status = STATUS_SUCCESS;
+        } _SEH_HANDLE {
+            if(Status != STATUS_PARTIAL_COPY)
+                Status = _SEH_GetExceptionCode();
+        } _SEH_END;
 
       KeDetachProcess();
 
@@ -507,7 +518,7 @@
 
    if (NumberOfBytesRead)
       *NumberOfBytesRead = NumberOfBytesToRead;
-   return(STATUS_SUCCESS);
+   return(Status);
 }
 
 /* (tMk 2004.II.05)
CVSspam 0.2.8