• Advertisement
Sign in to follow this  

wmi and drive letter from device id

This topic is 2162 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hello.
I wish extract from an usb and hd drive the drive letter of the drive and the pnpdeviceid.
i solved using wmi, but is too slow!!
especially this query:

stringstream strLogicalDiskToPartition;
strLogicalDiskToPartition << "ASSOCIATORS OF {Win32_DiskPartition.DeviceID='Disk #1, Partition #0' } WHERE AssocClass = Win32_LogicalDiskToPartition";
hr = m_pSvc->ExecQuery(CComBSTR("WQL"), CComBSTR(strLogicalDiskToPartition.str().c_str()),
WBEM_FLAG_FORWARD_ONLY | WBEM_FLAG_RETURN_IMMEDIATELY,
NULL,
&pEnumeratorLogicalDisk
);


is possible using an api function get the drive letter of the device from the phisical device id (\\.\PHYSICALDRIVE1) or logical(Disk #1, Partition #0') in a reasonable time?
thanks.

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement