tags:

views:

683

answers:

2

In a previous SO question, it was mentioned that USB devices can be mounted using the following approach in Windows:

MOUNTVOL C:\USB: \\?\Volume{ebc79032-5270-11d8-a724-806d6172696f}\

My question is what is that String starting with \\?\Volume called, and what is the best way to retrieve that. I would rather not use .NET if possible since you can't really 'bundle' the .NET runtime without physically installing it on the machine as far as I know.

I would also be interested in using JNA if that is possible.

+1  A: 

You can't bundle the Java "...runtime without physically installing it on the machine..." either.

Enumerating the device after it is mounting should be straightforward. Actually mounting the device should NOT be straightforward since Java (and .NET) are both designed to abstract away the hardware.

I recommend that you pick a more appropriate tool for this. Either choose to simply invoke another process to run the mount command (knowing that it won't be portable), or choose a tool that does not abstract away the hardware, or at least less so (perhaps Python?).

EDIT: Clarification on JVM install...

Excellent point--a JVM installation can be much less invasive than a .NET installation since the latter MUST integrate with the OS while the former merely CAN integrate with the OS. So, yes, including a private JVM install is viable and perhaps desirable.

NOTE: The question includes the mount command for the USB device, which tends to emphasize that aspect as a primary requirement.

Rob Williams
I may be wrong but I remember seeing many programs "bundle" the JRE in their installation directory without having me go through the JRE installation process. They did this regardless of whether I already had Java installed, that is what I was referring to.
Abdullah Jibaly
Also, I am not concerned (yet) about mounting the device, I am more interested in the discovery process right now. I'm doing some research and will update when I find out more.
Abdullah Jibaly
A: 

What kind of USB device are you looking for? The bit you quote is only applicable to USB disk drives, not USB devices in general.

Will Dean