Map the NLS tables after creating the PEB.
[reactos.git] / reactos / ntoskrnl / mm / process.c
index b07b5da..3577dd2 100644 (file)
@@ -203,6 +203,14 @@ MmCreatePeb(PEPROCESS Process)
 
     DPRINT("MmCreatePeb\n");
 
 
     DPRINT("MmCreatePeb\n");
 
+    /* Allocate the PEB */
+    Peb = MiCreatePebOrTeb(Process, (PVOID)PEB_BASE);
+    if (Peb != (PVOID)PEB_BASE)
+    {
+        DPRINT1("MiCreatePebOrTeb() returned %x\n", Peb);
+        return STATUS_UNSUCCESSFUL;
+    }
+
     /* Map NLS Tables */
     DPRINT("Mapping NLS\n");
     Status = MmMapViewOfSection(NlsSectionObject,
     /* Map NLS Tables */
     DPRINT("Mapping NLS\n");
     Status = MmMapViewOfSection(NlsSectionObject,
@@ -225,9 +233,6 @@ MmCreatePeb(PEPROCESS Process)
     /* Attach to Process */
     KeAttachProcess(&Process->Pcb);
 
     /* Attach to Process */
     KeAttachProcess(&Process->Pcb);
 
-    /* Allocate the PEB */
-    Peb = MiCreatePebOrTeb(Process, (PVOID)PEB_BASE);
-
     /* Initialize the PEB */
     DPRINT("Allocated: %x\n", Peb);
     RtlZeroMemory(Peb, sizeof(PEB));
     /* Initialize the PEB */
     DPRINT("Allocated: %x\n", Peb);
     RtlZeroMemory(Peb, sizeof(PEB));