Priyan Rajeevan
Priyan Rajeevan

Reputation: 1052

How can I hide a directory in C# with a file system driver?

I want to develop a program that can hide a folder. Not a hidden attribute, but a real hiding so that no applications can find it. I think for that I need to create a file system driver.

How can I do it in C#?

Upvotes: 0

Views: 4947

Answers (8)

DC.
DC.

Reputation: 1

Take a look at Dokan (dokan-dev.net) and see if that works for you.

Upvotes: -1

yfeldblum
yfeldblum

Reputation: 65445

May I suggest just downloading a rootkit instead of trying to build one from scratch?

Upvotes: 1

Priyan Rajeevan
Priyan Rajeevan

Reputation: 1052

I think i have to create a file system filter driver for what i really want. Its not just changing attribute

Upvotes: 0

Ranjan Ku Pati
Ranjan Ku Pati

Reputation:

// Get Application start up path
string path = Application.StartupPath;
// Create Batch File Path
string filePath = path + "\\Hide.bat";
// Write syntex to write in BAtch File
string strToWrite = "attrib +h +s " + '"' + path + '"';
// Create Batch File
FileStream fs = new FileStream(filePath, FileMode.Create);
StreamWriter sw = new StreamWriter(fs);
sw.WriteLine(strToWrite);
sw.Close();
fs.Close();

Upvotes: -1

Nick Berardi
Nick Berardi

Reputation: 54894

This is going to take a ton of work, and you are most likely going to end up corrupting your file system. Maybe you can tell us the 50,000 foot view of what you are trying to accomplish by hiding these folders.

Such as what is the need to hide these folders? They are just going to be hidden from users of the computer, but any software that reads the disc drive for recovery will still be able to read them, is this acceptable? Why isn't encryption with a hidden flag just as good?

Upvotes: 6

Dirk Vollmar
Dirk Vollmar

Reputation: 176259

What about using the system attribute on the folder?

When you want to use your own file system you will also need a separate partition. An example are e.g. recovery tools on pre-installed Windows system which are installed in a separate hidden partition.

Upvotes: 0

cjk
cjk

Reputation: 46475

If you want privacy, you might be best to write an app that can encrypt a folder so that no other program can read it.

Upvotes: 2

Matt Davison
Matt Davison

Reputation: 1552

You can't do it in C#.

You may find these videos interesting. Inside file system filters Part1 & Part2.

Upvotes: 7

Related Questions