[ros-diffs] [cgutman] 46719: [NTOSKRNL] - Fix a case where we miss copying back the IO_STATUS_BLOCK into the UserIosb buffer - Fixes the registry corruption caused when PnP wrote an invalid resource list (passed back via UserIosb->Information) to the registry - Hopefully this also fixes a few other nasty bugs in other areas related to this issue

cgutman at svn.reactos.org cgutman at svn.reactos.org
Sun Apr 4 20:17:51 CEST 2010


Author: cgutman
Date: Sun Apr  4 20:17:51 2010
New Revision: 46719

URL: http://svn.reactos.org/svn/reactos?rev=46719&view=rev
Log:
[NTOSKRNL]
- Fix a case where we miss copying back the IO_STATUS_BLOCK into the UserIosb buffer
- Fixes the registry corruption caused when PnP wrote an invalid resource list (passed back via UserIosb->Information) to the registry
- Hopefully this also fixes a few other nasty bugs in other areas related to this issue

Modified:
    trunk/reactos/ntoskrnl/io/iomgr/irp.c

Modified: trunk/reactos/ntoskrnl/io/iomgr/irp.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/irp.c?rev=46719&r1=46718&r2=46719&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/io/iomgr/irp.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/io/iomgr/irp.c [iso-8859-1] Sun Apr  4 20:17:51 2010
@@ -469,9 +469,6 @@
             /* So we did return with a synch operation, was it the IRP? */
             if (Irp->Flags & IRP_SYNCHRONOUS_API)
             {
-                /* Yes, this IRP was synchronous, so return the I/O Status */
-                *Irp->UserIosb = Irp->IoStatus;
-
                 /* Now check if the user gave an event */
                 if (Irp->UserEvent)
                 {
@@ -493,6 +490,22 @@
                 FileObject->FinalStatus = Irp->IoStatus.Status;
                 KeSetEvent(&FileObject->Event, 0, FALSE);
             }
+        }
+
+        /* Check if we have an associated user IOSB */
+        if (Irp->UserIosb)
+        {
+            /* We do, so let's give them the final status */
+            _SEH2_TRY
+            {
+               /*  Save the IOSB Information */
+               *Irp->UserIosb = Irp->IoStatus;
+            }
+            _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+            {
+               /* Ignore any error */
+            }
+            _SEH2_END;
         }
 
         /* Now that we got here, we do this for incomplete I/Os as well */




More information about the Ros-diffs mailing list