I was thinking of messing around with my own file system code, as a learning exercise. To start with this could be a RAM drive, or just mounted within a file on another drive. Questions:
- What windows APIs would I need to program to implement my own drive letter (eg an M: with my system)
- Where开发者_JAVA技巧 is the documentation for these APIs?
- Can you implement them using C#?
NB:
- I know there are other Ram drive implementations out there - I don't need a list of them.
- I've tried googling, but found it very hard to find the right search terms.
- I'm not fussy for now about which version of windows, any version is fine as I'm developing using Windows 7, but I hope that version for earlier Windows will still work
Take a look at the IFS (Installable Filesystem) Kit.
You're talking about writing a filesystem driver. The basic model is that your code gets loaded into the NT kernel and processes IRPs.
No, you can't do it in C#.
You need to look at the Windows DDK - now called "WDK" apparently. The WDK includes the Installable File Systems (IFS) kit. See here: Installable File Systems (IFS) kit
Device drivers on Windows are written in C/C++. As far as I know there is no way to implement a file system driver in .NET. There is no CLR in kernel space.
EDIT: asveikau beat me to it...
From this answer to a similar question: how to map a software as a Drive?
Have a look at Dokan. It looks like a nice scriptable wrapper to low-level filesystem drivers. Like FUSE on Linux.
The docs page mention that you can use it to write filesystem code in C#, VB, C++ and even Ruby! Since it exposes itself as a .Net library I'm guessing you can do it in any language running on the CLR as well such as IronPython or F#.
Depending on what you need (implement a file system or just a virtual disk with existing file system) you can use one of our virtual storage products: Callback File System and CallbackDisk respectively.
The difference is that CallbackDisk emulates a disk device (so you can mount, for example, ISO image there), and Callback File System lets you build your own file system (eg. distributed, or just remotely stored)
.NET APIs are available in both products.
精彩评论