tags:

views:

91

answers:

5

Hi!

I'm just a hobbyist programmer more or less and have grown up coding-wise in the .NET ClickOnce world. As much as I hesitate to do so, I'd really like to ask what I guess is a pretty basic question:

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.

Thx in advance!

+1  A: 

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.

Martin Hohenberg
Also some programs include registry changes or other changes. IronRuby's installer sets up the files, NGEN's the files on the machine and sets up the %PATH% to include IronRuby's executable for command line use.
James Deville
I think I covered that one with "changing the systems configuration" - tried to make it as system-agnostic as possible.
Martin Hohenberg
Thx Martin, it helps fill in the picture. BTW your sig image reminds me of a car sticker I saw at uni a few years ago: "I'm a mountain man and I love mountain women." A bit off topic, but anyway...
Gregg Cleland
Gregg ... the "berg" part of my surname means "mountain" in German ... and I happen to have studied Japanese, so this was kind of a no-brainer for me
Martin Hohenberg
+1  A: 

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.

Moayad Mardini
Hi Moayad, Thanks for taking the time. I still don't really see that all of these things require an installer but I guess some things do.
Gregg Cleland
+2  A: 

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.

Steve Gilham
+6  A: 

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"
Greg Hewgill
Would upvote but ran out for today :(
RCIX
Thx for the reply Greg. Now, could any of that NOT be done on the first run of an app? Just curious as to whether this is necessary or just 'done'
Gregg Cleland
Much of that can indeed be done on the first run of the application. However, one of the primary reasons for the existence of an installer in the first place is to provide an *uninstaller*. Often Windows applications need to write things in so many places around the filesystem and registry that the only good way to clean it all up is to have a program do it for you.
Greg Hewgill
Oh, the other thing that might need to be done at install time is anything that requires administrator privileges to do. If there are any such required actions, the installer will request that it be run with appropriate administrator privileges. Without this, the first run of the app might be run as a regular user account and it wouldn't have permission to do those things.
Greg Hewgill
Great! Thanks very much for taking the time to explain it all; much appreciated.
Gregg Cleland
+2  A: 

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.

Aaron Digulla
That's great! :) +1
Moayad Mardini
lolololol... Would upvote but ran out :(
RCIX
A nice read, thx.
Gregg Cleland