File System Filter Driver for VHD Mount

I want to develop a driver for mounting a VHD file.
actually they are having their own incremental image related software etc.
Please Give me some suggestion…

  1. Any sample is there for doing the same.
  2. i have seen FastFat sources may i start development with that or mini filters way or ??.
    3.give me some starting points, how can i achieve this.
    4.without FSFD can i do this if yes which sample i can follow.

I will be very thankful to you.

If you are going to mount custom VHD-like files there are 2 modules
which you will need to implement. The first will be an interface to
initialize a device instance for the given VHD file which you will be
mounting. You could mount the VHD files within a directory of an
existing name space which would eliminate the need for this component.

The second module would be the file system driver for handling all
access requests to the file. You can do this as a mini-filter driver
sitting over an existing local storage volume or a complete standalone
file system driver which would ‘mount’ the device instances you created
in the first module. Either route is going to entail lots of work,
basically you will be virtualizing a name space that is exposed through
the data contained within the VHD-like file you are mounting.

While the FastFat source code is a good sample for showing you how to
handle access requests, for what you are trying to achieve it will take
considerable more work and design. If you are unfamiliar with the
internals of Windows file systems and the storage stack I would begin by
taking classes and reading lots of books. Get your design worked out
completely and then start coding. From scratch this project will take
many months of effort to get to a working prototype.

Good luck.

Pete

On 5/21/2013 9:09 AM, xxxxx@gmail.com wrote:

I want to develop a driver for mounting a VHD file.
actually they are having their own incremental image related software etc.
Please Give me some suggestion…

  1. Any sample is there for doing the same.
  2. i have seen FastFat sources may i start development with that or mini filters way or ??.
    3.give me some starting points, how can i achieve this.
    4.without FSFD can i do this if yes which sample i can follow.

I will be very thankful to you.


NTFSD is sponsored by OSR

OSR is hiring!! Info at http://www.osr.com/careers

For our schedule of debugging and file system seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer


Kernel Drivers
Windows File System and Device Driver Consulting
www.KernelDrivers.com
866.263.9295

Hi Xavier,

Assuming VHD extends for Virtual Hard Disk, I think you should develop a disk driver for this image instead of a file system driver. A regular file system driver will recognize and mount the volume after having this new disk working.

Regards,

Fernando Roberto da Silva
DriverEntry Kernel Development
http://www.driverentry.com.br

+1 to what Fernando said.

One way to go would be to create this driver on the root bus, and then upon
an user command to perform the mount operation, this driver will create a
DISK device. Your disk device, which is virtual and emulating what a real
disk should, would have to handle a few IOCTLS targetted for the disk and
mount manager, but those are very few, and easy to emulate.

Now, once you successfully show the disk (this would be by actually reading
the VHD file and converting the virtual sectors to valid LBAs, Windows will
automatically mount an FS on it, and explorer will start showing this as it
does for any other drive.

Please remember, all IOs to this disk will come to your disk driver device,
so you will have to handle the translation of those IOs and fetching the
data from the actual backing up VHD.

On Tue, May 21, 2013 at 9:18 PM, wrote:

> Hi Xavier,
>
> Assuming VHD extends for Virtual Hard Disk, I think you should develop a
> disk driver for this image instead of a file system driver. A regular file
> system driver will recognize and mount the volume after having this new
> disk working.
>
> Regards,
> –
> Fernando Roberto da Silva
> DriverEntry Kernel Development
> http://www.driverentry.com.br
>
> —
> NTFSD is sponsored by OSR
>
> OSR is hiring!! Info at http://www.osr.com/careers
>
> For our schedule of debugging and file system seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>



- ab

This all assumes that the VHD is created on a Windows machine with a
Windows file system. If not as Pete pointed out this is two drivers.
More to the point since the OP had to ask what kind of driver, he really
needs some training since messing around in the storage stack is a great
way to crash the system.

Don Burn
Windows Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr

“A B” wrote in message news:xxxxx@ntfsd:

> +1 to what Fernando said.
>
> One way to go would be to create this driver on the root bus, and then upon
> an user command to perform the mount operation, this driver will create a
> DISK device. Your disk device, which is virtual and emulating what a real
> disk should, would have to handle a few IOCTLS targetted for the disk and
> mount manager, but those are very few, and easy to emulate.
>
> Now, once you successfully show the disk (this would be by actually reading
> the VHD file and converting the virtual sectors to valid LBAs, Windows will
> automatically mount an FS on it, and explorer will start showing this as it
> does for any other drive.
>
> Please remember, all IOs to this disk will come to your disk driver device,
> so you will have to handle the translation of those IOs and fetching the
> data from the actual backing up VHD.
>
>
>
>
> On Tue, May 21, 2013 at 9:18 PM, wrote:
>
> > Hi Xavier,
> >
> > Assuming VHD extends for Virtual Hard Disk, I think you should develop a
> > disk driver for this image instead of a file system driver. A regular file
> > system driver will recognize and mount the volume after having this new
> > disk working.
> >
> > Regards,
> > –
> > Fernando Roberto da Silva
> > DriverEntry Kernel Development
> > http://www.driverentry.com.br
> >
> > —
> > NTFSD is sponsored by OSR
> >
> > OSR is hiring!! Info at http://www.osr.com/careers
> >
> > For our schedule of debugging and file system seminars visit:
> > http://www.osr.com/seminars
> >
> > To unsubscribe, visit the List Server section of OSR Online at
> > http://www.osronline.com/page.cfm?name=ListServer
> >
>
>
>
> –
>
> - ab

yes, Don’s point is valid…my suggestion to mount will only work for FSs
recognised by MS. And again, if I am on a mordern OS like win 7 then this
facility is inbuilt into the OS…

On Tue, May 21, 2013 at 9:47 PM, Don Burn wrote:

> This all assumes that the VHD is created on a Windows machine with a
> Windows file system. If not as Pete pointed out this is two drivers. More
> to the point since the OP had to ask what kind of driver, he really needs
> some training since messing around in the storage stack is a great way to
> crash the system.
>
>
> Don Burn
> Windows Filesystem and Driver Consulting
> Website: http://www.windrvr.com
> Blog: http://msmvps.com/blogs/**WinDrvr http:
>
>
>
> “A B” wrote in message news:xxxxx@ntfsd:
>
>
> +1 to what Fernando said.
>>
>> One way to go would be to create this driver on the root bus, and then
>> upon
>> an user command to perform the mount operation, this driver will create a
>> DISK device. Your disk device, which is virtual and emulating what a real
>> disk should, would have to handle a few IOCTLS targetted for the disk and
>> mount manager, but those are very few, and easy to emulate.
>>
>> Now, once you successfully show the disk (this would be by actually
>> reading
>> the VHD file and converting the virtual sectors to valid LBAs, Windows
>> will
>> automatically mount an FS on it, and explorer will start showing this as
>> it
>> does for any other drive.
>>
>> Please remember, all IOs to this disk will come to your disk driver
>> device,
>> so you will have to handle the translation of those IOs and fetching the
>> data from the actual backing up VHD.
>>
>>
>>
>>
>> On Tue, May 21, 2013 at 9:18 PM, wrote:
>>
>> > Hi Xavier,
>> >
>> > Assuming VHD extends for Virtual Hard Disk, I think you should develop a
>> > disk driver for this image instead of a file system driver. A regular
>> file
>> > system driver will recognize and mount the volume after having this new
>> > disk working.
>> >
>> > Regards,
>> > –
>> > Fernando Roberto da Silva
>> > DriverEntry Kernel Development
>> > http://www.driverentry.com.br
>> >
>> > —
>> > NTFSD is sponsored by OSR
>> >
>> > OSR is hiring!! Info at http://www.osr.com/careers
>> >
>> > For our schedule of debugging and file system seminars visit:
>> > http://www.osr.com/seminars
>> >
>> > To unsubscribe, visit the List Server section of OSR Online at
>> > http://www.osronline.com/page.**cfm?name=ListServerhttp:
>> >
>>
>>
>>
>> –
>>
>> - ab
>>
>
>
> —
> NTFSD is sponsored by OSR
>
> OSR is hiring!! Info at http://www.osr.com/careers
>
> For our schedule of debugging and file system seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.**cfm?name=ListServerhttp:
>



- ab</http:></http:></http:>

Thank you all for the suggestions!!!

Don
I need a driver which can mount a vhd image like we can do using
diskmgmt.msc or automatically
without need of diskmgmt.msc.for that i am going with fastfat way but at
the initial stage i am getting some problems like according to vhd spec we
are having only three structure 1 for _VHDFooter,2 for _ParentLocatorEntry,
3 _VHDDynamicDiskHeader.now my confusion is that with the help of these
strctures may i’ll be able to make FS to mount my VHD? or i have to embed
my structures into fat defined one and then start my implementation.but how
to do that please give me some pointers.

Thanks in advance.

On Tue, May 21, 2013 at 10:00 PM, A B wrote:

> yes, Don’s point is valid…my suggestion to mount will only work for FSs
> recognised by MS. And again, if I am on a mordern OS like win 7 then this
> facility is inbuilt into the OS…
>
>
>
>
> On Tue, May 21, 2013 at 9:47 PM, Don Burn wrote:
>
>> This all assumes that the VHD is created on a Windows machine with a
>> Windows file system. If not as Pete pointed out this is two drivers. More
>> to the point since the OP had to ask what kind of driver, he really needs
>> some training since messing around in the storage stack is a great way to
>> crash the system.
>>
>>
>> Don Burn
>> Windows Filesystem and Driver Consulting
>> Website: http://www.windrvr.com
>> Blog: http://msmvps.com/blogs/**WinDrvr http:
>>
>>
>>
>> “A B” wrote in message news:xxxxx@ntfsd:
>>
>>
>> +1 to what Fernando said.
>>>
>>> One way to go would be to create this driver on the root bus, and then
>>> upon
>>> an user command to perform the mount operation, this driver will create a
>>> DISK device. Your disk device, which is virtual and emulating what a real
>>> disk should, would have to handle a few IOCTLS targetted for the disk and
>>> mount manager, but those are very few, and easy to emulate.
>>>
>>> Now, once you successfully show the disk (this would be by actually
>>> reading
>>> the VHD file and converting the virtual sectors to valid LBAs, Windows
>>> will
>>> automatically mount an FS on it, and explorer will start showing this as
>>> it
>>> does for any other drive.
>>>
>>> Please remember, all IOs to this disk will come to your disk driver
>>> device,
>>> so you will have to handle the translation of those IOs and fetching the
>>> data from the actual backing up VHD.
>>>
>>>
>>>
>>>
>>> On Tue, May 21, 2013 at 9:18 PM, wrote:
>>>
>>> > Hi Xavier,
>>> >
>>> > Assuming VHD extends for Virtual Hard Disk, I think you should develop
>>> a
>>> > disk driver for this image instead of a file system driver. A regular
>>> file
>>> > system driver will recognize and mount the volume after having this new
>>> > disk working.
>>> >
>>> > Regards,
>>> > –
>>> > Fernando Roberto da Silva
>>> > DriverEntry Kernel Development
>>> > http://www.driverentry.com.br
>>> >
>>> > —
>>> > NTFSD is sponsored by OSR
>>> >
>>> > OSR is hiring!! Info at http://www.osr.com/careers
>>> >
>>> > For our schedule of debugging and file system seminars visit:
>>> > http://www.osr.com/seminars
>>> >
>>> > To unsubscribe, visit the List Server section of OSR Online at
>>> > http://www.osronline.com/page.**cfm?name=ListServerhttp:
>>> >
>>>
>>>
>>>
>>> –
>>>
>>> - ab
>>>
>>
>>
>> —
>> NTFSD is sponsored by OSR
>>
>> OSR is hiring!! Info at http://www.osr.com/careers
>>
>> For our schedule of debugging and file system seminars visit:
>> http://www.osr.com/seminars
>>
>> To unsubscribe, visit the List Server section of OSR Online at
>> http://www.osronline.com/page.**cfm?name=ListServerhttp:
>>
>
>
>
> –
>
> - ab
> — NTFSD is sponsored by OSR OSR is hiring!! Info at
> http://www.osr.com/careers For our schedule of debugging and file system
> seminars visit: http://www.osr.com/seminars To unsubscribe, visit the
> List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
></http:></http:></http:>

I guess I am more confused than ever? If you are really using the
Microsoft VHD format what is your driver for? I.E. what is the special
thing that is needed that does not allow you to use the standard
Microsoft tools.

Don Burn
Windows Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr

“Max Xavier” wrote in message news:xxxxx@ntfsd:

> Thank you all for the suggestions!!!
>
> Don
> I need a driver which can mount a vhd image like we can do using
> diskmgmt.msc or automatically
> without need of diskmgmt.msc.for that i am going with fastfat way but at
> the initial stage i am getting some problems like according to vhd spec we
> are having only three structure 1 for _VHDFooter,2 for _ParentLocatorEntry,
> 3 _VHDDynamicDiskHeader.now my confusion is that with the help of these
> strctures may i’ll be able to make FS to mount my VHD? or i have to embed
> my structures into fat defined one and then start my implementation.but how
> to do that please give me some pointers.
>
> Thanks in advance.
>
>
> On Tue, May 21, 2013 at 10:00 PM, A B wrote:
>
> > yes, Don’s point is valid…my suggestion to mount will only work for FSs
> > recognised by MS. And again, if I am on a mordern OS like win 7 then this
> > facility is inbuilt into the OS…
> >
> >
> >
> >
> > On Tue, May 21, 2013 at 9:47 PM, Don Burn wrote:
> >
> >> This all assumes that the VHD is created on a Windows machine with a
> >> Windows file system. If not as Pete pointed out this is two drivers. More
> >> to the point since the OP had to ask what kind of driver, he really needs
> >> some training since messing around in the storage stack is a great way to
> >> crash the system.
> >>
> >>
> >> Don Burn
> >> Windows Filesystem and Driver Consulting
> >> Website: http://www.windrvr.com
> >> Blog: http://msmvps.com/blogs/**WinDrvr http:
> >>
> >>
> >>
> >> “A B” wrote in message news:xxxxx@ntfsd:
> >>
> >>
> >> +1 to what Fernando said.
> >>>
> >>> One way to go would be to create this driver on the root bus, and then
> >>> upon
> >>> an user command to perform the mount operation, this driver will create a
> >>> DISK device. Your disk device, which is virtual and emulating what a real
> >>> disk should, would have to handle a few IOCTLS targetted for the disk and
> >>> mount manager, but those are very few, and easy to emulate.
> >>>
> >>> Now, once you successfully show the disk (this would be by actually
> >>> reading
> >>> the VHD file and converting the virtual sectors to valid LBAs, Windows
> >>> will
> >>> automatically mount an FS on it, and explorer will start showing this as
> >>> it
> >>> does for any other drive.
> >>>
> >>> Please remember, all IOs to this disk will come to your disk driver
> >>> device,
> >>> so you will have to handle the translation of those IOs and fetching the
> >>> data from the actual backing up VHD.
> >>>
> >>>
> >>>
> >>>
> >>> On Tue, May 21, 2013 at 9:18 PM, wrote:
> >>>
> >>> > Hi Xavier,
> >>> >
> >>> > Assuming VHD extends for Virtual Hard Disk, I think you should develop
> >>> a
> >>> > disk driver for this image instead of a file system driver. A regular
> >>> file
> >>> > system driver will recognize and mount the volume after having this new
> >>> > disk working.
> >>> >
> >>> > Regards,
> >>> > –
> >>> > Fernando Roberto da Silva
> >>> > DriverEntry Kernel Development
> >>> > http://www.driverentry.com.br
> >>> >
> >>> > —
> >>> > NTFSD is sponsored by OSR
> >>> >
> >>> > OSR is hiring!! Info at http://www.osr.com/careers
> >>> >
> >>> > For our schedule of debugging and file system seminars visit:
> >>> > http://www.osr.com/seminars
> >>> >
> >>> > To unsubscribe, visit the List Server section of OSR Online at
> >>> > http://www.osronline.com/page.**cfm?name=ListServerhttp:
> >>> >
> >>>
> >>>
> >>>
> >>> –
> >>>
> >>> - ab
> >>>
> >>
> >>
> >> —
> >> NTFSD is sponsored by OSR
> >>
> >> OSR is hiring!! Info at http://www.osr.com/careers
> >>
> >> For our schedule of debugging and file system seminars visit:
> >> http://www.osr.com/seminars
> >>
> >> To unsubscribe, visit the List Server section of OSR Online at
> >> http://www.osronline.com/page.**cfm?name=ListServerhttp:
> >>
> >
> >
> >
> > –
> >
> > - ab
> > — NTFSD is sponsored by OSR OSR is hiring!! Info at
> > http://www.osr.com/careers For our schedule of debugging and file system
> > seminars visit: http://www.osr.com/seminars To unsubscribe, visit the
> > List Server section of OSR Online at
> > http://www.osronline.com/page.cfm?name=ListServer
> ></http:></http:></http:>

perhaps the op needs to support < win7?

OP,

VHD is a container. The structures in your post refer to what he VHD needs
to keep it’s own meta data, it has nothing to do with what the container
contains, that is, the data region of the VHD.

The data area will be a representation of the HDD layout, but VHD has
stripes of container data and then a region for itrs meta data, this goes
on repeatedly (IIRC).

So, to read the VHD, you will need to know the VHD format and design a
translator yourself that should be able to fetch you sector data from
inside the container.

Now remember, Windows will be expecting LBAs and your driver will have to
translate those LBA into virtual sectors inside the VHD.

If you dont want to support any file system unknown to Windows, then you
are better off by writing a disk emulation driver like we suggested before.
it makes it easier. that way u dont need to worry abt the FS inside it at
all.

On Thu, May 23, 2013 at 9:09 PM, Don Burn wrote:

> I guess I am more confused than ever? If you are really using the
> Microsoft VHD format what is your driver for? I.E. what is the special
> thing that is needed that does not allow you to use the standard Microsoft
> tools.
>
>
>
> Don Burn
> Windows Filesystem and Driver Consulting
> Website: http://www.windrvr.com
> Blog: http://msmvps.com/blogs/ WinDrvr http:
>
>
>
> “Max Xavier” wrote in message news:xxxxx@ntfsd:
>
> Thank you all for the suggestions!!!
>>
>> Don
>> I need a driver which can mount a vhd image like we can do using
>> diskmgmt.msc or automatically
>> without need of diskmgmt.msc.for that i am going with fastfat way but at
>> the initial stage i am getting some problems like according to vhd spec we
>> are having only three structure 1 for _VHDFooter,2 for
>> _ParentLocatorEntry,
>> 3 _VHDDynamicDiskHeader.now my confusion is that with the help of these
>> strctures may i’ll be able to make FS to mount my VHD? or i have to embed
>> my structures into fat defined one and then start my implementation.but
>> how
>> to do that please give me some pointers.
>>
>> Thanks in advance.
>>
>>
>> On Tue, May 21, 2013 at 10:00 PM, A B wrote:
>>
>> > yes, Don’s point is valid…my suggestion to mount will only work for
>> FSs
>> > recognised by MS. And again, if I am on a mordern OS like win 7 then
>> this
>> > facility is inbuilt into the OS…
>> >
>> >
>> >
>> >
>> > On Tue, May 21, 2013 at 9:47 PM, Don Burn wrote:
>> >
>> >> This all assumes that the VHD is created on a Windows machine with a
>> >> Windows file system. If not as Pete pointed out this is two drivers.
>> More
>> >> to the point since the OP had to ask what kind of driver, he really
>> needs
>> >> some training since messing around in the storage stack is a great way
>> to
>> >> crash the system.
>> >>
>> >>
>> >> Don Burn
>> >> Windows Filesystem and Driver Consulting
>> >> Website: http://www.windrvr.com
>> >> Blog: http://msmvps.com/blogs/
** WinDrvrhttp:<
>> http://msmvps.com/blogs/**WinDrvr http:>
>>
>> >>
>> >>
>> >>
>> >> “A B” wrote in message news:xxxxx@ntfsd:
>> >>
>> >>
>> >> +1 to what Fernando said.
>> >>>
>> >>> One way to go would be to create this driver on the root bus, and then
>> >>> upon
>> >>> an user command to perform the mount operation, this driver will
>> create a
>> >>> DISK device. Your disk device, which is virtual and emulating what a
>> real
>> >>> disk should, would have to handle a few IOCTLS targetted for the disk
>> and
>> >>> mount manager, but those are very few, and easy to emulate.
>> >>>
>> >>> Now, once you successfully show the disk (this would be by actually
>> >>> reading
>> >>> the VHD file and converting the virtual sectors to valid LBAs, Windows
>> >>> will
>> >>> automatically mount an FS on it, and explorer will start showing this
>> as
>> >>> it
>> >>> does for any other drive.
>> >>>
>> >>> Please remember, all IOs to this disk will come to your disk driver
>> >>> device,
>> >>> so you will have to handle the translation of those IOs and fetching
>> the
>> >>> data from the actual backing up VHD.
>> >>>
>> >>>
>> >>>
>> >>>
>> >>> On Tue, May 21, 2013 at 9:18 PM, wrote:
>> >>>
>> >>> > Hi Xavier,
>> >>> >
>> >>> > Assuming VHD extends for Virtual Hard Disk, I think you should
>> develop
>> >>> a
>> >>> > disk driver for this image instead of a file system driver. A
>> regular
>> >>> file
>> >>> > system driver will recognize and mount the volume after having this
>> new
>> >>> > disk working.
>> >>> >
>> >>> > Regards,
>> >>> > –
>> >>> > Fernando Roberto da Silva
>> >>> > DriverEntry Kernel Development
>> >>> > http://www.driverentry.com.br
>> >>> >
>> >>> > —
>> >>> > NTFSD is sponsored by OSR
>> >>> >
>> >>> > OSR is hiring!! Info at http://www.osr.com/careers
>> >>> >
>> >>> > For our schedule of debugging and file system seminars visit:
>> >>> > http://www.osr.com/seminars
>> >>> >
>> >>> > To unsubscribe, visit the List Server section of OSR Online at
>> >>> > http://www.osronline.com/page.****cfm?name=ListServerhttp:
>> http:
>> >
>>
>> >>> >
>> >>>
>> >>>
>> >>>
>> >>> –
>> >>>
>> >>> - ab
>> >>>
>> >>
>> >>
>> >> —
>> >> NTFSD is sponsored by OSR
>> >>
>> >> OSR is hiring!! Info at http://www.osr.com/careers
>> >>
>> >> For our schedule of debugging and file system seminars visit:
>> >> http://www.osr.com/seminars
>> >>
>> >> To unsubscribe, visit the List Server section of OSR Online at
>> >> http://www.osronline.com/page. **cfm?name=ListServerhttp:
>> http:
>> >
>>
>> >>
>> >
>> >
>> >
>> > –
>> >
>> > - ab
>> > — NTFSD is sponsored by OSR OSR is hiring!! Info at
>> > http://www.osr.com/careers For our schedule of debugging and file
>> system
>> > seminars visit: http://www.osr.com/seminars To unsubscribe, visit the
>> > List Server section of OSR Online at
>> > http://www.osronline.com/page.
cfm?name=ListServerhttp:
>> >
>>
>
>
> —
> NTFSD is sponsored by OSR
>
> OSR is hiring!! Info at http://www.osr.com/careers
>
> For our schedule of debugging and file system seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.**cfm?name=ListServerhttp:
>



- ab</http:></http:></http:></http:></http:></http:></http:></http:></http:>