简体   繁体   English

如何在Windows的文件系统驱动程序中查找PNP设备ID

[英]How to Find the PNP Device Id in File System Driver for windows

I have created a File system driver to allow or block the external storage devices in windows. 我创建了一个文件系统驱动程序,以允许或阻止Windows中的外部存储设备。 For allowing a particular device I need to find out the PNP device id. 为了允许特定设备,我需要找出PNP设备ID。 Is there is any possible way to find the PNP id device? 有没有可能找到PNP ID设备的方法?

You can create a IRP_MN_QUERY_ID , and using the BusQueryDeviceID to get the identificator into a buffer. 您可以创建一个IRP_MN_QUERY_ID ,并使用BusQueryDeviceID将标识符放入缓冲区。

You can also use IOCTL_STORAGE_QUERY_PROPERTY to get some data that is usually part of the id, like the vendor and productid. 您还可以使用IOCTL_STORAGE_QUERY_PROPERTY来获取通常是ID一部分的一些数据,例如供应商和产品ID。

Please note that not all hardware is guaranteed (in fact, most don't) to have unique identifiers. 请注意,并非所有硬件都保证有唯一的标识符(实际上,大多数没有)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM