First, specify the guid and use setupdigetclassdevs to obtain information about all devices in the harddisk and volume categories.
Define_guid/
(Harddisk_guid, 0x53f56307, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b );
Define_guid/
Volume_guid, 0x53f5630d, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b );
Then, setupdienumdeviceinterfaces is used to enumerate the interface information of each device in the device information set.
If the call succeeds, call setupdigetdeviceinterfacedetail to obtain the details of each device.
Then, use cm_get_parent and cm_get_device_id to obtain the device instance id of the device instance, which is a string similar to the following: pciide/idechannel/4 & e3ec092 & 0 & 0, USB/vid_0d7d & pid_0150/4d3b424303c0.
You must have noticed that all USB devices start with USB and contain both the PID and vid of the device. In this way, you can determine whether the device is from a specific manufacturer. Next, we need to get the drive letter corresponding to the USB device. Because each device may contain multiple volumes, we can use a similar method to obtain information about all volumes, by comparing the device number, you can determine whether multiple volumes belong to the same device. Then, you can use the physical device name of the volume device to reverse query the symbol (querydosdevice) to obtain the drive letter corresponding to the volume, we can further obtain the drive letter of all volumes on a physical disk.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.