Monday, 1 October 2007

Mounting ISO files from the command-line

With some recent birthdays, we've acquired some computer games for the kids to play.

The titles include:

  • Arthur's Wilderness Rescue
  • Arthur's Sand Castle Content
  • Arthur's Pet Chase
  • Discovering Dinosaurs
  • Phonics 1 for beginners

Even though these games are quite engaging and the kids really seem to like them, it's amazing at how clumsy some of these applications are to get installed in a 'safe' way.

I install them myself, and then set up shortcuts so that the kids can log in using their username. I am an admin on our home pc, but the other accounts are just regular users.

The games expect to run as Administrator (eg. the "Arthur" titles try and write the saved games back to the Program File installed directory (instead of in the user's profile). As a consequence, I had to fire up cacls.exe to grant Everyone permission to write to this folder.

They also seem to assume you have a VGA monitor - when they try and change the resolution it doesn't always look that good on a LCD display.

They also often require the CD to be in the CD-ROM drive. I find this particularly annoying. The installation should allow me to install everything from the drive onto the hard disk so you don't need to be swapping CD's.

I'm trying to work around this by generating an ISO image of the CD using ISO Recorder, and then mounting and unmounting the image when you want to run the game.

I found FileDisk - a Windows driver and command-line tool to mount and unmount ISO files. I then created a small batch file that I thought should do the job:

@echo off

REM mount cd
"C:\bin\filedisk.exe" /mount 1 "c:\Install\ISO\ArthurWildernessRescue.iso" /cd e:

cd "C:\Program Files\The Learning Company\Arthur's Wilderness Rescue\Launcher"

REM run
"C:\Program Files\The Learning Company\Arthur's Wilderness Rescue\Launcher\TLCLauncher.exe"

REM unmount
"C:\bin\filedisk.exe" /umount e:

I then tried this out with one of the non-admin logins, but sadly it fails with an "access denied" error. It appears that filedisk is using one of the Win32 API calls assuming the current user is an Administrator too.

Filedisk does include source code, so it might be possible to fix this, but I'm guessing it might take a bit of time to figure it out.

Taking "Arthur's Wilderness Rescue" as an example, I looked closer at what files it had left on the CD, and it didn't appear to be many at all!

I located a file "salstartup.xml" and noticed that it was pointing to a file on the CD, so I copied this file onto the hard disk and updated the XML file and it appears that it all works now without the CD being in the drive.

3 comments:

NanooGeek said...

Thanks for the tips on Arthur (TLC, now RiverDeep) software.

I've got a bit more than 1/3 century experience working with computers. Getting children's software running can still be an <expletives deleted> adventure.

A few things I have found (given my sparse log entries for some, the permissions might be more than absolutely necessary)... In the following, change the {braced} items to the particular computer and user.

Blue's (such as Art Time):
cacls windows\hegames.ini /E /g {computer}\{user}:F /p Builtin\Users:F

Dinosaurs and Prehistoric Life, a Softbook/Toolbook from ZigZag, ca 1995:
CACLS Dinosaur.tbk /e /g builtin\users:c

Nancy Drew, Curse of Blackmoor Manor:
CACLS game.ini /e /p BUILTIN\Users:C
CACLS display.drv /e /p BUILTIN\Users:C
CACLS *.SAV /e /p BUILTIN\Users:C
CACLS "HICONTINUECHEAT.SAV" /e /p BUILTIN\Users:C


Other children's software has dependencies on particular drivers. I never did get Saddle Club, Time to Ride, to run satisfactorily...

Grant said...

Haha. You know there's something wrong when it takes a computer expert to get a children's game running correctly!

PS: Thanks for the FileDisk tip. I've been looking for a way to mount ISO's programmatically.

JT said...

I realize this is an old thread, but the reason you are getting the access denied error is due to UAC opening CMD in the standard mode
even when using the Administrator profile and not admin mode with elevated permissions. You need to open CMD in elevated mode.
You can accomplish this by adding this script to the beginning of your batch file. It works.

Quote:
Source: http://stackoverflow.com/questions/7044985/how-can-i-auto-elevate-my-batch-file-so-that-it-requests-from-uac-admin-rights

:::::::::::::::::::::::::::::::::::::::::
:: Automatically check & get admin rights
:::::::::::::::::::::::::::::::::::::::::
@echo off
CLS
ECHO.
ECHO =============================
ECHO Running Admin shell
ECHO =============================

:checkPrivileges
NET FILE 1>NUL 2>NUL
if '%errorlevel%' == '0' ( goto gotPrivileges ) else ( goto getPrivileges )

:getPrivileges
if '%1'=='ELEV' (shift & goto gotPrivileges)
ECHO.
ECHO **************************************
ECHO Invoking UAC for Privilege Escalation
ECHO **************************************

setlocal DisableDelayedExpansion
set "batchPath=%~0"
setlocal EnableDelayedExpansion
ECHO Set UAC = CreateObject^("Shell.Application"^) > "%temp%\OEgetPrivileges.vbs"
ECHO UAC.ShellExecute "!batchPath!", "ELEV", "", "runas", 1 >> "%temp%\OEgetPrivileges.vbs"
"%temp%\OEgetPrivileges.vbs"
exit /B

:gotPrivileges
::::::::::::::::::::::::::::
:START
::::::::::::::::::::::::::::
setlocal & pushd .

REM Run shell as admin (example) - put here code as you like
cmd /k