mirror of
https://github.com/reactos/reactos.git
synced 2024-10-04 00:13:57 +00:00
[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. svn path=/trunk/; revision=53059
This commit is contained in:
parent
6da0958817
commit
8be271b56b
|
@ -576,13 +576,7 @@ MmCreatePeb(IN PEPROCESS Process,
|
|||
// 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 @@ MmCreatePeb(IN PEPROCESS Process,
|
|||
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 @@ MmCreatePeb(IN PEPROCESS Process,
|
|||
// 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 @@ MmCreatePeb(IN PEPROCESS Process,
|
|||
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 @@ MmCreatePeb(IN PEPROCESS Process,
|
|||
//
|
||||
// Force it to use CPU 0
|
||||
//
|
||||
/* FIXME: this should use the MmRotatingUniprocessorNumber */
|
||||
Peb->ImageProcessAffinityMask = 0;
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue