question

sathishviswanathan-5522 avatar image
0 Votes"
sathishviswanathan-5522 asked DanielZhang-MSFT edited

How to get the Device Instance Path from drive letter using c#

I need to get the Device Instance Path from the drive letter in C#. Using WMI is also fine.

dotnet-csharp
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thanks for immediate response. Do we have any code snippet in c#? if yes, Please share the link

0 Votes 0 ·
Castorix31 avatar image
0 Votes"
Castorix31 answered

SetupDiGetClassDevs, SetupDiEnumDeviceInterfaces , SetupDiGetDeviceInterfaceDetail
+
DeviceIoControl and IOCTL_STORAGE_GET_DEVICE_NUMBER





5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

DanielZhang-MSFT avatar image
0 Votes"
DanielZhang-MSFT answered DanielZhang-MSFT edited

Hi sathishviswanathan-5522,
David Ching has provided a solution that using a Windows API in this thread, and you can refer to it.
Best Regards,
Daniel Zhang


If the response is helpful, please click "Accept Answer" and upvote it.

Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.