Page 3 of 3

PostPosted: Tue Nov 13, 2007 12:40 am
by Antonio Linares
Inspecting the pendrive from Linux (Ubuntu) it seems as a pendrive has a hardware "serial" :-) so if we could get that serial from code...

PostPosted: Tue Nov 13, 2007 2:33 pm
by Mike Buckler
Try this test program generated with vb6 I believe that it is giving the embedded serial number not the volume number generated by windows.
You can download it here. http://www.trimpos.net/test1.exe

If you would like to generate it yourself with vb6 here is the source just put a list box on a form and copy in the following code?

Private Sub Form_Load()
Dim colProcessList
Dim objprocess
Set colProcessList = GetObject("Winmgmts:").ExecQuery("Select * from Win32_DiskDrive ")
For Each objprocess In colProcessList
If Mid(objprocess.PnPDeviceID, 1, 7) = "USBSTOR" Then
List1.AddItem objprocess.PnPDeviceID
End If
Next
Set colProcessList = Nothing
Set objprocess = Nothing
End Sub


I found the above code on the web, if it is not returning the actual hardware id please let me know.

PostPosted: Tue Nov 13, 2007 2:36 pm
by Antonio Linares
Mike,

The code is fine and Enrico's adaptation is very good, but we still need to know the drive letter, so we can write/read an encrypted file into it.

We need to locate the drive letter (i.e. "K:\") where the USB drive is, and its corresponding serial code. Actually we know the serial, but we don't know the drive letter for that serial

There could be more than one pendrive inserted in the computer

PostPosted: Tue Nov 13, 2007 3:36 pm
by Antonio Linares
Got it! :-)

Please download this EXE and tes tit with several USB pendrives, thanks!
http://www.hotshare.net/file/16342-6394189d08.html