mirror of
https://github.com/reactos/reactos.git
synced 2025-04-04 20:50:41 +00:00
Fix physical memory section creation
This commit is contained in:
parent
91f6fa0259
commit
543112008a
1 changed files with 20 additions and 14 deletions
|
@ -2068,7 +2068,7 @@ MmCreatePhysicalMemorySection(VOID)
|
|||
/*
|
||||
* Create the section mapping physical memory
|
||||
*/
|
||||
SectionSize.QuadPart = MmNumberOfPhysicalPages * PAGE_SIZE;
|
||||
SectionSize.QuadPart = MmHighestPhysicalPage * PAGE_SIZE;
|
||||
InitializeObjectAttributes(&Obj,
|
||||
&Name,
|
||||
OBJ_PERMANENT | OBJ_KERNEL_EXCLUSIVE,
|
||||
|
@ -2136,6 +2136,7 @@ MmCreatePhysicalMemorySection(VOID)
|
|||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
ObDereferenceObject(PhysSection);
|
||||
return Status;
|
||||
}
|
||||
ObCloseHandle(Handle, KernelMode);
|
||||
|
||||
|
@ -3654,16 +3655,17 @@ NtQuerySection(
|
|||
Sbi.BaseAddress = (PVOID)Section->Address.StartingVpn;
|
||||
|
||||
Sbi.Attributes = 0;
|
||||
if (Section->u.Flags.Commit)
|
||||
Sbi.Attributes |= SEC_COMMIT;
|
||||
if (Section->u.Flags.Reserve)
|
||||
Sbi.Attributes |= SEC_RESERVE;
|
||||
if (Section->u.Flags.File)
|
||||
Sbi.Attributes |= SEC_FILE;
|
||||
if (Section->u.Flags.Image)
|
||||
Sbi.Attributes |= SEC_IMAGE;
|
||||
|
||||
/* FIXME : Complete/test the list of flags passed back from NtCreateSection */
|
||||
/* Those are not set *************
|
||||
if (Section->u.Flags.Commit)
|
||||
Sbi.Attributes |= SEC_COMMIT;
|
||||
if (Section->u.Flags.Reserve)
|
||||
Sbi.Attributes |= SEC_RESERVE;
|
||||
**********************************/
|
||||
|
||||
if (Section->u.Flags.Image)
|
||||
{
|
||||
|
@ -4005,8 +4007,9 @@ MmMapViewOfSection(IN PVOID SectionObject,
|
|||
{
|
||||
(*ViewSize) = Section->SizeOfSection.QuadPart - ViewOffset;
|
||||
}
|
||||
else if (((*ViewSize)+ViewOffset) > Section->SizeOfSection.QuadPart)
|
||||
else if ((ExGetPreviousMode() == UserMode) && (((*ViewSize)+ViewOffset) > Section->SizeOfSection.QuadPart))
|
||||
{
|
||||
/* Dubious */
|
||||
(*ViewSize) = MIN(Section->SizeOfSection.QuadPart - ViewOffset, SIZE_T_MAX - PAGE_SIZE);
|
||||
}
|
||||
|
||||
|
@ -4329,8 +4332,16 @@ MmCreateSection (OUT PVOID * Section,
|
|||
return STATUS_INVALID_PARAMETER_6;
|
||||
}
|
||||
|
||||
/* Did the caller pass a handle? */
|
||||
if (FileHandle)
|
||||
/* Did the caller pass a file object ? */
|
||||
if (FileObject)
|
||||
{
|
||||
/* Reference the object directly */
|
||||
ObReferenceObject(FileObject);
|
||||
|
||||
/* We don't create image mappings with file objects */
|
||||
AllocationAttributes &= ~SEC_IMAGE;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Reference the file handle to get the object */
|
||||
Status = ObReferenceObjectByHandle(FileHandle,
|
||||
|
@ -4368,11 +4379,6 @@ MmCreateSection (OUT PVOID * Section,
|
|||
DPRINT1("Creating image map with writers open on the file!\n");
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Reference the object directly */
|
||||
ObReferenceObject(FileObject);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue