[ros-diffs] [fireball] 34047: - Extend SEH to cover writing result to output arguments. Noticed by Stefan Ginsberg.

fireball at svn.reactos.org fireball at svn.reactos.org
Sun Jun 22 18:24:15 CEST 2008


Author: fireball
Date: Sun Jun 22 11:24:15 2008
New Revision: 34047

URL: http://svn.reactos.org/svn/reactos?rev=34047&view=rev
Log:
- Extend SEH to cover writing result to output arguments. Noticed by Stefan Ginsberg.

Modified:
    trunk/reactos/ntoskrnl/config/ntapi.c

Modified: trunk/reactos/ntoskrnl/config/ntapi.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/ntapi.c?rev=34047&r1=34046&r2=34047&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/config/ntapi.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/config/ntapi.c [iso-8859-1] Sun Jun 22 11:24:15 2008
@@ -63,6 +63,23 @@
             /* Save the class directly */
             if (Class) ParseContext.Class = *Class;
         }
+
+        /* Setup the parse context */
+        ParseContext.CreateOperation = TRUE;
+        ParseContext.CreateOptions = CreateOptions;
+
+        /* Do the create */
+        Status = ObOpenObjectByName(ObjectAttributes,
+                                    CmpKeyObjectType,
+                                    PreviousMode,
+                                    NULL,
+                                    DesiredAccess,
+                                    &ParseContext,
+                                    &Handle);
+        if (NT_SUCCESS(Status)) *KeyHandle = Handle;
+
+        /* Return data to user */
+        if (Disposition) *Disposition = ParseContext.Disposition;
     }
     _SEH_HANDLE
     {
@@ -70,24 +87,8 @@
         Status = _SEH_GetExceptionCode();
     }
     _SEH_END;
-    if (!NT_SUCCESS(Status)) return Status;
-    
-    /* Setup the parse context */
-    ParseContext.CreateOperation = TRUE;
-    ParseContext.CreateOptions = CreateOptions;
-        
-    /* Do the create */
-    Status = ObOpenObjectByName(ObjectAttributes,
-                                CmpKeyObjectType,
-                                PreviousMode,
-                                NULL,
-                                DesiredAccess,
-                                &ParseContext,
-                                &Handle);
-    if (NT_SUCCESS(Status)) *KeyHandle = Handle;
-    
-    /* Return data to user */
-    if (Disposition) *Disposition = ParseContext.Disposition;
+
+    /* Return status */
     return Status;
 }
 
@@ -109,14 +110,24 @@
     {
         /* Check for user-mode caller */
         if (PreviousMode == UserMode)
-        {            
+        {
             /* Probe the key handle */
             ProbeForWriteHandle(KeyHandle);
             *KeyHandle = NULL;
-            
+
             /* Probe object attributes */
             ProbeForRead(ObjectAttributes, sizeof(OBJECT_ATTRIBUTES), 4);
         }
+
+        /* Just let the object manager handle this */
+        Status = ObOpenObjectByName(ObjectAttributes,
+                                    CmpKeyObjectType,
+                                    ExGetPreviousMode(),
+                                    NULL,
+                                    DesiredAccess,
+                                    &ParseContext,
+                                    &Handle);
+        if (NT_SUCCESS(Status)) *KeyHandle = Handle;
     }
     _SEH_HANDLE
     {
@@ -124,18 +135,7 @@
         Status = _SEH_GetExceptionCode();
     }
     _SEH_END;
-    if (!NT_SUCCESS(Status)) return Status;
-
-    /* Just let the object manager handle this */
-    Status = ObOpenObjectByName(ObjectAttributes,
-                                CmpKeyObjectType,
-                                ExGetPreviousMode(),
-                                NULL,
-                                DesiredAccess,
-                                &ParseContext,
-                                &Handle);
-    if (NT_SUCCESS(Status)) *KeyHandle = Handle;
-    
+
     /* Return status */
     return Status;
 }



More information about the Ros-diffs mailing list