141 ULONG_PTR BeginningAddress, EndingAddress;
148 DPRINT(
"MiFlushMappedSection(%p,%I64x,%I64x,%u,%s:%d)\n",
161 DPRINT(
"STATUS_NOT_MAPPED_DATA\n");
228 MmSetCleanAllRmaps(
Page);
243 DPRINT(
"Writeback from section flush %08x%08x (%x) %x@%x (%08x%08x:%wZ) failed %x\n",
251 &
Segment->FileObject->FileName,
289 Segment->FileObject->SectionObjectPointer->DataSectionObject =
NULL;
293 DPRINT(
"Dereference file object %wZ\n", &
Segment->FileObject->FileName);
319 PROS_SECTION_OBJECT Section;
328 DPRINT(
"MmCreateDataFileSection\n");
336 sizeof(ROS_SECTION_OBJECT),
349 Section->Type =
'SC';
350 Section->Size =
'TN';
353 Section->Segment =
NULL;
357 DPRINT(
"Getting original file size\n");
372 DPRINT(
"Querying info\n");
416 DPRINT(
"Zero size file\n");
427 DPRINT(
"Failed: STATUS_NO_MEMORY\n");
457 DPRINT(
"Filling out Segment info (No previous data section)\n");
483 DPRINT(
"Filling out Segment info (previous data section)\n");
505 Section->MaximumSize.QuadPart =
MaximumSize.QuadPart;
508 DPRINT(
"MaximumSize %I64x ValidDataLength %I64x\n",
513 DPRINT(
"Changing file size to %I64x, segment %p\n",
525 DPRINT(
"Could not expand section\n");
564 DPRINT(
"Mapping between 0x%p and 0x%p failed (%X).\n",
572 DPRINTC(
"MiMapViewOfSegment %p %p %p %I64x %Ix %wZ %s:%d\n",
576 ViewOffset ? ViewOffset->
QuadPart : 0,
589 MArea->NotPresent = MmNotPresentFaultPageFile;
590 MArea->AccessFault = MiCowSectionPage;
599 DPRINTC(
"MiMapViewOfSegment(P %p, A %p, T %x)\n",
624 DPRINTC(
"MiFreeSegmentPage(%p:%I64x -> Entry %Ix\n",
635 DPRINT(
"MiWriteBackPage(%p,%wZ,%I64x)\n",
642 DPRINTC(
"Free page %Ix (off %I64x from %p) (ref ct %lu, ent %Ix, dirty? %s)\n",
677 DPRINT(
"MmFreeSectionPage(%p,%p,%Ix,%Ix,%u)\n",
738 DPRINT(
"MmFreeMemoryArea(%p,%p)\n",
750 DPRINTC(
"MiUnmapViewOfSegment %p %p %p\n",
772 DPRINT(
"OldSize 0x%I64x NewSize 0x%I64x\n",
806 DPRINT(
"MmMapViewInSystemSpaceAtOffset() called offset 0x%I64x\n",
837 DPRINT(
"MmUnmapViewInSystemSpace() called\n");
static CC_FILE_SIZES FileSizes
_In_ PFCB _In_ LONGLONG FileOffset
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
#define NT_SUCCESS(StatCode)
static VOID WriteData(_In_ UCHAR Data)
#define RemoveEntryList(Entry)
#define InsertHeadList(ListHead, Entry)
#define ExAllocatePoolWithTag(hernya, size, tag)
#define KeReleaseSpinLock(sl, irql)
#define KeAcquireSpinLock(sl, irql)
#define ExGetPreviousMode
#define InterlockedIncrementUL(Addend)
#define ExAllocatePool(type, size)
_Must_inspect_result_ _In_ USHORT NewSize
@ FileEndOfFileInformation
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
_Must_inspect_result_ _Out_ PLARGE_INTEGER FileSize
_Must_inspect_result_ _Outptr_ PVOID * SectionObject
BOOLEAN NTAPI CcGetFileSizes(IN PFILE_OBJECT FileObject, IN PCC_FILE_SIZES FileSizes)
VOID FASTCALL ExAcquireFastMutex(IN PFAST_MUTEX FastMutex)
VOID FASTCALL ExReleaseFastMutex(IN PFAST_MUTEX FastMutex)
NTSTATUS NTAPI IoQueryFileInformation(IN PFILE_OBJECT FileObject, IN FILE_INFORMATION_CLASS FileInformationClass, IN ULONG Length, OUT PVOID FileInformation, OUT PULONG ReturnedLength)
NTSTATUS NTAPI IoSetInformation(IN PFILE_OBJECT FileObject, IN FILE_INFORMATION_CLASS FileInformationClass, IN ULONG Length, IN PVOID FileInformation)
#define ExFreePoolWithTag(_P, _T)
#define MM_ALLOCATION_GRANULARITY
_In_ ACCESS_MASK _In_opt_ POBJECT_ATTRIBUTES _In_opt_ PLARGE_INTEGER MaximumSize
_In_ ACCESS_MASK _In_opt_ POBJECT_ATTRIBUTES _In_opt_ PLARGE_INTEGER _In_ ULONG SectionPageProtection
_In_ ACCESS_MASK _In_opt_ POBJECT_ATTRIBUTES _In_opt_ PLARGE_INTEGER _In_ ULONG _In_ ULONG AllocationAttributes
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID * BaseAddress
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID _In_ ULONG_PTR _In_ SIZE_T _Inout_opt_ PLARGE_INTEGER _Inout_ PSIZE_T _In_ SECTION_INHERIT _In_ ULONG AllocationType
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID _In_ ULONG_PTR _In_ SIZE_T _Inout_opt_ PLARGE_INTEGER _Inout_ PSIZE_T ViewSize
#define PAGE_ROUND_DOWN(x)
ULONG MmGetReferenceCountPageWithoutLock(PFN_NUMBER Page)
NTSTATUS NTAPI MmExtendCacheSection(PSECTION Section, PLARGE_INTEGER NewSize, BOOLEAN ExtendFile)
NTSTATUS NTAPI MmCreateCacheSection(PSECTION *SectionObject, ACCESS_MASK DesiredAccess, POBJECT_ATTRIBUTES ObjectAttributes, PLARGE_INTEGER UMaximumSize, ULONG SectionPageProtection, ULONG AllocationAttributes, PFILE_OBJECT FileObject)
VOID NTAPI MmFinalizeSegment(PMM_SECTION_SEGMENT Segment)
VOID NTAPI MmFreePageTablesSectionSegment(PMM_SECTION_SEGMENT Segment, FREE_SECTION_PAGE_FUN FreePage)
#define MM_SEGMENT_FINALIZE
#define MiWriteBackPage(F, O, L, P)
_In_ PMEMORY_AREA MemoryArea
NTSTATUS NTAPI MmMapCacheViewInSystemSpaceAtOffset(IN PMM_SECTION_SEGMENT Segment, OUT PVOID *MappedBase, IN PLARGE_INTEGER ViewOffset, IN OUT PULONG ViewSize)
NTSTATUS NTAPI MmUnmapViewOfCacheSegment(PMMSUPPORT AddressSpace, PVOID BaseAddress)
NTSTATUS NTAPI MmUnmapCacheViewInSystemSpace(PVOID Address)
NTSTATUS NTAPI _MiMapViewOfSegment(PMMSUPPORT AddressSpace, PMM_SECTION_SEGMENT Segment, PVOID *BaseAddress, SIZE_T ViewSize, ULONG Protect, PLARGE_INTEGER ViewOffset, ULONG AllocationType, const char *file, int line)
#define MiMapViewOfSegment(AddressSpace, Segment, BaseAddress, ViewSize, Protect, ViewOffset, AllocationType)
NTSTATUS NTAPI MmPageOutPageFileView(PMMSUPPORT AddressSpace, PMEMORY_AREA MemoryArea, PVOID Address, PMM_REQUIRED_RESOURCES Required)
NTSTATUS NTAPI _MiFlushMappedSection(PVOID BaseAddress, PLARGE_INTEGER BaseOffset, PLARGE_INTEGER FileSize, BOOLEAN Dirty, const char *File, int Line)
VOID NTAPI MiInitializeSectionPageTable(PMM_SECTION_SEGMENT Segment)
#define DBG_UNREFERENCED_LOCAL_VARIABLE(L)
_In_ ULONG _In_ ULONG Offset
VOID NTAPI _MmUnlockSectionSegment(PMM_SECTION_SEGMENT Segment, const char *file, int line)
VOID NTAPI _MmLockSectionSegment(PMM_SECTION_SEGMENT Segment, const char *file, int line)
KSPIN_LOCK MiSectionPageTableLock
VOID MmFreeCacheSectionPage(PVOID Context, MEMORY_AREA *MemoryArea, PVOID Address, PFN_NUMBER Page, SWAPENTRY SwapEntry, BOOLEAN Dirty)
VOID NTAPI MiFreeSegmentPage(PMM_SECTION_SEGMENT Segment, PLARGE_INTEGER FileOffset)
#define MmGetPageEntrySectionSegment(S, O)
FORCEINLINE VOID MmLockAddressSpace(PMMSUPPORT AddressSpace)
VOID NTAPI MmSetPageProtect(struct _EPROCESS *Process, PVOID Address, ULONG flProtect)
#define MmLockSectionSegment(x)
NTSTATUS NTAPI MmCreateMemoryArea(PMMSUPPORT AddressSpace, ULONG Type, PVOID *BaseAddress, SIZE_T Length, ULONG Protection, PMEMORY_AREA *Result, ULONG AllocationFlags, ULONG AllocationGranularity)
VOID NTAPI MmReferencePage(PFN_NUMBER Page)
#define MmSetPageEntrySectionSegment(S, O, E)
NTSTATUS NTAPI MmFreeMemoryArea(PMMSUPPORT AddressSpace, PMEMORY_AREA MemoryArea, PMM_FREE_PAGE_FUNC FreePage, PVOID FreePageContext)
#define MmUnlockSectionSegment(x)
_In_ PVOID _Out_opt_ BOOLEAN _Out_opt_ PPFN_NUMBER Page
PMEMORY_AREA NTAPI MmLocateMemoryAreaByAddress(PMMSUPPORT AddressSpace, PVOID Address)
#define SWAPENTRY_FROM_SSE(E)
VOID NTAPI MmInitializeRegion(PLIST_ENTRY RegionListHead, SIZE_T Length, ULONG Type, ULONG Protect)
#define MA_GetEndingAddress(_MemoryArea)
#define MA_GetStartingAddress(_MemoryArea)
FORCEINLINE VOID MmUnlockAddressSpace(PMMSUPPORT AddressSpace)
FORCEINLINE PEPROCESS MmGetAddressSpaceOwner(IN PMMSUPPORT AddressSpace)
VOID NTAPI MmFreeSwapPage(SWAPENTRY Entry)
VOID NTAPI MmSetSavedSwapEntryPage(PFN_NUMBER Page, SWAPENTRY SavedSwapEntry)
VOID NTAPI MmDeleteRmap(PFN_NUMBER Page, struct _EPROCESS *Process, PVOID Address)
struct _MM_SECTION_SEGMENT * PMM_SECTION_SEGMENT
#define IS_SWAP_FROM_SSE(E)
NTSTATUS NTAPI MmReleasePageMemoryConsumer(ULONG Consumer, PFN_NUMBER Page)
FORCEINLINE PMMSUPPORT MmGetKernelAddressSpace(VOID)
#define MM_DATAFILE_SEGMENT
VOID NTAPI MmDeleteVirtualMapping(IN PEPROCESS Process, IN PVOID Address, OUT PBOOLEAN WasDirty, OUT PPFN_NUMBER Page)
#define STATUS_FILE_INVALID
NTSTATUS NTAPI ObCreateObject(IN KPROCESSOR_MODE ProbeMode OPTIONAL, IN POBJECT_TYPE Type, IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, IN KPROCESSOR_MODE AccessMode, IN OUT PVOID ParseContext OPTIONAL, IN ULONG ObjectSize, IN ULONG PagedPoolCharge OPTIONAL, IN ULONG NonPagedPoolCharge OPTIONAL, OUT PVOID *Object)
#define FileStandardInformation
POBJECT_TYPE MmSectionObjectType
base of all file and directory entries
LARGE_INTEGER ValidDataLength
struct _MEMORY_AREA::@1796 SectionData
#define TAG_MM_SECTION_SEGMENT
#define RtlZeroMemory(Destination, Length)
#define STATUS_UNSUCCESSFUL
#define STATUS_NOT_MAPPED_DATA
struct _LARGE_INTEGER::@2299 u
_Must_inspect_result_ _In_ WDFDEVICE _In_ ULONG _In_ ACCESS_MASK DesiredAccess
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
_In_ WDFREQUEST _In_ NTSTATUS _In_ ULONG_PTR Information
FORCEINLINE VOID ExInitializeFastMutex(_Out_ PFAST_MUTEX FastMutex)
_In_ ULONG _In_ PHYSICAL_ADDRESS _Inout_ PULONG AddressSpace
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
_Must_inspect_result_ _Outptr_result_bytebuffer_ ViewSize PVOID * MappedBase
_Must_inspect_result_ _In_ SIZE_T _In_ PVOID PageAddress
#define ObDereferenceObject
#define ObReferenceObject
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID _In_ ULONG_PTR _In_ SIZE_T _Inout_opt_ PLARGE_INTEGER _Inout_ PSIZE_T _In_ SECTION_INHERIT _In_ ULONG _In_ ULONG Protect