Why isn’t Windows Setup just a disk reimage plus a registry dump?

Date:June 29, 2005 / year-entry #168
Tags:other
Orig Link:https://blogs.msdn.microsoft.com/oldnewthing/20050629-11/?p=35163
Comments:    21
Summary:Why can't all the registry key needed by Windows Setup be precomputed and splorted at one go? One reason is that Windows Setup can be customized via a so-called "unattend file", which means that a lot of the work cannot be precalculated. Some settings also have cascade effects on other settings. Also, the model for...

Why can't all the registry key needed by Windows Setup be precomputed and splorted at one go? One reason is that Windows Setup can be customized via a so-called "unattend file", which means that a lot of the work cannot be precalculated. Some settings also have cascade effects on other settings.

Also, the model for component registration is to make each component responsible for its own registration, which can in turn be context-sensitive: "If the system has configuration x, then do y else z". Internet Explorer's component registration for example contains many conditional sections based on the installation configuration specified in the unattend file and the even fancier Winbom.ini file used by Sysprep-based deployment (which is used by computer manufacturers and large corporations).

Making each component responsible for its own registration reduces entanglements between components but also means that "global optimizations" such as precalculating the registry cannot be done. Engineering is about tradeoffs and this is one of them: Maintainability vs. speed.

(Of course, there are sections of the registry that are not context-sensitive, and those to some degree have already been gathered together for block copying onto the machine during Windows Setup. Look at the HIVExxx.INF files on your Windows XP CD.)

That said, it appears that Longhorn setup is moving towards the "disk image" model. I wish them luck.


Comments (21)
  1. FlorianW says:

    I would be very disappointed, if Longhorn setup would not based on Windows-Installer:-)

  2. The Windows Installer team has been trying to avoid the use of the DllSelfRegister as far I understand. From http://msdn.microsoft.com/library/en-us/msi/setup/selfreg_table.asp, "Installation package authors are strongly advised against using self registration."

  3. Longhorn setup CANNOT be based on the windows installer, frankly, OS setup is too complicated for the windows installer. As a simple example, how do you repartition a disk using the windows installer?

    And it’s my understanding that self registration is out for Longhorn.

  4. Andreas Haeber says:

    Ah, but that is easy to handle: Write a custom extension for MSI which starts diskpart.exe and let the user figure out the rest :P

  5. Matt says:

    Yes, but in order for Windows Installer to run, Windows must be running.

    Setup contains just the bare essentials of Windows; probably not a robust enough environment for Windows Installer. (Although it does present a rather amusing chicken and the egg problem.)

  6. memet says:

    Guys, I think he was joking about the windows installer. Hence the smiley face at the end.

  7. Travis Owens says:

    While I can’t find a url, I recall in early 2004 that somebody at MS saying they planned on using an image to install Longhorn and applying specific drivers & settings after the fact. I also remember them claiming Longhorn would install in "15mins or less" because of this fact.

    Although there hasn’t been any evidence of this fact yet, I sure hope MS sticks with their original idea/plan.

  8. BlackTigerX says:

    and why is the winsupersite.com written using ASP?

  9. AC says:

    Nice, now I’ve heard the first time for Winbom.ini, but there is actually a page in technet that mentions it:

    http://www.microsoft.com/technet/prodtechnol/winxppro/deploy/factorymode.mspx

  10. KJK::Hyperion says:

    Matt: Windows *can* boot fully-featured (well, enough-featured – no swap file) from a CD-ROM. There’s even an OEM tool based on it, called Windows Preinstallation Environment, but since in Windows XP and later it’s a native kernel feature (/minint kernel switch), anyone can make their own with just the original Windows files and a lot of patience (or more likely a tool such as BartPE – or even more likely by downloading one of the illegal pre-made images). Great as recovery disks too, I’m surprised the emergency repair console isn’t based on that

    Anyway. Windows Installer could well be used to build *the image*, since almost all (minus custom actions) of the setup process is under its full control, so it can "install" the files to a log of operations

  11. MGrier says:

    Raymond has asked me to post about this in the past and maybe I’ll do a series on LH OS installation technology after I’m done my series on the DLL loader.

    First thing to note is that when you purchase a system from a large OEM, you generally get a box where you plug it in, it shows you some "friendly" UI to get you going and then you’re done. The *VAST* majority of coppies of Windows are deployed using this technique.

    The technical challenges are issues around data that really has to be machine specific. e.g. the machine SID, local account SIDs (since they’re derived from the machine SID) and network connectoid GUIDs (these are just the standard examples we use for points of reference). There’s a tool in the OPK (OEM preinstall kit I believe) call sysprep which removes all the system specific data ("genericize") so that OEMs can make disk images (or even send the disk images off to disk manufactures who then deliver pallets of drives with the images already on them). When the system boots for the first time, sysprep "specialization" occurs which fixes up all the per-machine stuff, runs the happy UI and then you’re all set.

    I won’t go on further and instead will take this as a refcount on blogging more about all this stuff and what we’re doing here for Longhorn.

  12. Norman Diamond says:

    Sysprep-based deployment

    When the mouse cursor hovered over that link, I was anticipating a 404 error. But no, the link is correct. Of course, no one really needs a spelling checker in naming links.

    Wednesday, June 29, 2005 12:50 PM by Travis Owens

    > I also remember them claiming Longhorn would

    > install in "15mins or less" because of this

    > fact.

    Who needs that? I still have a copy that installs in 10 minutes.

    After some number of experiments I figured out that I want to turn off hard disk indexing. Longhorn’s estimate for how long it would take to apply the new attributes was a bit longer than 10 minutes. It posted a dialog box saying "44930 Days and 9 hours Remaining".

  13. Wes Miller says:

    KJK::Hyperion:

    "Great as recovery disks too, I’m surprised the emergency repair console isn’t based on that"

    Chicken and egg. The Recovery Console (AKA Command Console) isn’t based upon WinPE because, well, it predates it by an entire version of Windows. The CMDCONS was a new feature of Windows 2000. WinPE was totally new for Windows XP – and rewriting the Recovery Console was never in the cards for Whistler (Windows XP/Windows Server 2003).

    BTW, the /MiniNT flag means that it is in WinPE mode. WinPE was known as MiniNT during development. BartPE is simply a reverse engineered version of WinPE (with admittedly a more extensible builder.

    Also of note, MSIExec (the Windows Installer) has never been a component of WinPE. While it would conceptually have been possible to install Windows via an MSI, IMHO it would have made a very complicated task even more complicated, and still really not have met the needs of OEMs and customers.

  14. Ben Bryant says:

    Engineering is about tradeoffs and this is one of them: Maintainability vs. speed

    I would call it Configurability vs. speed, but anyway components registering themselves is the crux of the architectural mistake that Windows made. A service should not have an awareness or expectation of the world above it.

  15. Wes Miller says:

    KJK::Hyperion:

    Since ERD 2002, ERD has used WinPE as it’s infrastructure. Previous to that, the versions that supported booting from CD basically used the same boot code path that setup would have when you el-torito booted a Windows CD.

    FWIW, the MiniNT flag passed in at boot time is used pervasively through Windows… Lots of things were special cased to be able to run Win32 from CD

  16. Wes Miller says:

    I should also add there is no fake page file used for ERD (or WinPE. The only time a pagefile is ever created with WinPE is on a hard-disk boot with low memory… and no RAM-disk driver was used for pre-WinPE versions of ERD, nor is one used for WinPE (unless you manually create one for scratch space using a non-included driver, or boot to one, using the latest version of WinPE).

  17. KJK::Hyperion says:

    Wes: Russinovich has made live CDs out of Windows 2000 for years (see his ERD Commander product)

    The trick appeared to be using the setup CD boot loader to detect boot devices, pre-load their drivers and build a volatile SYSTEM hive, and probably (but I’m speculating, I didn’t check) a RAM disk driver to 1) make NtInitializeRegistry succeed despite no writable media (setup CD and repair console have no Win32 in them, so they only need the SYSTEM hive – but Win32 support is what makes WinPE *usable*) and 2) make the silly memory manager happy with a fake swap file

    It seems to me this is, on the long run, way less painful than rewriting an user environment from scratch (broken, at it)

  18. John says:

    I wonder how much faster the current setup process would run if NT had an option to agressively cache disk and registry I/O? Let’s say I don’t care about disk/registry integrity if the power goes out or the system bugchecks, since I’ll just restart the install from the beginning.

  19. Stefan Kanthak says:

    Wes:

    WinPE (or booting an NT based Windows completely from CD-ROM) was NOT totally new with XP.

    Embedded NT exists far longer, and I’ve setup CDs (called Server Start) for Siemens Primergy’s which boot into NT4 and start a GUI where you can prepare the installation. The oldest are about 7 years old!

    Stefan

  20. Norman Diamond says:

    Sunday, July 03, 2005 1:46 PM by John

    > Let’s say I don’t care about disk/registry

    > integrity if the power goes out or the

    > system bugchecks, since I’ll just restart

    > the install from the beginning.

    And your restarted install will bugcheck at the same place.

    And your restarted install will bugcheck at the same place.

    And your restarted install will bugcheck at the same place.

    Sometimes you DO want a reinstall to be able to detect which detection attempt to avoid repeating.

    Though you do have a point. In Linux installers that I’ve used during the past 3 years or so, if an automated install fails, then you can choose to restart a manual install and you can decide which risky detections to try and which to skip. (Of course manual installs pretty much always had this kind of capability with some degree or other of cumbersomeness, but automated installers sometimes optimistically forgot to say how to access the manual installer. This has improved.)

  21. Wes Miller says:

    True enough, NT 4 Embedded did indeed exist first. But an important aspect that differentiates WinPE (which itself was new for XP) from either NT Embedded or Windows XP Embedded when booted from CD is that the CD is exactly that, a CD. No write filter to cache writes and fib to the OS that writes happened. In the case of XP and NT Embedded, you must use a write filter when running from CD.

Comments are closed.


*DISCLAIMER: I DO NOT OWN THIS CONTENT. If you are the owner and would like it removed, please contact me. The content herein is an archived reproduction of entries from Raymond Chen's "Old New Thing" Blog (most recent link is here). It may have slight formatting modifications for consistency and to improve readability.

WHY DID I DUPLICATE THIS CONTENT HERE? Let me first say this site has never had anything to sell and has never shown ads of any kind. I have nothing monetarily to gain by duplicating content here. Because I had made my own local copy of this content throughout the years, for ease of using tools like grep, I decided to put it online after I discovered some of the original content previously and publicly available, had disappeared approximately early to mid 2019. At the same time, I present the content in an easily accessible theme-agnostic way.

The information provided by Raymond's blog is, for all practical purposes, more authoritative on Windows Development than Microsoft's own MSDN documentation and should be considered supplemental reading to that documentation. The wealth of missing details provided by this blog that Microsoft could not or did not document about Windows over the years is vital enough, many would agree an online "backup" of these details is a necessary endeavor. Specifics include:

<-- Back to Old New Thing Archive Index