Running Windows XP Under VirtualBox

As I write, it’s only another month until Microsoft’s free upgrade offer on Windows 10 expires (on 29 July 2016). I am so looking forward to that day, in the hope that it’ll mean an end to Microsoft’s intrusive little pop-up messages in the lower right corner of my monitor, and their increasingly devious attempts to trick me into accidentally upgrading. The experience is a little like having a weeping software engineer repeatedly grip your lapels, shake you gently, and sob: “But it’s cool. It’s free. Why don’t you want it? For pity’s sake, why? Why?”

I don’t want it because it offers nothing I need or am even curious to see, while promising inconvenience and hassle during the upgrade process. When Microsoft are willing to pay me for the time I’ll spend on their “free” upgrade, then maybe we can talk.

But at present, I’m much cheered to be running Windows XP again, which marked the last occasion I ever felt a new Microsoft operating system actually constituted an “upgrade”. The fact that you can run a virtual XP machine in a window under Windows 7, 8 or 10 is not as well known as it should be, and it has let me continue using some old software from that era that has resisted running in “compatibility mode” under later operating systems.

Microsoft offered a Windows XP Mode for Windows 7, which could be installed and run under that operating system. The file is still available from the Microsoft Download Center (click on my link), and it contains a virtual hard drive with an XP installation—so to get XP running under Windows 8, 8.1 or 10, all you have to do is retrieve that VHD.

I downloaded WindowsXPMode_en-us.exe from my link above. Since I wanted to run XP under Windows 8.1, I didn’t run the exectuable—I tucked it away in my Downloads folder. Embedded inside two layers of compression is the virtual hard drive I needed.

I used 7-Zip to find and extract the necessary file. 7-Zip is a handy, open-source archive manipulation program, which adds a couple of options to the Windows menu you see when you right-click on a file. So I navigated to where I’d stored WindowsXPMode_en-us.exe, right clicked on the file, selected “7-Zip” and then “Open archive”. 7-Zip then gave me a view of the contents of the archive file, which includes a folder named sources. In that folder, there’s a file called xpm. This is also compressed, so I right-clicked it and opened it in 7-Zip. In the archive listing for xpm, there’s a file called VirtualXPVHD. That’s the virtual hard drive containing the XP installation. I right-clicked it, and then selected “Copy to …”, telling 7-Zip to extract and decompress VirtualXPHD. I put it in a new folder called XP.

7-Zip showing the xpm file in the sources folder (Click to enlarge)7-Zip showing the VirtualXPVHD file inside the xpm file (Click to enlarge)

So that Windows could recognize VirtualXPVHD as a virtual hard drive, I now edited the file-name by adding a .vhd extension to it.

For an environment in which to run my new VHD, I downloaded VirtualBox, and installed it with the default options. Then I ran the program, told it I wanted to set up a new virtual XP machine using an existing virtual hard disk, and pointed it to the location of my VirtualXPVHD.vhd file.

And that was that. Now you I could launch an XP machine in a window on my Windows 8.1 desktop.

New XP machine, ready to go (Click to enlarge)

VirtualBox does a lot of handy things. There are a couple worth knowing about if you’re setting up your own virtual machine:
1) You can scale the window in which the XP machine runs, using the menu option View/Scale Factor. This is useful if you find yourself peering at a tiny window in the middle of your high resolution monitor.
2) At first, you’re going to need to let the XP window “capture” your mouse pointer. When you click inside the window, a dialogue box appears offering to capture the pointer. When you accept, you find your mouse is trapped inside the XP window. You can release it again by tapping a “hot key”, which defaults to the right control key on your keyboard. It’s worth checking that you actually have a right control key before you fire up XP for the first time, otherwise your mouse will be permanently trapped. If you don’t have one, you can change to a new hot key in the VirtualBox menu, File/Preferences/Input/Virtual Machine/Host Key Combination. Select the “Shortcut” box and press whichever key you want to designate as the new hot key.

I found the virtual machine was a bit crashy when XP was going through its initial set-up on my laptop (but not on my desktop). A couple of times I had to press the hot key to free up my mouse, and send a “power off” signal to the virtual machine using the VirtualBox interface. On each occasion it rebooted happily and let me proceed further with the set-up.

XP running at low resolution and with its horrible “Early Learning Centre” theme (Click to enlarge)

The first priority once you have the XP desktop on display is to add some additional function. Free up your mouse pointer so that you can use the VirtualBox menu at the top of the window, click on “Devices”, and then “Insert Guest Additions CD Image …” This makes the XP virtual machine think you’ve inserted a software CD, and it opens a set-up dialogue to let you install the new software. Accept this (and choose “Install Anyway” each time XP objects to the certification of the software that’s being installed).

Running the Guest Additions CD image (Click to enlarge)

Now you don’t need to go through the business of capturing and releasing the mouse pointer! The XP window is integrated into your desktop and behaves like any other windowed software. (On occasion, you may find that the mouse pointer behaves a little oddly in some programs—flickering, or scanning too quickly. On those occasions, capturing the mouse is useful. You can turn mouse capture on and off using Input/Mouse Integration in the VirtualBox menu at the top of the window.) I also found that installing the Guest Additions CD eliminated the crashes I’d been having during setup.

One hitch in all this was that XP soon announced that it needed activation, and demanded a Product Key. Now, back in the day, computers used to come with a copy of their operating system on a disc, and I still had the old XP installation disc for a long-defunct computer tucked away in a cupboard. I offered the Product Key from that disc, and XP was happy. In fact, I now have three virtual XP machines all happily registered with the same Product Key. Which is not unreasonable, given that Microsoft haven’t actually been supporting this operating system for a couple of years now.

A couple of the programs I installed under XP are so old they’ll only run if the parent disc is in a drive for them to access. That’s not exactly convenient, so I copied the necessary discs to .iso image files using DVD to ISO , and put the .iso files into a directory on my virtual XP machine.

Then I installed the Virtual CD-ROM Control Panel from Microsoft, which lets XP mount .iso files as if they were physical discs. It’s slightly finicky to install, but the readme file talks you through the process. You need to move the .sys driver file to your Windows XP drivers directory, and then run VCdControlTool.exe to install the driver. Once the driver is installed, running VCdControlTool again lets you create an unused drive letter and then mount an .iso file to that drive. I set my .iso files up as “persistent mounts”, so they’re always available.

Mounting a couple of disc images using VCdControlTool (Click to enlarge)The two disc images mounted as drives D: and Z: (Click to enlarge)

Finally, although I’m no great fan of cloud storage (sure, I’ll let a multinational corporation store my personal documents and photographs at some random location on the internet; what could possibly go wrong with that idea?) I do like to share a few program and configuration files between my various devices. The small storage capacity offered by the free version of DropBox has been more than enough for this—and anyone who cares to hack into my DropBox account isn’t going to find much that’s comprehensible to them, let alone useful. But DropBox discontinued support for XP recently, so I needed a way to transfer files from my XP virtual machine to a directory on its parent machine, where DropBox could then take over.

VirtualBox lets you set up folders that are shared between the XP virtual machine and the parent machine (go through Devices/Shared Folders) but some of my XP software is so ancient it refused to recognize the network drive on which these shared folders resided. So I tried using the free version of Tonido. Tonido synchronizes files through their server without ever storing them—I installed the server software on the parent machine, and the client software on the virtual XP machine. Presto! My shared XP files were transferred to the parent machine, where they could be DropBoxed or backed up as required. This had the advantage of being easy to set up, but the rather bizarre and deeply unsatisfying consequence of a computer transferring files to itself over the internet. It also has to be said that the Tonido file synchronization was often slow, and on occasion delayed for hours.

I found a solution in Link Shell Extension. Windows, in its various incarnations, provides various ways of tying files and folders together, so that a file that resides in one location is also accessible in another location. Traditionally, these hard links, junctions and symbolic links could only be set up from the command line prompt, but Link Shell Extension, once installed, lets you set them up from the mouse pointer with a right-click. Right-click on the origin file or folder, and select “Pick Link Source”; navigate to where you want a linked copy, right-click again, and select “Drop As …” Job done. Link Shell Extension provides all sorts of different ways to produce linked copies of folders and files—it’s well worth reading the description on their website (linked above) before you starting playing with it.

I’d already been using Link Shell Extension with DropBox, linking the DropBox copies to the parent folders my programs worked from. But in this instance what I needed was a link between a network drive and a parent folder in XP—that needs a symbolic link, which was supposedly not available under XP. But Link Shell Extension works with an XP driver written by Masatoshi Kimura, which adds symbolic link functionality to XP. The Link Shell Extension page provides download links and instructions on how to install the extra driver. Unfortunately, it’s slightly technical, requiring a one-off instruction from the command prompt. The page also says you’ll need to edit your Windows registry to make the driver permanently available. Interestingly, I found this wasn’t required on my virtual machines—the registry value HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SymLink\Start had already been set to zero when I checked, and it stayed that way—the Symbolic Link option was available immediately, each time I booted up.

Anyway, once I’d got that straightened out, I used the Devices menu in VirtualBox to make the DropBox folder on the parent machine a shared folder, ticking the boxes to make it “auto-mount” and “permanent”. It then appeared as a network drive the next time I booted the virtual XP machine. Using Link Shell Extension in XP, I could pick folders inside the DropBox network drive, and drop copies of them as symbolic links on the XP c:\ drive, where my ancient programs could see them. When the programs modify those files, the modification is then reflected in the DropBox folder on the parent machine, and that cascades off to my other devices, and their virtual XP machines. Joy!

So now, every time Microsoft offers me a free upgrade, I can sit back and enjoy my free downgrade instead.