且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

NTFS 备用数据流 - 好主意还是坏主意?

更新时间:2022-11-02 23:10:16

如果没有关于您存储的数据类型的更多信息,很难说.您似乎意识到使用它们的一些问题,所以我不确定我能提供多少帮助.不过,这是我对备用数据流的一般想法:

It's hard to say without more information about the kind of data you're storing. You seem to be aware of some of the concerns involving their use, so I'm not sure how much I can help. Here's my general thoughts on alternate data streams, though:

首先,正如您所指出的,AD 流仅适用于 NTFS.如果有可能需要将此元数据存储在 FAT 文件系统上,则需要某种回退机制.现代 PC 可能具有 NTFS 格式的内部硬盘驱动器,但您遇到的大多数 USB 闪存驱动器仍然是 FAT 格式的.如果您的用户将数据文件存储在闪存驱动器上,请记住这一点.

First of all, as you've noted, AD streams only work on NTFS. If there's any chance you'll need to store this metadata on a FAT filesystem, you'll need some kind of fallback mechanism. Modern PCs will probably have NTFS-formatted internal hard drives, but most USB flash drives you encounter are still FAT-formatted. Keep that in mind if your users will be storing data files on flash drives.

除此之外,我想不出任何避免 AD 流的技术原因,但我仍然对使用它们持谨慎态度.无论意图如何,人们往往对向他们隐藏"数据的应用程序感到紧张.考虑一下 Sony Rootkit 惨败,等等.我并不是说您的应用程序差得如此糟糕,但人们(尤其是不太懂技术的人)可能无法区分.不过,我会允许它们可能对您的应用程序有效.当然,卸载后留下AD流的问题仍然很现实.您可能需要考虑让运行卸载程序的人选择运行程序来搜索他们的驱动器并清理所有剩余的流.

Aside from that, I can't think of any technological reasons to avoid AD streams, but I'd still be wary of using them. People tend to be nervous about applications that "hide" data from them, regardless of the intent. Consider the Sony rootkit fiasco, and so on. I'm not saying your application is anywhere near as bad as that, but people (especially the less tech-savvy) may not make out the distinction. Still, I will allow that they might have a valid use for your application. The problem of leaving the AD streams behind after uninstallation is still very real, of course. You might want to consider giving people running the uninstaller the option of running a program to search their drive(s) and clean up any remaining streams.

另外,请记住KISS 原则.使用 AD 流真的是有效解决应用程序元数据存储问题的最简单方法吗?如果是这样,也许 AD 流是个好主意,但如果不是,我会认真考虑采用另一种方法.

Also, remember the KISS principle. Is the use of AD streams really the simplest way to effectively solve your application's metadata storage problem? If so, maybe AD streams are a good idea, but, if not, I'd seriously consider taking another approach.