Need help with usb filter driver

I’ve used this article (http://www.osronline.com/article.cfm?article=446) as an example to create the upper filter driver for a disk device for my usb flash. And now I need to access the sector before the first partition and put a verification signature there. But I do not know how. I will be glad to any help. I tried to use this request IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS, but I got an error code ntstatus.h -1073741808

xxxxx@gmail.com wrote:

I’ve used this article (http://www.osronline.com/article.cfm?article=446) as an example to create the upper filter driver for a disk device for my usb flash. And now I need to access the sector before the first partition and put a verification signature there. But I do not know how. I will be glad to any help. I tried to use this request IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS, but I got an error code ntstatus.h -1073741808

Have you ever in your life seen a status code printed as a signed
decimal value?  They are unsigned hex values, always.  That’s C0000010,
which is STATUS_INVALID_DEVICE_REQUEST.

Did your filter allocate space to make sure there IS a sector before the
first partition?  If not, how do you know it is available for you to write?

Where are you in the stack?  Specifically, what device did you filter? 
Remember the disk stack has disk drivers, volume drivers, partition
drivers, file system drivers, etc.  Your addressing and your interface
options all depend on where you are in the stack. 
IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS is recognized by partition drivers,
like opening the device \.\C: .


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

Hello, Tim. I’m developing drivers for the first time, so, really, my knowledge is not enough. I work with usb flash. To install the driver, I use the addfilter application, in the SetupDiGetClassDevs function I use the classguid GUID_DEVINTERFACE_DISK. Maybe it’s worth reading the MBR, and based on it determine whether there is a free sector before the first partition? Or maybe another way? How can I find out where I’m on the stack?

xxxxx@gmail.com wrote:

Hello, Tim. I’m developing drivers for the first time, so, really, my knowledge is not enough. I work with usb flash. To install the driver, I use the addfilter application, in the SetupDiGetClassDevs function I use the classguid GUID_DEVINTERFACE_DISK. Maybe it’s worth reading the MBR, and based on it determine whether there is a free sector before the first partition? Or maybe another way? How can I find out where I’m on the stack?

This is a tricky area to play around with as a beginner.  The disk stack
is complicated, with a lot of different players making a lot of
assumptions.  You don’t want to do anything, for example, that renders
your device unreadable on systems without your driver.

I don’t know the disk stack well enough to advise you on where to find a
private data space for your driver.  Hopefully, someone else here will
respond.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.