Creating an

Installation Program for Windows Vista and Windows 7



Windows Vista and Windows 7 - a new generation of OS from Microsoft
 
Windows 7Windows VistaWindows Vista, that was released in 2006, was a major upgrade of the Windows operating system. Microsoft made big efforts to create the Windows Vista operating system and when it was released there were lot of changes, both beneath the surface and in the visual graphical user interface (GUI). These changes affected installation tools (like Visual Installer) which had to take into account the new technical situation that arose. One big change was the increased security considerations, that affected application programs and installation programs in a very high degree.
 
In the year 2009 Microsoft released Windows 7. This version of Windows was a further development of Windows Vista. Beneath the surface very much is the same so an application program or installation program adapted for Windows Vista will very likely work well in Windows 7. The version number of Windows 7 is 6.1 and the version number of Windows Vista is 6.0 which indicates that Windows 7 is a minor upgrade of Windows Vista.
 
In this article we will suggest some things to consider when creating installations for Windows Vista and Windows 7. Some details concerning our installation tool Visual Installer is also addressed.
The information in this article is also valid for Windows 8. However, for Windows 8 specific information, read this article on our web site.
 
Advertisement
Click here for more information about Visual Installer

 
 
Standard privileges and administrator privileges
 
Programs in Windows Vista and Windows 7 runs either with standard privileges or with administrator privileges. A program that runs with standard privileges has limited access to the system while a program that runs with administrator privileges has almost unlimited access to the system.
 
A new feature in Windows Vista / Windows 7, compared with earlier versions of Windows, is that even if an user logs in as an administrator most programs are still started with standard privileges. If an application requires administrator privileges the developer must flag this in the program. If such a flag is missing, the program will start with standard privileges. This will happen whatever privileges the person has logged on with. Moreover, if a program in Windows Vista or Windows 7 requires administrator privileges, the user must always verify the rise of privilege level (through a dialog box) or change the account to an administrator account. It is not possible to run a program with administrator privileges without the user's knowledge. A user dialog is always shown, regardless of what privileges the logged-on user has.
 
 
When a program is run with standard privileges, parts of the system is read-only
 
When a program is run with standard privileges, some harddisk folders and registry keys in the system are read-only. This means that the user can not save any data in them because he/she has no write permission to them. For example the Program Files folder and Windows folder are read-only and the user can not copy any files to these folders. It is not possible to update any files in these folders either. They are pure read-only.
 
A standard user has write access to a folder as \Users\<Username>, for example \Users\<Username>\Documents. So the user can store documents, pictures, movies etc without any problem. But a standard user has no write access to folders that store executable code (programs, dll:s etc) and some other important files in the system.

Also some part of the Windows Registry is locked for writing for standard users. For example, the HKEY_LOCAL_MACHINE Registry key is read-only for standard users. The program that the standard user runs can read values from HKEY_LOCAL_MACHINE, but the program can not store or change any values in this Registry key. If a program need to store values in Windows Registry the program must use the HKEY_CURRENT_USER key instead. The information stored in HKEY_CURRENT_USER will be per user, which means that if another person logs in he/she can not access the information in this key. It is not possible (under normal circumstances) to share data with other users via the HKEY_CURRENT_USER key.
 
 
An installation program normally needs administrator privileges
 
Installation software such as Visual Installer normally needs to be run with administrator privileges. The reason is that installation programs often install files to the Program Files folder and store values in parts of the Windows Registry that a standard user has no write-permission to. For example the HKEY_LOCAL_MACHINE and HKEY_CLASSES_ROOT keys are often used to store settings that will be shared a by all users on a particular computer. To write data to these two Registry keys, administrator privileges are needed.
 
When you start a setup program, that requires administrator privileges, Windows Vista / Windows 7 will always ask you to confirm a rise of the privilege level or ask you to change to the a administrator account. A dialog box from Windows will always appear before the installer starts. There is no way to get around this because this is one of the foundations of the new security thinking in Windows Vista / Windows 7. As far as possible, programs must be run with standard rights, but if a program needs administrator rights the user must confirm this via dialog box.
 
 
UAC - User Access Control
 
The User Account Control (UAC) dialog box
The technology behind the handling of standard and administrator users / privileges (as described above) is referred to as User Account Control (UAC). Windows Vista, Windows 7 and Windows Server 2008 support this technology. UAC will make Windows more secure and resistant to damage because no software or users can change important parts of the system or make changes in installed programs without having administrator privileges. This will be a good protection against both mistakes and malicious software (malware). If you want to have more information about the User Account Control feature in Windows you can read this article on Wikipedia and this article on Microsofts web site.
 
 
What to consider when storing data in Windows Registry from an installation program
 
With the releases of Windows Vista and Windows 7 it has become more common to have one or more standard accounts, plus an administrator account, on a computer. This applies to both home systems and office computers. At home maybe parents prefer that their children only use a standard account, with limited access to the system. And in offices the security is stricter today so most users will only have standard privileges when they work with their computer.
 
This means that there will be some practical problems in Windows Vista / Windows 7 if the Registry key HKEY_CURRENT_USER is used and the installation program requires administrator privileges and the end-user will run the program with standard privileges. When the installation program is run an administrator account is used and when the end-user runs the program a standard account is used. Different accounts are used which also affects the use of HKEY_CURRENT_USER. If an installation program installs data to HKEY_CURRENT_USER this data will not be accessible from the program when the end-user runs the program. The reason to this is that they are two different users and HKEY_CURRENT_USER can only be accessed from the same user that stored the data in this key. So if an administrator stores some values in HKEY_CURRENT_USER only he/she can read these values.
 
If an installation program needs to store data in Registry it is better to use the HKEY_LOCAL_MACHINE Registry key instead. All users in the computer can access the data in this Registry key. Data that should be stored in HKEY_CURRENT_USER should be stored via the software that has been installed instead. For example, an installation program can store default settings in HKEY_LOCAL_MACHINE and then can the installed software read these settings, maybe adjust them and then store them in HKEY_CURRENT_USER instead.
 
 
Shortcuts in Windows Vista and Windows 7
 
In Windows XP and earlier, it was common practice to choose if you wanted to install shortcuts to a particular user or to all users. But with Windows Vista and Windows 7 this is more difficult because the setup program often requires an administrator account and then it will be impossible to install shortcuts for a particular user (except the administrator himself/herself). Information about who was the last standard user is not stored in the system in an accessible way and it can be difficult to know if the user changed the user account only for the current installation's sake or for a completely different reason.
 
When setup programs are running with administrator privileges all files and settings are stored per-computer. This also includes shortcuts (icons) to programs and documents etc. Program files that are installed into the Program Files folder are always per-computer and therefore it is often logical that shortcuts will be per-computer. So installed shortcuts are normally accessible for all users in a computer.
 
 
64-bit versions of Windows Vista and Windows 7
 
With the release of Windows 7 more and more computers has started to use 64-bit technology and have a 64-bit operating system such as Windows 7 64-bit installed. Some people also use a 64-bit version of Windows Vista and Windows XP in their 64-bit computer, but most people that has a 64-bit Windows has Windows 7 installed.
 
A 64-bit version of Windows can handle both 32-bit and 64-bit programs. When a 32-bit program is run in a 64-bit Windows the program will “think” that it is run in a 32-bit Windows and behave as it was run in a 32-bit system. But there are some things to consider when installing programs in a 64-bit Windows. For example, in a 64-bit Windows there are two versions of the Programs Files folder and two versions of the System folder. One version is intended for 32-bit files and one version is intended for 64-bit files. And when you install files it is important that you install files with a specific bitness (32 or 64 bit) to the correct folder, otherwise the program that needs these files might not work. Choosing correct System folder is especially important.
 
In the table below you can see the folder names of the two version of the System folder and the two versions of the Program Files folder:
 
Folder name Bitness Path Description
       
System32 64 C:\Windows\System32 Windows System folder for 64-bit files
SysWOW64 32 C:\Windows\SysWOW64 Windows System folder for 32-bit files
       
Program Files 64 C:\Program Files Folder for 64-bit program files
Program Files (x86) 32 C:\Program Files (x86) Folder for 32-bit program files
 
 
More information about  32-bit and 64-bit folders
 
You can read more about the 32-bit and 64-bit folders mentioned above in the following two articles on our web site:
 
The 'Program Files (x86)' and 'SysWOW64' folders explained
The 'Program Files' folder in different languages
 

 
See also:
How to install a desktop application / desktop app in Windows 8
Related products:
SamLogic Visual Installer
  
Do you want to read more articles and tips?
 
If you want to read more articles & tips about software installations and related topics you can follow us on Facebook or Twitter, or subscribe on our newsletter. You can also read our blog.
Visit our Facebook page Follow us on Twitter Visit our video channel on YouTube
  
Other articles
More articles are available from the article index page.

 
 


 
Related Articles
   

   

   

   

 
SamLogic
Article written by: Mika Larramo Swedish