Tuesday, May 13, 2008

HowTo: Longhorn WinPE (Windows Preinstallation Environment)

I've seen a lot of new sources pop up recently, so hi there to all the new people reading the blog =)

I'll take a break from the usual and talk about WinPE, the graphical boot environment featured on Longhorn builds starting with M4. In its simplest form, a WinPE is a version of a build of Windows that boots to command-prompt directly from CD, supports networking and other GUI tools. In Longhorn, WinPE launches the setup application which allows you to install the build, but you can easily access the command-line should you want to (Shift-F10 during setup).

With a little creative thinking, one can extract the WinPE of a Longhorn build without much trouble and make a standalone boot CD.

Firstly you'll need a version of ximage compatible with your build unless you're working with M6 or below. For Longhorn M7 builds you will need ximage 4059.0, available with a little searching on the web.

For this example I'll use Longhorn 4029, an M5 build. 

Create a folder structure on your hard disk, 


Copy the "boot" folder from the 4029 CD into this folder. It should be about 150-200Mb in size.

Copy "win51", "win51ip" and "wimbom.ini" from the CD to C:\4029PE

Copy "setupldr.bin" from the C:\4029pe\boot folder and rename it to C:\4029pe\ntldr

You will then need to create a bootable CD of the C:\4029pe folder in the software of your choice. I use Microsoft's cdimage utility from ReflectiaX's longhorn boot fix pack, one can use mkisofs on Linux or Mac, or something like Nero. Specific instructions for this are beyond the scope of the article, but use the following file as your boot image (about 4Kb).


Once you're finished you should have a bootable CD or ISO about 150-200Mb in size. Try it in a virtual machine, it should boot to a command prompt. Simple really =)

With an M7 build, the WinPE part is contained within the "install.wim" file as the first entry. You must extract it using ximage, and then ISO it and make it bootable as described above. Sometimes there are catches, and some builds may require manual tweaking to get right (4085's NTDETECT.COM, an essential file, doesn't work quite right when made into a WinPE like this so it would need to be replaced with a working one, from 4084 for example).

There you have it, a quick'n'dirty guide to creating a bootable WinPE disc.