PDA

View Full Version : Obtaining drive letter of installed drive.



bmschkerke
31.05.2005, 22:42
Operating System: Windows XP Professional
Burning Software: Alcohol 120%
Anti-virus Software: Symantec Antivirus
DAEMON Tools Version: 3.47

This is a lost cause, I know, because otherwise blacklists would be *all* over the place, but... is there a simple way to determine the virtual drive letter as it corresponds to 0..4?

I'm scripting my images so my son can just run a setup file and away he goes, without having to do anything. Unfortunately I don't know which drive letter he'll be using for his virtual drive, so I thought that it'd be "cooler" to figure out which drive was virtual.

Right now I'm inserting the CD by locating and calling daemon.exe, and then searching each existing drive letter for a known entity. Kind of a waste. :)

Thanks for any input. Anything works - C++, registry key, whatever.

bmschkerke
31.05.2005, 23:14
AutoIt v3 is a Win32 scripting environment that's quite powerful.

Using it I was able to, ah, cheat to get the information I wanted.

; This sends the "right click" message to the Daemon Tools process.
DllCall("user32.dll", "int", "PostMessage", "hwnd", WinGetHandle( "Virtual DAEMON Manager V3.47" ), "int", 32868, "int", 1000, "int", 517)
; This uses keyboard movements to select virtual drive 0's parameters.
Send("{up 5}{right 2}{down}{enter}")
; Here we wait for the window to appear - in case there's any unusual pauses, etc.
WinWait("Set device parameters - Device","")
; Now we grab the drive letter that we're set to out of control ID 1032, which is the drive letter combo box.
$virtualdrive = ControlGetText("Set device parameters - Device", "", 1032)
; Close the window by clicking the OK button.
ControlClick("Set device parameters - Device", "", "Button5")
MsgBox(64, "Virtual Drive Letter", "Virtual drive is currently set to drive letter " & $virtualdrive)

This works with v3.47 only as the control IDs are subject to change between versions, but it works well.

Jaime
01.06.2005, 17:51
Operating System: _
Burning Software: _
Anti-virus Software: _
DAEMON Tools Version: _

A much easier way would be to use the BTEWin scripting interpreter which supports DT directly. All the stuff that you have typed can be resumed in just one variable function, like f.e.:

%@DAEMONLETTER[0]

Read the docs for details.