可執行檔會使用記憶體對映映像檔載入到處理程序的位址空間中。 檔案本身不需要開啟,也不需要建立控制碼,因為對映是透過區段來完成的。 檔案系統必須檢查以強制執行這些特殊語意,假設它們支援記憶體對映檔案。 例如,要檢查此案例的 FASTFAT 檔案系統程式代碼,可以在 Create.c 來源檔案的 FatOpenExistingFCB 函式中找到,來自 WDK 所包含的 fastfat 範例:
//
// If the user wants write access to the file, make sure there
// is not a process mapping this file as an image. Any attempt to
// delete the file will be stopped in fileinfo.c
//
// If the user wants to delete on close, check at this
// point though.
//
if (FlagOn(*DesiredAccess, FILE_WRITE_DATA) || DeleteOnClose) {
Fcb->OpenCount += 1;
DecrementFcbOpenCount = TRUE;
if (!MmFlushImageSection( &Fcb->NonPaged->SectionObjectPointers,
MmFlushForWrite )) {
Iosb.Status = DeleteOnClose ? STATUS_CANNOT_DELETE :STATUS_SHARING_VIOLATION;
try_return( Iosb );
}
}
因此,檔案系統可確保記憶體對映檔案 (包括可執行檔映像檔) 無法刪除,即使該檔案未開啟。