Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否有某个库方法可以确定文件是否已使用 EFS 加密?我在 FileInfo 上看到了Encrypt()和Decrypt()方法,但正在寻找一种查询文件状态的方法。
Encrypt()
Decrypt()
扩展 bdolan & matt 的评论:
<snip> using System.IO; <snip> FileInfo fi = new FileInfo(uri); //uri is the full path and file name if (fi.Attributes.HasFlag(FileAttributes.Encrypted)) { //FILE IS ENCRYPTED } else { //FILE IS SAFE }
使用GetFileAttributes(),并检查FILE_ATTRIBUTE_ENCRYPTED。
GetFileAttributes()
FILE_ATTRIBUTE_ENCRYPTED