- 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
This commit is contained in:
Aleksey Bragin
2008-09-25 11:24:51 +00:00
parent 99d8e4f1b4
commit 94b893abac
2 changed files with 8 additions and 6 deletions
+3 -3
View File
@@ -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);
@@ -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);