This is a mirror of official site: http://jasper-net.blogspot.com/

Dokan.Mem, a filesystem prototype

| Wednesday, July 21, 2010
Introduction

Hiroki Asakawa created a device driver that enables an application in user-mode to simulate a file-system, and distributed it under a MIT-style license. This post shows how that's used in C# to create the functionality of a RAM-Disk, with some tips on rolling your own file-system application.

Before you can run the code, you have to run the installer to install a proxy driver (dokan.sys). This driver then acts as an intermediate between the kernel and our custom .NET solution. The installer for the proxy driver is also included with the sourcecode here, but I'd recommend downloading the package from the original website as they contain two cool examples; The first implements a mirror of your C-drive, and the second makes the Registry available as a readonly drive. This article briefly explains how the Dokan-libraries are used to build something that resembles a RAM-disk in functionality

Having the option to expose data as a file-system has several advantages. It makes your data instantaneous available for other applications, without the need for a complicated UI.

Download the basic installer and .NET bindings to Dokan here[^].

Using the code

Log in as administrator, run the installer (it's just 513 Kb), open the project and hit F5; a trayicon should appear, and on doubleclick it should open the Windows-Explorer, pointing to a simulated harddisk. It'll mount on the first available free drive-letter. Paste a zipfile on there and extract it :)

I choose to implement a basic RAM-Disk to test the library (version 0.5.3), with the results documented here.

There's three projects in the solution;

DokanNet - these are the .NET bindings to the Dokan libraries
Buffers - used to replace the MemoryStream
Dokan.Mem - example-implementation of the Dokan-interface, simulating a RAM-Disk

Read more: Codeproject

Posted via email from .NET Info

0 comments: