Archive: How to identify CDROM that files reside on - Patching program.


How to identify CDROM that files reside on - Patching program.
I found out that a particular print run of a program has some corrupted files. As such, we need to either send out brand new CDROMs, provide a 200+MB file that is the equivalent of the CDROM via internet (helloooo bandwidth charges), or make a patch that will install the 10 megs of actual "corrupted" files and copy the rest from the CDROM to the hard drive. I am trying the latter.

My problem is that this is for non-technical users. I want to make a standard patch that will search for the correct drive letter that holds the original CDROM. It will verify that the files are correct by comparing for file "X" in the drive location. I can't assume what CDROM letter it will be, although I suppose that I can include a prompt to say what drive letter that the CDROM is at. I just prefer to make the whole operation seamless and user-non-interactive as possible (idiot-proof, if you will). I have looked around, and can't seem to find the exact idea on the boards. My idea of the code (in non-code language) is as follows:

Set Drive ?:\ to D:\
Begin:
Look in Drive ?:\
If File Verifyfile.xxx exists in directory Data\, then
copy files xxx-yyy to directory $INSTDIR
If Drive ?:\ != Z:\ then
Drive ?:\ = Drive ?+1:\
goto Begin:
Else messagebox "CDROM not found, please insert CDROM and click OK." OK, Cancel #message box entries
If OK, set Drive ?:\ = D:\
goto Begin:
Else Quit:

Name "Output"
OutFile "Output.exe"

!include "FileFunc.nsh"
!insertmacro GetDrives

Section
Begin:
${GetDrives} "CDROM" "GetDrivesCallback"

StrCmp $R0 Founded +2
MessageBox MB_OKCANCEL "CDROM not found, please insert CDROM and click OK." IDOK begin
SectionEnd

Function GetDrivesCallback
IfFileExists "$9Data\Verifyfile.xxx" 0 end
CopyFiles "$9Data\*.*" $INSTDIR
StrCpy $R0 Founded
StrCpy $0 StopGetDrives

end:
Push $0
FunctionEnd

Script used header

Thank you very much. I have a general idea of how the script is supposed to be done, but I really don't know how to SAY what I need to the computer. This is helping me get more familiar with how NSIS interacts with the computer.

Thanks again.