- Remove all NT_ASSERT from the kernel and replace with good old ASSERT, for ease of debugging, especially for tests run on the build servers. There is no need to use NT_ASSERT in the kernel.

- The fish is long gone.

svn path=/trunk/; revision=68888
This commit is contained in:
Stefan Ginsberg 2015-09-01 01:45:59 +00:00
parent a4f0ae9e87
commit e4fd9b81bc
23 changed files with 59 additions and 60 deletions

View file

@ -453,7 +453,7 @@ CcFastCopyRead (
TRUE,
Buffer,
IoStatus);
NT_ASSERT(Success == TRUE);
ASSERT(Success == TRUE);
}
/*
@ -479,7 +479,7 @@ CcFastCopyWrite (
Length,
TRUE,
Buffer);
NT_ASSERT(Success == TRUE);
ASSERT(Success == TRUE);
}
/*

View file

@ -606,7 +606,7 @@ CmpQueryKeyData(IN PHHIVE Hive,
}
/* Copy the class data */
NT_ASSERT(Length >= Offset);
ASSERT(Length >= Offset);
RtlCopyMemory(Info->KeyFullInformation.Class,
ClassData,
min(Node->ClassLength, Length - Offset));

View file

@ -24,7 +24,7 @@ CmpGetNextName(IN OUT PUNICODE_STRING RemainingName,
{
BOOLEAN NameValid = TRUE;
NT_ASSERT(RemainingName->Length % sizeof(WCHAR) == 0);
ASSERT(RemainingName->Length % sizeof(WCHAR) == 0);
/* Check if there's nothing left in the name */
if (!(RemainingName->Buffer) ||

View file

@ -85,7 +85,7 @@ ExpLookupHandleTableEntry(IN PHANDLE_TABLE HandleTable,
default:
NT_ASSERT(FALSE);
ASSERT(FALSE);
Entry = NULL;
}

View file

@ -77,7 +77,7 @@ ExpWin32SessionCallout(
if (SessionEntry == NULL)
{
/* The requested session does not even exist! */
NT_ASSERT(FALSE);
ASSERT(FALSE);
return STATUS_NOT_FOUND;
}
@ -92,7 +92,7 @@ ExpWin32SessionCallout(
/* Cleanup and return */
MmQuitNextSession(SessionEntry);
NT_ASSERT(FALSE);
ASSERT(FALSE);
return Status;
}
}

View file

@ -876,7 +876,7 @@ NextReferenceString:
}
/* Add final NULL to ReturnBuffer */
NT_ASSERT(ReturnBuffer.Length <= ReturnBuffer.MaximumLength);
ASSERT(ReturnBuffer.Length <= ReturnBuffer.MaximumLength);
if (ReturnBuffer.Length >= ReturnBuffer.MaximumLength)
{
PWSTR NewBuffer;

View file

@ -934,7 +934,7 @@ IopInitializeBuiltinDriver(IN PLDR_DATA_TABLE_ENTRY BootLdrEntry)
NextEntry = NextEntry->Flink;
}
NT_ASSERT(NextEntry != &PsLoadedModuleList);
ASSERT(NextEntry != &PsLoadedModuleList);
/*
* Initialize the driver
@ -1374,7 +1374,7 @@ IopUnloadDriver(PUNICODE_STRING DriverServiceName, BOOLEAN UnloadPnpDrivers)
/* Set the unload invoked flag and call the unload routine */
DriverObject->Flags |= DRVO_UNLOAD_INVOKED;
Status = IopLoadUnloadDriver(NULL, &DriverObject);
NT_ASSERT(Status == STATUS_SUCCESS);
ASSERT(Status == STATUS_SUCCESS);
/* Mark the driver object temporary, so it could be deleted later */
ObMakeTemporaryObject(DriverObject);
@ -1874,7 +1874,7 @@ IopLoadUnloadDriverWorker(
{
PLOAD_UNLOAD_PARAMS LoadParams = Parameter;
NT_ASSERT(PsGetCurrentProcess() == PsInitialSystemProcess);
ASSERT(PsGetCurrentProcess() == PsInitialSystemProcess);
LoadParams->Status = IopLoadUnloadDriver(LoadParams->RegistryPath,
&LoadParams->DriverObject);
KeSetEvent(&LoadParams->Event, 0, FALSE);

View file

@ -312,7 +312,7 @@ KeUserModeCallback(IN ULONG RoutineIndex,
OUT PVOID *Result,
OUT PULONG ResultLength)
{
NT_ASSERT(FALSE);
ASSERT(FALSE);
return STATUS_NOT_IMPLEMENTED;
}
@ -322,7 +322,7 @@ KiCallUserMode(
IN PVOID *OutputBuffer,
IN PULONG OutputLength)
{
NT_ASSERT(FALSE);
ASSERT(FALSE);
return STATUS_NOT_IMPLEMENTED;
}
@ -333,7 +333,7 @@ NtCallbackReturn(
_In_ ULONG ResultLength,
_In_ NTSTATUS CallbackStatus)
{
NT_ASSERT(FALSE);
ASSERT(FALSE);
return STATUS_NOT_IMPLEMENTED;
}

View file

@ -1537,7 +1537,7 @@ KiCallbackReturnHandler(IN PKTRAP_FRAME TrapFrame)
Thread = KeGetCurrentThread();
Thread->TrapFrame = TrapFrame;
Thread->PreviousMode = KiUserTrap(TrapFrame);
NT_ASSERT(Thread->PreviousMode != KernelMode);
ASSERT(Thread->PreviousMode != KernelMode);
/* Pass the register parameters to NtCallbackReturn.
Result pointer is in ecx, result length in edx, status in eax */

View file

@ -793,7 +793,7 @@ NtRequestWaitReplyPort(IN HANDLE PortHandle,
MessageType = LocalLpcRequest.u2.s2.Type;
/* Due to the above probe, we know that TotalLength is positive */
NT_ASSERT(LocalLpcRequest.u1.s1.TotalLength >= 0);
ASSERT(LocalLpcRequest.u1.s1.TotalLength >= 0);
/* Validate the length */
if ((((ULONG)(USHORT)LocalLpcRequest.u1.s1.DataLength + sizeof(PORT_MESSAGE)) >

View file

@ -189,7 +189,7 @@ MiAccessCheck(IN PMMPTE PointerPte,
/* Check if this is a guard page */
if ((ProtectionMask & MM_PROTECT_SPECIAL) == MM_GUARDPAGE)
{
NT_ASSERT(ProtectionMask != MM_DECOMMIT);
ASSERT(ProtectionMask != MM_DECOMMIT);
/* Attached processes can't expand their stack */
if (KeIsAttachedProcess()) return STATUS_ACCESS_VIOLATION;
@ -200,7 +200,7 @@ MiAccessCheck(IN PMMPTE PointerPte,
/* Remove the guard page bit, and return a guard page violation */
TempPte.u.Soft.Protection = ProtectionMask & ~MM_GUARDPAGE;
NT_ASSERT(TempPte.u.Long != 0);
ASSERT(TempPte.u.Long != 0);
MI_WRITE_INVALID_PTE(PointerPte, TempPte);
return STATUS_GUARD_PAGE_VIOLATION;
}
@ -1080,7 +1080,7 @@ MiResolveProtoPteFault(IN BOOLEAN StoreInstruction,
}
/* There is no such thing as a decommitted prototype PTE */
NT_ASSERT(TempPte.u.Long != MmDecommittedPte.u.Long);
ASSERT(TempPte.u.Long != MmDecommittedPte.u.Long);
/* Check for access rights on the PTE proper */
PteContents = *PointerPte;
@ -1420,7 +1420,7 @@ MiDispatchFault(IN BOOLEAN StoreInstruction,
/* Resolve */
Status = MiResolveTransitionFault(Address, PointerPte, Process, LockIrql, &InPageBlock);
NT_ASSERT(NT_SUCCESS(Status));
ASSERT(NT_SUCCESS(Status));
/* And now release the lock and leave*/
KeReleaseQueuedSpinLock(LockQueuePfnLock, LockIrql);
@ -2069,7 +2069,7 @@ UserFault:
if ((ProtectionCode & MM_PROTECT_SPECIAL) == MM_GUARDPAGE)
{
/* The VAD protection cannot be MM_DECOMMIT! */
NT_ASSERT(ProtectionCode != MM_DECOMMIT);
ASSERT(ProtectionCode != MM_DECOMMIT);
/* Remove the bit */
TempPte.u.Soft.Protection = ProtectionCode & ~MM_GUARDPAGE;
@ -2185,7 +2185,7 @@ UserFault:
/* Write the prototype PTE */
TempPte = PrototypePte;
TempPte.u.Soft.Protection = ProtectionCode;
NT_ASSERT(TempPte.u.Long != 0);
ASSERT(TempPte.u.Long != 0);
MI_WRITE_INVALID_PTE(PointerPte, TempPte);
}
else

View file

@ -1121,7 +1121,7 @@ MiMapViewInSystemSpace(IN PVOID Section,
Status = MiSessionCommitPageTables(Base,
(PVOID)((ULONG_PTR)Base +
Buckets * MI_SYSTEM_VIEW_BUCKET_SIZE));
NT_ASSERT(NT_SUCCESS(Status));
ASSERT(NT_SUCCESS(Status));
}
/* Create the actual prototype PTEs for this mapping */

View file

@ -930,7 +930,7 @@ MmAttachSession(
/* The parameter is the actual process! */
EntryProcess = SessionEntry;
NT_ASSERT(EntryProcess != NULL);
ASSERT(EntryProcess != NULL);
/* Sanity checks */
ASSERT(KeGetCurrentIrql() <= APC_LEVEL);
@ -998,7 +998,7 @@ MmDetachSession(
/* The parameter is the actual process! */
EntryProcess = SessionEntry;
NT_ASSERT(EntryProcess != NULL);
ASSERT(EntryProcess != NULL);
/* Sanity checks */
ASSERT(KeGetCurrentIrql() <= APC_LEVEL);
@ -1039,7 +1039,7 @@ MmQuitNextSession(
/* The parameter is the actual process! */
EntryProcess = SessionEntry;
NT_ASSERT(EntryProcess != NULL);
ASSERT(EntryProcess != NULL);
/* Sanity checks */
ASSERT(KeGetCurrentIrql () <= APC_LEVEL);

View file

@ -7,7 +7,6 @@
*/
/* INCLUDES *******************************************************************/
/* So long, and Thanks for All the Fish */
#include <ntoskrnl.h>
#define NDEBUG
@ -431,7 +430,7 @@ MiDeletePte(IN PMMPTE PointerPte,
/* Make the page free. For prototypes, it will be made free when deleting the section object */
if (Pfn1->u2.ShareCount == 0)
{
NT_ASSERT(Pfn1->u3.e2.ReferenceCount == 0);
ASSERT(Pfn1->u3.e2.ReferenceCount == 0);
/* And it should be in standby or modified list */
ASSERT((Pfn1->u3.e1.PageLocation == ModifiedPageList) || (Pfn1->u3.e1.PageLocation == StandbyPageList));
@ -1887,7 +1886,7 @@ MiQueryMemoryBasicInformation(IN HANDLE ProcessHandle,
{
DPRINT1("MmQuerySectionView failed. MemoryArea=%p (%p-%p), BaseAddress=%p\n",
MemoryArea, MA_GetStartingAddress(MemoryArea), MA_GetEndingAddress(MemoryArea), BaseAddress);
NT_ASSERT(NT_SUCCESS(Status));
ASSERT(NT_SUCCESS(Status));
}
}
else
@ -4856,7 +4855,7 @@ NtAllocateVirtualMemory(IN HANDLE ProcessHandle,
//
TempPte.u.Long = 0;
TempPte.u.Soft.Protection = ProtectionMask;
NT_ASSERT(TempPte.u.Long != 0);
ASSERT(TempPte.u.Long != 0);
//
// Get the PTE, PDE and the last PTE for this address range

View file

@ -301,14 +301,14 @@ MmGetPageFileMapping(
PVOID Address,
SWAPENTRY* SwapEntry)
{
NT_ASSERT(FALSE);
ASSERT(FALSE);
}
BOOLEAN
NTAPI
MmIsDisabledPage(PEPROCESS Process, PVOID Address)
{
NT_ASSERT(FALSE);
ASSERT(FALSE);
return FALSE;
}
@ -317,6 +317,6 @@ NTAPI
INIT_FUNCTION
MiInitializeSessionSpaceLayout(VOID)
{
NT_ASSERT(FALSE);
ASSERT(FALSE);
}

View file

@ -1245,7 +1245,7 @@ ObCreateObjectType(IN PUNICODE_STRING TypeName,
/* Set the index and the entry into the object type array */
LocalObjectType->Index = ObpTypeObjectType->TotalNumberOfObjects;
NT_ASSERT(LocalObjectType->Index != 0);
ASSERT(LocalObjectType->Index != 0);
if (LocalObjectType->Index < 32)
{

View file

@ -465,7 +465,7 @@ SeFastTraverseCheck(IN PSECURITY_DESCRIPTOR SecurityDescriptor,
PAGED_CODE();
NT_ASSERT(AccessMode != KernelMode);
ASSERT(AccessMode != KernelMode);
if (SecurityDescriptor == NULL)
return FALSE;

View file

@ -439,10 +439,10 @@ SepPropagateAcl(
PSID Sid;
BOOLEAN WriteTwoAces;
NT_ASSERT(RtlValidAcl(AclSource));
NT_ASSERT(AclSource->AclSize % sizeof(ULONG) == 0);
NT_ASSERT(AclSource->Sbz1 == 0);
NT_ASSERT(AclSource->Sbz2 == 0);
ASSERT(RtlValidAcl(AclSource));
ASSERT(AclSource->AclSize % sizeof(ULONG) == 0);
ASSERT(AclSource->Sbz1 == 0);
ASSERT(AclSource->Sbz2 == 0);
Written = 0;
if (*AclLength >= Written + sizeof(ACL))
@ -457,18 +457,18 @@ SepPropagateAcl(
CurrentSource = (PUCHAR)(AclSource + 1);
for (i = 0; i < AclSource->AceCount; i++)
{
NT_ASSERT((ULONG_PTR)CurrentDest % sizeof(ULONG) == 0);
NT_ASSERT((ULONG_PTR)CurrentSource % sizeof(ULONG) == 0);
ASSERT((ULONG_PTR)CurrentDest % sizeof(ULONG) == 0);
ASSERT((ULONG_PTR)CurrentSource % sizeof(ULONG) == 0);
AceDest = (PACCESS_ALLOWED_ACE)CurrentDest;
AceSource = (PACCESS_ALLOWED_ACE)CurrentSource;
/* These all have the same structure */
NT_ASSERT(AceSource->Header.AceType == ACCESS_ALLOWED_ACE_TYPE ||
ASSERT(AceSource->Header.AceType == ACCESS_ALLOWED_ACE_TYPE ||
AceSource->Header.AceType == ACCESS_DENIED_ACE_TYPE ||
AceSource->Header.AceType == SYSTEM_AUDIT_ACE_TYPE);
NT_ASSERT(AceSource->Header.AceSize % sizeof(ULONG) == 0);
NT_ASSERT(AceSource->Header.AceSize >= sizeof(*AceSource));
ASSERT(AceSource->Header.AceSize % sizeof(ULONG) == 0);
ASSERT(AceSource->Header.AceSize >= sizeof(*AceSource));
if (!SepShouldPropagateAce(AceSource->Header.AceFlags,
&AceFlags,
IsInherited,
@ -482,7 +482,7 @@ SepPropagateAcl(
AceSize = AceSource->Header.AceSize;
Mask = AceSource->Mask;
Sid = (PSID)&AceSource->SidStart;
NT_ASSERT(AceSize >= FIELD_OFFSET(ACCESS_ALLOWED_ACE, SidStart) + RtlLengthSid(Sid));
ASSERT(AceSize >= FIELD_OFFSET(ACCESS_ALLOWED_ACE, SidStart) + RtlLengthSid(Sid));
WriteTwoAces = FALSE;
/* Map effective ACE to specific rights */
@ -598,7 +598,7 @@ SepSelectAcl(
*IsInherited,
IsDirectoryObject,
GenericMapping);
NT_ASSERT(Status == STATUS_BUFFER_TOO_SMALL);
ASSERT(Status == STATUS_BUFFER_TOO_SMALL);
/* Use the parent ACL only if it's not empty */
if (*AclLength != sizeof(ACL))
@ -633,7 +633,7 @@ SepSelectAcl(
*IsInherited,
IsDirectoryObject,
GenericMapping);
NT_ASSERT(Status == STATUS_BUFFER_TOO_SMALL);
ASSERT(Status == STATUS_BUFFER_TOO_SMALL);
}
return Acl;
}

View file

@ -644,7 +644,7 @@ SepAccessCheckAndAuditAlarm(
_SEH2_TRY
{
/* Loop all result entries (only 1 when no list was requested) */
NT_ASSERT(UseResultList || (ResultListLength == 1));
ASSERT(UseResultList || (ResultListLength == 1));
for (i = 0; i < ResultListLength; i++)
{
AccessStatusList[i] = SafeAccessStatusList[i];

View file

@ -129,7 +129,7 @@ SepPrivilegeCheck(PTOKEN Token,
SepReleaseTokenLock(Token);
/* When we reached this point, we did not find all privileges */
NT_ASSERT(Required > 0);
ASSERT(Required > 0);
return FALSE;
}

View file

@ -864,7 +864,7 @@ SeSetSecurityDescriptorInfoEx(
Control |= (ObjectSd->Control & SE_OWNER_DEFAULTED);
}
OwnerLength = Owner ? RtlLengthSid(Owner) : 0;
NT_ASSERT(OwnerLength % sizeof(ULONG) == 0);
ASSERT(OwnerLength % sizeof(ULONG) == 0);
/* Get group and group size */
if (SecurityInformation & GROUP_SECURITY_INFORMATION)
@ -878,7 +878,7 @@ SeSetSecurityDescriptorInfoEx(
Control |= (ObjectSd->Control & SE_GROUP_DEFAULTED);
}
GroupLength = Group ? RtlLengthSid(Group) : 0;
NT_ASSERT(GroupLength % sizeof(ULONG) == 0);
ASSERT(GroupLength % sizeof(ULONG) == 0);
/* Get DACL and DACL size */
if (SecurityInformation & DACL_SECURITY_INFORMATION)
@ -1211,7 +1211,7 @@ SeAssignSecurityEx(
}
}
OwnerLength = RtlLengthSid(Owner);
NT_ASSERT(OwnerLength % sizeof(ULONG) == 0);
ASSERT(OwnerLength % sizeof(ULONG) == 0);
/* Inherit the Group SID */
if (ExplicitDescriptor != NULL)
@ -1248,7 +1248,7 @@ SeAssignSecurityEx(
return STATUS_INVALID_PRIMARY_GROUP;
}
GroupLength = RtlLengthSid(Group);
NT_ASSERT(GroupLength % sizeof(ULONG) == 0);
ASSERT(GroupLength % sizeof(ULONG) == 0);
/* Inherit the DACL */
DaclLength = 0;
@ -1283,7 +1283,7 @@ SeAssignSecurityEx(
GenericMapping);
if (DaclPresent)
Control |= SE_DACL_PRESENT;
NT_ASSERT(DaclLength % sizeof(ULONG) == 0);
ASSERT(DaclLength % sizeof(ULONG) == 0);
/* Inherit the SACL */
SaclLength = 0;
@ -1318,7 +1318,7 @@ SeAssignSecurityEx(
GenericMapping);
if (SaclPresent)
Control |= SE_SACL_PRESENT;
NT_ASSERT(SaclLength % sizeof(ULONG) == 0);
ASSERT(SaclLength % sizeof(ULONG) == 0);
/* Allocate and initialize the new security descriptor */
Length = sizeof(SECURITY_DESCRIPTOR_RELATIVE) +
@ -1356,7 +1356,7 @@ SeAssignSecurityEx(
SaclIsInherited,
IsDirectoryObject,
GenericMapping);
NT_ASSERT(Status == STATUS_SUCCESS);
ASSERT(Status == STATUS_SUCCESS);
Descriptor->Sacl = Current;
Current += SaclLength;
}
@ -1371,7 +1371,7 @@ SeAssignSecurityEx(
DaclIsInherited,
IsDirectoryObject,
GenericMapping);
NT_ASSERT(Status == STATUS_SUCCESS);
ASSERT(Status == STATUS_SUCCESS);
Descriptor->Dacl = Current;
Current += DaclLength;
}

View file

@ -499,8 +499,8 @@ SeCaptureSidAndAttributesArray(
RtlCopyMemory(CurrentDest, SrcSidAndAttributes[i].Sid, SidLength);
/* Sanity checks */
NT_ASSERT(RtlLengthSid(SidAndAttributes[i].Sid) == SidLength);
NT_ASSERT(RtlValidSid(SidAndAttributes[i].Sid));
ASSERT(RtlLengthSid(SidAndAttributes[i].Sid) == SidLength);
ASSERT(RtlValidSid(SidAndAttributes[i].Sid));
/* Update the current destination address */
CurrentDest += ALIGN_UP_BY(SidLength, sizeof(ULONG));

View file

@ -125,7 +125,7 @@ WmipCaptureGuidObjectAttributes(
_Out_ PWSTR ObjectNameBuffer,
_In_ KPROCESSOR_MODE AccessMode)
{
NT_ASSERT(AccessMode != KernelMode);
ASSERT(AccessMode != KernelMode);
_SEH2_TRY
{