From 2a175cb99004fc1d7105126c2768b2ac697c9c02 Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Fri, 22 Oct 2004 20:57:39 +0000 Subject: [PATCH] Use upper-case ASSERT macros. svn path=/trunk/; revision=11393 --- reactos/include/ddk/iofuncs.h | 11 +++++------ reactos/include/ddk/mmfuncs.h | 6 +++--- reactos/include/ntos/rtl.h | 22 +++++++++++----------- reactos/ntoskrnl/ob/handle.c | 23 +++++++++++------------ reactos/ntoskrnl/ps/create.c | 6 +++--- reactos/ntoskrnl/ps/job.c | 10 +++++----- reactos/ntoskrnl/ps/process.c | 12 ++++-------- reactos/ntoskrnl/ps/thread.c | 8 ++++---- reactos/ntoskrnl/ps/w32call.c | 4 ++-- reactos/ntoskrnl/se/semgr.c | 4 ++-- reactos/ntoskrnl/se/token.c | 22 +++++++++++++--------- 11 files changed, 63 insertions(+), 65 deletions(-) diff --git a/reactos/include/ddk/iofuncs.h b/reactos/include/ddk/iofuncs.h index c47b232000f..4ac000e8a5b 100644 --- a/reactos/include/ddk/iofuncs.h +++ b/reactos/include/ddk/iofuncs.h @@ -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, diff --git a/reactos/include/ddk/mmfuncs.h b/reactos/include/ddk/mmfuncs.h index 76ed46e9f5f..4053f092714 100644 --- a/reactos/include/ddk/mmfuncs.h +++ b/reactos/include/ddk/mmfuncs.h @@ -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); \ } /* diff --git a/reactos/include/ntos/rtl.h b/reactos/include/ntos/rtl.h index f46c4622701..7b9d12a274f 100755 --- a/reactos/include/ntos/rtl.h +++ b/reactos/include/ntos/rtl.h @@ -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 @@ -115,11 +115,11 @@ (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; \ diff --git a/reactos/ntoskrnl/ob/handle.c b/reactos/ntoskrnl/ob/handle.c index 48b3d9310ee..8bf7368db9f 100644 --- a/reactos/ntoskrnl/ob/handle.c +++ b/reactos/ntoskrnl/ob/handle.c @@ -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; diff --git a/reactos/ntoskrnl/ps/create.c b/reactos/ntoskrnl/ps/create.c index 16915138b1b..6e4975f02e7 100644 --- a/reactos/ntoskrnl/ps/create.c +++ b/reactos/ntoskrnl/ps/create.c @@ -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 */ diff --git a/reactos/ntoskrnl/ps/job.c b/reactos/ntoskrnl/ps/job.c index 86ddacc71fd..b48bf0d37a4 100644 --- a/reactos/ntoskrnl/ps/job.c +++ b/reactos/ntoskrnl/ps/job.c @@ -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? */ } diff --git a/reactos/ntoskrnl/ps/process.c b/reactos/ntoskrnl/ps/process.c index 6bbd29cad54..9135b299330 100644 --- a/reactos/ntoskrnl/ps/process.c +++ b/reactos/ntoskrnl/ps/process.c @@ -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, diff --git a/reactos/ntoskrnl/ps/thread.c b/reactos/ntoskrnl/ps/thread.c index 107c4debcf1..0fd980d45ef 100644 --- a/reactos/ntoskrnl/ps/thread.c +++ b/reactos/ntoskrnl/ps/thread.c @@ -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); diff --git a/reactos/ntoskrnl/ps/w32call.c b/reactos/ntoskrnl/ps/w32call.c index b6bbe2c7800..56a51aec151 100644 --- a/reactos/ntoskrnl/ps/w32call.c +++ b/reactos/ntoskrnl/ps/w32call.c @@ -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); diff --git a/reactos/ntoskrnl/se/semgr.c b/reactos/ntoskrnl/se/semgr.c index 54f9a6197a2..626c8e5b8d0 100644 --- a/reactos/ntoskrnl/se/semgr.c +++ b/reactos/ntoskrnl/se/semgr.c @@ -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; } diff --git a/reactos/ntoskrnl/se/token.c b/reactos/ntoskrnl/se/token.c index 72f478b8a9b..2e8d77f2f31 100644 --- a/reactos/ntoskrnl/se/token.c +++ b/reactos/ntoskrnl/se/token.c @@ -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; -- 2.17.1