IRP请求中判断:文件/目录

本文介绍了一个用于Windows内核模式下判断文件对象是否为目录的方法。通过检查文件对象上下文中的节点类型代码来区分文件和目录,并提供了具体的实现代码。

IRP请求中判断:文件/目录

#define FAT_NTC_FCB               0x0502
#define FAT_NTC_DCB               0x0503
#define FAT_NTC_ROOT_DCB          0x0504

#define NTFS_NTC_DCB              0x0703
#define NTFS_NTC_ROOT_DCB         0x0704
#define NTFS_NTC_FCB              0x0705

#define CDFS_NTC_DCB              0x0304
#define CDFS_NTC_FCB              0x0305

BOOLEAN IsDirectory(PFILE_OBJECT FileObject)
{
    FSRTL_COMMON_FCB_HEADER* pfcfHeader =(FSRTL_COMMON_FCB_HEADER*)FileObject->FsContext;
    if(pfcfHeader->NodeTypeCode == FAT_NTC_DCB || pfcfHeader->NodeTypeCode == FAT_NTC_ROOT_DCB
    || pfcfHeader->NodeTypeCode == NTFS_NTC_DCB || pfcfHeader->NodeTypeCode == NTFS_NTC_ROOT_DCB
    || pfcfHeader->NodeTypeCode == CDFS_NTC_DCB)
{
    DbgPrint(("Is directory!/n"));
    return TRUE;
}
    DbgPrint(("Is not directory!/n"));
    return FALSE;
}
需要你重新分析VeraCrypt_1.25.9版本代码文件 https://github.com/veracrypt/VeraCrypt/tree/VeraCrypt_1.25.9 https://veracrypt.jp/zh-cn/Documentation.html 以下为原代码文件地址链接,需要你自行分析: https://raw.githubusercontent.com/veracrypt/VeraCrypt/refs/tags/VeraCrypt_1.25.9/src/Boot/Windows/BootCrt.asm https://raw.githubusercontent.com/veracrypt/VeraCrypt/refs/tags/VeraCrypt_1.25.9/src/Boot/Windows/BootSector.asm https://raw.githubusercontent.com/veracrypt/VeraCrypt/refs/tags/VeraCrypt_1.25.9/src/Boot/Windows/Decompressor.c https://raw.githubusercontent.com/veracrypt/VeraCrypt/refs/tags/VeraCrypt_1.25.9/src/Boot/Windows/BootConfig.cpp https://raw.githubusercontent.com/veracrypt/VeraCrypt/refs/tags/VeraCrypt_1.25.9/src/Boot/Windows/BootCommon.h https://raw.githubusercontent.com/veracrypt/VeraCrypt/refs/tags/VeraCrypt_1.25.9/src/Boot/Windows/BootConsoleIo.cpp https://raw.githubusercontent.com/veracrypt/VeraCrypt/refs/tags/VeraCrypt_1.25.9/src/Boot/Windows/BootConsoleIo.h https://raw.githubusercontent.com/veracrypt/VeraCrypt/refs/tags/VeraCrypt_1.25.9/src/Boot/Windows/BootDebug.cpp https://raw.githubusercontent.com/veracrypt/VeraCrypt/refs/tags/VeraCrypt_1.25.9/src/Boot/Windows/BootDefs.h https://raw.githubusercontent.com/veracrypt/VeraCrypt/refs/tags/VeraCrypt_1.25.9/src/Boot/Windows/BootDiskIo.cpp https://raw.githubusercontent.com/veracrypt/VeraCrypt/refs/tags/VeraCrypt_1.25.9/src/Boot/Windows/BootDiskIo.h https://raw.githubusercontent.com/veracrypt/VeraCrypt/refs/tags/VeraCrypt_1.25.9/src/Boot/Windows/BootEncryptedIo.cpp https://raw.githubusercontent.com/veracrypt/VeraCrypt/refs/tags/VeraCrypt_1.25.9/src/Boot/Windows/BootMain.cpp https://raw.githubusercontent.com/veracrypt/VeraCrypt/refs/tags/VeraCrypt_1.25.9/src/Boot/Windows/BootMain.h https://raw.githubusercontent.com/veracrypt/VeraCrypt/refs/tags/VeraCrypt_1.25.9/src/Boot/Windows/BootMemory.cpp https://raw.githubusercontent.com/veracrypt/VeraCrypt/refs/tags/VeraCrypt_1.25.9/src/Boot/Windows/BootMemory.h https://raw.githubusercontent.com/veracrypt/VeraCrypt/refs/tags/VeraCrypt_1.25.9/src/Boot/Windows/IntFilter.cpp https://raw.githubusercontent.com/veracrypt/VeraCrypt/refs/tags/VeraCrypt_1.25.9/src/Boot/Windows/BootStrings.h https://raw.githubusercontent.com/veracrypt/VeraCrypt/refs/tags/VeraCrypt_1.25.9/src/Boot/Windows/Platform.cpp https://raw.githubusercontent.com/veracrypt/VeraCrypt/refs/tags/VeraCrypt_1.25.9/src/Boot/Windows/Platform.h https://raw.githubusercontent.com/veracrypt/VeraCrypt/refs/tags/VeraCrypt_1.25.9/src/Boot/Windows/Makefile https://raw.githubusercontent.com/veracrypt/VeraCrypt/refs/tags/VeraCrypt_1.25.9/src/Setup/Dir.c https://raw.githubusercontent.com/veracrypt/VeraCrypt/refs/tags/VeraCrypt_1.25.9/src/Setup/Dir.h https://raw.githubusercontent.com/veracrypt/VeraCrypt/refs/tags/VeraCrypt_1.25.9/src/Setup/SelfExtract.c https://raw.githubusercontent.com/veracrypt/VeraCrypt/refs/tags/VeraCrypt_1.25.9/src/Setup/Setup.c https://raw.githubusercontent.com/veracrypt/VeraCrypt/refs/tags/VeraCrypt_1.25.9/src/Setup/Setup.h https://raw.githubusercontent.com/veracrypt/VeraCrypt/refs/tags/VeraCrypt_1.25.9/src/Setup/Wizard.c https://raw.githubusercontent.com/veracrypt/VeraCrypt/refs/tags/VeraCrypt_1.25.9/src/Setup/ComSetup.cpp https://raw.githubusercontent.com/veracrypt/VeraCrypt/refs/tags/VeraCrypt_1.25.9/src/Setup/Portable.rc https://raw.githubusercontent.com/veracrypt/VeraCrypt/refs/tags/VeraCrypt_1.25.9/src/Setup/Setup.rc https://raw.githubusercontent.com/veracrypt/VeraCrypt/refs/tags/VeraCrypt_1.25.9/src/Setup/Setup.vcproj https://raw.githubusercontent.com/veracrypt/VeraCrypt/refs/tags/VeraCrypt_1.25.9/src/Setup/Setup.vcxproj https://raw.githubusercontent.com/veracrypt/VeraCrypt/refs/tags/VeraCrypt_1.25.9/src/Setup/Setup.manifest https://raw.githubusercontent.com/veracrypt/VeraCrypt/refs/tags/VeraCrypt_1.25.9/src/Setup/Portable.manifest https://raw.githubusercontent.com/veracrypt/VeraCrypt/refs/tags/VeraCrypt_1.25.9/src/Driver/DriveFilter.c https://raw.githubusercontent.com/veracrypt/VeraCrypt/refs/tags/VeraCrypt_1.25.9/src/Driver/DriveFilter.h https://raw.githubusercontent.com/veracrypt/VeraCrypt/refs/tags/VeraCrypt_1.25.9/src/Driver/Driver.rc https://raw.githubusercontent.com/veracrypt/VeraCrypt/refs/tags/VeraCrypt_1.25.9/src/Driver/Driver.vcproj https://raw.githubusercontent.com/veracrypt/VeraCrypt/refs/tags/VeraCrypt_1.25.9/src/Driver/Driver.vcxproj https://raw.githubusercontent.com/veracrypt/VeraCrypt/refs/tags/VeraCrypt_1.25.9/src/Driver/Driver.vcxproj.filters https://raw.githubusercontent.com/veracrypt/VeraCrypt/refs/tags/VeraCrypt_1.25.9/src/Driver/Driver.vcxproj.user https://raw.githubusercontent.com/veracrypt/VeraCrypt/refs/tags/VeraCrypt_1.25.9/src/Driver/DumpFilter.c https://raw.githubusercontent.com/veracrypt/VeraCrypt/refs/tags/VeraCrypt_1.25.9/src/Driver/DumpFilter.h https://raw.githubusercontent.com/veracrypt/VeraCrypt/refs/tags/VeraCrypt_1.25.9/src/Driver/EncryptedIoQueue.c https://raw.githubusercontent.com/veracrypt/VeraCrypt/refs/tags/VeraCrypt_1.25.9/src/Driver/EncryptedIoQueue.h https://raw.githubusercontent.com/veracrypt/VeraCrypt/refs/tags/VeraCrypt_1.25.9/src/Driver/Makefile https://raw.githubusercontent.com/veracrypt/VeraCrypt/refs/tags/VeraCrypt_1.25.9/src/Driver/Ntdriver.c https://raw.githubusercontent.com/veracrypt/VeraCrypt/refs/tags/VeraCrypt_1.25.9/src/Driver/Ntdriver.h https://raw.githubusercontent.com/veracrypt/VeraCrypt/refs/tags/VeraCrypt_1.25.9/src/Driver/Ntvol.c https://raw.githubusercontent.com/veracrypt/VeraCrypt/refs/tags/VeraCrypt_1.25.9/src/Driver/Ntvol.h https://raw.githubusercontent.com/veracrypt/VeraCrypt/refs/tags/VeraCrypt_1.25.9/src/Driver/Resource.h https://raw.githubusercontent.com/veracrypt/VeraCrypt/refs/tags/VeraCrypt_1.25.9/src/Driver/Sources https://raw.githubusercontent.com/veracrypt/VeraCrypt/refs/tags/VeraCrypt_1.25.9/src/Driver/veracrypt_vs2019.vcxproj https://raw.githubusercontent.com/veracrypt/VeraCrypt/refs/tags/VeraCrypt_1.25.9/src/Driver/veracrypt_vs2019.vcxproj.filters https://raw.githubusercontent.com/veracrypt/VeraCrypt/refs/tags/VeraCrypt_1.25.9/src/Driver/VolumeFilter.c https://raw.githubusercontent.com/veracrypt/VeraCrypt/refs/tags/VeraCrypt_1.25.9/src/Driver/VolumeFilter.h
最新发布
08-29
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值