IoInvalidateDeviceRelations and disks

Hi, I’ll try to ask it again more clearly.
I have a bus filter sitting on top of adaptec controller.
I’m trying to make the disks that connect to this adapter to remove and
then start again.
I’m doing this by manipulating the structure of DEVICE_RELATION in the the
IRP_MN_QUERY_DEVICE_RELATIONS.
I triger the above request using the Hardware manager, scan devices.
then using softIce I change the structure. changing the counter to 0 make
the two scsi disks remove from the system using IRP_MN_SURPRISE_REMOVAL.
after that I’m scanning the hardware again this time just forward the
DEVICE_RELATION that I got from the controller (with two devices in it)
but the windows seems to ignore it and do not start the disks again.

what is wrong here?
I understood that the PNP manager always keep track of this structure and
check if there is a change from the structre it hold if there is it should
start or remove devices.

Omri

for one thing the PNP subsystem expects you to hand back a different
device object pointer than the one you were previously using. If you’re
attempting to simply return the PDO given out by scsiport it may not
work.

-p

-----Original Message-----
From: Omri [mailto:xxxxx@verizon.net]
Sent: Tuesday, September 10, 2002 11:11 AM
To: NT Developers Interest List
Subject: [ntdev] IoInvalidateDeviceRelations and disks

Hi, I’ll try to ask it again more clearly.
I have a bus filter sitting on top of adaptec controller.
I’m trying to make the disks that connect to this adapter to remove and
then start again. I’m doing this by manipulating the structure of
DEVICE_RELATION in the the IRP_MN_QUERY_DEVICE_RELATIONS. I triger the
above request using the Hardware manager, scan devices. then using
softIce I change the structure. changing the counter to 0 make the two
scsi disks remove from the system using IRP_MN_SURPRISE_REMOVAL. after
that I’m scanning the hardware again this time just forward the
DEVICE_RELATION that I got from the controller (with two devices in it)
but the windows seems to ignore it and do not start the disks again.

what is wrong here?
I understood that the PNP manager always keep track of this structure
and check if there is a change from the structre it hold if there is it
should start or remove devices.

Omri


You are currently subscribed to ntdev as: xxxxx@microsoft.com To
unsubscribe send a blank email to %%email.unsub%%

Thank you for your response, now I understand the problems thanks to you
:slight_smile:

since I am a Bus filter and the actual allocation of device object is done
in the Bus driver itself (the scsi controller) how can I return a new
pointer to the Pnp in such a case is there a way to work around this
problem?

Omri

As you are ‘outside the box’ here, you may have to take on some of the
actions of PnP itself, such as removing the device objects you have
claimed don’t exist anymore.

===========================
Mark Roddy
Consultant, Microsoft DDK MVP
Hollis Technology Solutions
xxxxx@hollistech.com
www.hollistech.com
603-321-1032

-----Original Message-----
From: “Omri”
To: “NT Developers Interest List”
Date: Tue, 10 Sep 2002 18:50:08 -0400
Subject: [ntdev] RE: IoInvalidateDeviceRelations and disks

> Thank you for your response, now I understand the problems thanks to
> you
> :slight_smile:
>
> since I am a Bus filter and the actual allocation of device object is
> done
> in the Bus driver itself (the scsi controller) how can I return a new
> pointer to the Pnp in such a case is there a way to work around this
> problem?
>
> Omri
>
> —
> You are currently subscribed to ntdev as: xxxxx@hollistech.com
> To unsubscribe send a blank email to %%email.unsub%%

Hi,
when I try to return my DeviceObjects (that I created on top of the Scsi
Controller PDOs) as a PDO in the query device relations of the Upper
filter to the scsi controller FDO
I’m getting an error in the IRP_MN_START_DEVICE of the PDO
STATUS_INVALID_DEVICE_REQUEST what can cause to this error?

Omri

deleting the device objects of another driver is probably not a good
idea.

-p

-----Original Message-----
From: Mark Roddy [mailto:xxxxx@hollistech.com]
Sent: Wednesday, September 11, 2002 5:42 AM
To: NT Developers Interest List
Subject: [ntdev] RE: IoInvalidateDeviceRelations and disks

As you are ‘outside the box’ here, you may have to take on some of the
actions of PnP itself, such as removing the device objects you have
claimed don’t exist anymore.

===========================
Mark Roddy
Consultant, Microsoft DDK MVP
Hollis Technology Solutions
xxxxx@hollistech.com
www.hollistech.com
603-321-1032

-----Original Message-----
From: “Omri”
To: “NT Developers Interest List”
Date: Tue, 10 Sep 2002 18:50:08 -0400
Subject: [ntdev] RE: IoInvalidateDeviceRelations and disks

> Thank you for your response, now I understand the problems thanks to
> you
> :slight_smile:
>
> since I am a Bus filter and the actual allocation of device object is
> done in the Bus driver itself (the scsi controller) how can I return a

> new pointer to the Pnp in such a case is there a way to work around
> this problem?
>
> Omri
>
> —
> You are currently subscribed to ntdev as: xxxxx@hollistech.com To
> unsubscribe send a blank email to %%email.unsub%%


You are currently subscribed to ntdev as: xxxxx@microsoft.com To
unsubscribe send a blank email to %%email.unsub%%

Did I say delete? The point is that scsiport is not aware of the actions
taken by his filter driver. At a minimum there is a device object reference
count that is hanging around. I suspect he is seeing the surprise remove
irp, and perhaps the initial remove irp, but not the final pdo remove irp,
due to the reference count issue. On re-enumeration scsiport is reporting
back the same pdos it reported the first time.

-----Original Message-----
From: Peter Wieland [mailto:xxxxx@windows.microsoft.com]
Sent: Wednesday, September 11, 2002 11:58 AM
To: NT Developers Interest List
Subject: [ntdev] RE: IoInvalidateDeviceRelations and disks

deleting the device objects of another driver is probably not
a good idea.

-p

-----Original Message-----
From: Mark Roddy [mailto:xxxxx@hollistech.com]
Sent: Wednesday, September 11, 2002 5:42 AM
To: NT Developers Interest List
Subject: [ntdev] RE: IoInvalidateDeviceRelations and disks

As you are ‘outside the box’ here, you may have to take on
some of the
actions of PnP itself, such as removing the device objects you have
claimed don’t exist anymore.

===========================
Mark Roddy
Consultant, Microsoft DDK MVP
Hollis Technology Solutions
xxxxx@hollistech.com
www.hollistech.com
603-321-1032

-----Original Message-----
From: “Omri”
> To: “NT Developers Interest List”
> Date: Tue, 10 Sep 2002 18:50:08 -0400
> Subject: [ntdev] RE: IoInvalidateDeviceRelations and disks
>
> > Thank you for your response, now I understand the problems thanks to
> > you
> > :slight_smile:
> >
> > since I am a Bus filter and the actual allocation of device
> object is
> > done in the Bus driver itself (the scsi controller) how can
> I return a
>
> > new pointer to the Pnp in such a case is there a way to work around
> > this problem?
> >
> > Omri
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@hollistech.com To
> > unsubscribe send a blank email to %%email.unsub%%
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@microsoft.com To
> unsubscribe send a blank email to %%email.unsub%%
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@stratus.com
> To unsubscribe send a blank email to %%email.unsub%%
>

You cannot return non-pdos in a query device relations, you have to return
pdos.

-----Original Message-----
From: Omri [mailto:xxxxx@verizon.net]
Sent: Wednesday, September 11, 2002 11:48 AM
To: NT Developers Interest List
Subject: [ntdev] RE: IoInvalidateDeviceRelations and disks

Hi,
when I try to return my DeviceObjects (that I created on top
of the Scsi Controller PDOs) as a PDO in the query device
relations of the Upper filter to the scsi controller FDO I’m
getting an error in the IRP_MN_START_DEVICE of the PDO
STATUS_INVALID_DEVICE_REQUEST what can cause to this error?

Omri


You are currently subscribed to ntdev as:
xxxxx@stratus.com To unsubscribe send a blank email to
%%email.unsub%%

scsiport will probably always return the same PDOs it reported the first
time because, to it, the surprise remove is completely bogus. Any bus
driver knows wehther or not the device is present (as long as the bus is
enumerable) - it doesn’t depend on getting a surprise remove IRP to
figure this out.

a bus filter can add its own PDOs into the device relations, can attach
filters to the PDOs reported by the bus driver, and can remove its own
PDOs from the device relations. There’s really not a provision for
something that attempts to force devices to be deleted in order to hide
them.

-p

-----Original Message-----
From: Roddy, Mark [mailto:xxxxx@stratus.com]
Sent: Wednesday, September 11, 2002 10:40 AM
To: NT Developers Interest List
Subject: [ntdev] RE: IoInvalidateDeviceRelations and disks

Did I say delete? The point is that scsiport is not aware of the actions
taken by his filter driver. At a minimum there is a device object
reference count that is hanging around. I suspect he is seeing the
surprise remove irp, and perhaps the initial remove irp, but not the
final pdo remove irp, due to the reference count issue. On
re-enumeration scsiport is reporting back the same pdos it reported the
first time.

-----Original Message-----
From: Peter Wieland [mailto:xxxxx@windows.microsoft.com]
Sent: Wednesday, September 11, 2002 11:58 AM
To: NT Developers Interest List
Subject: [ntdev] RE: IoInvalidateDeviceRelations and disks

deleting the device objects of another driver is probably not
a good idea.

-p

-----Original Message-----
From: Mark Roddy [mailto:xxxxx@hollistech.com]
Sent: Wednesday, September 11, 2002 5:42 AM
To: NT Developers Interest List
Subject: [ntdev] RE: IoInvalidateDeviceRelations and disks

As you are ‘outside the box’ here, you may have to take on
some of the
actions of PnP itself, such as removing the device objects you have
claimed don’t exist anymore.

===========================
Mark Roddy
Consultant, Microsoft DDK MVP
Hollis Technology Solutions
xxxxx@hollistech.com
www.hollistech.com
603-321-1032

-----Original Message-----
From: “Omri”
> To: “NT Developers Interest List”
> Date: Tue, 10 Sep 2002 18:50:08 -0400
> Subject: [ntdev] RE: IoInvalidateDeviceRelations and disks
>
> > Thank you for your response, now I understand the problems thanks to

> > you
> > :slight_smile:
> >
> > since I am a Bus filter and the actual allocation of device
> object is
> > done in the Bus driver itself (the scsi controller) how can
> I return a
>
> > new pointer to the Pnp in such a case is there a way to work around
> > this problem?
> >
> > Omri
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@hollistech.com To
> > unsubscribe send a blank email to %%email.unsub%%
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@microsoft.com To
> unsubscribe send a blank email to %%email.unsub%%
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@stratus.com To
> unsubscribe send a blank email to %%email.unsub%%
>


You are currently subscribed to ntdev as: xxxxx@microsoft.com To
unsubscribe send a blank email to %%email.unsub%%

Hi,
my bus filter on top of the scsiport create its own PDOs and fill the up
in the DEVICE_RELATION when query device relation generated by the system.
this way I’m returning different PDOs after remove request arrived.
the problem is in the IRP_MN_START_DEVICE for some reason when my PDO
receive this IRP and try to delegate it the underneath device (the real
PDO) deny it with status STATUS_INVALID_DEVICE_REQUEST, all the other
request are get success status from this PDO is there any reason for that?
when I return in the query device relation the real pdo, every thing work
fine altough the request goes through the same path (through my PDO
filter).
I tried to allocate my own IRP_MN_START_DEVICE using IoAllocateIrp, in my
virtual PDO start handler, and send it to the real PDO but this seems to
work only in debug mode (/debug in boot.ini)
but this let me check the Idea of returning different PDOs for query
device relation and its seems to work just fine, disk are come and go as I
need them.

hope you could give some ideas of where should I check.

Sincerely
Omri

have you sent a remove IRP to the scsiport PDO before you send the
second start?

-p

-----Original Message-----
From: Omri [mailto:xxxxx@verizon.net]
Sent: Thursday, September 12, 2002 8:32 AM
To: NT Developers Interest List
Subject: [ntdev] RE: IoInvalidateDeviceRelations and disks

Hi,
my bus filter on top of the scsiport create its own PDOs and fill the up
in the DEVICE_RELATION when query device relation generated by the
system. this way I’m returning different PDOs after remove request
arrived. the problem is in the IRP_MN_START_DEVICE for some reason when
my PDO receive this IRP and try to delegate it the underneath device
(the real
PDO) deny it with status STATUS_INVALID_DEVICE_REQUEST, all the other
request are get success status from this PDO is there any reason for
that? when I return in the query device relation the real pdo, every
thing work fine altough the request goes through the same path (through
my PDO filter). I tried to allocate my own IRP_MN_START_DEVICE using
IoAllocateIrp, in my virtual PDO start handler, and send it to the real
PDO but this seems to work only in debug mode (/debug in boot.ini) but
this let me check the Idea of returning different PDOs for query device
relation and its seems to work just fine, disk are come and go as I need
them.

hope you could give some ideas of where should I check.

Sincerely
Omri


You are currently subscribed to ntdev as: xxxxx@microsoft.com To
unsubscribe send a blank email to %%email.unsub%%

No, I’m getting the “START” before I’m getting “REMOVE”, and this is the
one that failed.

I look in the scsiport assembly and what I saw is that it failed in the
ScsiPortStartLogicalUnit in and this function failed in
IoOpenDeviceRegistryKey with the status STATUS_INVALID_DEVICE_REQUEST
which the DDK state as : “Possibly Indicated that the DeviceObject is not
a valid PDO”

again this happend not for the device I created but the device that the
scsiport created.
the only difference is that in the relation I’m sending my PDOs and not
the scsiport PDOs.

hope this information help.

a “valid PDO” is one which has been handed to PNP as a child device.
Since you’re blocking the device from PNP it’s never considered a valid
PDO.

so what’s your goal here?

-p

-----Original Message-----
From: Omri [mailto:xxxxx@verizon.net]
Sent: Thursday, September 12, 2002 6:18 PM
To: NT Developers Interest List
Subject: [ntdev] RE: IoInvalidateDeviceRelations and disks

No, I’m getting the “START” before I’m getting “REMOVE”, and this is the
one that failed.

I look in the scsiport assembly and what I saw is that it failed in the
ScsiPortStartLogicalUnit in and this function failed in
IoOpenDeviceRegistryKey with the status STATUS_INVALID_DEVICE_REQUEST
which the DDK state as : “Possibly Indicated that the DeviceObject is
not a valid PDO”

again this happend not for the device I created but the device that the
scsiport created. the only difference is that in the relation I’m
sending my PDOs and not the scsiport PDOs.

hope this information help.


You are currently subscribed to ntdev as: xxxxx@microsoft.com To
unsubscribe send a blank email to %%email.unsub%%

Hi,
I did it. now I fully control the disks.
it was very interesting to see how the PnP manager mark and DeviceObject
as a PDO this is completely undocumented :frowning:
maybe someone will be able to tell us more about how the PnP manager treat
PDO when it get them.

I’m trying to change the device description text but the Hardware manager
seems to cache the information it get the first time it discover the disks
and then read it from the registry or some place else when it shows the
devices, is that true?

Omri

It makes sense. This allows the partition device objects to be marked as
FDO. The disk is like a virtual bus that contains partition functional
devices.

Jamey

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Omri
Sent: Friday, September 13, 2002 11:03 AM
To: NT Developers Interest List
Subject: [ntdev] RE: IoInvalidateDeviceRelations and disks

Hi,
I did it. now I fully control the disks.
it was very interesting to see how the PnP manager mark and DeviceObject
as a PDO this is completely undocumented :frowning:
maybe someone will be able to tell us more about how the PnP manager
treat
PDO when it get them.

I’m trying to change the device description text but the Hardware
manager
seems to cache the information it get the first time it discover the
disks
and then read it from the registry or some place else when it shows the
devices, is that true?

Omri


You are currently subscribed to ntdev as: xxxxx@storagecraft.com
To unsubscribe send a blank email to %%email.unsub%%

>

Hi,
I did it. now I fully control the disks.
it was very interesting to see how the PnP manager mark and
DeviceObject as a PDO this is completely undocumented :frowning:
maybe someone will be able to tell us more about how the PnP
manager treat PDO when it get them.

That was fun, huh?

I’m trying to change the device description text but the
Hardware manager seems to cache the information it get the
first time it discover the disks and then read it from the
registry or some place else when it shows the devices, is that true?

Yes. You need to change the description the first time the specific device
PDO is seen.