Archive: How do I prompt for a disc until the user inserts the right one?


How do I prompt for a disc until the user inserts the right one?
I've spent about a week of poking at this, working on other parts of my installer and coming back to it. The EnumCDs, CABSetup and Cdrom plugins all look relevant but I haven't found an example of how to check for a particular disc.

The context for my request: I'm building an installer that grabs a bunch of patches off a network drive, installs some games from disc (Crysis in particular is one I'm working on) and then it applies the patches.

Thanks for your help.


The CD-ROM plugin isn't going to work - it doesn't support DVDs. I created some functions once that will probably do what you need: http://nsis.sourceforge.net/DVD_functions

I still use it to my satisfaction, maybe it'll do you some good.


I missed your page, looks helpful. I got it working with GetDrives though.


!include FileFunc.nsh
!include LogicLib.nsh
!include nsDialogs.nsh

Function isCrysisDVD
DetailPrint "Checking for Crysis DVD in $9"
${If} ${FileExists} "$9\Crysis.msi"
StrCpy $CrysisInstallerFound True
DetailPrint "Crysis disc found: $9"
ExecWait "msiexec /i $9\Crysis.msi"
StrCpy $0 StopGetDrives
${EndIf}
Push $0
FunctionEnd

Section "Crysis"
CrysisFindDisc:
${GetDrives} "CDROM" "isCrysisDVD"
Pop $0
StrCmp $CrysisInstallerFound True CrysisDone
CrysisRetryCancel:
MessageBox MB_RETRYCANCEL "Please insert a Crysis DVD. If you wish to skip installing Crysis, click cancel." IDRETRY CrysisFindDisc
CrysisDone:
SectionEnd


If you can think of anything I can do to improve this code, let me know. I may refactor it to use your functions later. Either way, a piece of sample code for this task on that page would be very helpful. I'll post it if I end up using your functions.

Easiest thing to do is to save $EXEDIR somewhere and use the first character of that as the CD/DVD drive for further disks. That is of course assuming the user won't decide to put the next disk in another CD/DVD drive.

Stu


The idea is to use an ini file with some data, which the installer, when asks for the next CD/DVD, will search and read that data from the ini.


Joel: Since altie is making a mod/patch/whatever installer for Crysis, modifying the DVD isn't an option.