[NTOS]
[reactos.git] / reactos / ntoskrnl / mm / ARM3 / procsup.c
index 7cfa0b3..9a0ae20 100644 (file)
@@ -687,20 +687,19 @@ MmCreatePeb(IN PEPROCESS Process,
         Peb->NumberOfProcessors = KeNumberProcessors;
         Peb->BeingDebugged = (BOOLEAN)(Process->DebugPort != NULL);
         Peb->NtGlobalFlag = NtGlobalFlag;
-        /*Peb->HeapSegmentReserve = MmHeapSegmentReserve;
-         Peb->HeapSegmentCommit = MmHeapSegmentCommit;
-         Peb->HeapDeCommitTotalFreeThreshold = MmHeapDeCommitTotalFreeThreshold;
-         Peb->HeapDeCommitFreeBlockThreshold = MmHeapDeCommitFreeBlockThreshold;
-         Peb->CriticalSectionTimeout = MmCriticalSectionTimeout;
-         Peb->MinimumStackCommit = MmMinimumStackCommitInBytes;
-         */
+        Peb->HeapSegmentReserve = MmHeapSegmentReserve;
+        Peb->HeapSegmentCommit = MmHeapSegmentCommit;
+        Peb->HeapDeCommitTotalFreeThreshold = MmHeapDeCommitTotalFreeThreshold;
+        Peb->HeapDeCommitFreeBlockThreshold = MmHeapDeCommitFreeBlockThreshold;
+        Peb->CriticalSectionTimeout = MmCriticalSectionTimeout;
+        Peb->MinimumStackCommit = MmMinimumStackCommitInBytes;
         Peb->MaximumNumberOfHeaps = (PAGE_SIZE - sizeof(PEB)) / sizeof(PVOID);
         Peb->ProcessHeaps = (PVOID*)(Peb + 1);
 
         //
         // Session ID
         //
-        MmGetSessionId(Process);
+        if (Process->Session) Peb->SessionId = MmGetSessionId(Process);
     }
     _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
     {
@@ -1577,11 +1576,11 @@ MiReleaseProcessReferenceToSessionDataPage(IN PMM_SESSION_SPACE SessionGlobal)
 
     /* Get the session ID */
     SessionId = SessionGlobal->SessionId;
-    DPRINT1("Last process in sessino %d going down!!!\n", SessionId);
+    DPRINT1("Last process in session %lu going down!!!\n", SessionId);
 
     /* Free the session page tables */
 #ifndef _M_AMD64
-    ExFreePool(SessionGlobal->PageTables);
+    ExFreePoolWithTag(SessionGlobal->PageTables, 'tHmM');
 #endif
     ASSERT(!MI_IS_PHYSICAL_ADDRESS(SessionGlobal));
 
@@ -1644,7 +1643,8 @@ MiSessionRemoveProcess(VOID)
     ASSERT(MmIsAddressValid(MmSessionSpace) == TRUE);
 
     /* Remove the process from the list ,and dereference the session */
-    RemoveEntryList(&CurrentProcess->SessionProcessLinks);
+    // DO NOT ENABLE THIS UNLESS YOU FIXED THE NP POOL CORRUPTION THAT IT CAUSES!!!
+    //RemoveEntryList(&CurrentProcess->SessionProcessLinks);
     //MiDereferenceSession();
 }
 
@@ -1673,7 +1673,8 @@ MiSessionAddProcess(IN PEPROCESS NewProcess)
     NewProcess->Session = SessionGlobal;
 
     /* Insert it into the process list */
-    InsertTailList(&SessionGlobal->ProcessList, &NewProcess->SessionProcessLinks);
+    // DO NOT ENABLE THIS UNLESS YOU FIXED THE NP POOL CORRUPTION THAT IT CAUSES!!!
+    //InsertTailList(&SessionGlobal->ProcessList, &NewProcess->SessionProcessLinks);
 
     /* Set the flag */
     PspSetProcessFlag(NewProcess, PSF_PROCESS_IN_SESSION_BIT);
@@ -1985,7 +1986,7 @@ MiSessionCreateInternal(OUT PULONG SessionId)
     MmSessionSpace->PageTables[PointerPde - MiAddressToPde(MmSessionBase)] = *PointerPde;
 #endif
     InitializeListHead(&MmSessionSpace->ImageList);
-    DPRINT1("Session %d is ready to go: 0x%p 0x%p, %lx 0x%p\n",
+    DPRINT1("Session %lu is ready to go: 0x%p 0x%p, %lx 0x%p\n",
             *SessionId, MmSessionSpace, SessionGlobal, SessionPageDirIndex, PageTables);
 
     /* Initialize session pool */