我需要一个可以隐藏敏感文件夹的功能 [英] Please I need a function with which I can make sensitive folders hidden
本文介绍了我需要一个可以隐藏敏感文件夹的功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要一个可以隐藏敏感文件夹的功能。
有我开发的这个应用程序,我想要某些文件夹
隐藏了用户因为它们包含一些我不希望在注册表中的敏感数据。我知道CreateFile
函数有隐藏文件的功能,但我不认为CreateDirectory
函数有相同的功能。是否有这样的功能?
Please I need a function with which I can make sensitive folders hidden.
There is this application I developped and there are certain folders I want
hidden from users because they contain certain sensitive
data that I do not wish to be in the registry. I know that CreateFile
Function has facility for hidding files but I don''t think CreateDirectory
function has the same. Is there such a function?
推荐答案
如果你想保护敏感信息,那么隐藏文件夹不仅仅是在截肢上放一个创可贴。
打开隐藏文件夹很简单 - 使用Windows资源管理器(查看组织...文件夹和搜索选项...查看选项卡...显示隐藏文件,文件夹和驱动器 )或者使用一个简单的应用程序 - 它完全忽略了隐藏的标志(或者你的程序也找不到它)。
相反,将数据存储在传统的地点(见这里:我应该在哪里存储我的数据? [< a href =http://www.codeproject.com/Tips/370232/Where-should-I-store-my-datatarget =_ blanktitle =New Window> ^ ])和使用加密来保护它免受查看。
If you want to secure sensitive information, then hiding a folder is not going to do more than put a band-aid on an amputation.
It is trivially easy to open hidden folders - either with Windows Explorer (look under "Organise...Folder and search options...View Tab...Show hidden files, folders and drives") or with a simple application - which completely ignores the hidden flag (or your program couldn''t find it either).
Instead, store your data in a conventional place (see here: Where should I store my data?[^]) and use encryption to secure it from view.
试试这个
Try this
private static void ToggleHidden(bool hide)
{
DirectoryInfo d = new DirectoryInfo(@"C:\MySecretFolder");
if(d.Exists)
{
FileAttributes atts = d.Attributes;
if(hide == true)
{ // Hide the folder.
// Append Hidden attribute only if not already set.
if((atts & FileAttributes.Hidden) != FileAttributes.Hidden)
atts |= FileAttributes.Hidden;
}
else
{ // Show the folder.
// Remove Hidden attribute if set.
if((atts & FileAttributes.Hidden) == FileAttributes.Hidden)
atts &= ~FileAttributes.Hidden;
}
}
hide-directories-programatically-in-c-sharp [ ^ ]
这篇关于我需要一个可以隐藏敏感文件夹的功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文