Archive: using CDrom plugin for DVD


using CDrom plugin for DVD
I have an external dvd rom reader/burner which I can use to burn an installer to span unzipping files across two DVD's. I get the "ready" status when I put in the 2nd DVD and it works. In QA, the status never changes from 0. Should the CDrom module be able to get the DVD status the way it gets CD status ?


What is this plug-in? I have never heard of it. The only CD-ROM plug-in I know ejects the tray.


CDRom-plugin gets the CD reader's status. It does more than just eject the tray.


The API is the same so it should work. Try looking into its source code for the key API it uses and search the web to see if someone else hit your problem with DVDs as well.


Same problem here - the CD-ROM plugin does not work with DVDs.
I just wrote my own set of functions to replace it.


;check if drive type is CD/DVD drive. Push parameter X:\ to stack
; before calling, pop return value after. (note: should probably
; be GetDriveType, not GetDriveTypeA. I can't remember why I use
; the ansi version here.)
Function DVD_CheckDrive
Exch $R0
System::Call 'kernel32::GetDriveTypeA(t "$R0") i .r10'
StrCmp $R0 5 0 +2
StrCpy $R0 "CDROM"
Exch $R0
FunctionEnd

;get the label of the disc in the drive X:\ (on stack, returns to stack)
Function DVD_GetLabel
Exch $R0
Push $R1
Push $R2

;may need some code here to check if any paremeter was passed at all

;get the label of the drive (return to $R1)
#System::Call 'kernel32::SetErrorMode(i 0) i .r11'
System::Call 'Kernel32::GetVolumeInformation(t r10,t.r11,i ${NSIS_MAX_STRLEN},*i,*i,*i,t.r12,i ${NSIS_MAX_STRLEN})i.r10'
StrCmp $R0 0 0 +3
StrCpy $R0 "DVDGetLabel_error"
goto +2
StrCpy $R0 $R1
#System::Call 'kernel32::SetErrorMode(i 1) i .r11'
break:

Pop $R2
Pop $R1
Exch $R0
FunctionEnd

;A replacement for the enumerate command of the CD-ROM plugin.
; Call with an emtpy string on stack to find the first CD/DVD-rom
; drive. Call with a parameter X:\ on stack to find the first
; drive after X:\ (alphabetical order). Returns found drive to stack.
Function DVD_GetNextDrive
Exch $R1
Push $R0
Push $R2
Push $R3
Push $R4

StrCpy $R4 $R1

;get all drives (return to $R0, bitwise)
System::Call 'kernel32::GetLogicalDrives() i .r10'
StrCmp $R0 "0" 0 +3 ;if no drives found, error
StrCpy $R1 ""
goto break

;If no parameter was supplied at all, assume we're starting at A:\.
StrCmp $R4 "" 0 +2
StrCpy $R4 "A"

;get ascii-number of first char in function parameter
System::Call "*(&t1 r14)i.r12"
System::Call "*$R2(&i1 .r14)"
System::Free $R2
IntOp $R4 $R4 - 65

;check if parameter driveletter is between A and Z
IntCmp $R4 0 0 +2
IntCmp $R4 25 +3 +3
StrCpy $R1 ""
goto break

;If a valid parameter was supplied (ie we survived so far),
; skip the supplied driveletter before beginning scan
StrCmp $R1 "" +2
IntOp $R4 $R4 + 1

;backup the (asciiconverted) starting driveletter, for detecting
; when we've cycled the entire alphabet
StrCpy $R1 $R4

loop:
IntOp $R2 0x01 << $R1
IntOp $R3 $R2 & $R0
;if (0x01<<driveletter & drivesfound) == 0x01<<driveletter
; (in other words, if there is a drive mounted at this driveletter)
StrCmp $R3 $R2 0 NoDriveHere
;convert asciinumber of driveletter to character
IntOp $R2 $R1 + 65
IntFmt $R2 %c $R2
;get type of drive
System::Call 'kernel32::GetDriveType(t "$R2:\") i .r13'
StrCmp $R3 5 0 NoDriveHere
;if type is CDROM, end
StrCpy $R1 "$R2:\"
goto break
NoDriveHere:
;increment driveletter
IntOp $R1 $R1 + 1
StrCmp $R1 $R4 break ;if we've cycled the entire alphabet, end
StrCmp $R1 26 0 +2 ;if >Z, return to A
StrCpy $R1 0
goto loop
break:

Pop $R4
Pop $R3
Pop $R2
Pop $R0
Exch $R1
FunctionEnd


Edit: Spacing fixed. Also, find the CD-ROM plugin here: hxxp://nsis.sourceforge.net/CDRom_plug-in

Thanks - I'll keep this for the future. I'm not experienced at the windows internals, but I'll try your status call, since I know which drive I'm installing from.