Author: sginsberg
Date: Mon Sep 28 07:44:49 2015
New Revision: 69391
URL: 
http://svn.reactos.org/svn/reactos?rev=69391&view=rev
Log:
[NTOS] Make SE routines use ExAllocateLocallyUniqueId instead of the system call variant
(SeCreateAccessStateEx already did this, but with Exp*). Also,
Ex(p)AllocateLocallyUniqueId can't fail so there is no need to return success all the
time (and check for it...). This also just happens to move the first system call to phase
1 instead of 0.
Modified:
    trunk/reactos/ntoskrnl/ex/uuid.c
    trunk/reactos/ntoskrnl/include/internal/ex.h
    trunk/reactos/ntoskrnl/se/access.c
    trunk/reactos/ntoskrnl/se/token.c
Modified: trunk/reactos/ntoskrnl/ex/uuid.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ex/uuid.c?rev=693…
==============================================================================
--- trunk/reactos/ntoskrnl/ex/uuid.c    [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ex/uuid.c    [iso-8859-1] Mon Sep 28 07:44:49 2015
@@ -227,9 +227,9 @@
 }
-NTSTATUS
-NTAPI
-ExpAllocateLocallyUniqueId(OUT LUID *LocallyUniqueId)
+VOID
+NTAPI
+ExAllocateLocallyUniqueId(OUT LUID *LocallyUniqueId)
 {
     LARGE_INTEGER NewLuid, PrevLuid;
@@ -246,26 +246,24 @@
     LocallyUniqueId->LowPart = NewLuid.u.LowPart;
     LocallyUniqueId->HighPart = NewLuid.u.HighPart;
-
-    return STATUS_SUCCESS;
 }
 /*
  * @implemented
  */
-NTSTATUS NTAPI
+NTSTATUS
+NTAPI
 NtAllocateLocallyUniqueId(OUT LUID *LocallyUniqueId)
 {
     LUID NewLuid;
     KPROCESSOR_MODE PreviousMode;
     NTSTATUS Status;
-
     PAGED_CODE();
+    /* Probe if user mode */
     PreviousMode = ExGetPreviousMode();
-
-    if(PreviousMode != KernelMode)
+    if (PreviousMode != KernelMode)
     {
         _SEH2_TRY
         {
@@ -280,18 +278,20 @@
         _SEH2_END;
     }
-    Status = ExpAllocateLocallyUniqueId(&NewLuid);
-
+    /* Do the allocation */
+    ExAllocateLocallyUniqueId(&NewLuid);
+    Status = STATUS_SUCCESS;
+
+    /* Write back LUID to caller */
     _SEH2_TRY
     {
         *LocallyUniqueId = NewLuid;
     }
-    _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+    _SEH2_EXCEPT(ExSystemExceptionFilter())
     {
         Status = _SEH2_GetExceptionCode();
     }
     _SEH2_END;
-
     return Status;
 }
Modified: trunk/reactos/ntoskrnl/include/internal/ex.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/ex.h        [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/include/internal/ex.h        [iso-8859-1] Mon Sep 28 07:44:49
2015
@@ -1388,28 +1388,40 @@
 );
 NTSTATUS
-ExpSetTimeZoneInformation(PTIME_ZONE_INFORMATION TimeZoneInformation);
-
-BOOLEAN
-NTAPI
-ExAcquireTimeRefreshLock(BOOLEAN Wait);
-
-VOID
-NTAPI
-ExReleaseTimeRefreshLock(VOID);
-
-VOID
-NTAPI
-ExUpdateSystemTimeFromCmos(IN BOOLEAN UpdateInterruptTime,
-                           IN ULONG MaxSepInSeconds);
-
-NTSTATUS
-NTAPI
-ExpAllocateLocallyUniqueId(OUT LUID *LocallyUniqueId);
-
-VOID
-NTAPI
-ExTimerRundown(VOID);
+ExpSetTimeZoneInformation(
+    IN PTIME_ZONE_INFORMATION TimeZoneInformation
+);
+
+BOOLEAN
+NTAPI
+ExAcquireTimeRefreshLock(
+    IN BOOLEAN Wait
+);
+
+VOID
+NTAPI
+ExReleaseTimeRefreshLock(
+    VOID
+);
+
+VOID
+NTAPI
+ExUpdateSystemTimeFromCmos(
+    IN BOOLEAN UpdateInterruptTime,
+    IN ULONG MaxSepInSeconds
+);
+
+VOID
+NTAPI
+ExAllocateLocallyUniqueId(
+    OUT LUID *LocallyUniqueId
+);
+
+VOID
+NTAPI
+ExTimerRundown(
+    VOID
+);
 VOID
 NTAPI
Modified: trunk/reactos/ntoskrnl/se/access.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/se/access.c?rev=6…
==============================================================================
--- trunk/reactos/ntoskrnl/se/access.c  [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/se/access.c  [iso-8859-1] Mon Sep 28 07:44:49 2015
@@ -403,7 +403,7 @@
     /* Set Access State Data */
     AccessState->RemainingDesiredAccess = AccessMask;
     AccessState->OriginalDesiredAccess = AccessMask;
-    ExpAllocateLocallyUniqueId(&AccessState->OperationID);
+    ExAllocateLocallyUniqueId(&AccessState->OperationID);
     /* Get the Token to use */
     Token = SeQuerySubjectContextToken(&AccessState->SubjectSecurityContext);
Modified: trunk/reactos/ntoskrnl/se/token.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/se/token.c?rev=69…
==============================================================================
--- trunk/reactos/ntoskrnl/se/token.c   [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/se/token.c   [iso-8859-1] Mon Sep 28 07:44:49 2015
@@ -393,12 +393,7 @@
     /* Zero out the buffer */
     RtlZeroMemory(AccessToken, sizeof(TOKEN));
-    Status = ZwAllocateLocallyUniqueId(&AccessToken->TokenId);
-    if (!NT_SUCCESS(Status))
-    {
-        ObDereferenceObject(AccessToken);
-        return Status;
-    }
+    ExAllocateLocallyUniqueId(&AccessToken->TokenId);
     AccessToken->TokenLock = &SepTokenLock;
@@ -722,13 +717,8 @@
         }
     }
-    Status = ZwAllocateLocallyUniqueId(&TokenId);
-    if (!NT_SUCCESS(Status))
-        return Status;
-
-    Status = ZwAllocateLocallyUniqueId(&ModifiedId);
-    if (!NT_SUCCESS(Status))
-        return Status;
+    ExAllocateLocallyUniqueId(&TokenId);
+    ExAllocateLocallyUniqueId(&ModifiedId);
     Status = ObCreateObject(PreviousMode,
                             SeTokenObjectType,