David Welch turned me on to the right way to solve the cygwin fork section
authorArt Yerkes <art.yerkes@gmail.com>
Sun, 7 Mar 2004 17:48:41 +0000 (17:48 +0000)
committerArt Yerkes <art.yerkes@gmail.com>
Sun, 7 Mar 2004 17:48:41 +0000 (17:48 +0000)
map problem.  This fixes map_dup_inherit.

svn path=/trunk/; revision=8567

reactos/ntoskrnl/mm/anonmem.c

index edb0990..d01162c 100644 (file)
@@ -16,7 +16,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-/* $Id: anonmem.c,v 1.25 2004/03/05 11:31:59 hbirr Exp $
+/* $Id: anonmem.c,v 1.26 2004/03/07 17:48:41 arty Exp $
  *
  * PROJECT:     ReactOS kernel
  * FILE:        ntoskrnl/mm/anonmem.c
@@ -613,6 +613,19 @@ NtAllocateVirtualMemory(IN HANDLE  ProcessHandle,
            DPRINT("NtAllocateVirtualMemory() = %x\n",Status);
            return(Status);
          }
+       else if (MemoryArea != NULL && MemoryArea->Length >= RegionSize)
+         {
+           Status =
+             MmAlterRegion(AddressSpace,
+                           MemoryArea->BaseAddress,
+                           &MemoryArea->Data.SectionData.RegionListHead,
+                           BaseAddress, RegionSize,
+                           Type, Protect, MmModifyAttributes);
+           MmUnlockAddressSpace(AddressSpace);
+           ObDereferenceObject(Process);
+           DPRINT("NtAllocateVirtualMemory() = %x\n",Status);
+           return(Status);
+         }
        else if (MemoryArea != NULL)
          {
            MmUnlockAddressSpace(AddressSpace);