Where to write the logic?

> How can I find out the sector number of a disk

being read or written to? Something similar to what

You will get the volume offset in the IrpStack->Parameters.Read.ByteOffset.
Divide it by sector size and you have the offset.

L.