How to stop attaching another device to my device in device stack. I want
always to be on the top of the device stack.
THANKS
How to stop attaching another device to my device in device stack. I want
always to be on the top of the device stack.
THANKS
Dimityr Andreev wrote:
How to stop attaching another device to my device in device stack. I want
always to be on the top of the device stack.
You can’t stop the PnP Manager from loading a filter driver above you
and calling its AddDevice function, which will then do an
IoAttachDeviceToDeviceStack. Nor can you stop someone in kernel mode
from locating your device object and sending you IRPs. What you could do
is any of the following:
Notice that the AttachedDevice field in your DEVICE_OBJECT is not
NULL, which would imply that someone has attached above you, whereupon
you could complain in some fashion.
Fail IRP_MJ_CREATE in an attempt to prevent someone from using
IoGetDeviceObjectPointer. Of course, this *also* prevents anyone from
opening a handle to your device, so it’s not likely to be a good
solution.
From user mode, use
SetupDiGetDeviceRegistryProperty(SPDRP_UPPERFILTERS) to see if anyone is
listed as a device upper filter. To check for class upper filters, use
SetupDiOpenClassRegKey to open the class key and check explicitly for an
UpperFilters entry.
All of this said, *why* do you need to be the top of the stack, given
that you really can’t force that to be true?
–
Walter Oney, Consulting and Training
Check out new US seminar schedule at http://www.oneysoft.com
In Solution 2. Correct me if i am wrong which i might be.
If i fail IRP_MJ_CREATE. i being filter driver i thought no one could open a
handle to the device i am filtering also.
Am i wrong?
-Srin.
-----Original Message-----
From: Walter Oney [mailto:xxxxx@oneysoft.com]
Sent: Wednesday, September 18, 2002 7:28 AM
To: NT Developers Interest List
Subject: [ntdev] Re: Stop attach device
Dimityr Andreev wrote:
How to stop attaching another device to my device in device stack. I want
always to be on the top of the device stack.
You can’t stop the PnP Manager from loading a filter driver above you
and calling its AddDevice function, which will then do an
IoAttachDeviceToDeviceStack. Nor can you stop someone in kernel mode
from locating your device object and sending you IRPs. What you could do
is any of the following:
Notice that the AttachedDevice field in your DEVICE_OBJECT is not
NULL, which would imply that someone has attached above you, whereupon
you could complain in some fashion.
Fail IRP_MJ_CREATE in an attempt to prevent someone from using
IoGetDeviceObjectPointer. Of course, this *also* prevents anyone from
opening a handle to your device, so it’s not likely to be a good
solution.
From user mode, use
SetupDiGetDeviceRegistryProperty(SPDRP_UPPERFILTERS) to see if anyone is
listed as a device upper filter. To check for class upper filters, use
SetupDiOpenClassRegKey to open the class key and check explicitly for an
UpperFilters entry.
All of this said, *why* do you need to be the top of the stack, given
that you really can’t force that to be true?
–
Walter Oney, Consulting and Training
Check out new US seminar schedule at http://www.oneysoft.com
You are currently subscribed to ntdev as: xxxxx@nai.com
To unsubscribe send a blank email to %%email.unsub%%