locked
USB drive letter from WMI RRS feed

  • Question

  • hi all,
    i am using a function to retrieve the drive letter of a USB drive from WMI with the deviceID i have with me, as it is with the specific deviceID and the corresponding drive letter, i create a file to monitor activities on the USB.

    the deviceID which i have with me is in the format "USB\\VID_0980&PID_762A\\..." which i retrieve at the moment a USB drive is inserted. in my function i take this deviceID as input and map the drive letter corresponding to it.

    as i have looked upon and subsequently found out that the mapping of drive letter in WMI has been done by taking the deviceID in the format "USBSTOR\\DISK&Ven_TOSHIBA&PROD_TRA........".
    the DeviceID "USBSTOR\\DISK&Ven_TOSHIBA&PROD_TRA......." can be achieved from WIN32_PnpEntity.DeviceID and also from WIN32_USBControllerDevice.Dependent

    the DeviceID "USB\\VID_0980&PID_762A\\..." can be retrieved from WIN32_PnpEntity.DeviceID and also from WIN32_USBControllerDevice.Dependent.

    although both these deviceID are from the same USB device the mapping for drive letter is done thorugh the previous one i.e "USBSTOR\\DISK&Ven_TOSHIBA&PROD_TRA......."

    and i am not getting a link between these two DeviceIDs.

    so please can i get some help on how to retrieve the drive letter of USB device using the device ID "USB\\VID_0980&PID_762A\\..."

    Thank You.
    Tuesday, January 13, 2009 6:04 AM

Answers

  • That's because you know. I don't think Your English teacher knows the answer to your problem, despite your problem is in English.
    C++ is just another language you use to express yourself. 
    Read the WMI FAQ for instructions about where to look for WMI information.

    MSMVP VC++
    Wednesday, January 14, 2009 5:02 AM

All replies

  • The Visual C++ compiler does not know WMI. If you don't know either, ask in a WMI forum/newsgroup. 
    MSMVP VC++
    Tuesday, January 13, 2009 6:03 PM
  • Hi, i have already used WMI query in VC++. i am able to retrieve the device ID by querying the WMI. i just need to map the drive letter using the device ID
    Wednesday, January 14, 2009 4:40 AM
  • That's because you know. I don't think Your English teacher knows the answer to your problem, despite your problem is in English.
    C++ is just another language you use to express yourself. 
    Read the WMI FAQ for instructions about where to look for WMI information.

    MSMVP VC++
    Wednesday, January 14, 2009 5:02 AM
  • Thank you for the intrinsic language description. and i will look upon int he FAq to get some more knowledge.
    Wednesday, January 14, 2009 6:10 AM