Use upper-case ASSERT macros.
authorEric Kohl <eric.kohl@reactos.org>
Fri, 22 Oct 2004 20:57:39 +0000 (20:57 +0000)
committerEric Kohl <eric.kohl@reactos.org>
Fri, 22 Oct 2004 20:57:39 +0000 (20:57 +0000)
svn path=/trunk/; revision=11393

reactos/include/ddk/iofuncs.h
reactos/include/ddk/mmfuncs.h
reactos/include/ntos/rtl.h
reactos/ntoskrnl/ob/handle.c
reactos/ntoskrnl/ps/create.c
reactos/ntoskrnl/ps/job.c
reactos/ntoskrnl/ps/process.c
reactos/ntoskrnl/ps/thread.c
reactos/ntoskrnl/ps/w32call.c
reactos/ntoskrnl/se/semgr.c
reactos/ntoskrnl/se/token.c

index c47b232..4ac000e 100644 (file)
@@ -1,6 +1,6 @@
 #ifndef _INCLUDE_DDK_IOFUNCS_H
 #define _INCLUDE_DDK_IOFUNCS_H
-/* $Id: iofuncs.h,v 1.44 2004/10/09 18:16:57 navaraf Exp $ */
+/* $Id: iofuncs.h,v 1.45 2004/10/22 20:51:44 ekohl Exp $ */
 
 #ifdef __NTOSKRNL__
 extern POBJECT_TYPE EXPORTED IoAdapterObjectType;
@@ -56,6 +56,7 @@ STDCALL
 IoAcquireVpbSpinLock (
        PKIRQL  Irpl
        );
+
 /**********************************************************************
  * NAME                                                        EXPORTED
  *     IoAllocateAdapterChannel@
@@ -977,7 +978,7 @@ IoReportResourceUsage (
 #define IoSetCompletionRoutine(Irp,Routine,NewContext,Success,Error,Cancel) \
        { \
                PIO_STACK_LOCATION param; \
-               assert((Success)||(Error)||(Cancel)?(Routine)!=NULL:TRUE); \
+               ASSERT((Success)||(Error)||(Cancel)?(Routine)!=NULL:TRUE); \
                param = IoGetNextIrpStackLocation((Irp)); \
                param->CompletionRoutine=(Routine); \
                param->Context=(NewContext); \
@@ -1484,8 +1485,7 @@ IoCreateDisk(
     );
 
 NTSTATUS
-STDCALL /* TMN: Huh? BOTH explicit STDCALL, and implicit by NTAPI ??? */
-NTAPI
+STDCALL
 IoGetDeviceInterfaces(
     IN CONST GUID *InterfaceClassGuid,
     IN PDEVICE_OBJECT PhysicalDeviceObject OPTIONAL,
@@ -1494,8 +1494,7 @@ IoGetDeviceInterfaces(
     );
 
 NTSTATUS
-STDCALL /* TMN: Huh? BOTH explicit STDCALL, and implicit by NTAPI ??? */
-NTAPI
+STDCALL
 IoGetDeviceInterfaceAlias(
     IN PUNICODE_STRING SymbolicLinkName,
     IN CONST GUID *AliasInterfaceClassGuid,
index 76ed46e..4053f09 100644 (file)
@@ -1,6 +1,6 @@
 #ifndef _INCLUDE_DDK_MMFUNCS_H
 #define _INCLUDE_DDK_MMFUNCS_H
-/* $Id: mmfuncs.h,v 1.23 2004/07/17 03:04:45 ion Exp $ */
+/* $Id: mmfuncs.h,v 1.24 2004/10/22 20:51:44 ekohl Exp $ */
 /* MEMORY MANAGMENT ******************************************************/
 
 
@@ -541,12 +541,12 @@ MmPrefetchPages (
 #define MmPrepareMdlForReuse(Mdl) \
        if (((Mdl)->MdlFlags & MDL_PARTIAL_HAS_BEEN_MAPPED) != 0) \
        { \
-               assert(((Mdl)->MdlFlags & MDL_PARTIAL) != 0); \
+               ASSERT(((Mdl)->MdlFlags & MDL_PARTIAL) != 0); \
                MmUnmapLockedPages ((Mdl)->MappedSystemVa, (Mdl)); \
        } \
        else if (((Mdl)->MdlFlags & MDL_PARTIAL) == 0) \
        { \
-               assert(((Mdl)->MdlFlags & MDL_MAPPED_TO_SYSTEM_VA) == 0); \
+               ASSERT(((Mdl)->MdlFlags & MDL_MAPPED_TO_SYSTEM_VA) == 0); \
        }
 
 /*
index f46c462..7b9d12a 100755 (executable)
@@ -1,4 +1,4 @@
-/* $Id: rtl.h,v 1.34 2004/09/13 20:25:25 weiden Exp $
+/* $Id: rtl.h,v 1.35 2004/10/22 20:53:11 ekohl Exp $
  * 
  */
 #ifndef __DDK_RTL_H
        (ListEntry)->Blink = (ListHead); \
        OldFlink->Blink = (ListEntry); \
        (ListHead)->Flink = (ListEntry); \
-       assert((ListEntry) != NULL); \
-       assert((ListEntry)->Blink!=NULL); \
-       assert((ListEntry)->Blink->Flink == (ListEntry)); \
-       assert((ListEntry)->Flink != NULL); \
-       assert((ListEntry)->Flink->Blink == (ListEntry)); \
+       ASSERT((ListEntry) != NULL); \
+       ASSERT((ListEntry)->Blink!=NULL); \
+       ASSERT((ListEntry)->Blink->Flink == (ListEntry)); \
+       ASSERT((ListEntry)->Flink != NULL); \
+       ASSERT((ListEntry)->Flink->Blink == (ListEntry)); \
 }
 
 
@@ -235,11 +235,11 @@ PushEntryList (
 { \
        PLIST_ENTRY OldFlink; \
        PLIST_ENTRY OldBlink; \
-       assert((ListEntry) != NULL); \
-       assert((ListEntry)->Blink!=NULL); \
-       assert((ListEntry)->Blink->Flink == (ListEntry)); \
-       assert((ListEntry)->Flink != NULL); \
-       assert((ListEntry)->Flink->Blink == (ListEntry)); \
+       ASSERT((ListEntry) != NULL); \
+       ASSERT((ListEntry)->Blink!=NULL); \
+       ASSERT((ListEntry)->Blink->Flink == (ListEntry)); \
+       ASSERT((ListEntry)->Flink != NULL); \
+       ASSERT((ListEntry)->Flink->Blink == (ListEntry)); \
        OldFlink = (ListEntry)->Flink; \
        OldBlink = (ListEntry)->Blink; \
        OldFlink->Blink = OldBlink; \
index 48b3d93..8bf7368 100644 (file)
@@ -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: handle.c,v 1.62 2004/09/28 15:02:29 weiden Exp $
+/* $Id: handle.c,v 1.63 2004/10/22 20:57:39 ekohl Exp $
  *
  * COPYRIGHT:          See COPYING in the top level directory
  * PROJECT:            ReactOS kernel
@@ -639,7 +639,7 @@ ObCreateHandle(PEPROCESS Process,
 
    DPRINT("ObCreateHandle(Process %x, obj %x)\n",Process,ObjectBody);
 
-   assert(Process);
+   ASSERT(Process);
 
    if (ObjectBody != NULL)
      {
@@ -752,16 +752,6 @@ ObQueryObjectAuditingByHandle(IN HANDLE Handle,
 }
 
 
-/*
- * @implemented
- */
-NTSTATUS STDCALL
-ObReferenceObjectByHandle(HANDLE Handle,
-                         ACCESS_MASK DesiredAccess,
-                         POBJECT_TYPE ObjectType,
-                         KPROCESSOR_MODE AccessMode,
-                         PVOID* Object,
-                         POBJECT_HANDLE_INFORMATION HandleInformation)
 /*
  * FUNCTION: Increments the reference count for an object and returns a 
  * pointer to its body
@@ -774,7 +764,16 @@ ObReferenceObjectByHandle(HANDLE Handle,
  *         HandleInformation (OUT) = Contains information about the handle 
  *                                   on return
  * RETURNS: Status
+ *
+ * @implemented
  */
+NTSTATUS STDCALL
+ObReferenceObjectByHandle(HANDLE Handle,
+                         ACCESS_MASK DesiredAccess,
+                         POBJECT_TYPE ObjectType,
+                         KPROCESSOR_MODE AccessMode,
+                         PVOID* Object,
+                         POBJECT_HANDLE_INFORMATION HandleInformation)
 {
    PHANDLE_ENTRY HandleEntry;
    POBJECT_HEADER ObjectHeader;
index 1691513..6e4975f 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: create.c,v 1.82 2004/10/01 20:26:05 gvg Exp $
+/* $Id: create.c,v 1.83 2004/10/22 20:45:46 ekohl Exp $
  *
  * COPYRIGHT:              See COPYING in the top level directory
  * PROJECT:                ReactOS kernel
@@ -518,7 +518,7 @@ PsCreateTeb(HANDLE ProcessHandle,
      {
        /* We'll be allocating a 64k block here and only use 4k of it, but this
           path should almost never be taken. Actually, I never saw it was taken,
-          so maybe we should just assert(NULL != Thread->ThreadsProcess) and
+          so maybe we should just ASSERT(NULL != Thread->ThreadsProcess) and
           move on */
        TebBase = NULL;
        Status = ZwAllocateVirtualMemory(ProcessHandle,
@@ -573,7 +573,7 @@ PsCreateTeb(HANDLE ProcessHandle,
      }
 
    DPRINT ("TebBase %p TebSize %lu\n", TebBase, TebSize);
-   assert(NULL != TebBase && PAGE_SIZE <= TebSize);
+   ASSERT(NULL != TebBase && PAGE_SIZE <= TebSize);
 
    RtlZeroMemory(&Teb, sizeof(TEB));
    /* set all pointers to and from the TEB */
index 86ddacc..b48bf0d 100644 (file)
@@ -238,7 +238,7 @@ PVOID
 STDCALL 
 PsGetJobLock(PEJOB Job)
 {
-  assert(Job);
+  ASSERT(Job);
   return (PVOID)&Job->JobLock;
 }
 
@@ -250,7 +250,7 @@ PVOID
 STDCALL
 PsGetJobSessionId(PEJOB Job)
 {
-  assert(Job);
+  ASSERT(Job);
   return (PVOID)Job->SessionId;
 }
 
@@ -262,20 +262,20 @@ ULONG
 STDCALL
 PsGetJobUIRestrictionsClass(PEJOB Job)
 {
-  assert(Job);
+  ASSERT(Job);
   return Job->UIRestrictionsClass;
 }
 
 
 /*
  * @unimplemented
- */                       
+ */
 VOID
 STDCALL
 PsSetJobUIRestrictionsClass(PEJOB Job,
                             ULONG UIRestrictionsClass)
 {
-  assert(Job);
+  ASSERT(Job);
   InterlockedExchange((LONG*)&Job->UIRestrictionsClass, (LONG)UIRestrictionsClass);
   /* FIXME - walk through the job process list and update the restrictions? */
 }
index 6bbd29c..9135b29 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: process.c,v 1.144 2004/10/01 20:26:05 gvg Exp $
+/* $Id: process.c,v 1.145 2004/10/22 20:45:46 ekohl Exp $
  *
  * COPYRIGHT:         See COPYING in the top level directory
  * PROJECT:           ReactOS kernel
@@ -439,7 +439,7 @@ PsCreatePeb(HANDLE ProcessHandle,
       DPRINT1("NtAllocateVirtualMemory() failed (Status %lx)\n", Status);
       return(Status);
     }
-  assert((ULONG_PTR) Process->TebBlock <= PEB_BASE &&
+  ASSERT((ULONG_PTR) Process->TebBlock <= PEB_BASE &&
          PEB_BASE + PAGE_SIZE <= (ULONG_PTR) Process->TebBlock + AllocSize);
   Peb = (PPEB)PEB_BASE;
   PebSize = PAGE_SIZE;
@@ -455,15 +455,11 @@ PsCreatePeb(HANDLE ProcessHandle,
       return(Status);
     }
   DPRINT("Peb %p  PebSize %lu\n", Peb, PebSize);
-  assert((PPEB) PEB_BASE == Peb && PAGE_SIZE <= PebSize);
+  ASSERT((PPEB) PEB_BASE == Peb && PAGE_SIZE <= PebSize);
   Process->TebLastAllocated = (PVOID) Peb;
 
   ViewSize = 0;
-#if defined(__GNUC__)
-  SectionOffset.QuadPart = 0LL;
-#else
-  SectionOffset.QuadPart = 0;
-#endif
+  SectionOffset.QuadPart = (ULONGLONG)0;
   TableBase = NULL;
   Status = MmMapViewOfSection(NlsSectionObject,
                              Process,
index 107c4de..0fd980d 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: thread.c,v 1.136 2004/10/17 15:39:29 hbirr Exp $
+/* $Id: thread.c,v 1.137 2004/10/22 20:45:46 ekohl Exp $
  *
  * COPYRIGHT:              See COPYING in the top level directory
  * PROJECT:                ReactOS kernel
@@ -236,7 +236,7 @@ PsIsThreadImpersonating(
 static VOID
 PsInsertIntoThreadList(KPRIORITY Priority, PETHREAD Thread)
 {
-   assert(THREAD_STATE_READY == Thread->Tcb.State);
+   ASSERT(THREAD_STATE_READY == Thread->Tcb.State);
    if (Priority >= MAXIMUM_PRIORITY || Priority < LOW_PRIORITY)
      {
        DPRINT1("Invalid thread priority (%d)\n", Priority);
@@ -248,7 +248,7 @@ PsInsertIntoThreadList(KPRIORITY Priority, PETHREAD Thread)
 
 static VOID PsRemoveFromThreadList(PETHREAD Thread)
 {
-   assert(THREAD_STATE_READY == Thread->Tcb.State);
+   ASSERT(THREAD_STATE_READY == Thread->Tcb.State);
    RemoveEntryList(&Thread->Tcb.QueueListEntry);
    if (IsListEmpty(&PriorityListHead[(ULONG)Thread->Tcb.Priority]))
      {
@@ -327,7 +327,7 @@ static PETHREAD PsScanThreadList(KPRIORITY Priority, ULONG Affinity)
             {
               DPRINT1("%d/%d\n", current->Cid.UniqueThread, current->Tcb.State);
             }
-           assert(current->Tcb.State == THREAD_STATE_READY);
+           ASSERT(current->Tcb.State == THREAD_STATE_READY);
            DPRINT("current->Tcb.UserAffinity %x Affinity %x PID %d %d\n",
                  current->Tcb.UserAffinity, Affinity, current->Cid.UniqueThread,
                  Priority);
index b6bbe2c..56a51ae 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: w32call.c,v 1.15 2004/08/27 10:25:46 hbirr Exp $
+/* $Id: w32call.c,v 1.16 2004/10/22 20:45:46 ekohl Exp $
  *
  * COPYRIGHT:              See COPYING in the top level directory
  * PROJECT:                ReactOS kernel
@@ -142,7 +142,7 @@ PsFreeCallbackStackPage(PVOID Context, MEMORY_AREA* MemoryArea, PVOID Address,
                        PFN_TYPE Page, SWAPENTRY SwapEntry, 
                        BOOLEAN Dirty)
 {
-  assert(SwapEntry == 0);
+  ASSERT(SwapEntry == 0);
   if (Page != 0)
     {
       MmReleasePageMemoryConsumer(MC_NPPOOL, Page);
index 54f9a61..626c8e5 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: semgr.c,v 1.47 2004/10/01 01:28:56 arty Exp $
+/* $Id: semgr.c,v 1.48 2004/10/22 20:48:00 ekohl Exp $
  *
  * COPYRIGHT:         See COPYING in the top level directory
  * PROJECT:           ReactOS kernel
@@ -562,7 +562,7 @@ SeAssignSecurity(PSECURITY_DESCRIPTOR ParentDescriptor OPTIONAL,
   *NewDescriptor = Descriptor;
 
   DPRINT("Descrptor %x\n", Descriptor);
-  assert( RtlLengthSecurityDescriptor( Descriptor ) );
+  ASSERT(RtlLengthSecurityDescriptor(Descriptor));
 
   return STATUS_SUCCESS;
 }
index 72f478b..2e8d77f 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: token.c,v 1.41 2004/08/10 21:11:20 gvg Exp $
+/* $Id: token.c,v 1.42 2004/10/22 20:48:00 ekohl Exp $
  *
  * COPYRIGHT:         See COPYING in the top level directory
  * PROJECT:           ReactOS kernel
@@ -31,7 +31,7 @@ static GENERIC_MAPPING SepTokenMapping = {TOKEN_READ,
                                          TOKEN_EXECUTE,
                                          TOKEN_ALL_ACCESS};
 
-#define SYSTEM_LUID                      0x3E7;
+//#define SYSTEM_LUID                      0x3E7;
 
 /* FUNCTIONS *****************************************************************/
 
@@ -351,7 +351,7 @@ SeCreateClientSecurity(IN struct _ETHREAD *Thread,
                                     &TokenType,
                                     &b,
                                     &ImpersonationLevel);
-   if (TokenType != 2)
+   if (TokenType != TokenImpersonation)
      {
        ClientContext->DirectAccessEffectiveOnly = Qos->EffectiveOnly;
      }
@@ -365,9 +365,9 @@ SeCreateClientSecurity(IN struct _ETHREAD *Thread,
               }
             return(STATUS_UNSUCCESSFUL);
          }
-       if (ImpersonationLevel == 0 ||
-           ImpersonationLevel == 1 ||
-           (RemoteClient != FALSE && ImpersonationLevel != 3))
+       if (ImpersonationLevel == SecurityAnonymous ||
+           ImpersonationLevel == SecurityIdentification ||
+           (RemoteClient != FALSE && ImpersonationLevel != SecurityDelegation))
          {
             if (Token != NULL)
               {
@@ -1335,8 +1335,12 @@ SepCreateSystemProcessToken(struct _EPROCESS* Process)
       return(Status);
     }
 
-  AccessToken->AuthenticationId.LowPart = SYSTEM_LUID;
-  AccessToken->AuthenticationId.HighPart = 0;
+  Status = NtAllocateLocallyUniqueId(&AccessToken->AuthenticationId);
+  if (!NT_SUCCESS(Status))
+    {
+      ObDereferenceObject(AccessToken);
+      return Status;
+    }
 
   AccessToken->TokenType = TokenPrimary;
   AccessToken->ImpersonationLevel = SecurityDelegation;
@@ -1457,7 +1461,7 @@ SepCreateSystemProcessToken(struct _EPROCESS* Process)
   AccessToken->Privileges[i++].Luid = SeManageVolumePrivilege;
 #endif
 
-  assert( i == 20 );
+  ASSERT(i == 20);
 
   uSize = sizeof(ACL);
   uSize += sizeof(ACE) + uLocalSystemLength;