IoSetDeviceInterfaceState and IRP_MN_REMOVE_DEVICE.

Hi,
The documentation states:

“A function or filter driver typically calls this routine with Enable set to
TRUE after it successfully starts a device in response to an
IRP_MN_START_DEVICE. Such a driver should disable the device interface
instance (Enable equals FALSE) when it removes the device in response to an
IRP_MN_REMOVE_DEVICE.”

My question - What happenes if a function driver does not disable the device
interface when processing IRP_MN_REMOVE_DEVICE? I want to leave the device
interface enabled and enumerable until the PDO is deleted by the bus driver.
Is this possible/allowed?

Thanks,
Shahar

No, it is not allowed. The device interface must be a unique name, the
instance path is used to make it unique. If you keep the name around
after remove has finished, but the PDO is still there and the stack is
rebuilt, the creation of the interface name will fail b/c a previous
instance will exist.

Furthermore, XP and later will turn off the interface for you after the
stack has processed remove (if the interface was accidentally left on).
Also, IIRC, creates will fail once the stack is put into a removed state
(if, for instance, you created an interface for PDO).

Having a device interface be enumerable, but not openable or functional
b/c the device is gone doesn’t make much sense. What are you trying to
accomplish?

D

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Shahar Talmi
Sent: Tuesday, March 15, 2005 7:55 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] IoSetDeviceInterfaceState and IRP_MN_REMOVE_DEVICE.

Hi,
The documentation states:

“A function or filter driver typically calls this routine with Enable
set to
TRUE after it successfully starts a device in response to an
IRP_MN_START_DEVICE. Such a driver should disable the device interface
instance (Enable equals FALSE) when it removes the device in response to
an
IRP_MN_REMOVE_DEVICE.”

My question - What happenes if a function driver does not disable the
device
interface when processing IRP_MN_REMOVE_DEVICE? I want to leave the
device
interface enabled and enumerable until the PDO is deleted by the bus
driver.
Is this possible/allowed?

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: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

Doron,
I want to be able to request rebuilding of a certain device stack that was
previously destroyed from a user mode process.
For doing so I need to somehow tag the device stack before it is destroyed
so the user mode process will know which stack to rebuild later.
A device interface is the only way I know to tag a device stack for a user
mode process (the tagging is done in a kernel mode driver…).
Can you think of a different solution? Please tell me if my explanation is
not clear enough.

Thanks,
Shahar

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Tuesday, March 15, 2005 6:05 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] IoSetDeviceInterfaceState and IRP_MN_REMOVE_DEVICE.

No, it is not allowed. The device interface must be a unique name, the
instance path is used to make it unique. If you keep the name around after
remove has finished, but the PDO is still there and the stack is rebuilt,
the creation of the interface name will fail b/c a previous instance will
exist.

Furthermore, XP and later will turn off the interface for you after the
stack has processed remove (if the interface was accidentally left on).
Also, IIRC, creates will fail once the stack is put into a removed state
(if, for instance, you created an interface for PDO).

Having a device interface be enumerable, but not openable or functional b/c
the device is gone doesn’t make much sense. What are you trying to
accomplish?

D

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Shahar Talmi
Sent: Tuesday, March 15, 2005 7:55 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] IoSetDeviceInterfaceState and IRP_MN_REMOVE_DEVICE.

Hi,
The documentation states:

“A function or filter driver typically calls this routine with Enable set to
TRUE after it successfully starts a device in response to an
IRP_MN_START_DEVICE. Such a driver should disable the device interface
instance (Enable equals FALSE) when it removes the device in response to an
IRP_MN_REMOVE_DEVICE.”

My question - What happenes if a function driver does not disable the device
interface when processing IRP_MN_REMOVE_DEVICE? I want to leave the device
interface enabled and enumerable until the PDO is deleted by the bus driver.
Is this possible/allowed?

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: 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

Use a unique value as an identifier for the stack. Are you the bus
driver? If your previous postings are any indication, you are not.

You can use the PDO value itself as the unique ID for the stack (be
careful to leave enough room for 64 bits so your design works on an x64
system). Next part is where to store that information…if you are
just a filter driver in the stack, you can store these IDs in a well
known registry location that your app can open. If you store the
information under a volatile key, you don’t have to worry about the same
values being reused on reboot b/c the key is not saved out.

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Shahar Talmi
Sent: Tuesday, March 15, 2005 8:41 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] IoSetDeviceInterfaceState and IRP_MN_REMOVE_DEVICE.

Doron,
I want to be able to request rebuilding of a certain device stack that
was
previously destroyed from a user mode process.
For doing so I need to somehow tag the device stack before it is
destroyed
so the user mode process will know which stack to rebuild later.
A device interface is the only way I know to tag a device stack for a
user
mode process (the tagging is done in a kernel mode driver…).
Can you think of a different solution? Please tell me if my explanation
is
not clear enough.

Thanks,
Shahar

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Tuesday, March 15, 2005 6:05 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] IoSetDeviceInterfaceState and IRP_MN_REMOVE_DEVICE.

No, it is not allowed. The device interface must be a unique name, the
instance path is used to make it unique. If you keep the name around
after
remove has finished, but the PDO is still there and the stack is
rebuilt,
the creation of the interface name will fail b/c a previous instance
will
exist.

Furthermore, XP and later will turn off the interface for you after the
stack has processed remove (if the interface was accidentally left on).
Also, IIRC, creates will fail once the stack is put into a removed state
(if, for instance, you created an interface for PDO).

Having a device interface be enumerable, but not openable or functional
b/c
the device is gone doesn’t make much sense. What are you trying to
accomplish?

D

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Shahar Talmi
Sent: Tuesday, March 15, 2005 7:55 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] IoSetDeviceInterfaceState and IRP_MN_REMOVE_DEVICE.

Hi,
The documentation states:

“A function or filter driver typically calls this routine with Enable
set to
TRUE after it successfully starts a device in response to an
IRP_MN_START_DEVICE. Such a driver should disable the device interface
instance (Enable equals FALSE) when it removes the device in response to
an
IRP_MN_REMOVE_DEVICE.”

My question - What happenes if a function driver does not disable the
device
interface when processing IRP_MN_REMOVE_DEVICE? I want to leave the
device
interface enabled and enumerable until the PDO is deleted by the bus
driver.
Is this possible/allowed?

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: 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: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

I’m sorry, I don’t think I got you right:
How can the app translate the unique value to a device interface instance or
device instace id?
As far as I know the app must have a device interface instace or device
instance id in order to rebuild the stack (My app rebuilds the stack by
disabling and enabling it, using SetupDiXxxx).

My driver is not a bus driver, it’s just a filter on the stack.
The filter driver (depending on configuration) might cause the stack to be
removed, but sometime later the configuration might change and then I want
to rebuild the stack.
The only way I thought of that this can be done is by tagging the stack in a
way that my app can notice when enumerating device using SetupDiXxxx.
When the app finds a tagged device stack it disables and enables the device
in order to rebuild the stack.

Sorry for the confusion,
Shahar

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Tuesday, March 15, 2005 7:14 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] IoSetDeviceInterfaceState and IRP_MN_REMOVE_DEVICE.

Use a unique value as an identifier for the stack. Are you the bus driver?
If your previous postings are any indication, you are not.

You can use the PDO value itself as the unique ID for the stack (be careful
to leave enough room for 64 bits so your design works on an x64 system).
Next part is where to store that information…if you are just a filter
driver in the stack, you can store these IDs in a well known registry
location that your app can open. If you store the information under a
volatile key, you don’t have to worry about the same values being reused on
reboot b/c the key is not saved out.

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Shahar Talmi
Sent: Tuesday, March 15, 2005 8:41 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] IoSetDeviceInterfaceState and IRP_MN_REMOVE_DEVICE.

Doron,
I want to be able to request rebuilding of a certain device stack that was
previously destroyed from a user mode process.
For doing so I need to somehow tag the device stack before it is destroyed
so the user mode process will know which stack to rebuild later.
A device interface is the only way I know to tag a device stack for a user
mode process (the tagging is done in a kernel mode driver…).
Can you think of a different solution? Please tell me if my explanation is
not clear enough.

Thanks,
Shahar

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Tuesday, March 15, 2005 6:05 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] IoSetDeviceInterfaceState and IRP_MN_REMOVE_DEVICE.

No, it is not allowed. The device interface must be a unique name, the
instance path is used to make it unique. If you keep the name around after
remove has finished, but the PDO is still there and the stack is rebuilt,
the creation of the interface name will fail b/c a previous instance will
exist.

Furthermore, XP and later will turn off the interface for you after the
stack has processed remove (if the interface was accidentally left on).
Also, IIRC, creates will fail once the stack is put into a removed state
(if, for instance, you created an interface for PDO).

Having a device interface be enumerable, but not openable or functional b/c
the device is gone doesn’t make much sense. What are you trying to
accomplish?

D

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Shahar Talmi
Sent: Tuesday, March 15, 2005 7:55 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] IoSetDeviceInterfaceState and IRP_MN_REMOVE_DEVICE.

Hi,
The documentation states:

“A function or filter driver typically calls this routine with Enable set to
TRUE after it successfully starts a device in response to an
IRP_MN_START_DEVICE. Such a driver should disable the device interface
instance (Enable equals FALSE) when it removes the device in response to an
IRP_MN_REMOVE_DEVICE.”

My question - What happenes if a function driver does not disable the device
interface when processing IRP_MN_REMOVE_DEVICE? I want to leave the device
interface enabled and enumerable until the PDO is deleted by the bus driver.
Is this possible/allowed?

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: 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: 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

Store something in the registry for each device node that your filter
disables. You can enumerate all devices, look in the registry for each,
and if the magic value is there you enable it again.

-p

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Shahar Talmi
Sent: Tuesday, March 15, 2005 11:36 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] IoSetDeviceInterfaceState and IRP_MN_REMOVE_DEVICE.

I’m sorry, I don’t think I got you right:
How can the app translate the unique value to a device interface
instance or device instace id?
As far as I know the app must have a device interface instace or device
instance id in order to rebuild the stack (My app rebuilds the stack by
disabling and enabling it, using SetupDiXxxx).

My driver is not a bus driver, it’s just a filter on the stack.
The filter driver (depending on configuration) might cause the stack to
be removed, but sometime later the configuration might change and then I
want to rebuild the stack.
The only way I thought of that this can be done is by tagging the stack
in a way that my app can notice when enumerating device using
SetupDiXxxx.
When the app finds a tagged device stack it disables and enables the
device in order to rebuild the stack.

Sorry for the confusion,
Shahar

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Tuesday, March 15, 2005 7:14 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] IoSetDeviceInterfaceState and IRP_MN_REMOVE_DEVICE.

Use a unique value as an identifier for the stack. Are you the bus
driver?
If your previous postings are any indication, you are not.

You can use the PDO value itself as the unique ID for the stack (be
careful to leave enough room for 64 bits so your design works on an x64
system).
Next part is where to store that information…if you are just a filter
driver in the stack, you can store these IDs in a well known registry
location that your app can open. If you store the information under a
volatile key, you don’t have to worry about the same values being reused
on reboot b/c the key is not saved out.

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Shahar Talmi
Sent: Tuesday, March 15, 2005 8:41 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] IoSetDeviceInterfaceState and IRP_MN_REMOVE_DEVICE.

Doron,
I want to be able to request rebuilding of a certain device stack that
was previously destroyed from a user mode process.
For doing so I need to somehow tag the device stack before it is
destroyed so the user mode process will know which stack to rebuild
later.
A device interface is the only way I know to tag a device stack for a
user mode process (the tagging is done in a kernel mode driver…).
Can you think of a different solution? Please tell me if my explanation
is not clear enough.

Thanks,
Shahar

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Tuesday, March 15, 2005 6:05 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] IoSetDeviceInterfaceState and IRP_MN_REMOVE_DEVICE.

No, it is not allowed. The device interface must be a unique name, the
instance path is used to make it unique. If you keep the name around
after remove has finished, but the PDO is still there and the stack is
rebuilt, the creation of the interface name will fail b/c a previous
instance will exist.

Furthermore, XP and later will turn off the interface for you after the
stack has processed remove (if the interface was accidentally left on).
Also, IIRC, creates will fail once the stack is put into a removed state
(if, for instance, you created an interface for PDO).

Having a device interface be enumerable, but not openable or functional
b/c the device is gone doesn’t make much sense. What are you trying to
accomplish?

D

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Shahar Talmi
Sent: Tuesday, March 15, 2005 7:55 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] IoSetDeviceInterfaceState and IRP_MN_REMOVE_DEVICE.

Hi,
The documentation states:

“A function or filter driver typically calls this routine with Enable
set to TRUE after it successfully starts a device in response to an
IRP_MN_START_DEVICE. Such a driver should disable the device interface
instance (Enable equals FALSE) when it removes the device in response to
an IRP_MN_REMOVE_DEVICE.”

My question - What happenes if a function driver does not disable the
device interface when processing IRP_MN_REMOVE_DEVICE? I want to leave
the device interface enabled and enumerable until the PDO is deleted by
the bus driver.
Is this possible/allowed?

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: 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: 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: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

OK, use the name of the PDO.

In kernel mode, use
IoGetDeviceProperty(DevicePropertyPhysicalDeviceObjectName) and shove it
into the registry somewhere.

In user mode, use
SetupDiGetDeviceRegistryProperty(SPDRP_PHYSICAL_DEVICE_OBJECT_NAME) to
get the name. From user mode you can enumerate the entire tree to find
the PDO that you need by name.

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Shahar Talmi
Sent: Tuesday, March 15, 2005 11:36 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] IoSetDeviceInterfaceState and IRP_MN_REMOVE_DEVICE.

I’m sorry, I don’t think I got you right:
How can the app translate the unique value to a device interface
instance or
device instace id?
As far as I know the app must have a device interface instace or device
instance id in order to rebuild the stack (My app rebuilds the stack by
disabling and enabling it, using SetupDiXxxx).

My driver is not a bus driver, it’s just a filter on the stack.
The filter driver (depending on configuration) might cause the stack to
be
removed, but sometime later the configuration might change and then I
want
to rebuild the stack.
The only way I thought of that this can be done is by tagging the stack
in a
way that my app can notice when enumerating device using SetupDiXxxx.
When the app finds a tagged device stack it disables and enables the
device
in order to rebuild the stack.

Sorry for the confusion,
Shahar

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Tuesday, March 15, 2005 7:14 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] IoSetDeviceInterfaceState and IRP_MN_REMOVE_DEVICE.

Use a unique value as an identifier for the stack. Are you the bus
driver?
If your previous postings are any indication, you are not.

You can use the PDO value itself as the unique ID for the stack (be
careful
to leave enough room for 64 bits so your design works on an x64 system).
Next part is where to store that information…if you are just a filter
driver in the stack, you can store these IDs in a well known registry
location that your app can open. If you store the information under a
volatile key, you don’t have to worry about the same values being reused
on
reboot b/c the key is not saved out.

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Shahar Talmi
Sent: Tuesday, March 15, 2005 8:41 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] IoSetDeviceInterfaceState and IRP_MN_REMOVE_DEVICE.

Doron,
I want to be able to request rebuilding of a certain device stack that
was
previously destroyed from a user mode process.
For doing so I need to somehow tag the device stack before it is
destroyed
so the user mode process will know which stack to rebuild later.
A device interface is the only way I know to tag a device stack for a
user
mode process (the tagging is done in a kernel mode driver…).
Can you think of a different solution? Please tell me if my explanation
is
not clear enough.

Thanks,
Shahar

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Tuesday, March 15, 2005 6:05 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] IoSetDeviceInterfaceState and IRP_MN_REMOVE_DEVICE.

No, it is not allowed. The device interface must be a unique name, the
instance path is used to make it unique. If you keep the name around
after
remove has finished, but the PDO is still there and the stack is
rebuilt,
the creation of the interface name will fail b/c a previous instance
will
exist.

Furthermore, XP and later will turn off the interface for you after the
stack has processed remove (if the interface was accidentally left on).
Also, IIRC, creates will fail once the stack is put into a removed state
(if, for instance, you created an interface for PDO).

Having a device interface be enumerable, but not openable or functional
b/c
the device is gone doesn’t make much sense. What are you trying to
accomplish?

D

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Shahar Talmi
Sent: Tuesday, March 15, 2005 7:55 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] IoSetDeviceInterfaceState and IRP_MN_REMOVE_DEVICE.

Hi,
The documentation states:

“A function or filter driver typically calls this routine with Enable
set to
TRUE after it successfully starts a device in response to an
IRP_MN_START_DEVICE. Such a driver should disable the device interface
instance (Enable equals FALSE) when it removes the device in response to
an
IRP_MN_REMOVE_DEVICE.”

My question - What happenes if a function driver does not disable the
device
interface when processing IRP_MN_REMOVE_DEVICE? I want to leave the
device
interface enabled and enumerable until the PDO is deleted by the bus
driver.
Is this possible/allowed?

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: 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: 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: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

I am not sure there is a documented way to open the registry key for a
device in user-mode…
My driver can use IoOpenDeviceRegistryKey with PLUGPLAY_REGKEY_DEVICE, but
do you know a API in user-mode to open that key?
As far as I know a user-mode application can only use
SetupDiGetDeviceRegistryProperty() to get specific properties (no magic
values…).

Thanks,
Shahar

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Peter Wieland
Sent: Tuesday, March 15, 2005 10:11 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] IoSetDeviceInterfaceState and IRP_MN_REMOVE_DEVICE.

Store something in the registry for each device node that your filter
disables. You can enumerate all devices, look in the registry for each, and
if the magic value is there you enable it again.

-p

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Shahar Talmi
Sent: Tuesday, March 15, 2005 11:36 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] IoSetDeviceInterfaceState and IRP_MN_REMOVE_DEVICE.

I’m sorry, I don’t think I got you right:
How can the app translate the unique value to a device interface instance or
device instace id?
As far as I know the app must have a device interface instace or device
instance id in order to rebuild the stack (My app rebuilds the stack by
disabling and enabling it, using SetupDiXxxx).

My driver is not a bus driver, it’s just a filter on the stack.
The filter driver (depending on configuration) might cause the stack to be
removed, but sometime later the configuration might change and then I want
to rebuild the stack.
The only way I thought of that this can be done is by tagging the stack in a
way that my app can notice when enumerating device using SetupDiXxxx.
When the app finds a tagged device stack it disables and enables the device
in order to rebuild the stack.

Sorry for the confusion,
Shahar

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Tuesday, March 15, 2005 7:14 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] IoSetDeviceInterfaceState and IRP_MN_REMOVE_DEVICE.

Use a unique value as an identifier for the stack. Are you the bus driver?
If your previous postings are any indication, you are not.

You can use the PDO value itself as the unique ID for the stack (be careful
to leave enough room for 64 bits so your design works on an x64 system).
Next part is where to store that information…if you are just a filter
driver in the stack, you can store these IDs in a well known registry
location that your app can open. If you store the information under a
volatile key, you don’t have to worry about the same values being reused on
reboot b/c the key is not saved out.

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Shahar Talmi
Sent: Tuesday, March 15, 2005 8:41 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] IoSetDeviceInterfaceState and IRP_MN_REMOVE_DEVICE.

Doron,
I want to be able to request rebuilding of a certain device stack that was
previously destroyed from a user mode process.
For doing so I need to somehow tag the device stack before it is destroyed
so the user mode process will know which stack to rebuild later.
A device interface is the only way I know to tag a device stack for a user
mode process (the tagging is done in a kernel mode driver…).
Can you think of a different solution? Please tell me if my explanation is
not clear enough.

Thanks,
Shahar

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Tuesday, March 15, 2005 6:05 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] IoSetDeviceInterfaceState and IRP_MN_REMOVE_DEVICE.

No, it is not allowed. The device interface must be a unique name, the
instance path is used to make it unique. If you keep the name around after
remove has finished, but the PDO is still there and the stack is rebuilt,
the creation of the interface name will fail b/c a previous instance will
exist.

Furthermore, XP and later will turn off the interface for you after the
stack has processed remove (if the interface was accidentally left on).
Also, IIRC, creates will fail once the stack is put into a removed state
(if, for instance, you created an interface for PDO).

Having a device interface be enumerable, but not openable or functional b/c
the device is gone doesn’t make much sense. What are you trying to
accomplish?

D

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Shahar Talmi
Sent: Tuesday, March 15, 2005 7:55 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] IoSetDeviceInterfaceState and IRP_MN_REMOVE_DEVICE.

Hi,
The documentation states:

“A function or filter driver typically calls this routine with Enable set to
TRUE after it successfully starts a device in response to an
IRP_MN_START_DEVICE. Such a driver should disable the device interface
instance (Enable equals FALSE) when it removes the device in response to an
IRP_MN_REMOVE_DEVICE.”

My question - What happenes if a function driver does not disable the device
interface when processing IRP_MN_REMOVE_DEVICE? I want to leave the device
interface enabled and enumerable until the PDO is deleted by the bus driver.
Is this possible/allowed?

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: 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: 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: 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

OH,
I didn’t realize you were talking about the PDO *name*, sorry.
Is it safe to assume that after a PDO is deleted, another PDO will not get
the same name?
I’m afraid to get into a corner where I accidently disable and enable the
wrong device…

Shahar

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Tuesday, March 15, 2005 10:22 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] IoSetDeviceInterfaceState and IRP_MN_REMOVE_DEVICE.

OK, use the name of the PDO.

In kernel mode, use
IoGetDeviceProperty(DevicePropertyPhysicalDeviceObjectName) and shove it
into the registry somewhere.

In user mode, use
SetupDiGetDeviceRegistryProperty(SPDRP_PHYSICAL_DEVICE_OBJECT_NAME) to get
the name. From user mode you can enumerate the entire tree to find the PDO
that you need by name.

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Shahar Talmi
Sent: Tuesday, March 15, 2005 11:36 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] IoSetDeviceInterfaceState and IRP_MN_REMOVE_DEVICE.

I’m sorry, I don’t think I got you right:
How can the app translate the unique value to a device interface instance or
device instace id?
As far as I know the app must have a device interface instace or device
instance id in order to rebuild the stack (My app rebuilds the stack by
disabling and enabling it, using SetupDiXxxx).

My driver is not a bus driver, it’s just a filter on the stack.
The filter driver (depending on configuration) might cause the stack to be
removed, but sometime later the configuration might change and then I want
to rebuild the stack.
The only way I thought of that this can be done is by tagging the stack in a
way that my app can notice when enumerating device using SetupDiXxxx.
When the app finds a tagged device stack it disables and enables the device
in order to rebuild the stack.

Sorry for the confusion,
Shahar

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Tuesday, March 15, 2005 7:14 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] IoSetDeviceInterfaceState and IRP_MN_REMOVE_DEVICE.

Use a unique value as an identifier for the stack. Are you the bus driver?
If your previous postings are any indication, you are not.

You can use the PDO value itself as the unique ID for the stack (be careful
to leave enough room for 64 bits so your design works on an x64 system).
Next part is where to store that information…if you are just a filter
driver in the stack, you can store these IDs in a well known registry
location that your app can open. If you store the information under a
volatile key, you don’t have to worry about the same values being reused on
reboot b/c the key is not saved out.

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Shahar Talmi
Sent: Tuesday, March 15, 2005 8:41 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] IoSetDeviceInterfaceState and IRP_MN_REMOVE_DEVICE.

Doron,
I want to be able to request rebuilding of a certain device stack that was
previously destroyed from a user mode process.
For doing so I need to somehow tag the device stack before it is destroyed
so the user mode process will know which stack to rebuild later.
A device interface is the only way I know to tag a device stack for a user
mode process (the tagging is done in a kernel mode driver…).
Can you think of a different solution? Please tell me if my explanation is
not clear enough.

Thanks,
Shahar

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Tuesday, March 15, 2005 6:05 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] IoSetDeviceInterfaceState and IRP_MN_REMOVE_DEVICE.

No, it is not allowed. The device interface must be a unique name, the
instance path is used to make it unique. If you keep the name around after
remove has finished, but the PDO is still there and the stack is rebuilt,
the creation of the interface name will fail b/c a previous instance will
exist.

Furthermore, XP and later will turn off the interface for you after the
stack has processed remove (if the interface was accidentally left on).
Also, IIRC, creates will fail once the stack is put into a removed state
(if, for instance, you created an interface for PDO).

Having a device interface be enumerable, but not openable or functional b/c
the device is gone doesn’t make much sense. What are you trying to
accomplish?

D

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Shahar Talmi
Sent: Tuesday, March 15, 2005 7:55 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] IoSetDeviceInterfaceState and IRP_MN_REMOVE_DEVICE.

Hi,
The documentation states:

“A function or filter driver typically calls this routine with Enable set to
TRUE after it successfully starts a device in response to an
IRP_MN_START_DEVICE. Such a driver should disable the device interface
instance (Enable equals FALSE) when it removes the device in response to an
IRP_MN_REMOVE_DEVICE.”

My question - What happenes if a function driver does not disable the device
interface when processing IRP_MN_REMOVE_DEVICE? I want to leave the device
interface enabled and enumerable until the PDO is deleted by the bus driver.
Is this possible/allowed?

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: 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: 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: 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

No, there is no way to guarantee that the name will stay unique when the
old one is deleted.

SetupDiOpenDevRegKey(… , DICS_FLAG_GLOBAL, , DIREG_DEV, ); will open
the device node key (same key as IoOpenDeviceRegistryKey). You can
create a volatile subkey off of this key with a unique name and then
search for this specific subkey in your user mode app. The key would
exist across device surprise removal / reinsertion but not across
reboots.

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Shahar Talmi
Sent: Tuesday, March 15, 2005 12:49 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] IoSetDeviceInterfaceState and IRP_MN_REMOVE_DEVICE.

OH,
I didn’t realize you were talking about the PDO *name*, sorry.
Is it safe to assume that after a PDO is deleted, another PDO will not
get
the same name?
I’m afraid to get into a corner where I accidently disable and enable
the
wrong device…

Shahar

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Tuesday, March 15, 2005 10:22 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] IoSetDeviceInterfaceState and IRP_MN_REMOVE_DEVICE.

OK, use the name of the PDO.

In kernel mode, use
IoGetDeviceProperty(DevicePropertyPhysicalDeviceObjectName) and shove it
into the registry somewhere.

In user mode, use
SetupDiGetDeviceRegistryProperty(SPDRP_PHYSICAL_DEVICE_OBJECT_NAME) to
get
the name. From user mode you can enumerate the entire tree to find the
PDO
that you need by name.

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Shahar Talmi
Sent: Tuesday, March 15, 2005 11:36 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] IoSetDeviceInterfaceState and IRP_MN_REMOVE_DEVICE.

I’m sorry, I don’t think I got you right:
How can the app translate the unique value to a device interface
instance or
device instace id?
As far as I know the app must have a device interface instace or device
instance id in order to rebuild the stack (My app rebuilds the stack by
disabling and enabling it, using SetupDiXxxx).

My driver is not a bus driver, it’s just a filter on the stack.
The filter driver (depending on configuration) might cause the stack to
be
removed, but sometime later the configuration might change and then I
want
to rebuild the stack.
The only way I thought of that this can be done is by tagging the stack
in a
way that my app can notice when enumerating device using SetupDiXxxx.
When the app finds a tagged device stack it disables and enables the
device
in order to rebuild the stack.

Sorry for the confusion,
Shahar

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Tuesday, March 15, 2005 7:14 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] IoSetDeviceInterfaceState and IRP_MN_REMOVE_DEVICE.

Use a unique value as an identifier for the stack. Are you the bus
driver?
If your previous postings are any indication, you are not.

You can use the PDO value itself as the unique ID for the stack (be
careful
to leave enough room for 64 bits so your design works on an x64 system).
Next part is where to store that information…if you are just a filter
driver in the stack, you can store these IDs in a well known registry
location that your app can open. If you store the information under a
volatile key, you don’t have to worry about the same values being reused
on
reboot b/c the key is not saved out.

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Shahar Talmi
Sent: Tuesday, March 15, 2005 8:41 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] IoSetDeviceInterfaceState and IRP_MN_REMOVE_DEVICE.

Doron,
I want to be able to request rebuilding of a certain device stack that
was
previously destroyed from a user mode process.
For doing so I need to somehow tag the device stack before it is
destroyed
so the user mode process will know which stack to rebuild later.
A device interface is the only way I know to tag a device stack for a
user
mode process (the tagging is done in a kernel mode driver…).
Can you think of a different solution? Please tell me if my explanation
is
not clear enough.

Thanks,
Shahar

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Tuesday, March 15, 2005 6:05 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] IoSetDeviceInterfaceState and IRP_MN_REMOVE_DEVICE.

No, it is not allowed. The device interface must be a unique name, the
instance path is used to make it unique. If you keep the name around
after
remove has finished, but the PDO is still there and the stack is
rebuilt,
the creation of the interface name will fail b/c a previous instance
will
exist.

Furthermore, XP and later will turn off the interface for you after the
stack has processed remove (if the interface was accidentally left on).
Also, IIRC, creates will fail once the stack is put into a removed state
(if, for instance, you created an interface for PDO).

Having a device interface be enumerable, but not openable or functional
b/c
the device is gone doesn’t make much sense. What are you trying to
accomplish?

D

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Shahar Talmi
Sent: Tuesday, March 15, 2005 7:55 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] IoSetDeviceInterfaceState and IRP_MN_REMOVE_DEVICE.

Hi,
The documentation states:

“A function or filter driver typically calls this routine with Enable
set to
TRUE after it successfully starts a device in response to an
IRP_MN_START_DEVICE. Such a driver should disable the device interface
instance (Enable equals FALSE) when it removes the device in response to
an
IRP_MN_REMOVE_DEVICE.”

My question - What happenes if a function driver does not disable the
device
interface when processing IRP_MN_REMOVE_DEVICE? I want to leave the
device
interface enabled and enumerable until the PDO is deleted by the bus
driver.
Is this possible/allowed?

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: 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: 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: 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: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

Excellent, this solves my problem.
I didn’t know this function before.

Thanks Doron and Peter,
Shahar

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Tuesday, March 15, 2005 11:08 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] IoSetDeviceInterfaceState and IRP_MN_REMOVE_DEVICE.

No, there is no way to guarantee that the name will stay unique when the old
one is deleted.

SetupDiOpenDevRegKey(… , DICS_FLAG_GLOBAL, , DIREG_DEV, ); will open the
device node key (same key as IoOpenDeviceRegistryKey). You can create a
volatile subkey off of this key with a unique name and then search for this
specific subkey in your user mode app. The key would exist across device
surprise removal / reinsertion but not across reboots.

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Shahar Talmi
Sent: Tuesday, March 15, 2005 12:49 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] IoSetDeviceInterfaceState and IRP_MN_REMOVE_DEVICE.

OH,
I didn’t realize you were talking about the PDO *name*, sorry.
Is it safe to assume that after a PDO is deleted, another PDO will not get
the same name?
I’m afraid to get into a corner where I accidently disable and enable the
wrong device…

Shahar

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Tuesday, March 15, 2005 10:22 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] IoSetDeviceInterfaceState and IRP_MN_REMOVE_DEVICE.

OK, use the name of the PDO.

In kernel mode, use
IoGetDeviceProperty(DevicePropertyPhysicalDeviceObjectName) and shove it
into the registry somewhere.

In user mode, use
SetupDiGetDeviceRegistryProperty(SPDRP_PHYSICAL_DEVICE_OBJECT_NAME) to get
the name. From user mode you can enumerate the entire tree to find the PDO
that you need by name.

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Shahar Talmi
Sent: Tuesday, March 15, 2005 11:36 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] IoSetDeviceInterfaceState and IRP_MN_REMOVE_DEVICE.

I’m sorry, I don’t think I got you right:
How can the app translate the unique value to a device interface instance or
device instace id?
As far as I know the app must have a device interface instace or device
instance id in order to rebuild the stack (My app rebuilds the stack by
disabling and enabling it, using SetupDiXxxx).

My driver is not a bus driver, it’s just a filter on the stack.
The filter driver (depending on configuration) might cause the stack to be
removed, but sometime later the configuration might change and then I want
to rebuild the stack.
The only way I thought of that this can be done is by tagging the stack in a
way that my app can notice when enumerating device using SetupDiXxxx.
When the app finds a tagged device stack it disables and enables the device
in order to rebuild the stack.

Sorry for the confusion,
Shahar

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Tuesday, March 15, 2005 7:14 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] IoSetDeviceInterfaceState and IRP_MN_REMOVE_DEVICE.

Use a unique value as an identifier for the stack. Are you the bus driver?
If your previous postings are any indication, you are not.

You can use the PDO value itself as the unique ID for the stack (be careful
to leave enough room for 64 bits so your design works on an x64 system).
Next part is where to store that information…if you are just a filter
driver in the stack, you can store these IDs in a well known registry
location that your app can open. If you store the information under a
volatile key, you don’t have to worry about the same values being reused on
reboot b/c the key is not saved out.

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Shahar Talmi
Sent: Tuesday, March 15, 2005 8:41 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] IoSetDeviceInterfaceState and IRP_MN_REMOVE_DEVICE.

Doron,
I want to be able to request rebuilding of a certain device stack that was
previously destroyed from a user mode process.
For doing so I need to somehow tag the device stack before it is destroyed
so the user mode process will know which stack to rebuild later.
A device interface is the only way I know to tag a device stack for a user
mode process (the tagging is done in a kernel mode driver…).
Can you think of a different solution? Please tell me if my explanation is
not clear enough.

Thanks,
Shahar

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Tuesday, March 15, 2005 6:05 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] IoSetDeviceInterfaceState and IRP_MN_REMOVE_DEVICE.

No, it is not allowed. The device interface must be a unique name, the
instance path is used to make it unique. If you keep the name around after
remove has finished, but the PDO is still there and the stack is rebuilt,
the creation of the interface name will fail b/c a previous instance will
exist.

Furthermore, XP and later will turn off the interface for you after the
stack has processed remove (if the interface was accidentally left on).
Also, IIRC, creates will fail once the stack is put into a removed state
(if, for instance, you created an interface for PDO).

Having a device interface be enumerable, but not openable or functional b/c
the device is gone doesn’t make much sense. What are you trying to
accomplish?

D

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Shahar Talmi
Sent: Tuesday, March 15, 2005 7:55 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] IoSetDeviceInterfaceState and IRP_MN_REMOVE_DEVICE.

Hi,
The documentation states:

“A function or filter driver typically calls this routine with Enable set to
TRUE after it successfully starts a device in response to an
IRP_MN_START_DEVICE. Such a driver should disable the device interface
instance (Enable equals FALSE) when it removes the device in response to an
IRP_MN_REMOVE_DEVICE.”

My question - What happenes if a function driver does not disable the device
interface when processing IRP_MN_REMOVE_DEVICE? I want to leave the device
interface enabled and enumerable until the PDO is deleted by the bus driver.
Is this possible/allowed?

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: 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: 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: 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: 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

> My question - What happenes if a function driver does not disable the device

interface when processing IRP_MN_REMOVE_DEVICE?

Stale symlink pointing to nothing.

I want to leave the device
interface enabled and enumerable until the PDO is deleted by the bus driver.

Bad idea. On Device Manager’s Disable function, the PDO is not deleted, and you
will have a stale symlink possibly forever.

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

> When the app finds a tagged device stack it disables and enables the device

in order to rebuild the stack.

And this is correct.

Another way is to emulate PDO removal/arrival in the bus driver.

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