Native VHD Boot on unsupported versions of Windows 7
In Windows 7, Native VHD boot is currently supported only on Ultimate and Enterprise versions and is disabled by a license policy on other versions of Windows. This article/tutorial shows how Native VHD Boot can be enabled on unsupported versions of Windows 7 as well.
Please note that this article is only for educational purposes and I wrote it as it appealed to my intellectual curiosity. Circumventing license policies on Windows operating systems is a violation of Microsoft’s Software License Terms. I do not take any responsibility, and I am not liable for any damage caused through this tutorial.
Before we begin, I will try to briefly explain a few jargon. Those of you who are familiar with these can skip directly to the tutorial. Please note that this tutorial is meant for advanced users. If you don’t know how to edit the registry or mount an iso, then this article is not for you.
What is a VHD?
Quoted from msdn.microsoft.com/en-us/library/windows/desktop/dd323654(v=vs.85).aspx
The Virtual Hard Disk (VHD) format is a publicly-available image format specification that allows encapsulation of the hard disk into an individual file for use by the operating system as a virtual disk in all the same ways physical hard disks are used. These virtual disks are capable of hosting native file systems (NTFS, FAT, exFAT, and UDFS) while supporting standard disk and file operations.
What is Native VHD Boot
Native boot enables virtual hard disks (VHDs) to run on a computer without a virtual machine or hypervisor. Booting Windows natively from VHDs is very interesting and useful as they can boot from real PC hardware, allow to install any applications, drivers and updates, and deliver almost the same performance as an operating system directly installed on a hard drive. It allows us to test changes to operating systems on real PC hardware without having to worry about partitioning the hard disk.
User sambul61 @Reboot.Pro has written some good tutorials on VHD Booting. You can refer to this tutorials for more details on VHD booting.
Investigating the Native VHD Boot process
This article is an extension of Install and Boot Unsupported for Native Boot OS from VHD where sambul61 describes a procedure involving third party drivers like Firadisk or Winvblock to support VHD Boot from fixed-size VHDs. As per that tutorial
Presently native boot from VHD is supported by MS only in Windows 7 Enterprise, Ultimate, Windows Server 2008 R2, and Windows 7 Embedded Standard. Any other Win7 version by default has deactivated VHD drivers, while older OSs don’t have any, and would require a 3-rd party virtual disk driver installed on it, and boot via a 3-rd party bootloader like Grub4DOS or Vboot to run from VHD
This triggered my curiosity, and I tried to find out what exactly prevents native VHD boot on other Windows 7 versions. Third party drivers like Firadisk or Winvblock do not support dynamic VHDs; they only support fixed-size VHDs.
You can read more about Firadisk in Install and Boot all versions of Windows from VHD using Firadisk
I used WinNTSetup to create a VHD and install Windows 7 x64 Professional, which does not support native VHD boot. ( I have earlier written about WinNTSetup in Windows to Go in all versions of Windows 7/8 )
The installation and the Sysprep phase completes successfully. However, when I tried to log in, I got an error message
I used grepWin to search for that error and the I found it in C:\Windows\System32\en-US\winlogon.exe.mui.
Mui files are language-specific resource files. So that actual code invoking the Error Message is in winlogon.exe. I used IDA 5.0 Freeware to disassemble winlogon.exe. Since the freeware version supported only 32-bit executables, I extracted the 32 bit winlogon.exe from the Windows 7 SP1 32 bit ISO and used it with IDA.
In the List of Functions, I found an interesting function ValidateNativeVHDBoot.
Looking at this function, it calls SLGetWindowsInFormationDWORD and passes in “Kernel-NativeVHDBoot”
After a bit of Googling, SLGetWindowsInFormationDWORD looks in the Registry Key – HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ProductOptions to get license information.
There is a detailed explanation of this in Having fun with Windows Licensing by Remko Weijnen. Using the tool written by Remko, it was evident that Kernel-NativeVHDBoot is set to 1 in Windows 7 Ultimate/Enterprise and is 0 in other versions of Windows 7.
This was discussed by Wonko and erwan.l @reboot.Pro http://reboot.pro/topic/15407-booting-from-vhd-in-grub4dos/page-4#entry193599 . erwan.l created an excellent Utility called ProductPolicy Viewer which can be used to edit the policies of an offline Windows.
In short I was able to set Kernel-NativeVHDBoot to 1 in Windows 7 Professional and successfully native boot it from a dynamic VHD without having to use any third-party drivers.
Advantages and Disadvantages
- No need for third party drivers and bootloaders
- Uses Microsoft’s native VHD Driver which supports both fixed size and dynamic size VHDs
- Works with fragmented VHDs
- Circumvents Microsoft’s licensing policy and causes problems with Windows Activation
If you are concerned about the licensing policy and activation problems, you can use Firadisk – Install and Boot all versions of Windows from VHD using Firadisk
Installing and Enabling Native VHD Boot in Windows 7 Professional/HomePremium
The below steps were tested on Windows 7 Ultimate 64 bit.
- Insert your Windows installation DVD or mount Windows Installation ISO using ImDisk.
- Download and extract WinNTSetup. Run WinNTSetup_x64 or WinNTSetup_x86 as Administrator depending on your operating system. I ran WinNTSetup_x64 as I am using a 64-bit operating system. WinNTSetup might require some additional files. So when prompted, say ‘Yes’ so that it can download the necessary files.
- Create a VHD by clicking on the VHD button. The VHD drive will be mounted as Z:
- Select the location of Windows Installation files – choose the sources folder in your Windows Installation DVD or mounted ISO. Select the location of Boot Drive – Your Main Hardisk. Select location of the Installation drive – Your VHD Drive.
- If you try Clicking on Setup, you get an Error Message
- Right click on the VHD and disable the VHD checks.
- Click on Setup and click on OK to start the installation to the VHD.
- Once the process completes, reboot the computer and boot from the VHD. WinNTSetup should have created an entry for VHD in the Boot Manager. Allow the setup to complete. After you create your Username, password, select Timezone, etc, and when you try logging in, you will the get “License error: Booting from a VHD is not supported on this system”.
- Reboot into your main operating system and Mount the VHD using Windows Disk Management – Start – Run – diskmgmt.msc – Action – Attach VHD. You should see a new drive, maybe Z containing the files the VHD. I will be referring to this drive as VHD Drive
- We now use ProductPolicy Viewer (built by erwan.l @ reboot.pro ) to change the Kernel-NativeVHDBoot policy to 1. Run the tool as Admin, Select Offline ( as we are editing the offline Windows in the VHD ) – GO – select the system file from VHD Drive:Windows\System32\config . Right click on Kernel-NativeVHDBoot – Edit and change to 1. The tool does not the modify the actual System file. Instead it creates a system.bak file. So go to VHD Drive:Windows\System32\config , rename system to system.old and rename system.bak to system
- Optional – We now need to disable Windows Software Protection, else the policy changes made above will be reset once we boot from the VHD. Start Regedit – HKEY_LOCAL_MACHINE – File – Load Hive and the system file from VHD Drive:Windows\System32\config. Navigate to ControlSet001\Services\sppsvc and Start to 4 ( disabled )
- Reboot into the VHD and you should now be able to login.
- This step needs to be done only if you have skipped Step 11. Windows Software Protection will revert the license policy changes. Disable that by running the below two commands in command promptsc stop sppsvcsc config sppsvc start= disabled
Alternatively you can open services.msc and Disable the Software Protection service
- Reboot into the VHD. If you get the get “License error: Booting from a VHD is not supported on this system”, then that means the Software Protection service had reverted the Policy changes before you stopped the service. So you will have to repeat step 9 and 10 to reenable the Kernel-NativeVHDBoot policy.
You now have a Windows 7 Professional or HomePremium booting natively from a VHD!!
My next article describes how to Install and Boot all versions of Windows from VHD using Firadisk