diff --git "a/ntoskrnl/mm/section.c" "b/ntoskrnl/mm/section.c" index c01bf3792f3..015988c3c81 100644 --- "a/ntoskrnl/mm/section.c" +++ "b/ntoskrnl/mm/section.c" @@ -3608,6 +3608,7 @@ MiRosUnmapViewOfSection( NTSTATUS Status; PMMSUPPORT AddressSpace; PVOID ImageBaseAddress = 0; + ULONG MapCount = 0; DPRINT("Opening memory area Process %p BaseAddress %p\n", Process, BaseAddress); @@ -3676,7 +3677,7 @@ MiRosUnmapViewOfSection( } } DPRINT("One mapping less for %p\n", ImageSectionObject->FileObject->SectionObjectPointer); - InterlockedDecrement(&ImageSectionObject->MapCount); + MapCount = InterlockedDecrement(&ImageSectionObject->MapCount); } else { @@ -3746,7 +3747,8 @@ MiRosUnmapViewOfSection( } /* Notify debugger */ - if (ImageBaseAddress && !SkipDebuggerNotify) DbgkUnMapViewOfSection(ImageBaseAddress); + if (ImageBaseAddress && !SkipDebuggerNotify && MapCount == 0) + DbgkUnMapViewOfSection(ImageBaseAddress); return STATUS_SUCCESS; }