What is the use of IrpSp->Parameters.MountVolume.DeviceObject?

Hi, experts,

In handling IRP_MN_MOUNT_VOLUME, we have four device objects.

Say:

NTSTATUS DispatchFsControl(PDEVICE_OBJECT DeviceObject1, PIRP Irp)
{
IrpSp->Parameters.MountVolume.Vpb.RealDevice; // DeviceObject2
IrpSp->Parameters.MountVolume.Vpb.DeviceObject; // DeviceObject3

IrpSp->Parameters.MountVolume.DeviceObject; // DeviceObject4
}

To my understanding,

1, DeviceObject1 is the file system, say L"\Ntfs".

2, DeviceObject2 is the partition device, say L"\Device\HarddiskVolume1".

3, DeviceObject3 is the volume device created in this routine to respond to
IRP_MN_MOUNT_VOLUME, say L"FileSystem\Ntfs".

4, DeviceObject4 is ???

http://www.osronline.com/showThread.cfm?link=25276
and
http://www.osronline.com/showThread.cfm?link=22666

The preceding two postings discussed this question. However, I’m still
unclear.

In the latter posting, Neal from Microsoft says:

"I don’t know if you are writing a filter or file system, but in either case
you want to ignore this parameter. "

If what he says is true, then what is the intent to reserve such a field?

> 1, DeviceObject1 is the file system, say L"\Ntfs".

Yes.

2, DeviceObject2 is the partition device, say L"\Device\HarddiskVolume1".

Yes, bottom of partition stack.

IIRC the top of partition stack.


Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

Thank you, Maxim.

What I want to know is: For an FSD writer, when and where to use the field
IrpSp->Parameters.MountVolume.DeviceObject?

Someone says FSD writers should ignore this field. But I can’t understand
the reason why Microsoft reserves such an device object.

I can’t understand WHY an FSD needs the top device object of the storage
stack.

“Maxim S. Shatskih” xxxxx@ntfsd…
>> 1, DeviceObject1 is the file system, say L"\Ntfs".
>
> Yes.
>
>> 2, DeviceObject2 is the partition device, say
>> L"\Device\HarddiskVolume1".
>
> Yes, bottom of partition stack.
>
> IIRC the top of partition stack.
>
> –
> Maxim Shatskih, Windows DDK MVP
> StorageCraft Corporation
> xxxxx@storagecraft.com
> http://www.storagecraft.com
>
>

> What I want to know is: For an FSD writer, when and where to use the field

IrpSp->Parameters.MountVolume.DeviceObject?

Someone says FSD writers should ignore this field. But I can’t understand
the reason why Microsoft reserves such an device object.

This is the current top of disk stack to send IRPs to.


Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com