Have your app open a handle to your driver using a device interface. By
getting the device interface to your device, the user mode app can get
the DEVINST/instance path when finding the interface.
d
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Shahar Talmi
Sent: Tuesday, August 24, 2004 3:21 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Disabling a device from kernel mode
I understand. Thank you.
Can you think of another solution?
Shahar
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Peter Wieland
Sent: Tuesday, August 24, 2004 11:15 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Disabling a device from kernel mode
It's not legal to extract the name from the path that the kernel happens
to use to keep your device's instance data. Tomorrow that path might
have a different name and your customers would be screwed.
Sorry that this doesn't solve your problem, but a bad solution is
usually worse than no solution.
-p
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Shahar Talmi
Sent: Tuesday, August 24, 2004 2:45 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Disabling a device from kernel mode
You are right, I am talking about a very different functionality which
has nothing to do with the previous questions about install/uninstall.
I am now talking about a completely different driver that has nothing to
do with the previous driver that was discussed.
Although the filter driver got to the conclusion that the device should
be removed, the state of the device is not harmful and so I don't want
to make the device 'disappear' or to report that it is broken since this
will trigger a surprise removal from the PNP manager which might lead to
lose of information in the device.
Instead I want to get the device removed gracefully by disabling it or
removing it from a user mode process. Can you think of a way I can tell
the user mode process what device to disable when all I have is a PDO
and the user mode process needs a device instance id?
Is it legal to extract the device instance id from the
PLUGPLAY_REGKEY_DEVICE name that I got from ObQueryNameString after I
opened it using IoOpenDeviceRegistryKey?
Thanks,
Shahar
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Roddy, Mark
Sent: Tuesday, August 24, 2004 10:20 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Disabling a device from kernel mode
Well then you have added a new functional requirement on top of the
original requirement that appeared to be: install/uninstall your filter
driver. Your new requirement is: manage the operational state of the
filtered device from your filter driver. That is a different beast
entirely, and has little if anything to do with the install/uninstall
function. If you think the device is broken, just tell PnP its broken.
If you want the device to 'disappear'
then you need to consider bus driver functionality.
=====================
Mark Roddy
-----Original Message-----
From: Shahar Talmi [mailto:xxxxx@safend.com]
Sent: Tuesday, August 24, 2004 5:03 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Disabling a device from kernel mode
But suppose I'm writing a filter driver that disables the device it
filters if that device made some kind of illegal operation.
In this case the filter will need to inform the user mode service that
this device should be disabled, but all the filter has is the PDO for
the device...
How do you suggest getting the device disabled in this case?
Thanks
Shahar
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Tuesday, August 24, 2004 9:42 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Disabling a device from kernel mode
It is by design that you cannot get the complete instance ID from kernel
mode. There is no need for it. If you can figure out which PDO you
want to attach to in kernel mode, you can figure this out from your
installer as well. I would recommend doing all of this in user mode
w/documented functions.
The value named SymbolicLink is placed there by the USB core stack, not
the pnp manager. As such, it is only present on usb enumerated devices.
This string is the device interface string that you can get in user
mode.
d
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Shahar Talmi
Sent: Tuesday, August 24, 2004 11:56 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Disabling a device from kernel mode
Hi,
A couple of days ago I posted a question about disabling devices from a
device driver.
I now understand that the only way to do this is from user mode, so I
decided to send notify a user mode service when my driver needs to get
some other device disabled.
The function I figured that can do this is
SetupDiSetClassInstallParams(), but in order to call this function I
need the Device Instance ID, which I could not find a way to retrieve in
kernel mode using a PDO.
To my understanding the device instance id is "device id\instance id".
I can get both of these IDs from the PDO by sending it a IRP_MN_QUERY_ID
with BusQueryDeviceID and BusQueryInstanceID respectively.
The problem is that if the bus does not have UniqueID capability then
the BusQueryInstanceID is only part of the instance id, and the rest of
it is defined by the PnP manager, which I did not find anyway to query.
I found some old thread in NTDEV
(http://www.osronline.com/lists_archive/ntdev/thread369.html) of a guy
with the same problem.
He used IoOpenDeviceRegistryKey with PLUGPLAY_REGKEY_DEVICE to open the
hardware key for the device which is (for example):
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\USB\Vid_03eb&Pid_7605\5
&29c7aec0&0&1\Device Parameters
The bold part in the key name is the device instance id, so after he
opened the key he used ObQueryNameString to get the full name for the
key and extracted the parent keys name.
This sounds like a good solution (if it's reliable). The only thing I
don't like is that ObQueryNameString is not documented in the DDK (only
in the IFS).
So here is a newbie question: I do I include ntifs.h in my project when
I already include wdm.h without getting a lot of multiple definition
errors?
And some more questions:
Is this an acceptable solution for getting the device instance id? Will
I always get the right id? Will it be better to only take the instance
id
(5&29c7aec0&0&1) from the registry key and retrieve the device id with
IRP_MN_QUERY_ID? Is there a better way to get the device instance id?
Maybe there is some other parameter that I can send from kernel mode to
user mode that will be sufficient for disabling the device?
I noticed that in the Device Parameters key that IoOpenDeviceRegistryKey
opens there is a key named SymbolicName with the value (for example):
??\USB#Vid_03eb&Pid_7605#5&29c7aec0&0&1#{a5dcbf10-6530-11d2-901f-00c04f
b951ed}
Now, I guess that this symbolic link is created by the PnP manager. Is
it created for every device? Is it always created in this format? Is it
legal / reliable to extract the device instance id from this string? Is
there some API (kernel or user) I can use to get the device instance id
using the symbolic name? Can the user-mode program use this symbolic
name to disable the device instead of using the device instance id?
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: xxxxx@stratus.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: xxxxx@safend.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: 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