views:

731

answers:

6

Is there a way to emulate a disk drive in .NET, intercepting read/write/lock operations?
I would like to create something with a front-end similar to GMail Drive in C#.

Thanks, Tom

A: 

I use the Eldos Callback File System myself for this purpose, but although it's good, it's not exactly cheap.

There are some free/cheap projects as well, and I'm sure one of them was mentioned in a similar question on SO recently -- can't find it anymore at the moment, though. Stability tends to be a major issue, though, as layered Windows file system drivers aren't trivial.

mdb
A: 

You could implement a GmailStream...

Chuck Conway
A: 

Not really, .Net sits on top of OS functionality like disk access to give you things like managed file accessors.You could write all of it in managed C#, but you'd need unmanaged calls to make the OS treat it like another drive.

All the shell extension stuff is COM: http://msdn.microsoft.com/en-us/library/cc147467(VS.85).aspx

You could, however, write a .Net desktop app that allowed drag-drop from explorer and that looked like a file system view.

Keith
+7  A: 

On Linux you can use the Mono.Fuse API (http://www.jprl.com/Projects/mono-fuse.html) to implement .NET-based file systems with user-land code.

miguel.de.icaza
A: 

You could see how http://www.truecrypt.org/ is doing it. It's doing exactly that either by using files or by using a drive or a partition. And then it mounts the file as if it were a real drive. Now, probably that the source code is a bit complex ;)

Jonx
A: 

You could also use EZNamespaceExtension for .NET. This gives you integration with Windows Explorer. Not too expensive given that the license is per developer and not distribution.

tronda