[CMAKE]
[reactos.git] / ntoskrnl / ps / process.c
index fea26c9..01f9a77 100644 (file)
@@ -469,14 +469,14 @@ PspCreateProcess(OUT PHANDLE ProcessHandle,
         if (Parent != PsInitialSystemProcess)
         {
             /* It's not, so acquire the process rundown */
-            if (ExAcquireRundownProtection(&Process->RundownProtect))
+            if (ExAcquireRundownProtection(&Parent->RundownProtect))
             {
                 /* If the parent has a section, use it */
                 SectionObject = Parent->SectionObject;
                 if (SectionObject) ObReferenceObject(SectionObject);
 
                 /* Release process rundown */
-                ExReleaseRundownProtection(&Process->RundownProtect);
+                ExReleaseRundownProtection(&Parent->RundownProtect);
             }
 
             /* If we don't have a section object */
@@ -669,6 +669,13 @@ PspCreateProcess(OUT PHANDLE ProcessHandle,
         }
     }
 
+#if MI_TRACE_PFNS
+    /* Copy the process name now that we have it */
+    memcpy(MiGetPfnEntry(Process->Pcb.DirectoryTableBase[0] >> PAGE_SHIFT)->ProcessName, Process->ImageFileName, 16);
+    if (Process->Pcb.DirectoryTableBase[1]) memcpy(MiGetPfnEntry(Process->Pcb.DirectoryTableBase[1] >> PAGE_SHIFT)->ProcessName, Process->ImageFileName, 16);
+    if (Process->WorkingSetPage) memcpy(MiGetPfnEntry(Process->WorkingSetPage)->ProcessName, Process->ImageFileName, 16);
+#endif
+
     /* Check if we have a section object and map the system DLL */
     if (SectionObject) PspMapSystemDll(Process, NULL, FALSE);