by

“Unable to access CD Drive” on DOSBox

If you are seeing the error Unable to access CD Drive when trying to play a game on DOSBox, this guide may be able to help you. These caveats apply:

So with that out of the way, let's proceed. I will use Heroes of Might and Magic as an example.

Install the game with Wine

First, you will have to download the "offline" version of the game, as available on your library on GOG.com after purchase:

Download dialog on GOG.com

You should now have a file called something like setup_heroes_of_might_and_magic_1.2_(1.1)_(33754).exe. You can install it using Wine:

1$ wine setup_heroes_of_might_and_magic_1.2_\(1.1\)_\(33754\).exe

This will bring up a graphical wizard tool that should install the game. At the end there will be a "Launch" button, but unfortunately it will not work. That is not a problem and we will get to actually running the game in a moment:

Last step of the installer wizard

After the installer has run, you should be able to find the installed files in your Wine directory:

1$ find $HOME/.wine/ | grep -i heroes
2$HOME/.wine/drive_c/GOG Games/HoMM/HEROES.EXE
3$HOME/.wine/drive_c/GOG Games/HoMM/HEROES.CFG
4(...many files listed...)
5$HOME/.wine/drive_c/ProgramData/Microsoft/Windows/Start Menu/Programs/GOG.com/Heroes of Might and Magic/Documents/Manual.lnk
6$HOME/.wine/drive_c/ProgramData/Microsoft/Windows/Start Menu/Programs/GOG.com/Heroes of Might and Magic/Documents/Support.url

Situation after install

If you try running the game with Wine or DOSBox (providing the path to HEROES.EXE) it will not work either. Wine will tell you that the game is a DOS application, you need to install DOSBox, while DOSBox will tell you Unable to access CD Drive.

OK, so let's get that CD Drive going now. The installation includes an ISO image of the CD, so we need to tell DOSBox about it. The file has the .gog extension and it can be found among the installed files:

1$ ls -l $HOME/.wine/drive_c/GOG\ Games/HoMM/homm1.gog
2-rw-r--r-- 1 anjali anjali 457375744 Apr  1 22:25 "$HOME/.wine/drive_c/GOG Games/HoMM/homm1.gog"

(Note: in some cases, the file you need is not the one with the .gog extension. More detail below.)

This is the process:

  1. Open DOSBox on the game directory.
  2. Mount the ISO image as a CD-ROM drive.
  3. Run the game.

So let's do just that.

Actually running the game

First run DOSBox on the game directory:

1$ dosbox $HOME/.wine/drive_c/GOG\ Games/HoMM

By passing the game directory as argument, we get the C: drive mounted there. So in the example above, directory C:\ within DOSBox is the same as folder $HOME/.wine/drive_c/GOG\ Games/HoMM in my Linux machine. This will mean fewer keystrokes for us in the next steps, as well as the safety of the DOS software not being allowed access all of our hard drive.

Now we can use the tool imgmount within DOSBox to mount the ISO image as drive D:, like so:

1C:\>imgmount d homm1.gog -t iso
2MSCDEX installed.
3Drive D is mounted as $HOME/.wine/drive_c/GOG Games/HoMM/homm1.gog

If that worked correctly and you got similar output, you should now be able to run the game from within DOSBox:

1C:\>HEROES.EXE

And the game should now launch succesfully.

Splash screen for Heroes of Might and Magic

A variation: different directories and the .ins file

I was able to run Alone in the Dark with a couple of variations on this method.

An initial but minor detail is that this game is bundled with files split into two directories: INDARK and JACK, corresponding to the game proper and the bonus spin-off Jack in the Dark. However the ISO file is still in the root directory:

1$ ls -l
2total 355M
3drwxr-xr-x 2 bakithi bakithi 4.0K Apr  7 10:00  INDARK
4drwxr-xr-x 2 bakithi bakithi 4.0K Apr  7 10:00  JACK
5(...some other files and directories...)
6-rw-r--r-- 1 bakithi bakithi 338M Apr  7 10:00  GAME.GOG
7-rw-r--r-- 1 bakithi bakithi  793 Apr  7 10:00  GAME.INS

So when we run the game, we will need to cd into the INDARK directory and then actually run INDARK.EXE.

A more important detail is that mounting the ISO image GAME.GOG is not enough. Instead it is the file GAME.INS that has to be provided to imgmount. This file appears to be a sort of playlist that points to GAME.GOG while also providing info about audio tracks in the CD.

So with these two details in mind, the game can be run as follows. Start by running DOSBox on the game directory:

1$ dosbox $HOME/.wine/drive_c/GOG\ Games/Alone\ in\ the\ Dark

Then mount the ISO image, but via the GAME.INS file:

1C:\>imgmount d GAME.INS -t iso
2MSCDEX installed.
3Drive D is mounted as $HOME/.wine/drive_c/GOG Games/Alone in the Dark/GAME.INS

Finally, we go into the INDARK directory and run the game:

1C:\>cd INDARK
2C:\INDARK>INDARK

And that should land you on the mansion of horrors.

However note that the presence of a .ins file is not guarantee that this is the correct file to use. In the case of Heroes of Might and Magic 2: Gold, the file is present but I could not get the game to work correctly if I used the .ins file instead of the .gog file. Go figure.

Taking a shortcut

To avoid running three commands every time you want to play the game, you can use the argument -c to DOSBox, which allows you to run it with prepared commands ahead of the target program. In my example of Heroes of Might and Magic, it would be like this:

1$ dosbox "$HOME/.wine/drive_c/GOG Games/HoMM/HEROES.EXE" -c "imgmount d \"$HOME/.wine/drive_c/GOG Games/HoMM/homm1.gog\" -t iso"

And this is a variation for the case of Alone in the Dark:

1$ dosbox "$HOME/.wine/drive_c/GOG Games/Alone in the Dark/INDARK/INDARK.EXE" -c "imgmount d \"$HOME/.wine/drive_c/GOG Games/Alone in the Dark/GAME.INS\" -t iso"

Those lines are a mouthful, but you can use them to create shortcuts and run the games with short commands. Watch out for the spaces, escaping, etc!

Going further

The GOG install also provides configuration files for DOSBox, which look like this:

1$ ls -l *.conf
2-rw-r--r-- 1 calle calle   281 Apr  1 22:25 dosboxHOMM1_client.conf
3-rw-r--r-- 1 calle calle 10869 Apr  1 22:25 dosboxHOMM1.conf
4-rw-r--r-- 1 calle calle   273 Apr  1 22:25 dosboxHOMM1_server.conf
5-rw-r--r-- 1 calle calle  1010 Apr  1 22:25 dosboxHOMM1_single.conf

These include launchers for several situations, as well as tweaks for DOSBox such as default fullscreen mode, clock speed settings, etc. I have been experimenting with them a bit, and I have not been able to make them work as provided. My impression is that they have two problems:

But these files are not really necessary and I have not needed them to play the games. Still they may be interesting to you, so it is worth being aware of them.

References

I pieced this guide together after reading articles on the topic from FreezeNet, DOSGamers, the DOSBox Wiki, and a forum post that I cannot find now (!) but was particularly useful.

Perhaps there's an easier way to do all this and I missed it, as I'm not a hard-core gamer. If you find it, please hit me up with it on the socials!