실행 파일 이미지
실행 파일은 메모리 매핑된 이미지 파일을 사용하여 프로세스의 주소 공간에 로드됩니다. 파일 자체는 열 필요가 없으며 섹션을 통해 매핑이 수행되므로 핸들을 만들 필요가 없습니다. 파일 시스템은 메모리 매핑 파일을 지원한다고 가정하여 이러한 특수 의미 체계를 적용하기 위해 검사 합니다. 예를 들어 이 경우에 검사 FASTFAT 파일 시스템 코드는 WDK에 포함된 fastfat 샘플의 Create.c 원본 파일의 FatOpenExistingFCB 함수에서 찾을 수 있습니다.
//
// 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 );
}
}
따라서 파일 시스템은 파일이 열려 있지 않더라도 실행 파일 이미지를 포함하여 메모리 매핑된 파일을 삭제할 수 없도록 합니다.