Commit in reactos on MAIN
lib/advapi32/token/token.c+9-31.10 -> 1.11
ntoskrnl/se/token.c+7-71.35 -> 1.36
+16-10
2 modified files
Make AdjustTokenPrivileges confirm to MSDN-documented behaviour:
- return FALSE on error with appropriate LastError
- return TRUE with LastError == ERROR_NOT_ALL_ASSIGNED if not all
  privileges could be adjusted
- return TRUE with LastError == ERROR_SUCCESS if all privileges
  were successfully adjusted

reactos/lib/advapi32/token
token.c 1.10 -> 1.11
diff -u -r1.10 -r1.11
--- token.c	25 Mar 2004 11:30:07 -0000	1.10
+++ token.c	6 Jul 2004 22:07:25 -0000	1.11
@@ -1,4 +1,4 @@
-/* $Id: token.c,v 1.10 2004/03/25 11:30:07 ekohl Exp $
+/* $Id: token.c,v 1.11 2004/07/06 22:07:25 gvg Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS system libraries
@@ -61,12 +61,18 @@
 				    BufferLength,
 				    PreviousState,
 				    (PULONG)ReturnLength);
-  if (!NT_SUCCESS (Status))
+  if (STATUS_NOT_ALL_ASSIGNED == Status)
     {
-      SetLastError (RtlNtStatusToDosError (Status));
+      SetLastError(ERROR_NOT_ALL_ASSIGNED);
+      return TRUE;
+    }
+  if (! NT_SUCCESS(Status))
+    {
+      SetLastError(RtlNtStatusToDosError(Status));
       return FALSE;
     }
 
+  SetLastError(ERROR_SUCCESS); /* AdjustTokenPrivileges is documented to do this */
   return TRUE;
 }
 

reactos/ntoskrnl/se
token.c 1.35 -> 1.36
diff -u -r1.35 -r1.36
--- token.c	18 May 2004 12:23:48 -0000	1.35
+++ token.c	6 Jul 2004 22:07:26 -0000	1.36
@@ -1,4 +1,4 @@
-/* $Id: token.c,v 1.35 2004/05/18 12:23:48 ekohl Exp $
+/* $Id: token.c,v 1.36 2004/07/06 22:07:26 gvg Exp $
  *
  * COPYRIGHT:         See COPYING in the top level directory
  * PROJECT:           ReactOS kernel
@@ -989,6 +989,7 @@
   ULONG i;
   ULONG j;
   ULONG k;
+  ULONG Count;
 #if 0
    ULONG a;
    ULONG b;
@@ -1059,9 +1060,11 @@
 	      Token->Privileges[i].Attributes &= ~SE_PRIVILEGE_ENABLED;
 	    }
 	}
+      Status = STATUS_SUCCESS;
     }
   else
     {
+      Count = 0;
       for (i = 0; i < Token->PrivilegeCount; i++)
 	{
 	  for (j = 0; j < NewState->PrivilegeCount; j++)
@@ -1094,9 +1097,11 @@
 		      DPRINT ("New attributes %lx\n",
 			      Token->Privileges[i].Attributes);
 		    }
+                  Count++;
 		}
 	    }
 	}
+      Status = Count < NewState->PrivilegeCount ? STATUS_NOT_ALL_ASSIGNED : STATUS_SUCCESS;
     }
 
   if (ReturnLength != NULL)
@@ -1113,12 +1118,7 @@
 
   DPRINT ("NtAdjustPrivilegesToken() done\n");
 
-  if (k < NewState->PrivilegeCount)
-    {
-      return STATUS_NOT_ALL_ASSIGNED;
-    }
-
-  return STATUS_SUCCESS;
+  return Status;
 }
 
 
CVSspam 0.2.8