Re: How to make link between USB physical port and drive letter mount by windows

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



thanks you for your help.
Now, I'm managing to display all USB devices and when it's an USB key,
I display the letter of the driver assigned by Windows.



On 10 juin, 18:47, Uwe Sieber <m...@xxxxxxxxxxxxx> wrote:
All I've written is for user mode.

You get a parent device by CM_Get_Parent and the
driver key name by CM_Get_DevInst_Registry_Property
called with CM_DRP_DRIVER.

Using CM_xxx functions is not suggested by MS, but
they are so easy too use...

Uwe

max_mont wrote:
Thank you very much for your help. But I'm a newbie in driver
development (I usually develop in higer level).
I don't see how I can get parent device and get "driver key name).

Have you got a piece of code ?

Many thanks in advance again.

On 10 juin, 09:12, Uwe Sieber <m...@xxxxxxxxxxxxx> wrote:
max_mont wrote:

I would like to enumerate all USB storage plugged on a PC, identify
all by physical port and by drive letter.
I can enumerate all USB device with DDK sample (usbview) but I can't
manage to find drive letter for each storage.
You need an enumeration of all VOLUMES. Get their device
numbers. The enumerate all DISKs, CDROMs and FLOPPYs. Match
them with the volumes by their device numbers. I've shown
this here:http://www.codeproject.com/system/RemoveDriveByLetter.asp

For each drive with BusType==BusTypeUsb get the parent
device of the DISK/CDROM/FLOPPY which is the USB device
itself. Get their "driver key name" (SPDRP_DRIVER / CM_DRP_DRIVER).

Match it with the driver key name of the USB devices found
thru the USB API (IOCTL_USB_GET_NODE_CONNECTION_DRIVERKEY_NAME).

Good luck :-)

Uwe

.



Relevant Pages

  • Help, Usb copy files, show error message "Path is too long".
    ... my usb device is a standard mass storage U disk, ... some file from PC to usb device, PC display a error messagebox, which means ... but this bug is only display once. ...
    (microsoft.public.development.device.drivers)
  • USB Monitor software
    ... I am looking for some free-download software that can run on a PC (W 2000 or ... XP) that will display all the communication between the PC and a selected ... USB device, even if the device is not being enumerated ...
    (comp.arch.embedded)
  • Re: How to display the contents of USB Jump drive
    ... using vc++ i detected the USB device. ... Now i want to display the contents of ... The device will have been mounted as a file system with a drive letter. ... Providenza & Boekelheide, Inc. ...
    (microsoft.public.development.device.drivers)
  • Re: Need some help getting started with low-level USB I/O requests
    ... Use CreateFilewith DevicePath as parameter to open a handle to USB device. ... Instead, it requires you to specify a hub and the port index to which the device is connected (i.e. it requires me to enumerate host controllers, hubs and downstream ports). ... It would be great if I could somehow query the USB device so that I know its connection parameters. ...
    (microsoft.public.win32.programmer.kernel)
  • Re: Recognizing two identical usb devices
    ... instead of using a fixed name, you should use a device interface. ... you can then enumerate the device interface and find all ... each usb device seams to get lost in the usb bus. ... > The software driver creates a distinct device name for each usb device ...
    (microsoft.public.development.device.drivers)