Can I filter IOCTL_STORAGE_QUERY_PROPERTY below disk.sys?

I want to mount Removable Media’s sencond partition in Windows 2000.
I just found a post at Microsoft Newsgroup kernal, which said there is a way to add a filter driver below disk, and filter IOCTL_STORAGE_QUERY_PROPERTY. Then I learned from source codes of disk.sys and ClassPnp illustrated by Windows 2000 DDK. And I found that, FDO created by disk.sys use ClassGetDescriptor function to get Media’s characteristics. It generates a new irp according to IoControlCode, then uses IoCallDriver to call portdriver.
I was wondering that, if I add filter driver just below disk, does it work?
Should I add filter driver to usbstor as upper filter ?

I’m really new at this field, please don’t mind.
Thanks in advance

Michael

Impossible.

Look at Disk/ClassPnP sources - the limit of 1 partition on the removable media is hard-coded.

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

----- Original Message -----
From: Michael Kong
To: Windows System Software Devs Interest List
Sent: Tuesday, May 11, 2004 11:40 AM
Subject: [ntdev] Can I filter IOCTL_STORAGE_QUERY_PROPERTY below disk.sys?

I want to mount Removable Media’s sencond partition in Windows 2000.
I just found a post at Microsoft Newsgroup kernal, which said there is a way to add a filter driver below disk, and filter IOCTL_STORAGE_QUERY_PROPERTY. Then I learned from source codes of disk.sys and ClassPnp illustrated by Windows 2000 DDK. And I found that, FDO created by disk.sys use ClassGetDescriptor function to get Media’s characteristics. It generates a new irp according to IoControlCode, then uses IoCallDriver to call portdriver.
I was wondering that, if I add filter driver just below disk, does it work?
Should I add filter driver to usbstor as upper filter ?

I’m really new at this field, please don’t mind.
Thanks in advance

Michael
B???'?X???y??➮w???z?@A?a??? 0???X?y???^q??t ??j???ٲ?r?y۞׽?k??j??r???ޱ??i?Z?G?j)m?W???u???~?X???&

Dear Maxim,
First of all, thank you for your reply.
I have tried to change Media’s Characteristics, and then I alter the disk.sys to my version. It worked.
The code like this:

NTSTATUS
ClassPnpStartDevice(
IN PDEVICE_OBJECT DeviceObject
)
{

/////////////////////////////////////
// Get Media’s Descriptor

status = ClassGetDescriptor(
commonExtension->LowerDeviceObject,
&propertyId,
&fdoExtension->DeviceDescriptor);

// Added by Michael Kong 2004.5.4
// Remove the Removable property of the Device, so system
// can treat it as fixed
if (fdoExtension->DeviceDescriptor->RemovableMedia)
{
fdoExtension->DeviceDescriptor->RemovableMedia = FALSE;
}
// End Adding

}

After I removed the property, disk treated it as fixed disk. I could use all of the partitions on Media. And system did not become unstable.
It is a bad way to change class drive or the ClassPnp lib. So I want to add a filter to filter IOCTL_STORAGE_QUERY_PROPERTY, which was used to get media property.
My problem is, I don’t know where to add filter.

Impossible.

Look at Disk/ClassPnP sources - the limit of 1 partition on the removable media is hard-coded.

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

I want to mount Removable Media’s sencond partition in Windows 2000.
I just found a post at Microsoft Newsgroup kernal, which said there is a way to add a filter driver below disk, and filter IOCTL_STORAGE_QUERY_PROPERTY. Then I learned from source codes of disk.sys and ClassPnp illustrated by Windows 2000 DDK. And I found that, FDO created by disk.sys use ClassGetDescriptor function to get Media’s characteristics. It generates a new irp according to IoControlCode, then uses IoCallDriver to call portdriver.
I was wondering that, if I add filter driver just below disk, does it work?
Should I add filter driver to usbstor as upper filter ?

I’m really new at this field, please don’t mind.
Thanks in advance

Michael

“and the system did not become unstable”

try writing some data to the disk and then hitting the eject button. You’re pretty much guaranteed to corrupt the media by doing this since the file systems will believe the disk is fixed and will aggressively cache data.

-p


From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Michael Kong
Sent: Tuesday, May 11, 2004 4:55 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Can I filter IOCTL_STORAGE_QUERY_PROPERTY below disk.sys?

Dear Maxim,
First of all, thank you for your reply.
I have tried to change Media’s Characteristics, and then I alter the disk.sys to my version. It worked.
The code like this:

NTSTATUS
ClassPnpStartDevice(
IN PDEVICE_OBJECT DeviceObject
)
{

/////////////////////////////////////
// Get Media’s Descriptor

status = ClassGetDescriptor(
commonExtension->LowerDeviceObject,
&propertyId,
&fdoExtension->DeviceDescriptor);

// Added by Michael Kong 2004.5.4
// Remove the Removable property of the Device, so system
// can treat it as fixed
if (fdoExtension->DeviceDescriptor->RemovableMedia)
{
fdoExtension->DeviceDescriptor->RemovableMedia = FALSE;
}
// End Adding

}

After I removed the property, disk treated it as fixed disk. I could use all of the partitions on Media. And system did not become unstable.
It is a bad way to change class drive or the ClassPnp lib. So I want to add a filter to filter IOCTL_STORAGE_QUERY_PROPERTY, which was used to get media property.
My problem is, I don’t know where to add filter.

Impossible.

Look at Disk/ClassPnP sources - the limit of 1 partition on the removable media is hard-coded.

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

I want to mount Removable Media’s sencond partition in Windows 2000.
I just found a post at Microsoft Newsgroup kernal, which said there is a way to add a filter driver below disk, and filter IOCTL_STORAGE_QUERY_PROPERTY. Then I learned from source codes of disk.sys and ClassPnp illustrated by Windows 2000 DDK. And I found that, FDO created by disk.sys use ClassGetDescriptor function to get Media’s characteristics. It generates a new irp according to IoControlCode, then uses IoCallDriver to call portdriver.
I was wondering that, if I add filter driver just below disk, does it work?
Should I add filter driver to usbstor as upper filter ?

I’m really new at this field, please don’t mind.
Thanks in advance

Michael

B栋瞴叜zA?y龎q韬{.n?壏瑉wZnV闅奫h曟痾{]z8卟%娝l⑹

Dear Peter,
I had it tested in this way.
When File Reading or Writing is in progress, system will give you a message shows Media can not be removed after you hit the eject button. If you hit the eject button as soon as File Reading or Writing is just done, system will flush data to or from media and then show Media has been removed successfully.

And there are a few USB storage media which is fixed disk itself. It is shown and used as fixed disk when it is pluged without any changes you should do. I’ve read the USB Spec. In fact, it depends on the value of Media’ characteristic reside in Media’s Rom as Descriptor. So I think it is a convenient way to filter the Removable property.

I just want to know if my filter driver, which as disk’s lower filter, could receive the IOCTL still with which disk.sys gets the media’s characteristic.
If not, where could I add filter to? USBSTOR?

thank you
Michael

----- Original Message -----
From: “Peter Wieland”
To: “Windows System Software Devs Interest List”
Sent: Tuesday, May 11, 2004 10:31 PM
Subject: RE: [ntdev] Can I filter IOCTL_STORAGE_QUERY_PROPERTY below disk.sys?

> “and the system did not become unstable”
>
> try writing some data to the disk and then hitting the eject button. You’re pretty much guaranteed to corrupt the media by doing this since the file systems will believe the disk is fixed and will aggressively cache data.
>
> -p
>
> ________________________________
>
> From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Michael Kong
> Sent: Tuesday, May 11, 2004 4:55 AM
> To: Windows System Software Devs Interest List
> Subject: Re: [ntdev] Can I filter IOCTL_STORAGE_QUERY_PROPERTY below disk.sys?
>
>
> Dear Maxim,
> First of all, thank you for your reply.
> I have tried to change Media’s Characteristics, and then I alter the disk.sys to my version. It worked.
> The code like this:
>
> NTSTATUS
> ClassPnpStartDevice(
> IN PDEVICE_OBJECT DeviceObject
> )
> {
> …
> /////////////////////////////////////
> // Get Media’s Descriptor
>
> status = ClassGetDescriptor(
> commonExtension->LowerDeviceObject,
> &propertyId,
> &fdoExtension->DeviceDescriptor);
>
> // Added by Michael Kong 2004.5.4
> // Remove the Removable property of the Device, so system
> // can treat it as fixed
> if (fdoExtension->DeviceDescriptor->RemovableMedia)
> {
> fdoExtension->DeviceDescriptor->RemovableMedia = FALSE;
> }
> // End Adding
> …
> }
>
> After I removed the property, disk treated it as fixed disk. I could use all of the partitions on Media. And system did not become unstable.
> It is a bad way to change class drive or the ClassPnp lib. So I want to add a filter to filter IOCTL_STORAGE_QUERY_PROPERTY, which was used to get media property.
> My problem is, I don’t know where to add filter.
>
>
>
>
>
> Impossible.
>
> Look at Disk/ClassPnP sources - the limit of 1 partition on the removable media is hard-coded.
>
> Maxim Shatskih, Windows DDK MVP
> StorageCraft Corporation
> xxxxx@storagecraft.com
> http://www.storagecraft.com
>
>
> I want to mount Removable Media’s sencond partition in Windows 2000.
> I just found a post at Microsoft Newsgroup kernal, which said there is a way to add a filter driver below disk, and filter IOCTL_STORAGE_QUERY_PROPERTY. Then I learned from source codes of disk.sys and ClassPnp illustrated by Windows 2000 DDK. And I found that, FDO created by disk.sys use ClassGetDescriptor function to get Media’s characteristics. It generates a new irp according to IoControlCode, then uses IoCallDriver to call portdriver.
> I was wondering that, if I add filter driver just below disk, does it work?
> Should I add filter driver to usbstor as upper filter ?
>
> I’m really new at this field, please don’t mind.
> Thanks in advance
>
> Michael