From 94b893abacec278705fa3aea906c438c65c6fe92 Mon Sep 17 00:00:00 2001 From: Aleksey Bragin Date: Thu, 25 Sep 2008 11:24:51 +0000 Subject: [PATCH] - Fix one more totally "out of ideas how to create sections" MmCreateSection usage. Not only the MaximumSize is mandatory for file-backed sections, but an allocation type must be specified (SEC_COMMIT, and it's not the same as some humble "0" passed there as a value). - Fix ReactOS's MmCreateDataFileSection to ignore 0 value in the MaximumSize (it has an additional check for MaximumSize being non-NULL, but this should be removed in future). svn path=/trunk/; revision=36506 --- reactos/ntoskrnl/mm/section.c | 6 +++--- reactos/subsystems/win32/win32k/objects/text.c | 8 +++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/reactos/ntoskrnl/mm/section.c b/reactos/ntoskrnl/mm/section.c index d439803efec..b4f9ac04c63 100644 --- a/reactos/ntoskrnl/mm/section.c +++ b/reactos/ntoskrnl/mm/section.c @@ -2455,9 +2455,9 @@ MmCreateDataFileSection(PROS_SECTION_OBJECT *SectionObject, * FIXME: Revise this once a locking order for file size changes is * decided */ - if (UMaximumSize != NULL) + if ((UMaximumSize != NULL) && (UMaximumSize->QuadPart != 0)) { - MaximumSize = *UMaximumSize; + MaximumSize = *UMaximumSize; } else { @@ -3383,7 +3383,7 @@ MmCreateImageSection(PROS_SECTION_OBJECT *SectionObject, ImageSectionObject, NULL)) { /* - * An other thread has initialized the some image in the background + * An other thread has initialized the same image in the background */ ExFreePool(ImageSectionObject->Segments); ExFreePool(ImageSectionObject); diff --git a/reactos/subsystems/win32/win32k/objects/text.c b/reactos/subsystems/win32/win32k/objects/text.c index a4e59a2978f..8adc45b27ee 100644 --- a/reactos/subsystems/win32/win32k/objects/text.c +++ b/reactos/subsystems/win32/win32k/objects/text.c @@ -278,6 +278,7 @@ IntGdiAddFontResource(PUNICODE_STRING FileName, DWORD Characteristics) PFONT_ENTRY Entry; PSECTION_OBJECT SectionObject; ULONG ViewSize = 0; + LARGE_INTEGER SectionSize; FT_Fixed XScale, YScale; UNICODE_STRING FontRegPath = RTL_CONSTANT_STRING(L"\\REGISTRY\\Machine\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Fonts"); @@ -294,13 +295,14 @@ IntGdiAddFontResource(PUNICODE_STRING FileName, DWORD Characteristics) if (!NT_SUCCESS(Status)) { - DPRINT("Could not font file: %wZ\n", FileName); + DPRINT("Could not load font file: %wZ\n", FileName); return 0; } + SectionSize.QuadPart = 0LL; Status = MmCreateSection((PVOID)&SectionObject, SECTION_ALL_ACCESS, - NULL, NULL, PAGE_READONLY, - 0, FileHandle, NULL); + NULL, &SectionSize, PAGE_READONLY, + SEC_COMMIT, FileHandle, NULL); if (!NT_SUCCESS(Status)) { DPRINT("Could not map file: %wZ\n", FileName);