RE: IoAttachDeviceToDeviceStack and DO_DEVICE_INITIALIZIN G

The bus driver reporting the PDO must clear the flag before reporting the
device - otherwise the function driver will not be able to attach itself to
the stack; forgetting the legailty or otherwise of what you are doing, when
PNP get the results of a QDR it will locate the appropriate function drivers
and call their AddDevice entrypoint to pass the PDO to them - the flag has
to be clear for this to work.

Simon


From: Shahar Talmi [mailto:xxxxx@safend.com]
Sent: Saturday, August 28, 2004 12:29 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] IoAttachDeviceToDeviceStack and DO_DEVICE_INITIALIZING

Hi,

Can someone explain why does IoAttachDeviceToDeviceStack fail when the
DO_DEVICE_INITIALIZING flag is turned on?

My driver attaches itself to PDOs when their parent bus reports them in the
BusRelations for the first time.

What should a bus filter do if the IoAttachDeviceToDeviceStack fails? What
other opportunity will I have to attach myself?

Is it legal for bus drivers to report PDOs in the BusRelations when the
DO_DEVICE_INITIALIZING is still on?

Thanks

Shahar`


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com

I would say that this is a bug in USBPRINT.SYS although the rules for bus
drivers are not well documented; so long as the flag gets cleared before a
function driver attempts to attach to the PDO it should work but I’m not
sure if a bus driver can assume it will get the opportunity to clear the
flag once it returns the PDO in the response to a QDR/BusRelations (and
therefore it seems to me that the flag must be clear before returning the
PDO pointer in the QDR results).

Note that I am not making any comment on the legailty of what you are
attempting although I will say that any bus filter driver (such as ACPI.SYS
for example) has to do this (and this is why the FastIODetachDevice entry
was added to the fast-io table…)

As to SP2 - I have no idea; I suggest you try it out!

Simon


From: Shahar Talmi [mailto:xxxxx@safend.com]
Sent: Sunday, August 29, 2004 3:11 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] IoAttachDeviceToDeviceStack and DO_DEVICE_INITIALIZING

The driver that created this specific PDO is usbprint.sys

Are you saying that this is a bug in Microsoft’s code?

Any chance this was fixed in SP2?

Thanks,

Shahar


From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Peter Wieland
Sent: Saturday, August 28, 2004 6:06 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] IoAttachDeviceToDeviceStack and DO_DEVICE_INITIALIZING

I don’t believe it’s legal for a bus driver to be doing this. Out of
curiosity, what driver are you attaching to here?

-p


From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Shahar Talmi
Sent: Saturday, August 28, 2004 9:29 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] IoAttachDeviceToDeviceStack and DO_DEVICE_INITIALIZING

Hi,

Can someone explain why does IoAttachDeviceToDeviceStack fail when the
DO_DEVICE_INITIALIZING flag is turned on?

My driver attaches itself to PDOs when their parent bus reports them in the
BusRelations for the first time.

What should a bus filter do if the IoAttachDeviceToDeviceStack fails? What
other opportunity will I have to attach myself?

Is it legal for bus drivers to report PDOs in the BusRelations when the
DO_DEVICE_INITIALIZING is still on?

Thanks

Shahar`


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com

I know that usbprint's PDO enumeration is there only to cause a port monitor (in user mode) to be installed for the printer. It does not accept i/o IIRC and is enumerated as raw. Based on those design points, I could see where the owner of usbprint would not clear the initializing flag b/c there is nothing that would attach to the PDO (that assumption is obviously incorrect in this case) nor open it.

d


From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Graham, Simon
Sent: Sunday, August 29, 2004 8:48 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] IoAttachDeviceToDeviceStack and DO_DEVICE_INITIALIZIN G

I would say that this is a bug in USBPRINT.SYS although the rules for bus drivers are not well documented; so long as the flag gets cleared before a function driver attempts to attach to the PDO it should work but I'm not sure if a bus driver can assume it will get the opportunity to clear the flag once it returns the PDO in the response to a QDR/BusRelations (and therefore it seems to me that the flag must be clear before returning the PDO pointer in the QDR results).
?
Note that I am not making any comment on the legailty of what you are attempting although I will say that any bus filter driver (such as ACPI.SYS for example) has to do this (and this is why the FastIODetachDevice entry was added to the fast-io table...)
?
As to SP2 - I have no idea; I suggest you try it out!
?
Simon


From: Shahar Talmi [mailto:xxxxx@safend.com]
Sent: Sunday, August 29, 2004 3:11 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] IoAttachDeviceToDeviceStack and DO_DEVICE_INITIALIZING
The driver that created this specific PDO is usbprint.sys
Are you saying that this is a bug in Microsoft's code?
Any chance this was fixed in SP2?

Thanks,
Shahar


From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Peter Wieland
Sent: Saturday, August 28, 2004 6:06 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] IoAttachDeviceToDeviceStack and DO_DEVICE_INITIALIZING

I don't believe it's legal for a bus driver to be doing this.? Out of curiosity, what driver are you attaching to here?
?
-p


From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Shahar Talmi
Sent: Saturday, August 28, 2004 9:29 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] IoAttachDeviceToDeviceStack and DO_DEVICE_INITIALIZING
Hi,
Can someone explain why does IoAttachDeviceToDeviceStack fail when the DO_DEVICE_INITIALIZING flag is turned on?
My driver attaches itself to PDOs when their parent bus reports them in the BusRelations for the first time.
What should a bus filter do if the IoAttachDeviceToDeviceStack fails? What other opportunity will I have to attach myself?
Is it legal for bus drivers to report PDOs in the BusRelations when the DO_DEVICE_INITIALIZING is still on?

Thanks
Shahar`

Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ''
To unsubscribe send a blank email to xxxxx@lists.osr.com ---
Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ''
To unsubscribe send a blank email to xxxxx@lists.osr.com

Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ''
To unsubscribe send a blank email to xxxxx@lists.osr.com

Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

Would you say it is legal to turn off the DO_DEVICE_INITIALIZING myself
while processing the QDR/BusRelations response? Should I turn the bit on
after I am attached or should I complete the IRP while the bit is still off?
Note that I am filtering many kinds of drivers. Usbprint is the only one in
which I encountered such behavior, but some of them might have similar
bugs...

I didn't investigate it any further, but I noticed that the
DO_DEVICE_INITIALIZING bit is on only in some of the PDO's that usbprint
reports. Does this make any sense?

Thanks,
Shahar

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Sunday, August 29, 2004 5:58 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] IoAttachDeviceToDeviceStack and DO_DEVICE_INITIALIZIN G

I know that usbprint's PDO enumeration is there only to cause a port monitor
(in user mode) to be installed for the printer. It does not accept i/o IIRC
and is enumerated as raw. Based on those design points, I could see where
the owner of usbprint would not clear the initializing flag b/c there is
nothing that would attach to the PDO (that assumption is obviously incorrect
in this case) nor open it.

d


From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Graham, Simon
Sent: Sunday, August 29, 2004 8:48 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] IoAttachDeviceToDeviceStack and DO_DEVICE_INITIALIZIN G

I would say that this is a bug in USBPRINT.SYS although the rules for bus
drivers are not well documented; so long as the flag gets cleared before a
function driver attempts to attach to the PDO it should work but I'm not
sure if a bus driver can assume it will get the opportunity to clear the
flag once it returns the PDO in the response to a QDR/BusRelations (and
therefore it seems to me that the flag must be clear before returning the
PDO pointer in the QDR results).
?
Note that I am not making any comment on the legailty of what you are
attempting although I will say that any bus filter driver (such as ACPI.SYS
for example) has to do this (and this is why the FastIODetachDevice entry
was added to the fast-io table...)
?
As to SP2 - I have no idea; I suggest you try it out!
?
Simon


From: Shahar Talmi [mailto:xxxxx@safend.com]
Sent: Sunday, August 29, 2004 3:11 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] IoAttachDeviceToDeviceStack and DO_DEVICE_INITIALIZING
The driver that created this specific PDO is usbprint.sys
Are you saying that this is a bug in Microsoft's code?
Any chance this was fixed in SP2?

Thanks,
Shahar


From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Peter Wieland
Sent: Saturday, August 28, 2004 6:06 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] IoAttachDeviceToDeviceStack and DO_DEVICE_INITIALIZING

I don't believe it's legal for a bus driver to be doing this.? Out of
curiosity, what driver are you attaching to here?
?
-p


From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Shahar Talmi
Sent: Saturday, August 28, 2004 9:29 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] IoAttachDeviceToDeviceStack and DO_DEVICE_INITIALIZING
Hi,
Can someone explain why does IoAttachDeviceToDeviceStack fail when the
DO_DEVICE_INITIALIZING flag is turned on?
My driver attaches itself to PDOs when their parent bus reports them in the
BusRelations for the first time.
What should a bus filter do if the IoAttachDeviceToDeviceStack fails? What
other opportunity will I have to attach myself?
Is it legal for bus drivers to report PDOs in the BusRelations when the
DO_DEVICE_INITIALIZING is still on?

Thanks
Shahar`

Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ''
To unsubscribe send a blank email to xxxxx@lists.osr.com ---
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ''
To unsubscribe send a blank email to xxxxx@lists.osr.com

Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ''
To unsubscribe send a blank email to xxxxx@lists.osr.com

Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ''
To unsubscribe send a blank email to xxxxx@lists.osr.com

Well, as Doron said, the intent appears to have been that the PDOs created
by USBPRINT would never have function drivers or be opened; maybe you need
to rethink your design...

Strictly speaking it is, of course, illegal to mess with some other drivers
device objects...

/simgr

-----Original Message-----
From: Shahar Talmi [mailto:xxxxx@safend.com]
Sent: Monday, August 30, 2004 4:27 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] IoAttachDeviceToDeviceStack and DO_DEVICE_INITIALIZIN G

Would you say it is legal to turn off the DO_DEVICE_INITIALIZING myself
while processing the QDR/BusRelations response? Should I turn the bit on
after I am attached or should I complete the IRP while the bit is still off?
Note that I am filtering many kinds of drivers. Usbprint is the only one in
which I encountered such behavior, but some of them might have similar
bugs...

I didn't investigate it any further, but I noticed that the
DO_DEVICE_INITIALIZING bit is on only in some of the PDO's that usbprint
reports. Does this make any sense?

Thanks,
Shahar

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Sunday, August 29, 2004 5:58 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] IoAttachDeviceToDeviceStack and DO_DEVICE_INITIALIZIN G

I know that usbprint's PDO enumeration is there only to cause a port monitor
(in user mode) to be installed for the printer. It does not accept i/o IIRC
and is enumerated as raw. Based on those design points, I could see where
the owner of usbprint would not clear the initializing flag b/c there is
nothing that would attach to the PDO (that assumption is obviously incorrect
in this case) nor open it.

d


From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Graham, Simon
Sent: Sunday, August 29, 2004 8:48 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] IoAttachDeviceToDeviceStack and DO_DEVICE_INITIALIZIN G

I would say that this is a bug in USBPRINT.SYS although the rules for bus
drivers are not well documented; so long as the flag gets cleared before a
function driver attempts to attach to the PDO it should work but I'm not
sure if a bus driver can assume it will get the opportunity to clear the
flag once it returns the PDO in the response to a QDR/BusRelations (and
therefore it seems to me that the flag must be clear before returning the
PDO pointer in the QDR results).
?
Note that I am not making any comment on the legailty of what you are
attempting although I will say that any bus filter driver (such as ACPI.SYS
for example) has to do this (and this is why the FastIODetachDevice entry
was added to the fast-io table...)
?
As to SP2 - I have no idea; I suggest you try it out!
?
Simon


From: Shahar Talmi [mailto:xxxxx@safend.com]
Sent: Sunday, August 29, 2004 3:11 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] IoAttachDeviceToDeviceStack and DO_DEVICE_INITIALIZING
The driver that created this specific PDO is usbprint.sys
Are you saying that this is a bug in Microsoft's code?
Any chance this was fixed in SP2?

Thanks,
Shahar


From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Peter Wieland
Sent: Saturday, August 28, 2004 6:06 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] IoAttachDeviceToDeviceStack and DO_DEVICE_INITIALIZING

I don't believe it's legal for a bus driver to be doing this.? Out of
curiosity, what driver are you attaching to here?
?
-p


From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Shahar Talmi
Sent: Saturday, August 28, 2004 9:29 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] IoAttachDeviceToDeviceStack and DO_DEVICE_INITIALIZING
Hi,
Can someone explain why does IoAttachDeviceToDeviceStack fail when the
DO_DEVICE_INITIALIZING flag is turned on?
My driver attaches itself to PDOs when their parent bus reports them in the
BusRelations for the first time.
What should a bus filter do if the IoAttachDeviceToDeviceStack fails? What
other opportunity will I have to attach myself?
Is it legal for bus drivers to report PDOs in the BusRelations when the
DO_DEVICE_INITIALIZING is still on?

Thanks
Shahar`

Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ''
To unsubscribe send a blank email to xxxxx@lists.osr.com ---
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ''
To unsubscribe send a blank email to xxxxx@lists.osr.com

Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ''
To unsubscribe send a blank email to xxxxx@lists.osr.com

Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ''
To unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ''
To unsubscribe send a blank email to xxxxx@lists.osr.com