Question

I'm just a hobbyist programmer more or less and have grown up coding-wise in the .NET ClickOnce world.

When one "installs" a program, what actually happens?!

Also: Some little apps/tools just run from the exe. Why do most programs need a fancy installation process? What are the advantages, disadvantages, pros & cons? Is installation usually necessary or more like standard practice?

Apologies for the extra questions. I'm just hoping for a plain-English more-or-less layman's explanation of the key factors.

Was it helpful?

Solution

You're really looking at a lot of legacy reasons all rolled into what has become standard practice in the Windows world.

First, some contrast, because it isn't always this way. An "application" in Mac OS X is simply a directory with a certain structure inside it, named with a .app extension. Installing an application is as simple as dragging it (just the app icon) to your Applications folder, and uninstalling involves dragging it to the trash. That's it, no fancy installer is (usually) necessary.

On Windows, application are typically built from independent components which need to be "registered". This involves the installer program writing some bits and pieces to the Windows registry, to tell Windows where to find the components. Yes, the application probably should know where to find them (since they're all installed in the same place), but years of legacy and different ways of hooking up components has got us where we are today.

Typically, an installation program on Windows:

  • copies files
  • registers components
  • sets security permissions (if appropriate)
  • adds icons to the Start menu and/or desktop
  • writes more stuff to the registry to tell Windows to add the program to "Add and Remove Programs"

OTHER TIPS

The program tries to modify the computer in such a way that it works and all competing products fail. On Windows, this means:

  • Modifying arbitrary keys in the registry until it becomes slow and full of broken entries
  • Replacing DLLs with the single ancient version that your software can use
  • Spreading as many files in as many places as possible
  • Creating an uninstall script to maintain the illusion that the user can get rid of the software without a reinstall of the OS. In the unlikely case that the user tries to run this script, you can educate him/her not to ever do this again with questions like "The file .... might be used by other applications. Do you really want to delete it? Yes/No/Maybe/Any answer/All answers are correct"
  • Installing hooks in obscure places so your software runs when the computer boots. That may slow down the boot process but your software will start in an instant, so it's a small price to pay ... for you.
  • Doing obscure things which take a long time but no one can tell what you do (what does "Setup is preparing the install" do for 15 minutes?)
  • Checking whether there is enough disk space but use 32bit integers to make sure that it can't be installed on 1TB disks.
  • An important task is to fail with the installation and print the error: "Installation failed. This might be because there is an antivirus software installed. Please deactivate it and try again." This will make sure that users will start to distrust their anti-virus (especially when the install succeeds during the second run since the obscure bugs in the installer weren't triggered) and a lot of them will forget to enable the virus scanner again or even uninstall the damn thing.

    Virus authors all over the world are people, too! Spam makes up for most of the traffic on the Internet which must mean that it's important and who wouldn't want to be part of the biggest community on earth? On top of that, you can make big money this way. All you need it a weak conscience and/or some criminal energy.

  • A very important part of your installer is to increase the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-7-9-23-64738-1349283462-3754093625-4491\IsYourWindowWideEnough\NotGivenUpYetHuh\GoAway\ImportantSystemInformation\Let See How You Can Handle Spaces\DamnIGottaStopSincePathsCanHaveOnl\ReinstalCtr

    This important system counter will help to create the illusion of instability for the user until they feel a strong urge to reinstall the whole system. This will help the professional IT industry to sell support hours, sell new computers, more RAM, bigger hard disks, or new Windows versions (they must be better, right?).

Note: If you take this text seriously, seek professional help.

The reasons for using a "fancy" install process

  1. to record the installation process so it can be replayed (repair) or undone (uninstall)
  2. to perform actions beyons simple file copy (create registry keys, register components, perform other arbitrary actions

The "standard" option on most installs will be "all the bits usually wanted, in a standard location, like Program Files" install with no customisation, possibly without some expert-level features enabled.

Wikipedia tells us that a typical installer creates or modifies the following:

  • Shared and non-shared program files
  • Folders/directories
  • Windows registry entries (Windows only)
  • Configuration file entries
  • Environment variables
  • Links or shortcuts

So if your program needs one or more of these modifications, you should create an installer which does that job.

Depends on the program you are installing. An "Installation" can range from simply copying the (relatively small) executable to a directory, to setting up shared libraries, doing patchlevel checks (I am designed to run on SP2 or higher - do I have SP2 or higher?) and changing the systems configuration, either for the current user or for all users. Most of them also register the Installation with a package manager so that you can easily uninstall at a later point.

An installer abstracts the process of deploying complex pieces of software infrastructure, which is usually contained within an archive, through a convenient, self-sufficient user interface.

This UI can be graphical or based on text which is output on a command-line such as the unix shell (e.g. bash). In case of graphical installers, most often a so called installation-bootstrapper is used, in the latter case, installation scripts which can be bash-scripts, Microsoft batch scripts, or other any scripting language which runs on a command line.

In the simplest case an application is simply an executable file, with the operating system knowing what to do with the file in order to run it. The application file may reside in a folder with subfolders and other auxiliary files, packed into one archive. In this case no installer may be needed.

For complex software, entire software platforms and tight integration with the underlying operating system infrastructure may be desirable, for instance to enforce the copyright of a software product.

Many installers on Windows provide an /e or /extract flag. e.g. setup.exe /e to allow extraction of the archive's contents without the installer running its installation script. I recently needed to do just that.

Shifts in Mindset

Installers have almost become a norm for delivering professional software, no matter how simple the underlying software assets. With an increasing number of computer savvy users and the desire to migrate ones applications from one desktop to the next, portable software, often delivered in a simple archive, is becoming increasingly popular.

( I don't know how much time in total I have spent on installers, but it is definitely on the order of days. )

Tasks the installer may handle are:

  • unpacking (often using exotic, high compression archivers)
  • ensuring system hardware requirements
  • ensuring sufficient hard-disk space
  • ensuring software platform runtime requirements (e.g. 'redistributables')
  • checking for newer software updates
  • downloading the software from a remote repository
  • creating and/or updating program files and folders
  • create configuration files, registry entries or environment variables
  • install sofware drivers, mount or unmount devices
  • increase accessibility for everyday users, by explaining installation steps, creating links, shortcuts
  • promote the own sofware through bookmarks, etc...
  • create incentive for the user to actually startup the software, by presenting the keypoints of the software during the installation, slide by slide
  • create additional revenue, through software-bundling
  • configure kernel-modules and automatically running components (e.g. daemons, windows-services)
  • automatic patching of the sofware
  • setting folder, file and user permissions
  • creating UUIDs references to couple the software to an installation-instance and prevent portability

PS: If you can think of other points, let me know and I will incorporate them.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top