[ros-diffs] [fireball] 37668: - 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.

fireball at svn.reactos.org fireball at svn.reactos.org
Wed Nov 26 19:56:42 CET 2008


Author: fireball
Date: Wed Nov 26 12:56:41 2008
New Revision: 37668

URL: http://svn.reactos.org/svn/reactos?rev=37668&view=rev
Log:
- 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.

Modified:
    trunk/reactos/include/ddk/winddk.h
    trunk/reactos/include/ndk/rtlfuncs.h
    trunk/reactos/ntoskrnl/dbgk/dbgkobj.c
    trunk/reactos/ntoskrnl/ex/atom.c
    trunk/reactos/ntoskrnl/include/internal/i386/asmmacro.S
    trunk/reactos/ntoskrnl/io/iomgr/irp.c
    trunk/reactos/ntoskrnl/io/pnpmgr/pnproot.c
    trunk/reactos/ntoskrnl/ke/apc.c
    trunk/reactos/ntoskrnl/ke/bug.c
    trunk/reactos/ntoskrnl/ke/i386/exp.c
    trunk/reactos/ntoskrnl/ke/i386/v86m_sup.S
    trunk/reactos/ntoskrnl/lpc/send.c
    trunk/reactos/ntoskrnl/mm/i386/page.c
    trunk/reactos/ntoskrnl/mm/section.c
    trunk/reactos/ntoskrnl/ob/obhandle.c
    trunk/reactos/ntoskrnl/ob/obname.c

Modified: trunk/reactos/include/ddk/winddk.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/ddk/winddk.h?rev=37668&r1=37667&r2=37668&view=diff
==============================================================================
--- trunk/reactos/include/ddk/winddk.h [iso-8859-1] (original)
+++ trunk/reactos/include/ddk/winddk.h [iso-8859-1] Wed Nov 26 12:56:41 2008
@@ -7666,12 +7666,14 @@
 NTKERNELAPI
 VOID
 NTAPI
+__declspec(noreturn)
 ExRaiseAccessViolation(
   VOID);
 
 NTKERNELAPI
 VOID
 NTAPI
+__declspec(noreturn)
 ExRaiseDatatypeMisalignment(
   VOID);
 
@@ -7679,6 +7681,7 @@
 NTKERNELAPI
 VOID
 NTAPI
+__declspec(noreturn)
 ExRaiseStatus(
   IN NTSTATUS  Status);
 
@@ -9603,12 +9606,14 @@
 NTKERNELAPI
 VOID
 NTAPI
+__declspec(noreturn)
 KeBugCheck(
   IN ULONG  BugCheckCode);
 
 NTKERNELAPI
 VOID
 NTAPI
+__declspec(noreturn)
 KeBugCheckEx(
   IN ULONG  BugCheckCode,
   IN ULONG_PTR  BugCheckParameter1,

Modified: trunk/reactos/include/ndk/rtlfuncs.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/rtlfuncs.h?rev=37668&r1=37667&r2=37668&view=diff
==============================================================================
--- trunk/reactos/include/ndk/rtlfuncs.h [iso-8859-1] (original)
+++ trunk/reactos/include/ndk/rtlfuncs.h [iso-8859-1] Wed Nov 26 12:56:41 2008
@@ -431,6 +431,7 @@
 NTSYSAPI
 VOID
 NTAPI
+__declspec(noreturn)
 RtlRaiseStatus(
     IN NTSTATUS Status
 );

Modified: trunk/reactos/ntoskrnl/dbgk/dbgkobj.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/dbgk/dbgkobj.c?rev=37668&r1=37667&r2=37668&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/dbgk/dbgkobj.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/dbgk/dbgkobj.c [iso-8859-1] Wed Nov 26 12:56:41 2008
@@ -603,7 +603,7 @@
     else
     {
         /* Get the first thread ourselves */
-        ThisThread = PsGetNextProcessThread(Process, OldThread);
+        ThisThread = PsGetNextProcessThread(Process, NULL);
         IsFirstThread = TRUE;
     }
 

Modified: trunk/reactos/ntoskrnl/ex/atom.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ex/atom.c?rev=37668&r1=37667&r2=37668&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/ex/atom.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ex/atom.c [iso-8859-1] Wed Nov 26 12:56:41 2008
@@ -92,7 +92,7 @@
     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 @@
         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)
@@ -147,11 +150,6 @@
             Status = _SEH2_GetExceptionCode();
         }
         _SEH2_END;
-    }
-    else
-    {
-        /* Simplify code and re-use one variable */
-        if (AtomName) CapturedName = AtomName;
     }
 
     /* Make sure probe worked */
@@ -261,6 +259,9 @@
         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)
@@ -301,11 +302,6 @@
             Status = _SEH2_GetExceptionCode();
         }
         _SEH2_END;
-    }
-    else
-    {
-        /* Simplify code and re-use one variable */
-        if (AtomName) CapturedName = AtomName;
     }
 
     /* Make sure probe worked */

Modified: trunk/reactos/ntoskrnl/include/internal/i386/asmmacro.S
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/i386/asmmacro.S?rev=37668&r1=37667&r2=37668&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/i386/asmmacro.S [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/include/internal/i386/asmmacro.S [iso-8859-1] Wed Nov 26 12:56:41 2008
@@ -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
 
 //
@@ -196,6 +211,23 @@
 .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
 //
 // This macro prints out visible message and hangs the computer.

Modified: trunk/reactos/ntoskrnl/io/iomgr/irp.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/irp.c?rev=37668&r1=37667&r2=37668&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/io/iomgr/irp.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/io/iomgr/irp.c [iso-8859-1] Wed Nov 26 12:56:41 2008
@@ -519,6 +519,8 @@
     /* 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 @@
     }
     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;
     }

Modified: trunk/reactos/ntoskrnl/io/pnpmgr/pnproot.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/pnpmgr/pnproot.c?rev=37668&r1=37667&r2=37668&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/io/pnpmgr/pnproot.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/io/pnpmgr/pnproot.c [iso-8859-1] Wed Nov 26 12:56:41 2008
@@ -4,7 +4,7 @@
  * FILE:            ntoskrnl/io/pnpmgr/pnproot.c
  * PURPOSE:         PnP manager root device
  * PROGRAMMERS:     Casper S. Hornstrup (chorns at users.sourceforge.net)
- *                  Copyright 2007 Hervé Poussineau (hpoussin at reactos.org)
+ *                  Copyright 2007 Herv? Poussineau (hpoussin at reactos.org)
  */
 
 /* INCLUDES ******************************************************************/
@@ -503,8 +503,10 @@
         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;
 }

Modified: trunk/reactos/ntoskrnl/ke/apc.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/apc.c?rev=37668&r1=37667&r2=37668&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/ke/apc.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ke/apc.c [iso-8859-1] Wed Nov 26 12:56:41 2008
@@ -90,6 +90,7 @@
     KPROCESSOR_MODE ApcMode;
     PLIST_ENTRY ListHead, NextEntry;
     PKAPC QueuedApc;
+    PKGATE Gate;
     NTSTATUS Status;
     BOOLEAN RequestInterrupt = FALSE;
 
@@ -211,24 +212,42 @@
                 }
                 else if (Thread->State == GateWait)
                 {
-                    /* We were in a gate wait. Handle this. */
-                    DPRINT1("A thread was in a gate wait\n");
-
-                    /* 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 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(&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) &&

Modified: trunk/reactos/ntoskrnl/ke/bug.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/bug.c?rev=37668&r1=37667&r2=37668&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/ke/bug.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ke/bug.c [iso-8859-1] Wed Nov 26 12:56:41 2008
@@ -546,11 +546,13 @@
 
 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 @@
                                      &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 @@
 
 VOID
 NTAPI
+__declspec(noreturn)
 KeBugCheckWithTf(IN ULONG BugCheckCode,
                  IN ULONG_PTR BugCheckParameter1,
                  IN ULONG_PTR BugCheckParameter2,

Modified: trunk/reactos/ntoskrnl/ke/i386/exp.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/exp.c?rev=37668&r1=37667&r2=37668&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/ke/i386/exp.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ke/i386/exp.c [iso-8859-1] Wed Nov 26 12:56:41 2008
@@ -124,7 +124,7 @@
             NewMask |= DR_MASK(DR7_OVERRIDE_V);
 
             /* Set DR7 override */
-            *DrMask |= DR7_OVERRIDE_MASK;
+            *Dr7Ptr |= DR7_OVERRIDE_MASK;
         }
         else
         {

Modified: trunk/reactos/ntoskrnl/ke/i386/v86m_sup.S
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/v86m_sup.S?rev=37668&r1=37667&r2=37668&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/ke/i386/v86m_sup.S [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ke/i386/v86m_sup.S [iso-8859-1] Wed Nov 26 12:56:41 2008
@@ -10,6 +10,7 @@
 
 #include <asm.h>
 #include <internal/i386/asmmacro.S>
+#undef LOCK
 .intel_syntax noprefix
 
 /* FIXME: Can we make a nice macro to generate V86 Opcode handlers? */
@@ -139,45 +140,17 @@
     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 @@
     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 @@
     add edx, 4
 
     /* Check for OPER32 prefix */
-    test ebx, 0x4000
+    test ebx, PREFIX_FLAG_OPER32
     jnz NoPrefix
 
     /* Skip 2 bytes */
@@ -431,7 +404,7 @@
     add ecx, edx
 
     /* Check for OPER32 prefix */
-    test ebx, 0x4000
+    test ebx, PREFIX_FLAG_OPER32
     jnz Iret32
 
     /* Get flat IP */
@@ -576,21 +549,6 @@
     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:
 
@@ -631,6 +589,23 @@
     /* Return success */
     mov eax, 1
     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

Modified: trunk/reactos/ntoskrnl/lpc/send.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/lpc/send.c?rev=37668&r1=37667&r2=37668&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/lpc/send.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/lpc/send.c [iso-8859-1] Wed Nov 26 12:56:41 2008
@@ -256,6 +256,7 @@
         /* FIXME: TODO */
         Semaphore = NULL; // we'd use the Thread Semaphore here
         ASSERT(FALSE);
+        return STATUS_NOT_IMPLEMENTED;
     }
     else
     {

Modified: trunk/reactos/ntoskrnl/mm/i386/page.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/i386/page.c?rev=37668&r1=37667&r2=37668&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/mm/i386/page.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/i386/page.c [iso-8859-1] Wed Nov 26 12:56:41 2008
@@ -97,7 +97,7 @@
     else
     {
         DPRINT1("Unknown main protection type.\n");
-        ASSERT(FALSE);
+        KeBugCheck(MEMORY_MANAGEMENT);
     }
     
     if (flProtect & PAGE_SYSTEM)
@@ -241,7 +241,7 @@
     
     if (Address >= MmSystemRangeStart)
     {
-        ASSERT(FALSE);
+        KeBugCheck(MEMORY_MANAGEMENT);
         //       MmGlobalKernelPageDirectory[ADDR_TO_PDE_OFFSET(Address)] = 0;
     }
     if (Process != NULL && Process != CurrentProcess)
@@ -264,7 +264,7 @@
         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 @@
             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 @@
         Pt = MmCreateHyperspaceMapping(Pfn);
         if (Pt == NULL)
         {
-            ASSERT(FALSE);
+            KeBugCheck(MEMORY_MANAGEMENT);
         }
         return Pt + ADDR_TO_PTE_OFFSET(Address);
     }
@@ -311,7 +311,7 @@
                 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 @@
             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 @@
     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 @@
     WasValid = (PAGE_MASK(Pte) != 0);
     if (!WasValid)
     {
-        ASSERT(FALSE);
+        KeBugCheck(MEMORY_MANAGEMENT);
     }
     
     /*
@@ -582,14 +582,14 @@
     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 @@
     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 @@
     Pt = MmGetPageTableForProcess(Process, Address, FALSE);
     if (Pt == NULL)
     {
-        ASSERT(FALSE);
+        KeBugCheck(MEMORY_MANAGEMENT);
     }
     
     do
@@ -704,7 +704,7 @@
     if (Address < MmSystemRangeStart)
     {
         DPRINT1("MmCreateVirtualMappingForKernel is called for user space\n");
-        ASSERT(FALSE);
+        KeBugCheck(MEMORY_MANAGEMENT);
     }
     
     Attributes = ProtectToPTE(flProtect);
@@ -724,7 +724,7 @@
     Pt = MmGetPageTableForProcess(NULL, Addr, TRUE);
     if (Pt == NULL)
     {
-        ASSERT(FALSE);
+        KeBugCheck(MEMORY_MANAGEMENT);
     }
     Pt--;
     
@@ -735,7 +735,7 @@
             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 @@
             Pt = MmGetPageTableForProcess(NULL, Addr, TRUE);
             if (Pt == NULL)
             {
-                ASSERT(FALSE);
+                KeBugCheck(MEMORY_MANAGEMENT);
             }
         }
         else
@@ -756,7 +756,7 @@
         Pte = *Pt;
         if (Pte != 0)
         {
-            ASSERT(FALSE);
+            KeBugCheck(MEMORY_MANAGEMENT);
         }
         InterlockedExchangePte(Pt, PFN_TO_PTE(Pages[i]) | Attributes);
     }
@@ -776,22 +776,22 @@
     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 @@
         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 @@
         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 @@
             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 @@
             Pt = MmGetPageTableForProcess(Process, Addr, TRUE);
             if (Pt == NULL)
             {
-                ASSERT(FALSE);
+                KeBugCheck(MEMORY_MANAGEMENT);
             }
         }
         else
@@ -911,7 +911,7 @@
         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 @@
         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 @@
     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 @@
             }
             if (i >= Page % 1024)
             {
-                ASSERT(FALSE);
+                KeBugCheck(MEMORY_MANAGEMENT);
             }
         }
     }
@@ -1124,7 +1124,7 @@
             }
             if (i <= Page % 1024)
             {
-                ASSERT(FALSE);
+                KeBugCheck(MEMORY_MANAGEMENT);
             }
         }
     }
@@ -1158,7 +1158,7 @@
     
     if (Address < MmSystemRangeStart)
     {
-        ASSERT(FALSE);
+        KeBugCheck(MEMORY_MANAGEMENT);
     }
     
     StartOffset = ADDR_TO_PDE_OFFSET(Address);
@@ -1237,7 +1237,7 @@
                                 BoundaryAddressMultiple);
     if (!NT_SUCCESS(Status))
     {
-        ASSERT(FALSE);
+        KeBugCheck(MEMORY_MANAGEMENT);
     }
     BaseAddress = (PVOID)HYPERSPACE;
     Status = MmCreateMemoryArea(MmGetKernelAddressSpace(),
@@ -1251,7 +1251,7 @@
                                 BoundaryAddressMultiple);
     if (!NT_SUCCESS(Status))
     {
-        ASSERT(FALSE);
+        KeBugCheck(MEMORY_MANAGEMENT);
     }
 }
 

Modified: trunk/reactos/ntoskrnl/mm/section.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/section.c?rev=37668&r1=37667&r2=37668&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/mm/section.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/section.c [iso-8859-1] Wed Nov 26 12:56:41 2008
@@ -291,7 +291,7 @@
          {
             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 @@
       if (Segment->ReferenceCount != 0)
       {
          DPRINT1("Data segment still referenced\n");
-         ASSERT(FALSE);
+          KeBugCheck(MEMORY_MANAGEMENT);
       }
       MmFreePageTablesSectionSegment(Segment);
       ExFreePool(Segment);
@@ -357,7 +357,7 @@
                                      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 @@
    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 @@
    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 @@
             if (!NT_SUCCESS(Status))
             {
                DPRINT1("CcRosUnmapCacheSegment failed, status = %x\n", Status);
-               ASSERT(FALSE);
+                KeBugCheck(MEMORY_MANAGEMENT);
             }
          }
       }
@@ -534,7 +534,7 @@
                   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 @@
          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 @@
    if (PageOp == NULL)
    {
       DPRINT1("MmGetPageOp failed\n");
-      ASSERT(FALSE);
+       KeBugCheck(MEMORY_MANAGEMENT);
    }
 
    /*
@@ -834,12 +834,12 @@
       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 @@
          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 @@
       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 @@
       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 @@
       if (!NT_SUCCESS(Status))
       {
          DPRINT("MmCreateVirtualMapping failed, not out of memory\n");
-         ASSERT(FALSE);
+          KeBugCheck(MEMORY_MANAGEMENT);
          return(Status);
       }
 
@@ -999,7 +999,7 @@
       if (!NT_SUCCESS(Status))
       {
          DPRINT("MmCreateVirtualMappingUnsafe failed, not out of memory\n");
-         ASSERT(FALSE);
+          KeBugCheck(MEMORY_MANAGEMENT);
          return(Status);
       }
       /*
@@ -1035,7 +1035,7 @@
       }
       if (!NT_SUCCESS(Status))
       {
-         ASSERT(FALSE);
+          KeBugCheck(MEMORY_MANAGEMENT);
       }
       Status = MmCreateVirtualMapping(Process,
                                       Address,
@@ -1045,7 +1045,7 @@
       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 @@
       if (Entry != Entry1)
       {
          DPRINT1("Someone changed ppte entry while we slept\n");
-         ASSERT(FALSE);
+          KeBugCheck(MEMORY_MANAGEMENT);
       }
 
       /*
@@ -1145,7 +1145,7 @@
       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 @@
       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 @@
       if (Entry != Entry1)
       {
          DPRINT1("Someone changed ppte entry while we slept\n");
-         ASSERT(FALSE);
+          KeBugCheck(MEMORY_MANAGEMENT);
       }
 
       /*
@@ -1220,7 +1220,7 @@
       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 @@
       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 @@
    if (PageOp == NULL)
    {
       DPRINT1("MmGetPageOp failed\n");
-      ASSERT(FALSE);
+       KeBugCheck(MEMORY_MANAGEMENT);
    }
 
    /*
@@ -1362,12 +1362,12 @@
       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 @@
    Status = MmRequestPageMemoryConsumer(MC_USER, TRUE, &NewPage);
    if (!NT_SUCCESS(Status))
    {
-      ASSERT(FALSE);
+       KeBugCheck(MEMORY_MANAGEMENT);
    }
 
    /*
@@ -1414,13 +1414,13 @@
    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 @@
       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 @@
    {
       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 @@
       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 @@
       if (!(Context.Segment->Flags & MM_PAGEFILE_SEGMENT) &&
             !(Context.Segment->Characteristics & IMAGE_SCN_MEM_SHARED))
       {
-         ASSERT(FALSE);
+          KeBugCheck(MEMORY_MANAGEMENT);
       }
    }
 
@@ -1626,7 +1626,7 @@
       {
          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 @@
       {
          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 @@
       {
          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 @@
       {
          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 @@
       MmUnlockAddressSpace(AddressSpace);
       if (!NT_SUCCESS(Status))
       {
-         ASSERT(FALSE);
+         KeBugCheck(MEMORY_MANAGEMENT);
       }
       MmReleasePageMemoryConsumer(MC_USER, Page);
       PageOp->Status = STATUS_SUCCESS;
@@ -1828,7 +1828,7 @@
       MmUnlockAddressSpace(AddressSpace);
       if (!NT_SUCCESS(Status))
       {
-         ASSERT(FALSE);
+         KeBugCheck(MEMORY_MANAGEMENT);
       }
    }
    else
@@ -1903,7 +1903,7 @@
       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 @@
    {
       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 @@
    if (!NT_SUCCESS(Status))
    {
       DPRINT1("Failed to create PhysicalMemory section\n");
-      ASSERT(FALSE);
+      KeBugCheck(MEMORY_MANAGEMENT);
    }
    Status = ObInsertObject(PhysSection,
                            NULL,
@@ -2723,7 +2723,7 @@
 
    if(Length == 0)
    {
-      ASSERT(FALSE);
+      KeBugCheck(MEMORY_MANAGEMENT);
    }
 
    FileOffset = *Offset;
@@ -2731,7 +2731,7 @@
    /* 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 @@
           */
          else
          {
-            ASSERT(FALSE);
+            KeBugCheck(MEMORY_MANAGEMENT);
          }
       }
    }
@@ -3903,7 +3903,7 @@
       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 @@
       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 @@
          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 @@
             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 @@
       }
       if (i >= NrSegments)
       {
-         ASSERT(FALSE);
+         KeBugCheck(MEMORY_MANAGEMENT);
       }
 
       for (i = 0; i < NrSegments; i++)

Modified: trunk/reactos/ntoskrnl/ob/obhandle.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ob/obhandle.c?rev=37668&r1=37667&r2=37668&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/ob/obhandle.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ob/obhandle.c [iso-8859-1] Wed Nov 26 12:56:41 2008
@@ -763,7 +763,7 @@
 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,

Modified: trunk/reactos/ntoskrnl/ob/obname.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ob/obname.c?rev=37668&r1=37667&r2=37668&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/ob/obname.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ob/obname.c [iso-8859-1] Wed Nov 26 12:56:41 2008
@@ -497,13 +497,8 @@
         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))



More information about the Ros-diffs mailing list