Windows XP VirtualBox P2V


Ahhhhhhhhhhhhhhhhh!

me, while trying to debug this sh*t.

Sup, guys. Sigma here.

So, this is a small write-up of my adventure of trying to virtualize an ancient Windows XP installation in VirtualBox. If you are only interested in the technical part, just scroll down to “The Solution”.

The Setting

So, to give some context: In my village, I’m kinda the girl Friday of computer stuff. So when an acquaintance asked for help with their PC I naturally said I would take a look.

They had a pretty awful setup: A computer from 2001 running Windows XP and some sort of accounting software that boasts with “year-2000-safe” on the packaging. The hard drive was about to die, and there were no backups to speak of. I already kinda knew what I was getting myself into since I already swapped the hard drive once (back then I even had to ask a friend who’s into retro tech for a favor because I simply didn’t have any IDE/ATA hard disks). Yet, within hours I completely regretted taking on the task. Anyway: They finally realized that the old box wasn’t going to survive for much longer, so they bought a new PC. But for some odd reason, they still wanted to use that hoary accounting software (that, by the way, can’t really deal with dates after 2021).

There was already some groundwork done: They installed the software from the original CD and transferred the core data, but they couldn’t figure out how to transfer the transaction data. After taking a quick look it was apparent that the version of the software on the old machine was much newer. Presumably, there was some online update at some point. Anyhow: The old version could not deal with the backup format of the new(er) one. Exporting and reimporting the data didn’t work either, because for some stupid licensing reason the import was not allowed. There was an additional piece of software I found by accident that was perfect for dealing with the historic transaction data that we failed to transfer. But because of the way the client used the accounting software, that didn’t work either.

As a makeshift solution, I also tried to copy the application files of the new(er) version over, but after spending an hour manually copying DLL files, and altering registry entries (foreshadowing), I finally gave up.

My next idea was the title of this post: How hard could it be to virtualize the old box onto the new one? Turned out: Very.

The Problem

As a side note: I use Arch (btw). So the way I went about this problem is probably heavily influenced by that.

First, I created a disk image from the hard drive (Retrospectively, this should have been the very first thing to do, just in case the hard drive failed during my experiments.). Already this was somewhat of an adventure since I didn’t want to move the PC and I didn’t own any IDE/ATA to USB adapters I could have used with my notebook. I tried to boot a Linux live environment from USB, but that failed (not sure why though; the BIOS can handle USB as boot devices – it even listed the thumb drive as bootable – and the specific Linux image I used should have worked with legacy boot). Luckily I had an IDE/ATA to SATA adapter that I used in conjunction with the new box.

IDE/ATA jumper settings suck! You can quote me on that. It took me far longer than I’m willing to admit to figure out that my adapter can only deal with hard drives in master mode. There is no error either, the BIOS of the new PC just froze during POST.

Finally in a familiar Linux environment, I used ddrescue to create an image (dd didn’t work – there were already IO errors). While the imaging process was going I thought about which hypervisor to use. I’m most familiar with Oracle VirtualBox and I knew that it works fine on Windows, so I decided on that.

Note: For the following problems, I will first introduce the problem and explain my approaches. The solution that worked will be discussed in “The Solution”. I’m doing this just for narrative’s sake. ^^

Problem 1: How can I convert the raw disk image to a virtual disk file that VirtualBox can use?

My first approach was to use VBoxManage internalcommands createrawvmdk to create a “virtual” virtual disk that’s just a reference to the image file. This is actually meant for physical drives in VirtualBox. I suspect that could have worked in Linux (since everything is a file) but I couldn’t get it to work on Windows.

Problem 2: How do I get Windows XP to boot?

Windows sucks balls when it comes to hardware compatibility of existing installations. It not only disables unused drivers but also remembers exactly what kind of hardware it was installed on.

I just got a blinking cursor. I could access the boot menu and select Safe Mode but it still wouldn’t boot. But even after fixing this, there was still another problem.

Blue Screen of Death “STOP 0x0000007b”. In English, that means: “Waah, I can’t access the drive I’m booting from. Yes, I’m aware that’s a contradiction in term.”.

There is a very extensive article on how to fix this error on a Microsoft website. Spoiler: It involves a lot of registry stuff. I prepared the image at home so I didn’t have a Windows setup I could use to edit the registry hive on. Luckily there is a program suite by Petter N Hagen used to change Windows NT user credentials from within Linux. It’s called chntpw and includes a utility called reged for editing registry hives. I mounted the raw image with losetup, edited the registry, converted the image to a virtual disk, tried to boot it, aaaaand: It was still bluescreening.

The official VirtualBox guide suggests a tool called MergeIDE by the German computer magazine c’t that seemed promising. I tracked down the most recent version and analyzed what it was doing: It basically restored some drivers and made similar modifications to the registry that the Microsoft guide was suggesting. The tool had the form of a batch file that I couldn’t execute without a Windows install. However, the registry modifications were just reg files that I could use with reged. Or so I thought. The program didn’t seem to be able to deal with comments (maybe because they included German umlaut characters – I don’t know) and even after I stripped out all of them it complained about non-existing keys. After some trial-and-error, I figured out that the Windows Registry is case-insensitive, but reged is not. I rebuild the disk image and it still didn’t boot.

By now I was sick and tired of always rebuilding the image because at about 100 GiB it took half an hour every time. I found a way of directly mounting virtual box disk images to the host system. So I did the modifications again using this method only to find out that my changes were lost after unmounting the partition. This was the exact moment when I contemplated switching my profession to gardener.

The VirtualBox guide mentioned a repair mode in the Windows XP install disk partition menu. I asked around for an ISO and by chance, a friend had one. In the partition menu, I didn’t find the repair option. I did however somehow manage to nuke the system partition.

Half an hour and a new disk image later, I noticed a “repair” option in the Windows XP install dialog. That turned out to be the “Recovery Console”, which is basically a version of DOS loaded with some recovery tools. I figured it’s worth a shot, so created a virtual ISO containing only the MergeIDE script. I tried to execute it but the Windows XP Recovery Console is so basic, it does not even provide a way of editing the registry.

Problem 3: How do I relicense Windows XP in 2022?

After finally managing to boot into Windows, it turned out that because basically all of the hardware changed, the operating system thought it was no longer licensed correctly. The solution would be to reactivate the license via the Internet or telephone.

Turns out: The Windows XP activation server is no longer online: There was no way of reactivating the license. I even tried a different – totally legit – product key I found on the internet but that didn’t work either. (It might have been worth a try to call the service center since I did have a valid license – even though an OEM one – but I figured: Since XP is no longer supported at all (even under the extended support period) it’s very unlikely. Also, I’m a nerd and don’t like interacting with people. :P)

The Solution

So how did I solve all those problems?

(Just to reiterate for those who skipped the last two chapters: I created a raw disk image using ddrescue /dev/sda raw.img; using dd if=/dev/sda of=raw.img bs=1M status=progress should work too)

Problem 1: How can I convert the raw disk image to a virtual disk file that VirtualBox can use?

The VirtualBox command-line tool has a function to convert raw, low-level disk images into the VDI format: VBoxManage convertfromraw input.img output.vdi
This surprisingly also works on Windows.

Problem 2: How do I get Windows XP to boot?

The blinking cursor issue can be resolved, by enabling the I/O APIC flag in the System settings in VirtualBox.

Regarding the BSOD: What worked for me, was using the much more powerful Recovery Console from a Windows 7 install ISO to execute the MergeIDE tool from a virtual ISO (in VirtualBox open the “Optical Disk Selector”, click “Create”, select the directory, then click “Add selected file objects to VISO”, then click “OK”).

Problem 3: How do I relicense Windows XP in 2022?

I found a German guide on how to disable the license check in Windows XP:

  1. Open the Windows Registry (Win+R or Start->Run; regedit)
  2. Go to hive “HKEY_LOCAL_MACHINE”
  3. Go to key “\Software\Microsoft\Windows\Windows NT\Current Version\WPAEvents”
  4. Change value “OOBETimer” to “FF D5 71 D6 8B 6A 8D 6F D5 33 93 FD”
  5. Right-click on key “WPAEvents” -> “Permissions”
  6. Select user “SYSTEM” and check “Deny” for “Full Control”
  7. Reboot the system into Safe Mode (press F8 during startup)
  8. Execute each of these commands in the Run dialog (Win+R or Start->Run)
    • rundll32.exe syssetup,SetupOobeBnk
    • regsvr32 regwizc.dll
    • regsvr32 licdll.dll
  9. Reboot into normal mode

It seems to work: The Windows activation dialog did not show up after that.

Conclusion

This whole odyssey in total cost me three days and pretty much all of my nerves, but in the end, the client was happy. As for me: I think I need a lot of alcohol to forget all the useless details I now know about the intricacies of the Windows Registry. ^^

I hope this post was at least somewhat entertaining and maybe a bit useful for some.

Have a nice day. o/

Edit [2023-04-30]

I’m a bit late with this update – sorry. Turned out, the Windows activation dialog hack only works for 3 months…

So I setup a new Windows XP VM, mounted the other virtual disk, copied over all the files and registry entries that I thought where necessary. Then I just tried to launch the program, while looking at error messages and the Sysinternals Process Explorer (great tool) to determine, which other libraries and registry entries the program tried to read. After copying the missing files and entries, I tried again. Rinse, repeat until the program started and all common functionality was working again.

A few the days later some more problems with the printing dialog appeared but I was able to resolve them.

Haven’t heard from them since, so I assume everything is still working. Glad this nightmare is over.

,

Leave a Reply

Your email address will not be published. Required fields are marked *