In user mode I open memory mapped file like:
{
HANDLE hHandle = CreateFile(“fsm.txt”, GENERIC_WRITE|GENERIC_READ, 0, 0, OPEN_ALWAYS, 0, 0);
if (!hHandle) break;
HANDLE hMapping = CreateFileMapping(hHandle, 0, PAGE_READWRITE, 0,256, 0);
char* lpBuffer = (char*)MapViewOfFile(hMapping, FILE_MAP_ALL_ACCESS, 0, 0, 0);
*lpBuffer = ‘2’;
printf(“lpBuffer:%s\n”, lpBuffer);
UnmapViewOfFile(lpBuffer);
CloseHandle(hMapping);
CloseHandle(hHandle);
}
But when use inline hook, found none of these cache functions are called:
CcInitializeCacheMap,
CcCopyRead,
CcMdlRead,
CcMapData
I think memory mapped file would deal with cache also, actually in CreateFileMapping would call MmCreateSection.
Below is what I reversed for reference:
CreateFileMapping
NtCreateSection
MmCreateSection
nt!MiCreatePagingFileMap
nt!FsRtlAcquireToCreateMappedSection
nt!IoSetTopLevelIrp
nt!MiFindImageSectionObject
nt!MiInsertImageSectionObject
nt!MiFlushDataSection
nt!FsRtlGetFileSize
nt!FsRtlReleaseFile
nt!MiRemoveImageSectionObject
nt!MiCreateImageFileMap
nt!MiCreateDataFileMap
nt!FsRtlGetFileSize
nt!FsRtlSetFileSize
nt!XIPLocatePages
nt!MiMakeControlAreaRom
nt!MiCheckControlArea
nt!MiFindEmptyAddressRangeDownBasedTree
nt!MiInsertBasedSection
nt!MmExtendSection
CcInitializeCacheMap would call MmCreateSection also
CcCleanSharedCacheMapList (variable)
nt!ObfReferenceObject
nt!MmCreateSection
nt!ObDeleteCapturedInsertInfo
nt!MmDisableModifiedWriteOfSection
nt!CcCreateVacbArray
nt!MmExtendSection
nt!CcExtendVacbArray
nt!CcDeleteSharedCacheMap
nt!MiMapViewOfPhysicalSection
nt!MiMapViewOfImageSection
nt!MiMapViewOfDataSection
nt!MiCheckPurgeAndUpMapCount
nt!MiAddViewsForSectionWithPfn
nt!MiFindEmptyAddressRange
nt!MiFindEmptyAddressRangeDownTree
nt!MiRemoveViewsFromSectionWithPfn
nt!MiCheckForConflictingVadExistence
nt!MiDereferenceControlArea
nt!MiChargeCommitment
nt!MiInsertVad
Can anybody tell which cache function would be called for memory mapped file? Thanks!