https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e392bdf962d278fa7ee7d…
commit e392bdf962d278fa7ee7dd0c2aeaf6658d8bef03
Author: Pierre Schweitzer <pierre(a)reactos.org>
AuthorDate: Thu Aug 16 13:50:16 2018 +0200
Commit: Pierre Schweitzer <pierre(a)reactos.org>
CommitDate: Thu Aug 16 13:50:16 2018 +0200
[NTOSKRNL] Store page file sizes in pages, not in bytes
---
ntoskrnl/include/internal/mm.h | 6 +++---
ntoskrnl/mm/pagefile.c | 10 +++++-----
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/ntoskrnl/include/internal/mm.h b/ntoskrnl/include/internal/mm.h
index 9739d62709..ca82fd87d9 100644
--- a/ntoskrnl/include/internal/mm.h
+++ b/ntoskrnl/include/internal/mm.h
@@ -426,9 +426,9 @@ extern MM_MEMORY_CONSUMER MiMemoryConsumers[MC_MAXIMUM];
/* Page file information */
typedef struct _MMPAGING_FILE
{
- LARGE_INTEGER CurrentSize;
- LARGE_INTEGER MaximumSize;
- LARGE_INTEGER MinimumSize;
+ PFN_NUMBER CurrentSize;
+ PFN_NUMBER MaximumSize;
+ PFN_NUMBER MinimumSize;
PFN_NUMBER FreePages;
PFN_NUMBER UsedPages;
PFILE_OBJECT FileObject;
diff --git a/ntoskrnl/mm/pagefile.c b/ntoskrnl/mm/pagefile.c
index 784495d444..dd24fe7d5b 100644
--- a/ntoskrnl/mm/pagefile.c
+++ b/ntoskrnl/mm/pagefile.c
@@ -635,7 +635,7 @@ NtCreatePagingFile(IN PUNICODE_STRING FileName,
}
/* Don't allow page file shrinking */
- if (PagingFile->MinimumSize.QuadPart > SafeMinimumSize.QuadPart)
+ if (PagingFile->MinimumSize > (SafeMinimumSize.QuadPart >>
PAGE_SHIFT))
{
KeReleaseGuardedMutex(&MmPageFileCreationLock);
ObDereferenceObject(FileObject);
@@ -645,7 +645,7 @@ NtCreatePagingFile(IN PUNICODE_STRING FileName,
return STATUS_INVALID_PARAMETER_2;
}
- if (SafeMaximumSize.QuadPart < PagingFile->MaximumSize.QuadPart)
+ if ((SafeMaximumSize.QuadPart >> PAGE_SHIFT) <
PagingFile->MaximumSize)
{
KeReleaseGuardedMutex(&MmPageFileCreationLock);
ObDereferenceObject(FileObject);
@@ -740,9 +740,9 @@ NtCreatePagingFile(IN PUNICODE_STRING FileName,
PagingFile->FileHandle = FileHandle;
PagingFile->FileObject = FileObject;
- PagingFile->MaximumSize.QuadPart = SafeMaximumSize.QuadPart;
- PagingFile->CurrentSize.QuadPart = SafeMinimumSize.QuadPart;
- PagingFile->MinimumSize.QuadPart = SafeMinimumSize.QuadPart;
+ PagingFile->MaximumSize = (SafeMaximumSize.QuadPart >> PAGE_SHIFT);
+ PagingFile->CurrentSize = (SafeMinimumSize.QuadPart >> PAGE_SHIFT);
+ PagingFile->MinimumSize = (SafeMinimumSize.QuadPart >> PAGE_SHIFT);
PagingFile->FreePages = (ULONG)(SafeMinimumSize.QuadPart / PAGE_SIZE);
PagingFile->UsedPages = 0;
PagingFile->PageFileName = PageFileName;