Old 2nd October 2014, 20:33   #1
gruntlord6
Junior Member
 
Join Date: Jul 2010
Posts: 14
Check for CD Volume

Hey everyone. I'm working on a project where I need to modify my existing installer to provide the option of copying some files from the original installation CD instead of downloading them. I did find the NSIS CDROM plugin but I'm not exactly sure what I should be doing with it to achieve my goal.

In essence, the plugin would:
1. Probe for the next cd/dvd drive
2. check for the CD volume label "PRODUCT1", if it is not found repeat step 1
3. Copy the "DATA" directory from the volume to the install directory

Obviously the last part is pretty simple, but I'm not sure what I should be doing to achieve parts 1 and 2. Any help is appreciated.
gruntlord6 is offline   Reply With Quote
Old 2nd October 2014, 20:47   #2
Yathosho
Forum King
 
Yathosho's Avatar
 
Join Date: Jan 2002
Location: AT-DE
Posts: 3,366
Have a look at the CD-ROM plug-in
Yathosho is offline   Reply With Quote
Old 2nd October 2014, 21:02   #3
gruntlord6
Junior Member
 
Join Date: Jul 2010
Posts: 14
Quote:
Originally Posted by Yathosho View Post
Have a look at the CD-ROM plug-in
Like I said in my post I'm aware of the plugin but the example didn't help clarify it's usage in my case. Do you perhaps have an example?
gruntlord6 is offline   Reply With Quote
Old 3rd October 2014, 10:32   #4
jpderuiter
Major Dude
 
Join Date: Feb 2007
Posts: 672
Have you checked the plugin example?
It's al there.
jpderuiter is offline   Reply With Quote
Old 3rd October 2014, 11:27   #5
JasonFriday13
Major Dude
 
JasonFriday13's Avatar
 
Join Date: May 2005
Location: New Zealand
Posts: 916
I've noticed that several of my older multi CD games don't require physical media to install, just dumping all the files into one directory is enough for it to install correctly (running it is a different story).

I know you have found my WimImage plugin (with multi-disc tweaks), and all I use to check for the next file is an IfFileExists call in a loop, and it displays a message box if not found. So, storing the files in an archive (zip, 7z, wim) and checking for a single file is quite a bit easier to implement.

Here's a couple of un-archiver plugins (I used to use zipdll, now I use my own plugin):

http://nsis.sourceforge.net/ZipDLL_plug-in

http://nsis.sourceforge.net/Nsis7z_plug-in

WimImage is also good, although it requires Windows 7 and up which is not great for Vista and earlier users.

"Only a MouseHelmet will save you from a MouseTrap" -Jason Ross (Me)
NSIS 3 POSIX Ninja
Wiki Profile
JasonFriday13 is offline   Reply With Quote
Old 3rd October 2014, 15:51   #6
aerDNA
Senior Member
 
aerDNA's Avatar
 
Join Date: Feb 2007
Location: Rijeka, Croatia
Posts: 225
This should do what OP wants:
code:

OutFile "CDCheck.exe"
!include "FileFunc.nsh"
!define CDLabel "PRODUCT1"

Function .onInit
StrCpy $R9 ""
${GetDrives} "CDROM" "CDCheck"
StrCmp $R9 "StopGetDrives" 0 +2
MessageBox MB_OK|MB_ICONINFORMATION "Volume ${CDLabel} is mounted as $R2" IDOK +2
MessageBox MB_OK|MB_ICONEXCLAMATION "Volume ${CDLabel} not found."
Abort
FunctionEnd

Function CDCheck
System::Call 'Kernel32::GetVolumeInformation(t r9, t.R1, i ${NSIS_MAX_STRLEN},,,,,) i.R0'
StrCmp $R0 0 CDCheck_Return
StrCmp $R1 ${CDLabel} 0 CDCheck_Return
StrCpy $R2 $9
StrCpy $R9 "StopGetDrives"
CDCheck_Return:
Push $R9
FunctionEnd

Section Blank
SectionEnd


PostEnd:
aerDNA is offline   Reply With Quote
Old 6th October 2014, 18:27   #7
Collector9999
Junior Member
 
Join Date: Mar 2009
Posts: 41
But not all CD have a volume label. Often you have to ID a disc by other means, such as searching for a specific file on the disc.
Collector9999 is offline   Reply With Quote
Old 7th October 2014, 10:24   #8
JasonFriday13
Major Dude
 
JasonFriday13's Avatar
 
Join Date: May 2005
Location: New Zealand
Posts: 916
That's the reason that older multi-disc installs work when dumped into a folder, because they only check for the required files, not volume labels.

"Only a MouseHelmet will save you from a MouseTrap" -Jason Ross (Me)
NSIS 3 POSIX Ninja
Wiki Profile
JasonFriday13 is offline   Reply With Quote
Old 7th October 2014, 20:25   #9
gruntlord6
Junior Member
 
Join Date: Jul 2010
Posts: 14
Quote:
Originally Posted by Collector9999 View Post
But not all CD have a volume label. Often you have to ID a disc by other means, such as searching for a specific file on the disc.
If it's the right disk it would always have that as the volume label.

Basically, you guys are saying I should just check if the files are in the proper structure on the disk?
gruntlord6 is offline   Reply With Quote
Old 8th October 2014, 10:23   #10
JasonFriday13
Major Dude
 
JasonFriday13's Avatar
 
Join Date: May 2005
Location: New Zealand
Posts: 916
Yes, because that way you can put the entire install in a folder for initial testing, and move to .iso and a virtual disc drive for actual testing. I haven't tested WimImage on a virtual drive yet, but it should work as the source path doesn't change.

"Only a MouseHelmet will save you from a MouseTrap" -Jason Ross (Me)
NSIS 3 POSIX Ninja
Wiki Profile
JasonFriday13 is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump