mirror of
https://github.com/reactos/reactos.git
synced 2024-11-20 06:15:26 +00:00
[NTOS:MM] Unconditionally purge cache on image section creation.
This commit is contained in:
parent
c1c51e31e4
commit
ea354c4bc7
1 changed files with 8 additions and 56 deletions
|
@ -2470,20 +2470,6 @@ ExeFmtpAllocateSegments(IN ULONG NrSegments)
|
|||
|
||||
return Segments;
|
||||
}
|
||||
|
||||
static NTSTATUS
|
||||
MmMapViewOfSegment(PMMSUPPORT AddressSpace,
|
||||
BOOLEAN AsImage,
|
||||
PMM_SECTION_SEGMENT Segment,
|
||||
PVOID* BaseAddress,
|
||||
SIZE_T ViewSize,
|
||||
ULONG Protect,
|
||||
LONGLONG ViewOffset,
|
||||
ULONG AllocationType);
|
||||
static NTSTATUS
|
||||
MmUnmapViewOfSegment(PMMSUPPORT AddressSpace,
|
||||
PVOID BaseAddress);
|
||||
|
||||
static
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
|
@ -2538,45 +2524,14 @@ ExeFmtpReadFile(IN PVOID File,
|
|||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
|
||||
if (FileObject->SectionObjectPointer->DataSectionObject)
|
||||
Status = MiSimpleRead(FileObject, &FileOffset, Buffer, BufferSize, TRUE, &Iosb);
|
||||
|
||||
UsedSize = (ULONG)Iosb.Information;
|
||||
|
||||
if(NT_SUCCESS(Status) && UsedSize < OffsetAdjustment)
|
||||
{
|
||||
PVOID SegmentMap = NULL;
|
||||
|
||||
/* Get the data from the file mapping instead */
|
||||
MmLockAddressSpace(MmGetKernelAddressSpace());
|
||||
Status = MmMapViewOfSegment(MmGetKernelAddressSpace(),
|
||||
FALSE,
|
||||
FileObject->SectionObjectPointer->DataSectionObject,
|
||||
&SegmentMap,
|
||||
BufferSize,
|
||||
PAGE_READONLY,
|
||||
FileOffset.QuadPart,
|
||||
0);
|
||||
MmUnlockAddressSpace(MmGetKernelAddressSpace());
|
||||
|
||||
if (!NT_SUCCESS(Status))
|
||||
return Status;
|
||||
|
||||
RtlCopyMemory(Buffer, SegmentMap, BufferSize);
|
||||
UsedSize = BufferSize;
|
||||
|
||||
MmLockAddressSpace(MmGetKernelAddressSpace());
|
||||
|
||||
MmUnmapViewOfSegment(MmGetKernelAddressSpace(), SegmentMap);
|
||||
|
||||
MmUnlockAddressSpace(MmGetKernelAddressSpace());
|
||||
}
|
||||
else
|
||||
{
|
||||
Status = MiSimpleRead(FileObject, &FileOffset, Buffer, BufferSize, TRUE, &Iosb);
|
||||
|
||||
UsedSize = (ULONG)Iosb.Information;
|
||||
|
||||
if(NT_SUCCESS(Status) && UsedSize < OffsetAdjustment)
|
||||
{
|
||||
Status = STATUS_IN_PAGE_ERROR;
|
||||
ASSERT(!NT_SUCCESS(Status));
|
||||
}
|
||||
Status = STATUS_IN_PAGE_ERROR;
|
||||
ASSERT(!NT_SUCCESS(Status));
|
||||
}
|
||||
|
||||
if(NT_SUCCESS(Status))
|
||||
|
@ -3175,10 +3130,7 @@ MmCreateImageSection(PSECTION *SectionObject,
|
|||
MiReleasePfnLock(OldIrql);
|
||||
|
||||
/* Purge the cache */
|
||||
if (CcIsFileCached(FileObject))
|
||||
{
|
||||
CcFlushCache(FileObject->SectionObjectPointer, NULL, 0, NULL);
|
||||
}
|
||||
CcFlushCache(FileObject->SectionObjectPointer, NULL, 0, NULL);
|
||||
|
||||
StatusExeFmt = ExeFmtpCreateImageSection(FileObject, ImageSectionObject);
|
||||
|
||||
|
|
Loading…
Reference in a new issue