https://git.reactos.org/?p=reactos.git;a=commitdiff;h=240dc77e4270572a47252…
commit 240dc77e4270572a472523108bbfb3651bdb6c0f
Author: Marat Nagayev <nagaevmt49(a)gmail.com>
AuthorDate: Wed Aug 4 09:03:39 2021 +0300
Commit: Victor Perevertkin <victor(a)perevertkin.ru>
CommitDate: Wed Aug 4 16:07:18 2021 +0300
[NTFS] Check file isn't encrypted
---
drivers/filesystems/ntfs/fcb.c | 6 ++++++
drivers/filesystems/ntfs/ntfs.h | 3 +++
drivers/filesystems/ntfs/rw.c | 7 +++++++
3 files changed, 16 insertions(+)
diff --git a/drivers/filesystems/ntfs/fcb.c b/drivers/filesystems/ntfs/fcb.c
index 2ff5ac5395f..7badedba171 100644
--- a/drivers/filesystems/ntfs/fcb.c
+++ b/drivers/filesystems/ntfs/fcb.c
@@ -143,6 +143,12 @@ NtfsFCBIsCompressed(PNTFS_FCB Fcb)
return ((Fcb->Entry.FileAttributes & NTFS_FILE_TYPE_COMPRESSED) ==
NTFS_FILE_TYPE_COMPRESSED);
}
+BOOLEAN
+NtfsFCBIsEncrypted(PNTFS_FCB Fcb)
+{
+ return ((Fcb->Entry.FileAttributes & NTFS_FILE_TYPE_ENCRYPTED) ==
NTFS_FILE_TYPE_ENCRYPTED);
+}
+
BOOLEAN
NtfsFCBIsRoot(PNTFS_FCB Fcb)
{
diff --git a/drivers/filesystems/ntfs/ntfs.h b/drivers/filesystems/ntfs/ntfs.h
index 38107a808a9..b5bb0645fa7 100644
--- a/drivers/filesystems/ntfs/ntfs.h
+++ b/drivers/filesystems/ntfs/ntfs.h
@@ -935,6 +935,9 @@ NtfsFCBIsReparsePoint(PNTFS_FCB Fcb);
BOOLEAN
NtfsFCBIsCompressed(PNTFS_FCB Fcb);
+BOOLEAN
+NtfsFCBIsEncrypted(PNTFS_FCB Fcb);
+
BOOLEAN
NtfsFCBIsRoot(PNTFS_FCB Fcb);
diff --git a/drivers/filesystems/ntfs/rw.c b/drivers/filesystems/ntfs/rw.c
index a060adbb411..f5bac1e9c4e 100644
--- a/drivers/filesystems/ntfs/rw.c
+++ b/drivers/filesystems/ntfs/rw.c
@@ -79,6 +79,13 @@ NtfsReadFile(PDEVICE_EXTENSION DeviceExt,
return STATUS_NOT_IMPLEMENTED;
}
+ if (NtfsFCBIsEncrypted(Fcb))
+ {
+ DPRINT1("Encrypted file!\n");
+ UNIMPLEMENTED;
+ return STATUS_NOT_IMPLEMENTED;
+ }
+
FileRecord =
ExAllocateFromNPagedLookasideList(&DeviceExt->FileRecLookasideList);
if (FileRecord == NULL)
{