Author: ion
Date: Thu Aug 4 13:10:57 2011
New Revision: 53059
URL:
http://svn.reactos.org/svn/reactos?rev=53059&view=rev
Log:
[NTOSKRNL]: NLS tables should be mapped before PEB.
[NTOSKRNL]: Handle failure of NLS and PEB mapping correctly.
[NTOSKRNL]: Only set Peb->OsCSDVersion if NtHeader->Win32VersionValue is set.
Modified:
trunk/reactos/ntoskrnl/mm/ARM3/procsup.c
Modified: trunk/reactos/ntoskrnl/mm/ARM3/procsup.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/procsup.c…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/ARM3/procsup.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/ARM3/procsup.c [iso-8859-1] Thu Aug 4 13:10:57 2011
@@ -576,13 +576,7 @@
// Attach to Process
//
KeAttachProcess(&Process->Pcb);
-
- //
- // Allocate the PEB
- //
- Status = MiCreatePebOrTeb(Process, sizeof(PEB), (PULONG_PTR)&Peb);
- ASSERT(NT_SUCCESS(Status));
-
+
//
// Map NLS Tables
//
@@ -596,7 +590,25 @@
ViewShare,
MEM_TOP_DOWN,
PAGE_READONLY);
- if (!NT_SUCCESS(Status)) return Status;
+ DPRINT1("NLS Tables at: %p\n", TableBase);
+ if (!NT_SUCCESS(Status))
+ {
+ /* Cleanup and exit */
+ KeDetachProcess();
+ return Status;
+ }
+
+ //
+ // Allocate the PEB
+ //
+ Status = MiCreatePebOrTeb(Process, sizeof(PEB), (PULONG_PTR)&Peb);
+ DPRINT1("PEB at: %p\n", Peb);
+ if (!NT_SUCCESS(Status))
+ {
+ /* Cleanup and exit */
+ KeDetachProcess();
+ return Status;
+ }
//
// Use SEH in case we can't load the PEB
@@ -636,7 +648,7 @@
// Heap and Debug Data
//
Peb->NumberOfProcessors = KeNumberProcessors;
- Peb->BeingDebugged = (BOOLEAN)(Process->DebugPort != NULL ? TRUE : FALSE);
+ Peb->BeingDebugged = (BOOLEAN)(Process->DebugPort != NULL);
Peb->NtGlobalFlag = NtGlobalFlag;
/*Peb->HeapSegmentReserve = MmHeapSegmentReserve;
Peb->HeapSegmentCommit = MmHeapSegmentCommit;
@@ -730,34 +742,20 @@
Peb->OSMinorVersion = (NtHeaders->OptionalHeader.Win32VersionValue
>> 8) & 0xFF;
Peb->OSBuildNumber = (NtHeaders->OptionalHeader.Win32VersionValue
>> 16) & 0x3FFF;
Peb->OSPlatformId = (NtHeaders->OptionalHeader.Win32VersionValue
>> 30) ^ 2;
- }
-
- //
- // Process the image config data overrides if specfied
- //
- if (ImageConfigData != NULL)
- {
- //
- // Process CSD version override
- //
- if (ImageConfigData->CSDVersion)
+
+ /* Process CSD version override */
+ if ((ImageConfigData) && (ImageConfigData->CSDVersion))
{
- //
- // Set new data
- //
+ /* Take the value from the image configuration directory */
Peb->OSCSDVersion = ImageConfigData->CSDVersion;
}
-
- //
- // Process affinity mask ovverride
- //
- if (ImageConfigData->ProcessAffinityMask)
- {
- //
- // Set new data
- //
- ProcessAffinityMask = ImageConfigData->ProcessAffinityMask;
- }
+ }
+
+ /* Process optional process affinity mask override */
+ if ((ImageConfigData) && (ImageConfigData->ProcessAffinityMask))
+ {
+ /* Take the value from the image configuration directory */
+ ProcessAffinityMask = ImageConfigData->ProcessAffinityMask;
}
//
@@ -767,6 +765,7 @@
//
// Force it to use CPU 0
//
+ /* FIXME: this should use the MmRotatingUniprocessorNumber */
Peb->ImageProcessAffinityMask = 0;
}
else