[NTOS]: Allocate the PEB at a pseudo-random address just like Windows XP SP2 and...
[reactos.git] / reactos / ntoskrnl / mm / procsup.c
index 1e5bd9a..fce21f5 100644 (file)
@@ -17,80 +17,6 @@ VOID NTAPI MiRosTakeOverPebTebRanges(IN PEPROCESS Process);
 
 /* FUNCTIONS *****************************************************************/
  
-PVOID
-NTAPI
-MiCreatePebOrTeb(PEPROCESS Process,
-                 PVOID BaseAddress)
-{
-    NTSTATUS Status;
-    PMMSUPPORT ProcessAddressSpace = &Process->Vm;
-    PMEMORY_AREA MemoryArea;
-    PHYSICAL_ADDRESS BoundaryAddressMultiple;
-    PVOID AllocatedBase = BaseAddress;
-    BoundaryAddressMultiple.QuadPart = 0;
-
-    /* Acquire the Lock */
-    MmLockAddressSpace(ProcessAddressSpace);
-
-    /*
-     * Create a Peb or Teb.
-     * Loop until it works, decreasing by PAGE_SIZE each time. The logic here
-     * is that a PEB allocation should never fail since the address is free,
-     * while TEB allocation can fail, and we should simply try the address
-     * below. Is there a nicer way of doing this automagically? (ie: findning)
-     * a gap region? -- Alex
-     */
-    do {
-        DPRINT("Trying to allocate: %x\n", AllocatedBase);
-        Status = MmCreateMemoryArea(ProcessAddressSpace,
-                                    MEMORY_AREA_PEB_OR_TEB,
-                                    &AllocatedBase,
-                                    PAGE_SIZE,
-                                    PAGE_READWRITE,
-                                    &MemoryArea,
-                                    TRUE,
-                                    0,
-                                    BoundaryAddressMultiple);
-        AllocatedBase = RVA(AllocatedBase, -PAGE_SIZE);
-    } while (Status != STATUS_SUCCESS);
-
-    /* Initialize the Region */
-    MmInitializeRegion(&MemoryArea->Data.VirtualMemoryData.RegionListHead,
-                       PAGE_SIZE,
-                       MEM_COMMIT,
-                       PAGE_READWRITE);
-
-    /* Reserve the pages */
-    MmReserveSwapPages(PAGE_SIZE);
-
-    /* Unlock Address Space */
-    DPRINT("Returning\n");
-    MmUnlockAddressSpace(ProcessAddressSpace);
-    return RVA(AllocatedBase, PAGE_SIZE);
-}
-
-VOID
-NTAPI
-MmDeleteTeb(PEPROCESS Process,
-            PTEB Teb)
-{
-    PMMSUPPORT ProcessAddressSpace = &Process->Vm;
-    PMEMORY_AREA MemoryArea;
-
-    /* Lock the Address Space */
-    MmLockAddressSpace(ProcessAddressSpace);
-
-    MemoryArea = MmLocateMemoryAreaByAddress(ProcessAddressSpace, (PVOID)Teb);
-    if (MemoryArea)
-    {
-       /* Delete the Teb */
-       MmFreeVirtualMemory(Process, MemoryArea);
-    }
-
-    /* Unlock the Address Space */
-    MmUnlockAddressSpace(ProcessAddressSpace);
-}
-
 NTSTATUS
 NTAPI
 MmInitializeHandBuiltProcess2(IN PEPROCESS Process)