First of all I would like to thank the excellent authors of Imdisk for a job well done. This is a very useful tool.
However, I am stuck with a particular problem and was hoping the folks in this group could help.
Here is the issue. I am writing a filter layer on top of a regular disk class driver. This filter driver (sitting below NTFS FS driver and above the disk class storage driver) has to redirect certain block requests to a remote block storage server. To realize this, I am using Imdisk to fetch the blocks from the remote server using 'devio' in the other end. The Imdisk drive is mapped to a local drive letter 'R:' and is also available at "\Device\ImDisk0".
Here is the issue I am facing:
I need this to be functional even when the system boots - so at some stage in the boot when all the relevant drivers are loaded (my filter driver, storage class driver, tcp/ip driver and imdisk) I need to have this mechanism functional. That is, any read request that hits my filter driver has to be redirected not to the underlying local storage but to the remote storage provided by Imdisk. I need this to work _only_ for read requests and for certain blocks that is determined by my filter driver as being remotely available.
I tried opening the Imdisk device from my filter driver's start function using the path "\Device\ImDisk0" (ZwFileOpen) but the call fails because ImDisk gets loaded later on in the boot process and even if it gets loaded the drive letter will not be mapped till the 'imdisk' command line is invoked.
I already set the starttype to '0' (to indicate that it is a boot start driver) in the INF file. But not sure how to hardcode the ability to map the drive and create the path "\Device\ImDisk0" when the driver loads.
So in essence, is there a way to load ImDisk early in the boot process and hardcode the mapping of the drive letter to the remote block server so that when my filter driver loads the path "\Device\ImDisk0" is already available and functional?
Also is there a way to ensure that Imdisk loads before my filter driver?