可執行檔影像
可執行檔會使用記憶體對應影像檔載入進程的位址空間。 檔案本身不需要開啟,也不需要建立控制碼,因為對應是透過區段來完成。 檔案系統必須檢查以強制執行這些特殊語意,前提是它們支援記憶體對應檔案。 例如,要檢查此案例的 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 );
}
}
因此,即使檔案未開啟,檔案系統也可確保無法刪除記憶體對應檔案,包括可執行檔映射。