From cfad1c53076e4c6fe6a5878e32fd43cea9b746ae Mon Sep 17 00:00:00 2001 From: Christoph von Wittich Date: Mon, 2 Feb 2009 17:14:24 +0000 Subject: [PATCH] halfplement MmCanFileBeTruncated svn path=/trunk/; revision=39289 --- reactos/ntoskrnl/mm/section.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/reactos/ntoskrnl/mm/section.c b/reactos/ntoskrnl/mm/section.c index e09044b44eb..1659114a703 100644 --- a/reactos/ntoskrnl/mm/section.c +++ b/reactos/ntoskrnl/mm/section.c @@ -4714,8 +4714,31 @@ BOOLEAN NTAPI MmCanFileBeTruncated (IN PSECTION_OBJECT_POINTERS SectionObjectPointer, IN PLARGE_INTEGER NewFileSize) { + + /* Check whether an ImageSectionObject exists */ + if (SectionObjectPointer->ImageSectionObject != NULL) + { + return FALSE; + } + + if (SectionObjectPointer->DataSectionObject != NULL) + { + PMM_SECTION_SEGMENT Segment; + + Segment = (PMM_SECTION_SEGMENT)SectionObjectPointer-> + DataSectionObject; + + if (Segment->ReferenceCount != 0) + { + /* FIXME: check if NewFileSize <= current file size */ + return FALSE; + } + } + + /* FIXME: check for outstanding write probes */ UNIMPLEMENTED; - return (FALSE); + + return FALSE; }