How to secure a hard disk programmatically through C#?
Like if a user wants to open a hard disk and first he/she has to give a password to access it. If the password is wrong then the hard disk is hidden from that user..
How to secure a hard disk programmatically through C#?
Like if a user wants to open a hard disk and first he/she has to give a password to access it. If the password is wrong then the hard disk is hidden from that user..
If you're trying to do this inside an app written in C#:
Get logical drives:
string[] drives = Directory.GetLogicalDrives();
Also check this out: http://www.experts-exchange.com/Programming/Languages/C_Sharp/Q_23825199.html
http://bytes.com/topic/c-sharp/answers/276247-get-drive-letter-win32_diskdrive
You'll need to expand that more. Associate a drive letter with a password and keep that stored somewhere. If the entered password is correct, show that drive as you already have a list/array of them. (note it's too early for me to write this all out and I have a cold - but it's fairly simple).
You have your list of drives, you check a password to see if they can see a drive, if so let them see it.
If you are trying to restrict the entire windows system from showing drive letters based on a password, I would say do not use C#. This is a windows security issue.
I would recommend reading abot MS Group Policies. This article can help you: http://support.microsoft.com/kb/231289
I don't think this can be done transparently (you can access the file with any program) and securely (that is, the disk is actually encrypted, not just hidden from the shell) in C# (on Windows, not on Singularity). To decrypt the disk on the fly you need a kernel mode driver. And you can't write that in .NET.
On Linux you might be able to write a FUSE (usermode) driver in C#+Mono.