I am writing a virtual disk driver which uses a file as a virtual disk.

The disk
file can be mounted with a drive letter and normally used. Internally,
ZwReadFile and ZwWriteFile in the dispatch routine for IRP_MJ_READ and
_WRITE do
the job to write on and read from "disk". As far, everything works
fine.
Now, I would like to write a volume header sector at the beginning of
the disk
file. This volume header sector should not be formatted by e.g. the
windows
format command. It should be ignored by any write operation on the disk

file.
I think I have to modify the StartingOffset in the VERIFY_INFORMATION
when IOCTL_DISK_VERIFY comes down and shift as well the offest of
IRP_MJ_WRITE to save this special sector for overwriting?
Until now, e.g. the windows format begins at StartingOffset 0 and thus,

overwrites my volume header sector which was previously written when
the disk file was created. Any help would be gratefully appreciated.
More info can be provided if applied.

Re: virtual disk driver - write a volume header by Maxim

Maxim
Wed Oct 11 16:19:04 CDT 2006

> I think I have to modify the StartingOffset in the VERIFY_INFORMATION
> when IOCTL_DISK_VERIFY comes down and shift as well the offest of
> IRP_MJ_WRITE to save this special sector for overwriting?

Correct. Also respond to disk size IOCTLs properly, they are crucial for
formatting.

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