How to DO IRP_MJ_DEVICE_CONTROL in a minifilter

hi all,

I want to do IRP_MJ_DEVICE_CONTROL in my minifilter driver but I got bluescreen all the time.

My target is to call IOCTL_STORAGE_QUERY_RROPERTY in InstanceSetup to query infromation about the volume just attached.
Using following APIs
FltAllocateCallbackData
FltPerformAsynchronousIo
FltFreeCallbackData

Did anyone do this before?

I cound not find any example code that tell me how to use FltPerformAsynchronousIo properly.

And my first question is “Is it allowed to use IRP_MJ_DEVICE_CONTROL in a minifilter?”

Thank you for you reading and reply in advance.

I got improved.

Bluescreen was gone but I still got a error return in callbackData->IoStatus.Status

The error is 0xC0000010, STATUS_INVAILD_DEVICE_REQUEST

Some facts of my code, I implemented these in InstanceSetup callback routine:
Query.PropertyId = StorageDeviceProperty;
Query.QueryType = PropertyStandardQuery;

callbackData->Iopb->MajorFunction = IRP_MJ_INTERNAL_DEVICE_CONTROL;
callbackData->Iopb->TargetInstance = FltObjects->Instance;
callbackData->Iopb->Parameters.DeviceIoControl.Common.IoControlCode = IOCTL_STORAGE_QUERY_PROPERTY;
callbackData->Iopb->Parameters.DeviceIoControl.Buffered.SystemBuffer = (PVOID)&Query;
callbackData->Iopb->Parameters.DeviceIoControl.Common.InputBufferLength = sizeof(Query);

For me, STATUS_INVAILD_DEVICE_REQUEST points to no where, I don’t know what to do next.

If anyone had experience on this, please give me a hand.
Thank you.

Start over. Why do you need to send device control? What information are
you trying to get? Can you get what you need with FltGetVolumeProperties or
FltQueryVolumeInformation?

Ken

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@yahoo.com.tw
Sent: Monday, March 19, 2007 3:06 AM
To: Windows File Systems Devs Interest List
Subject: RE:[ntfsd] How to DO IRP_MJ_DEVICE_CONTROL in a minifilter

I got improved.

Bluescreen was gone but I still got a error return in
callbackData->IoStatus.Status

The error is 0xC0000010, STATUS_INVAILD_DEVICE_REQUEST

Some facts of my code, I implemented these in InstanceSetup callback
routine:
Query.PropertyId = StorageDeviceProperty;
Query.QueryType = PropertyStandardQuery;

callbackData->Iopb->MajorFunction = IRP_MJ_INTERNAL_DEVICE_CONTROL;
callbackData->Iopb->TargetInstance = FltObjects->Instance;
callbackData->Iopb->Parameters.DeviceIoControl.Common.IoControlCode =
IOCTL_STORAGE_QUERY_PROPERTY;
callbackData->Iopb->Parameters.DeviceIoControl.Buffered.SystemBuffer =
(PVOID)&Query;
callbackData->Iopb->Parameters.DeviceIoControl.Common.InputBufferLength
= sizeof(Query);

For me, STATUS_INVAILD_DEVICE_REQUEST points to no where, I don’t know what
to do next.

If anyone had experience on this, please give me a hand.
Thank you.


Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as: xxxxx@comcast.net
To unsubscribe send a blank email to xxxxx@lists.osr.com

Thanks Ken.

I want to know the bus type (STORAGE_BUS_TYPE) of the instance/volume just attached.

FltGetVolumeProperties/FltQueryVolumeInformation don’t have this kind of information.