How to create a "Block device" in Windows
For those familiar with Linux, it is possible to create a module and register it as a block device. This allows the user to mount it as a regular disk (while all the block I/O is handl开发者_StackOverflow社区ed by the module, e.g. USB mass storage).
Is there a way to do this in Windows ? (Need to create a volume mountable by Windows. The raw data will come from propriety interface).
The easiest way (and it's not easy!) is to write a Storport Miniport driver, you can even do this with KMDF as well. The latest issue of OSR's "The NT Insider" has an article on how to do this, but it's not going to be any kind of easy.
You will learn a ton though, so if you're interested in kernel development, this is a good way to get started!
You can find some simple block device drivers at http://www.acc.umu.se/~bosse/ . Look at the FileDisk driver, which is a Windows equivalent of /dev/loop
Take a look at the Truecrypt project. They have a pretty good implementation of a virtual block device.
精彩评论