From 24da6d32fe2dfe655f9db55ee618956dbe4c10f5 Mon Sep 17 00:00:00 2001 From: Aleksey Bragin Date: Wed, 26 Nov 2008 18:56:41 +0000 Subject: [PATCH] - Fix some coverity errors. - Use KeBugCheck(MEMORY_MANAGEMENT) instead of ASSERT(FALSE), so it dies on release builds too. - Enable support for Hyper-V. - Fix incorrect gate wait code -- fixes sporadic crashes in the network stack. - Mark KeBugCheck*, ExRaise* and RtlRaiseStatus as declspec(noreturn), for better optimization of functions which call them, less potential warnings in the compiler, and, assuming coverity understands it, less false CIDs. - Fix KiUpdateDr7, which resulted in broken support for hardware breakpoints. - Fix failure cases in EnumerateRootDevices which might've freed non-allocated memory. - Fix NtAddAtom/NtFindAtom logic when dealing with NULL or kernel Atom names. Patch by Alex Ionescu. svn path=/trunk/; revision=37668 --- reactos/include/ddk/winddk.h | 5 + reactos/include/ndk/rtlfuncs.h | 1 + reactos/ntoskrnl/dbgk/dbgkobj.c | 2 +- reactos/ntoskrnl/ex/atom.c | 18 ++- .../ntoskrnl/include/internal/i386/asmmacro.S | 32 +++++ reactos/ntoskrnl/io/iomgr/irp.c | 5 +- reactos/ntoskrnl/io/pnpmgr/pnproot.c | 8 +- reactos/ntoskrnl/ke/apc.c | 53 +++++--- reactos/ntoskrnl/ke/bug.c | 13 +- reactos/ntoskrnl/ke/i386/exp.c | 2 +- reactos/ntoskrnl/ke/i386/v86m_sup.S | 89 +++++--------- reactos/ntoskrnl/lpc/send.c | 1 + reactos/ntoskrnl/mm/i386/page.c | 74 +++++------ reactos/ntoskrnl/mm/section.c | 116 +++++++++--------- reactos/ntoskrnl/ob/obhandle.c | 2 +- reactos/ntoskrnl/ob/obname.c | 9 +- 16 files changed, 227 insertions(+), 203 deletions(-) diff --git a/reactos/include/ddk/winddk.h b/reactos/include/ddk/winddk.h index 30531924dab..4eb8976c8f4 100644 --- a/reactos/include/ddk/winddk.h +++ b/reactos/include/ddk/winddk.h @@ -7666,12 +7666,14 @@ ExNotifyCallback( NTKERNELAPI VOID NTAPI +__declspec(noreturn) ExRaiseAccessViolation( VOID); NTKERNELAPI VOID NTAPI +__declspec(noreturn) ExRaiseDatatypeMisalignment( VOID); @@ -7679,6 +7681,7 @@ DECLSPEC_NORETURN NTKERNELAPI VOID NTAPI +__declspec(noreturn) ExRaiseStatus( IN NTSTATUS Status); @@ -9603,12 +9606,14 @@ KeAreApcsDisabled( NTKERNELAPI VOID NTAPI +__declspec(noreturn) KeBugCheck( IN ULONG BugCheckCode); NTKERNELAPI VOID NTAPI +__declspec(noreturn) KeBugCheckEx( IN ULONG BugCheckCode, IN ULONG_PTR BugCheckParameter1, diff --git a/reactos/include/ndk/rtlfuncs.h b/reactos/include/ndk/rtlfuncs.h index 78d8a320f5c..612437aaad6 100644 --- a/reactos/include/ndk/rtlfuncs.h +++ b/reactos/include/ndk/rtlfuncs.h @@ -431,6 +431,7 @@ RtlRaiseException( NTSYSAPI VOID NTAPI +__declspec(noreturn) RtlRaiseStatus( IN NTSTATUS Status ); diff --git a/reactos/ntoskrnl/dbgk/dbgkobj.c b/reactos/ntoskrnl/dbgk/dbgkobj.c index 023c36073c5..fa34a107abc 100644 --- a/reactos/ntoskrnl/dbgk/dbgkobj.c +++ b/reactos/ntoskrnl/dbgk/dbgkobj.c @@ -603,7 +603,7 @@ DbgkpPostFakeThreadMessages(IN PEPROCESS Process, else { /* Get the first thread ourselves */ - ThisThread = PsGetNextProcessThread(Process, OldThread); + ThisThread = PsGetNextProcessThread(Process, NULL); IsFirstThread = TRUE; } diff --git a/reactos/ntoskrnl/ex/atom.c b/reactos/ntoskrnl/ex/atom.c index 1c3ee74a2e7..dd5c9971702 100644 --- a/reactos/ntoskrnl/ex/atom.c +++ b/reactos/ntoskrnl/ex/atom.c @@ -92,7 +92,7 @@ NtAddAtom(IN PWSTR AtomName, PRTL_ATOM_TABLE AtomTable = ExpGetGlobalAtomTable(); NTSTATUS Status = STATUS_SUCCESS; KPROCESSOR_MODE PreviousMode = ExGetPreviousMode(); - LPWSTR CapturedName = NULL; + LPWSTR CapturedName; ULONG CapturedSize; RTL_ATOM SafeAtom; PAGED_CODE(); @@ -107,6 +107,9 @@ NtAddAtom(IN PWSTR AtomName, DPRINT1("Atom name too long\n"); return STATUS_INVALID_PARAMETER; } + + /* Re-use the given name if kernel mode or no atom name */ + CapturedName = AtomName; /* Check if we're called from user-mode*/ if (PreviousMode != KernelMode) @@ -148,11 +151,6 @@ NtAddAtom(IN PWSTR AtomName, } _SEH2_END; } - else - { - /* Simplify code and re-use one variable */ - if (AtomName) CapturedName = AtomName; - } /* Make sure probe worked */ if (NT_SUCCESS(Status)) @@ -261,6 +259,9 @@ NtFindAtom(IN PWSTR AtomName, DPRINT1("Atom name too long\n"); return STATUS_INVALID_PARAMETER; } + + /* Re-use the given name if kernel mode or no atom name */ + CapturedName = AtomName; /* Check if we're called from user-mode*/ if (PreviousMode != KernelMode) @@ -302,11 +303,6 @@ NtFindAtom(IN PWSTR AtomName, } _SEH2_END; } - else - { - /* Simplify code and re-use one variable */ - if (AtomName) CapturedName = AtomName; - } /* Make sure probe worked */ if (NT_SUCCESS(Status)) diff --git a/reactos/ntoskrnl/include/internal/i386/asmmacro.S b/reactos/ntoskrnl/include/internal/i386/asmmacro.S index 73b72994723..370be0a4c66 100644 --- a/reactos/ntoskrnl/include/internal/i386/asmmacro.S +++ b/reactos/ntoskrnl/include/internal/i386/asmmacro.S @@ -32,6 +32,21 @@ #define INT_32_DPL0 0x8E00 #define INT_32_DPL3 0xEE00 +// +// This table contains the prefix flags that are used by V86 emulation +// +.equ PREFIX_FLAG_ES, 0x00000100 +.equ PREFIX_FLAG_CS, 0x00000200 +.equ PREFIX_FLAG_SS, 0x00000400 +.equ PREFIX_FLAG_DS, 0x00000800 +.equ PREFIX_FLAG_FS, 0x00001000 +.equ PREFIX_FLAG_GS, 0x00002000 +.equ PREFIX_FLAG_OPER32, 0x00004000 +.equ PREFIX_FLAG_ADDR32, 0x00008000 +.equ PREFIX_FLAG_LOCK, 0x00010000 +.equ PREFIX_FLAG_REPNE, 0x00020000 +.equ PREFIX_FLAG_REP, 0x00040000 + .intel_syntax noprefix // @@ -195,6 +210,23 @@ _KiUnexpectedInterrupt&Number: .endr .endm +// +// @name GENERATE_PREFIX_HANDLER +// +// This macro creates a prefix opcode handler. +// +// @param None. +// +// @remark None. +// +.macro GENERATE_PREFIX_HANDLER Name +.func Opcode&Name&PrefixV86 +_Opcode&Name&PrefixV86: + or ebx, PREFIX_FLAG_&Name + jmp _OpcodeGenericPrefixV86 +.endfunc +.endm + // // @name INVALID_V86_OPCODE // diff --git a/reactos/ntoskrnl/io/iomgr/irp.c b/reactos/ntoskrnl/io/iomgr/irp.c index e8bf25e43f7..9dc571bd871 100644 --- a/reactos/ntoskrnl/io/iomgr/irp.c +++ b/reactos/ntoskrnl/io/iomgr/irp.c @@ -519,6 +519,8 @@ IoAllocateIrp(IN CCHAR StackSize, /* Set Charge Quota Flag */ if (ChargeQuota) Flags |= IRP_QUOTA_CHARGED; + /* FIXME: Implement Lookaside Floats */ + /* Figure out which Lookaside List to use */ if ((StackSize <= 8) && (ChargeQuota == FALSE)) { @@ -579,9 +581,6 @@ IoAllocateIrp(IN CCHAR StackSize, } else { - /* We have an IRP from Lookaside */ - if (ChargeQuota) Flags |= IRP_LOOKASIDE_ALLOCATION; - /* In this case there is no charge quota */ Flags &= ~IRP_QUOTA_CHARGED; } diff --git a/reactos/ntoskrnl/io/pnpmgr/pnproot.c b/reactos/ntoskrnl/io/pnpmgr/pnproot.c index 8951ed2371c..5a5bf85c3eb 100644 --- a/reactos/ntoskrnl/io/pnpmgr/pnproot.c +++ b/reactos/ntoskrnl/io/pnpmgr/pnproot.c @@ -4,7 +4,7 @@ * FILE: ntoskrnl/io/pnpmgr/pnproot.c * PURPOSE: PnP manager root device * PROGRAMMERS: Casper S. Hornstrup (chorns@users.sourceforge.net) - * Copyright 2007 Hervé Poussineau (hpoussin@reactos.org) + * Copyright 2007 Herv? Poussineau (hpoussin@reactos.org) */ /* INCLUDES ******************************************************************/ @@ -503,8 +503,10 @@ cleanup: ZwClose(SubKeyHandle); if (KeyHandle != INVALID_HANDLE_VALUE) ZwClose(KeyHandle); - ExFreePoolWithTag(KeyInfo, TAG_PNP_ROOT); - ExFreePoolWithTag(SubKeyInfo, TAG_PNP_ROOT); + if (KeyInfo) + ExFreePoolWithTag(KeyInfo, TAG_PNP_ROOT); + if (SubKeyInfo) + ExFreePoolWithTag(SubKeyInfo, TAG_PNP_ROOT); KeReleaseGuardedMutex(&DeviceExtension->DeviceListLock); return Status; } diff --git a/reactos/ntoskrnl/ke/apc.c b/reactos/ntoskrnl/ke/apc.c index 4c06f75ca38..f042f816c58 100644 --- a/reactos/ntoskrnl/ke/apc.c +++ b/reactos/ntoskrnl/ke/apc.c @@ -90,6 +90,7 @@ KiInsertQueueApc(IN PKAPC Apc, KPROCESSOR_MODE ApcMode; PLIST_ENTRY ListHead, NextEntry; PKAPC QueuedApc; + PKGATE Gate; NTSTATUS Status; BOOLEAN RequestInterrupt = FALSE; @@ -211,24 +212,42 @@ KiInsertQueueApc(IN PKAPC Apc, } else if (Thread->State == GateWait) { - /* We were in a gate wait. Handle this. */ - DPRINT1("A thread was in a gate wait\n"); + /* Lock the thread */ + KiAcquireThreadLock(Thread); + + /* Essentially do the same check as above */ + if ((Thread->State == GateWait) && + (Thread->WaitIrql == PASSIVE_LEVEL) && + !(Thread->SpecialApcDisable) && + (!(Apc->NormalRoutine) || + (!(Thread->KernelApcDisable) && + !(Thread->ApcState.KernelApcInProgress)))) + { + /* We were in a gate wait. Handle this. */ + DPRINT1("A thread was in a gate wait\n"); + + /* Get the gate */ + Gate = Thread->GateObject; - /* Lock the gate */ - KiAcquireDispatcherObject(&Thread->GateObject->Header); - - /* Remove it from the waiters list */ - RemoveEntryList(&Thread->WaitBlock[0].WaitListEntry); - - /* Unlock the gate */ - KiReleaseDispatcherObject(&Thread->GateObject->Header); - - /* Increase the queue counter if needed */ - if (Thread->Queue) Thread->Queue->CurrentCount++; - - /* Put into deferred ready list with this status */ - Status = STATUS_KERNEL_APC; - KiInsertDeferredReadyList(Thread); + /* Lock the gate */ + KiAcquireDispatcherObject(&Gate->Header); + + /* Remove it from the waiters list */ + RemoveEntryList(&Thread->WaitBlock[0].WaitListEntry); + + /* Unlock the gate */ + KiReleaseDispatcherObject(&Gate->Header); + + /* Increase the queue counter if needed */ + if (Thread->Queue) Thread->Queue->CurrentCount++; + + /* Put into deferred ready list with this status */ + Status = STATUS_KERNEL_APC; + KiInsertDeferredReadyList(Thread); + } + + /* Release the thread lock */ + KiReleaseThreadLock(Thread); } } else if ((Thread->State == Waiting) && diff --git a/reactos/ntoskrnl/ke/bug.c b/reactos/ntoskrnl/ke/bug.c index 2b901b8a407..b537ba019c2 100644 --- a/reactos/ntoskrnl/ke/bug.c +++ b/reactos/ntoskrnl/ke/bug.c @@ -546,11 +546,13 @@ KiDoBugCheckCallbacks(VOID) VOID NTAPI +__declspec(noreturn) KiBugCheckDebugBreak(IN ULONG StatusCode) { /* If KDBG isn't connected, freeze the CPU, otherwise, break */ if (KdDebuggerNotPresent) for (;;) KeArchHaltProcessor(); DbgBreakPointWithStatus(StatusCode); + while (TRUE); } PCHAR @@ -604,13 +606,9 @@ KiDumpParameterImages(IN PCHAR Message, &InSystem); if (!ImageBase) { - /* Driver wasn't found, check for unloaded driver */ - DriverName = NULL; // FIXME: ROS can't - if (!DriverName) continue; - - /* Convert the driver name */ - ImageBase = (PVOID)Parameters[i]; - ConversionRoutine(DriverName, AnsiName, sizeof(AnsiName)); + /* FIXME: Add code to check for unloaded drivers */ + DPRINT1("Potentially unloaded driver!\n"); + continue; } else { @@ -751,6 +749,7 @@ KiDisplayBlueScreen(IN ULONG MessageId, VOID NTAPI +__declspec(noreturn) KeBugCheckWithTf(IN ULONG BugCheckCode, IN ULONG_PTR BugCheckParameter1, IN ULONG_PTR BugCheckParameter2, diff --git a/reactos/ntoskrnl/ke/i386/exp.c b/reactos/ntoskrnl/ke/i386/exp.c index 5500a706f9f..c300a58627f 100644 --- a/reactos/ntoskrnl/ke/i386/exp.c +++ b/reactos/ntoskrnl/ke/i386/exp.c @@ -124,7 +124,7 @@ KiRecordDr7(OUT PULONG Dr7Ptr, NewMask |= DR_MASK(DR7_OVERRIDE_V); /* Set DR7 override */ - *DrMask |= DR7_OVERRIDE_MASK; + *Dr7Ptr |= DR7_OVERRIDE_MASK; } else { diff --git a/reactos/ntoskrnl/ke/i386/v86m_sup.S b/reactos/ntoskrnl/ke/i386/v86m_sup.S index a6ff1a7c153..99939149144 100644 --- a/reactos/ntoskrnl/ke/i386/v86m_sup.S +++ b/reactos/ntoskrnl/ke/i386/v86m_sup.S @@ -10,6 +10,7 @@ #include #include +#undef LOCK .intel_syntax noprefix /* FIXME: Can we make a nice macro to generate V86 Opcode handlers? */ @@ -139,45 +140,17 @@ _Opcode0FV86: UNHANDLED_V86_OPCODE .endfunc -.func OpcodeESPrefixV86 -_OpcodeESPrefixV86: - UNHANDLED_V86_OPCODE -.endfunc - -.func OpcodeCSPrefixV86 -_OpcodeCSPrefixV86: - UNHANDLED_V86_OPCODE -.endfunc - -.func OpcodeSSPrefixV86 -_OpcodeSSPrefixV86: - UNHANDLED_V86_OPCODE -.endfunc - -.func OpcodeDSPrefixV86 -_OpcodeDSPrefixV86: - UNHANDLED_V86_OPCODE -.endfunc - -.func OpcodeFSPrefixV86 -_OpcodeFSPrefixV86: - UNHANDLED_V86_OPCODE -.endfunc - -.func OpcodeGSPrefixV86 -_OpcodeGSPrefixV86: - UNHANDLED_V86_OPCODE -.endfunc - -.func OpcodeOPER32PrefixV86 -_OpcodeOPER32PrefixV86: - UNHANDLED_V86_OPCODE -.endfunc - -.func OpcodeADDR32PrefixV86 -_OpcodeADDR32PrefixV86: - UNHANDLED_V86_OPCODE -.endfunc +GENERATE_PREFIX_HANDLER ES +GENERATE_PREFIX_HANDLER CS +GENERATE_PREFIX_HANDLER DS +GENERATE_PREFIX_HANDLER FS +GENERATE_PREFIX_HANDLER GS +GENERATE_PREFIX_HANDLER SS +GENERATE_PREFIX_HANDLER OPER32 +GENERATE_PREFIX_HANDLER ADDR32 +GENERATE_PREFIX_HANDLER LOCK +GENERATE_PREFIX_HANDLER REP +GENERATE_PREFIX_HANDLER REPNE .func OpcodeINSBV86 _OpcodeINSBV86: @@ -224,7 +197,7 @@ _OpcodePUSHFV86: sub dx, 2 /* Check if there is an OPER32 prefix */ - test ebx, 0x4000 + test ebx, PREFIX_FLAG_OPER32 jnz SkipPrefix /* Push EFLAGS */ @@ -264,7 +237,7 @@ _OpcodePOPFV86: add edx, 4 /* Check for OPER32 prefix */ - test ebx, 0x4000 + test ebx, PREFIX_FLAG_OPER32 jnz NoPrefix /* Skip 2 bytes */ @@ -431,7 +404,7 @@ _OpcodeIRETV86: add ecx, edx /* Check for OPER32 prefix */ - test ebx, 0x4000 + test ebx, PREFIX_FLAG_OPER32 jnz Iret32 /* Get flat IP */ @@ -576,21 +549,6 @@ _OpcodeOUTWV86: UNHANDLED_V86_OPCODE .endfunc -.func OpcodeLOCKPrefixV86 -_OpcodeLOCKPrefixV86: - UNHANDLED_V86_OPCODE -.endfunc - -.func OpcodeREPNEPrefixV86 -_OpcodeREPNEPrefixV86: - UNHANDLED_V86_OPCODE -.endfunc - -.func OpcodeREPPrefixV86 -_OpcodeREPPrefixV86: - UNHANDLED_V86_OPCODE -.endfunc - .func OpcodeCLIV86 _OpcodeCLIV86: @@ -633,6 +591,23 @@ _OpcodeSTIV86: ret .endfunc +.func OpcodeGenericPrefixV86 +_OpcodeGenericPrefixV86: + + /* Skip instruction */ + inc esi + inc edi + + /* Get the instruction */ + movzx ecx, byte ptr [esi] + + /* Get the opcode index */ + movzx edx, byte ptr OpcodeIndex[ecx] + + /* Dispatch it */ + jmp OpcodeDispatchV86[edx*4] +.endfunc + .func OpcodeHLTV86 _OpcodeHLTV86: UNHANDLED_V86_OPCODE diff --git a/reactos/ntoskrnl/lpc/send.c b/reactos/ntoskrnl/lpc/send.c index 4fd083d6ea5..6b4ee12c698 100644 --- a/reactos/ntoskrnl/lpc/send.c +++ b/reactos/ntoskrnl/lpc/send.c @@ -256,6 +256,7 @@ LpcRequestWaitReplyPort(IN PVOID PortObject, /* FIXME: TODO */ Semaphore = NULL; // we'd use the Thread Semaphore here ASSERT(FALSE); + return STATUS_NOT_IMPLEMENTED; } else { diff --git a/reactos/ntoskrnl/mm/i386/page.c b/reactos/ntoskrnl/mm/i386/page.c index 8c887816b30..98ab3212af6 100644 --- a/reactos/ntoskrnl/mm/i386/page.c +++ b/reactos/ntoskrnl/mm/i386/page.c @@ -97,7 +97,7 @@ ProtectToPTE(ULONG flProtect) else { DPRINT1("Unknown main protection type.\n"); - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } if (flProtect & PAGE_SYSTEM) @@ -241,7 +241,7 @@ MmDeletePageTable(PEPROCESS Process, PVOID Address) if (Address >= MmSystemRangeStart) { - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); // MmGlobalKernelPageDirectory[ADDR_TO_PDE_OFFSET(Address)] = 0; } if (Process != NULL && Process != CurrentProcess) @@ -264,7 +264,7 @@ MmGetPageTableForProcess(PEPROCESS Process, PVOID Address, BOOLEAN Create) PageDir = MmCreateHyperspaceMapping(PTE_TO_PFN(Process->Pcb.DirectoryTableBase[0])); if (PageDir == NULL) { - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } if (0 == InterlockedCompareExchangePte(&PageDir[PdeOffset], 0, 0)) { @@ -276,7 +276,7 @@ MmGetPageTableForProcess(PEPROCESS Process, PVOID Address, BOOLEAN Create) Status = MmRequestPageMemoryConsumer(MC_NPPOOL, FALSE, &Pfn); if (!NT_SUCCESS(Status) || Pfn == 0) { - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } Entry = InterlockedCompareExchangePte(&PageDir[PdeOffset], PFN_TO_PTE(Pfn) | PA_PRESENT | PA_READWRITE | PA_USER, 0); if (Entry != 0) @@ -293,7 +293,7 @@ MmGetPageTableForProcess(PEPROCESS Process, PVOID Address, BOOLEAN Create) Pt = MmCreateHyperspaceMapping(Pfn); if (Pt == NULL) { - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } return Pt + ADDR_TO_PTE_OFFSET(Address); } @@ -311,7 +311,7 @@ MmGetPageTableForProcess(PEPROCESS Process, PVOID Address, BOOLEAN Create) Status = MmRequestPageMemoryConsumer(MC_NPPOOL, FALSE, &Pfn); if (!NT_SUCCESS(Status) || Pfn == 0) { - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } Entry = PFN_TO_PTE(Pfn) | PA_PRESENT | PA_READWRITE; if (Ke386GlobalPagesEnabled) @@ -334,7 +334,7 @@ MmGetPageTableForProcess(PEPROCESS Process, PVOID Address, BOOLEAN Create) Status = MmRequestPageMemoryConsumer(MC_NPPOOL, FALSE, &Pfn); if (!NT_SUCCESS(Status) || Pfn == 0) { - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } Entry = InterlockedCompareExchangePte(PageDir, PFN_TO_PTE(Pfn) | PA_PRESENT | PA_READWRITE | PA_USER, 0); if (Entry != 0) @@ -403,7 +403,7 @@ MmDisableVirtualMapping(PEPROCESS Process, PVOID Address, BOOLEAN* WasDirty, PPF Pt = MmGetPageTableForProcess(Process, Address, FALSE); if (Pt == NULL) { - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } /* * Atomically disable the present bit and get the old value. @@ -417,7 +417,7 @@ MmDisableVirtualMapping(PEPROCESS Process, PVOID Address, BOOLEAN* WasDirty, PPF WasValid = (PAGE_MASK(Pte) != 0); if (!WasValid) { - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } /* @@ -582,14 +582,14 @@ MmSetCleanPage(PEPROCESS Process, PVOID Address) if (Address < MmSystemRangeStart && Process == NULL) { DPRINT1("MmSetCleanPage is called for user space without a process.\n"); - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } Pt = MmGetPageTableForProcess(Process, Address, FALSE); if (Pt == NULL) { - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } do @@ -617,13 +617,13 @@ MmSetDirtyPage(PEPROCESS Process, PVOID Address) if (Address < MmSystemRangeStart && Process == NULL) { DPRINT1("MmSetDirtyPage is called for user space without a process.\n"); - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } Pt = MmGetPageTableForProcess(Process, Address, FALSE); if (Pt == NULL) { - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } do @@ -650,7 +650,7 @@ MmEnableVirtualMapping(PEPROCESS Process, PVOID Address) Pt = MmGetPageTableForProcess(Process, Address, FALSE); if (Pt == NULL) { - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } do @@ -704,7 +704,7 @@ MmCreateVirtualMappingForKernel(PVOID Address, if (Address < MmSystemRangeStart) { DPRINT1("MmCreateVirtualMappingForKernel is called for user space\n"); - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } Attributes = ProtectToPTE(flProtect); @@ -724,7 +724,7 @@ MmCreateVirtualMappingForKernel(PVOID Address, Pt = MmGetPageTableForProcess(NULL, Addr, TRUE); if (Pt == NULL) { - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } Pt--; @@ -735,7 +735,7 @@ MmCreateVirtualMappingForKernel(PVOID Address, DPRINT1("Setting physical address but not allowing access at address " "0x%.8X with attributes %x/%x.\n", Addr, Attributes, flProtect); - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } PdeOffset = ADDR_TO_PDE_OFFSET(Addr); @@ -744,7 +744,7 @@ MmCreateVirtualMappingForKernel(PVOID Address, Pt = MmGetPageTableForProcess(NULL, Addr, TRUE); if (Pt == NULL) { - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } } else @@ -756,7 +756,7 @@ MmCreateVirtualMappingForKernel(PVOID Address, Pte = *Pt; if (Pte != 0) { - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } InterlockedExchangePte(Pt, PFN_TO_PTE(Pages[i]) | Attributes); } @@ -776,22 +776,22 @@ MmCreatePageFileMapping(PEPROCESS Process, if (Process == NULL && Address < MmSystemRangeStart) { DPRINT1("No process\n"); - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } if (Process != NULL && Address >= MmSystemRangeStart) { DPRINT1("Setting kernel address with process context\n"); - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } if (SwapEntry & (1 << 31)) { - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } Pt = MmGetPageTableForProcess(Process, Address, TRUE); if (Pt == NULL) { - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } Pte = *Pt; if (PAGE_MASK((Pte)) != 0) @@ -836,13 +836,13 @@ MmCreateVirtualMappingUnsafe(PEPROCESS Process, if (Address < MmSystemRangeStart) { DPRINT1("No process\n"); - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } if (PageCount > 0x10000 || (ULONG_PTR) Address / PAGE_SIZE + PageCount > 0x100000) { DPRINT1("Page count to large\n"); - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } } else @@ -850,14 +850,14 @@ MmCreateVirtualMappingUnsafe(PEPROCESS Process, if (Address >= MmSystemRangeStart) { DPRINT1("Setting kernel address with process context\n"); - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } if (PageCount > (ULONG_PTR)MmSystemRangeStart / PAGE_SIZE || (ULONG_PTR) Address / PAGE_SIZE + PageCount > (ULONG_PTR)MmSystemRangeStart / PAGE_SIZE) { DPRINT1("Page Count to large\n"); - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } } @@ -889,7 +889,7 @@ MmCreateVirtualMappingUnsafe(PEPROCESS Process, DPRINT1("Setting physical address but not allowing access at address " "0x%.8X with attributes %x/%x.\n", Addr, Attributes, flProtect); - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } PdeOffset = ADDR_TO_PDE_OFFSET(Addr); if (oldPdeOffset != PdeOffset) @@ -898,7 +898,7 @@ MmCreateVirtualMappingUnsafe(PEPROCESS Process, Pt = MmGetPageTableForProcess(Process, Addr, TRUE); if (Pt == NULL) { - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } } else @@ -911,7 +911,7 @@ MmCreateVirtualMappingUnsafe(PEPROCESS Process, MmMarkPageMapped(Pages[i]); if (PAGE_MASK((Pte)) != 0 && !((Pte) & PA_PRESENT)) { - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } if (PAGE_MASK((Pte)) != 0) { @@ -950,7 +950,7 @@ MmCreateVirtualMapping(PEPROCESS Process, if (!MmIsPageInUse(Pages[i])) { DPRINT1("Page at address %x not in use\n", PFN_TO_PTE(Pages[i])); - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } } @@ -1035,7 +1035,7 @@ MmSetPageProtect(PEPROCESS Process, PVOID Address, ULONG flProtect) Pt = MmGetPageTableForProcess(Process, Address, FALSE); if (Pt == NULL) { - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } InterlockedExchangePte(Pt, PAGE_MASK(*Pt) | Attributes | (*Pt & (PA_ACCESSED|PA_DIRTY))); MiFlushTlb(Pt, Address); @@ -1099,7 +1099,7 @@ MmCreateHyperspaceMapping(PFN_TYPE Page) } if (i >= Page % 1024) { - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } } } @@ -1124,7 +1124,7 @@ MmCreateHyperspaceMapping(PFN_TYPE Page) } if (i <= Page % 1024) { - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } } } @@ -1158,7 +1158,7 @@ MmUpdatePageDir(PEPROCESS Process, PVOID Address, ULONG Size) if (Address < MmSystemRangeStart) { - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } StartOffset = ADDR_TO_PDE_OFFSET(Address); @@ -1237,7 +1237,7 @@ MiInitPageDirectoryMap(VOID) BoundaryAddressMultiple); if (!NT_SUCCESS(Status)) { - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } BaseAddress = (PVOID)HYPERSPACE; Status = MmCreateMemoryArea(MmGetKernelAddressSpace(), @@ -1251,7 +1251,7 @@ MiInitPageDirectoryMap(VOID) BoundaryAddressMultiple); if (!NT_SUCCESS(Status)) { - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } } diff --git a/reactos/ntoskrnl/mm/section.c b/reactos/ntoskrnl/mm/section.c index e587cf2b928..5dec48d360b 100644 --- a/reactos/ntoskrnl/mm/section.c +++ b/reactos/ntoskrnl/mm/section.c @@ -291,7 +291,7 @@ MmFreeSectionSegments(PFILE_OBJECT FileObject) { DPRINT1("Image segment %d still referenced (was %d)\n", i, SectionSegments[i].ReferenceCount); - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } MmFreePageTablesSectionSegment(&SectionSegments[i]); } @@ -309,7 +309,7 @@ MmFreeSectionSegments(PFILE_OBJECT FileObject) if (Segment->ReferenceCount != 0) { DPRINT1("Data segment still referenced\n"); - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } MmFreePageTablesSectionSegment(Segment); ExFreePool(Segment); @@ -357,7 +357,7 @@ MmSetPageEntrySectionSegment(PMM_SECTION_SEGMENT Segment, TAG_SECTION_PAGE_TABLE); if (Table == NULL) { - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } memset(Table, 0, sizeof(SECTION_PAGE_TABLE)); DPRINT("Table %x\n", Table); @@ -410,16 +410,16 @@ MmSharePageEntrySectionSegment(PMM_SECTION_SEGMENT Segment, if (Entry == 0) { DPRINT1("Entry == 0 for MmSharePageEntrySectionSegment\n"); - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } if (SHARE_COUNT_FROM_SSE(Entry) == MAX_SHARE_COUNT) { DPRINT1("Maximum share count reached\n"); - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } if (IS_SWAP_FROM_SSE(Entry)) { - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } Entry = MAKE_SSE(PAGE_FROM_SSE(Entry), SHARE_COUNT_FROM_SSE(Entry) + 1); MmSetPageEntrySectionSegment(Segment, Offset, Entry); @@ -440,16 +440,16 @@ MmUnsharePageEntrySectionSegment(PROS_SECTION_OBJECT Section, if (Entry == 0) { DPRINT1("Entry == 0 for MmUnsharePageEntrySectionSegment\n"); - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } if (SHARE_COUNT_FROM_SSE(Entry) == 0) { DPRINT1("Zero share count for unshare\n"); - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } if (IS_SWAP_FROM_SSE(Entry)) { - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } Entry = MAKE_SSE(PAGE_FROM_SSE(Entry), SHARE_COUNT_FROM_SSE(Entry) - 1); /* @@ -485,7 +485,7 @@ MmUnsharePageEntrySectionSegment(PROS_SECTION_OBJECT Section, if (!NT_SUCCESS(Status)) { DPRINT1("CcRosUnmapCacheSegment failed, status = %x\n", Status); - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } } } @@ -534,7 +534,7 @@ MmUnsharePageEntrySectionSegment(PROS_SECTION_OBJECT Section, if (!NT_SUCCESS(Status)) { DPRINT1("MM: Failed to write to swap page (Status was 0x%.8X)\n", Status); - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } } MmSetPageEntrySectionSegment(Segment, Offset, MAKE_SWAP_SSE(SavedSwapEntry)); @@ -545,7 +545,7 @@ MmUnsharePageEntrySectionSegment(PROS_SECTION_OBJECT Section, else { DPRINT1("Found a swapentry for a non private page in an image or data file sgment\n"); - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } } } @@ -816,7 +816,7 @@ MmNotPresentFaultSectionView(PMM_AVL_TABLE AddressSpace, if (PageOp == NULL) { DPRINT1("MmGetPageOp failed\n"); - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } /* @@ -834,12 +834,12 @@ MmNotPresentFaultSectionView(PMM_AVL_TABLE AddressSpace, if (Status != STATUS_SUCCESS) { DPRINT1("Failed to wait for page op, status = %x\n", Status); - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } if (PageOp->Status == STATUS_PENDING) { DPRINT1("Woke for page op before completion\n"); - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } MmLockAddressSpace(AddressSpace); /* @@ -897,7 +897,7 @@ MmNotPresentFaultSectionView(PMM_AVL_TABLE AddressSpace, if (!NT_SUCCESS(Status)) { DPRINT1("Unable to create virtual mapping\n"); - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } MmInsertRmap(Page, Process, (PVOID)PAddress); } @@ -926,7 +926,7 @@ MmNotPresentFaultSectionView(PMM_AVL_TABLE AddressSpace, if (Segment->Flags & MM_PAGEFILE_SEGMENT) { DPRINT1("Found a swaped out private page in a pagefile section.\n"); - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } MmUnlockSectionSegment(Segment); @@ -936,14 +936,14 @@ MmNotPresentFaultSectionView(PMM_AVL_TABLE AddressSpace, Status = MmRequestPageMemoryConsumer(MC_USER, TRUE, &Page); if (!NT_SUCCESS(Status)) { - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } Status = MmReadFromSwapPage(SwapEntry, Page); if (!NT_SUCCESS(Status)) { DPRINT1("MmReadFromSwapPage failed, status = %x\n", Status); - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } MmLockAddressSpace(AddressSpace); Status = MmCreateVirtualMapping(Process, @@ -954,7 +954,7 @@ MmNotPresentFaultSectionView(PMM_AVL_TABLE AddressSpace, if (!NT_SUCCESS(Status)) { DPRINT("MmCreateVirtualMapping failed, not out of memory\n"); - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); return(Status); } @@ -999,7 +999,7 @@ MmNotPresentFaultSectionView(PMM_AVL_TABLE AddressSpace, if (!NT_SUCCESS(Status)) { DPRINT("MmCreateVirtualMappingUnsafe failed, not out of memory\n"); - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); return(Status); } /* @@ -1035,7 +1035,7 @@ MmNotPresentFaultSectionView(PMM_AVL_TABLE AddressSpace, } if (!NT_SUCCESS(Status)) { - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } Status = MmCreateVirtualMapping(Process, Address, @@ -1045,7 +1045,7 @@ MmNotPresentFaultSectionView(PMM_AVL_TABLE AddressSpace, if (!NT_SUCCESS(Status)) { DPRINT("MmCreateVirtualMapping failed, not out of memory\n"); - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); return(Status); } MmInsertRmap(Page, Process, (PVOID)PAddress); @@ -1126,7 +1126,7 @@ MmNotPresentFaultSectionView(PMM_AVL_TABLE AddressSpace, if (Entry != Entry1) { DPRINT1("Someone changed ppte entry while we slept\n"); - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } /* @@ -1145,7 +1145,7 @@ MmNotPresentFaultSectionView(PMM_AVL_TABLE AddressSpace, if (!NT_SUCCESS(Status)) { DPRINT1("Unable to create virtual mapping\n"); - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } MmInsertRmap(Page, Process, (PVOID)PAddress); @@ -1174,13 +1174,13 @@ MmNotPresentFaultSectionView(PMM_AVL_TABLE AddressSpace, Status = MmRequestPageMemoryConsumer(MC_USER, TRUE, &Page); if (!NT_SUCCESS(Status)) { - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } Status = MmReadFromSwapPage(SwapEntry, Page); if (!NT_SUCCESS(Status)) { - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } /* @@ -1197,7 +1197,7 @@ MmNotPresentFaultSectionView(PMM_AVL_TABLE AddressSpace, if (Entry != Entry1) { DPRINT1("Someone changed ppte entry while we slept\n"); - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } /* @@ -1220,7 +1220,7 @@ MmNotPresentFaultSectionView(PMM_AVL_TABLE AddressSpace, if (!NT_SUCCESS(Status)) { DPRINT1("Unable to create virtual mapping\n"); - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } MmInsertRmap(Page, Process, (PVOID)PAddress); if (Locked) @@ -1252,7 +1252,7 @@ MmNotPresentFaultSectionView(PMM_AVL_TABLE AddressSpace, if (!NT_SUCCESS(Status)) { DPRINT1("Unable to create virtual mapping\n"); - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } MmInsertRmap(Page, Process, (PVOID)PAddress); if (Locked) @@ -1346,7 +1346,7 @@ MmAccessFaultSectionView(PMM_AVL_TABLE AddressSpace, if (PageOp == NULL) { DPRINT1("MmGetPageOp failed\n"); - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } /* @@ -1362,12 +1362,12 @@ MmAccessFaultSectionView(PMM_AVL_TABLE AddressSpace, if (Status == STATUS_TIMEOUT) { DPRINT1("Failed to wait for page op, status = %x\n", Status); - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } if (PageOp->Status == STATUS_PENDING) { DPRINT1("Woke for page op before completion\n"); - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } /* * Restart the operation @@ -1389,7 +1389,7 @@ MmAccessFaultSectionView(PMM_AVL_TABLE AddressSpace, Status = MmRequestPageMemoryConsumer(MC_USER, TRUE, &NewPage); if (!NT_SUCCESS(Status)) { - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } /* @@ -1414,13 +1414,13 @@ MmAccessFaultSectionView(PMM_AVL_TABLE AddressSpace, if (!NT_SUCCESS(Status)) { DPRINT("MmCreateVirtualMapping failed, not out of memory\n"); - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); return(Status); } if (!NT_SUCCESS(Status)) { DPRINT1("Unable to create virtual mapping\n"); - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } if (Locked) { @@ -1550,7 +1550,7 @@ MmPageOutSectionView(PMM_AVL_TABLE AddressSpace, DPRINT1("Trying to page out from physical memory section address 0x%X " "process %d\n", Address, Process ? Process->UniqueProcessId : 0); - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } /* @@ -1561,7 +1561,7 @@ MmPageOutSectionView(PMM_AVL_TABLE AddressSpace, { DPRINT1("Trying to page out not-present page at (%d,0x%.8X).\n", Process ? Process->UniqueProcessId : 0, Address); - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } Page = MmGetPfnForProcess(Process, Address); SwapEntry = MmGetSavedSwapEntryPage(Page); @@ -1589,7 +1589,7 @@ MmPageOutSectionView(PMM_AVL_TABLE AddressSpace, if(!MiIsPageFromCache(MemoryArea, Context.Offset)) { DPRINT1("Direct mapped non private page is not associated with the cache.\n"); - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } } else @@ -1608,7 +1608,7 @@ MmPageOutSectionView(PMM_AVL_TABLE AddressSpace, if (!(Context.Segment->Flags & MM_PAGEFILE_SEGMENT) && !(Context.Segment->Characteristics & IMAGE_SCN_MEM_SHARED)) { - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } } @@ -1626,7 +1626,7 @@ MmPageOutSectionView(PMM_AVL_TABLE AddressSpace, { DPRINT1("Found a %s private page (address %x) in a pagefile segment.\n", Context.WasDirty ? "dirty" : "clean", Address); - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } if (!Context.WasDirty && SwapEntry != 0) { @@ -1644,7 +1644,7 @@ MmPageOutSectionView(PMM_AVL_TABLE AddressSpace, { DPRINT1("Found a %s private page (address %x) in a shared section segment.\n", Context.WasDirty ? "dirty" : "clean", Address); - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } if (!Context.WasDirty || SwapEntry != 0) { @@ -1665,13 +1665,13 @@ MmPageOutSectionView(PMM_AVL_TABLE AddressSpace, { DPRINT1("Found a swapentry for a non private and direct mapped page (address %x)\n", Address); - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } Status = CcRosUnmapCacheSegment(Bcb, FileOffset, FALSE); if (!NT_SUCCESS(Status)) { DPRINT1("CCRosUnmapCacheSegment failed, status = %x\n", Status); - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } PageOp->Status = STATUS_SUCCESS; MmspCompleteAndReleasePageOp(PageOp); @@ -1683,7 +1683,7 @@ MmPageOutSectionView(PMM_AVL_TABLE AddressSpace, { DPRINT1("Found a swap entry for a non dirty, non private and not direct mapped page (address %x)\n", Address); - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } MmReleasePageMemoryConsumer(MC_USER, Page); PageOp->Status = STATUS_SUCCESS; @@ -1700,7 +1700,7 @@ MmPageOutSectionView(PMM_AVL_TABLE AddressSpace, MmUnlockAddressSpace(AddressSpace); if (!NT_SUCCESS(Status)) { - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } MmReleasePageMemoryConsumer(MC_USER, Page); PageOp->Status = STATUS_SUCCESS; @@ -1828,7 +1828,7 @@ MmPageOutSectionView(PMM_AVL_TABLE AddressSpace, MmUnlockAddressSpace(AddressSpace); if (!NT_SUCCESS(Status)) { - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } } else @@ -1903,7 +1903,7 @@ MmWritePageSectionView(PMM_AVL_TABLE AddressSpace, DPRINT1("Trying to write back page from physical memory mapped at %X " "process %d\n", Address, Process ? Process->UniqueProcessId : 0); - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } /* @@ -1914,7 +1914,7 @@ MmWritePageSectionView(PMM_AVL_TABLE AddressSpace, { DPRINT1("Trying to page out not-present page at (%d,0x%.8X).\n", Process ? Process->UniqueProcessId : 0, Address); - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } Page = MmGetPfnForProcess(Process, Address); SwapEntry = MmGetSavedSwapEntryPage(Page); @@ -2282,7 +2282,7 @@ MmCreatePhysicalMemorySection(VOID) if (!NT_SUCCESS(Status)) { DPRINT1("Failed to create PhysicalMemory section\n"); - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } Status = ObInsertObject(PhysSection, NULL, @@ -2723,7 +2723,7 @@ ExeFmtpReadFile(IN PVOID File, if(Length == 0) { - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } FileOffset = *Offset; @@ -2731,7 +2731,7 @@ ExeFmtpReadFile(IN PVOID File, /* Negative/special offset: it cannot be used in this context */ if(FileOffset.u.HighPart < 0) { - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } AdjustOffset = PAGE_ROUND_DOWN(FileOffset.u.LowPart); @@ -3134,7 +3134,7 @@ MmspPageAlignSegments */ else { - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } } } @@ -3903,7 +3903,7 @@ MmFreeSectionPage(PVOID Context, MEMORY_AREA* MemoryArea, PVOID Address, if (Status != STATUS_SUCCESS) { DPRINT1("Failed to wait for page op, status = %x\n", Status); - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } MmLockAddressSpace(AddressSpace); @@ -3937,7 +3937,7 @@ MmFreeSectionPage(PVOID Context, MEMORY_AREA* MemoryArea, PVOID Address, if (Segment->Flags & MM_PAGEFILE_SEGMENT) { DPRINT1("Found a swap entry for a page in a pagefile section.\n"); - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } MmFreeSwapPage(SwapEntry); } @@ -3952,7 +3952,7 @@ MmFreeSectionPage(PVOID Context, MEMORY_AREA* MemoryArea, PVOID Address, if (Segment->Flags & MM_PAGEFILE_SEGMENT) { DPRINT1("Found a private page in a pagefile section.\n"); - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } /* * Just dereference private pages @@ -4078,7 +4078,7 @@ MmUnmapViewOfSection(PEPROCESS Process, if (Status != STATUS_SUCCESS) { DPRINT1("Failed to wait for page op, status = %x\n", Status); - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } MmLockAddressSpace(AddressSpace); MemoryArea = MmLocateMemoryAreaByAddress(AddressSpace, @@ -4124,7 +4124,7 @@ MmUnmapViewOfSection(PEPROCESS Process, } if (i >= NrSegments) { - ASSERT(FALSE); + KeBugCheck(MEMORY_MANAGEMENT); } for (i = 0; i < NrSegments; i++) diff --git a/reactos/ntoskrnl/ob/obhandle.c b/reactos/ntoskrnl/ob/obhandle.c index 5a785def734..18170fbc37e 100644 --- a/reactos/ntoskrnl/ob/obhandle.c +++ b/reactos/ntoskrnl/ob/obhandle.c @@ -763,7 +763,7 @@ ObpCloseHandleTableEntry(IN PHANDLE_TABLE HandleTable, NTSTATUS NTAPI ObpIncrementHandleCount(IN PVOID Object, - IN PACCESS_STATE AccessState, + IN PACCESS_STATE AccessState OPTIONAL, IN KPROCESSOR_MODE AccessMode, IN ULONG HandleAttributes, IN PEPROCESS Process, diff --git a/reactos/ntoskrnl/ob/obname.c b/reactos/ntoskrnl/ob/obname.c index 79800319003..03501238336 100644 --- a/reactos/ntoskrnl/ob/obname.c +++ b/reactos/ntoskrnl/ob/obname.c @@ -497,13 +497,8 @@ ObpLookupObjectName(IN HANDLE RootHandle OPTIONAL, else { ParseFromRoot: - /* Check if we have a device map */ - if (DeviceMap) - { - /* Dereference it */ - //ObfDereferenceDeviceMap(DeviceMap); - DeviceMap = NULL; - } + /* FIXME: Check if we have a device map */ + ASSERT(DeviceMap == NULL); /* Check if this is a possible DOS name */ if (!((ULONG_PTR)(ObjectName->Buffer) & 7))