Create Setup Program
Two steps to deployment; first transfer files to users hard disk, second configure users computer to recognise and correctly execute program. These steps should be automated - users are used to applications that have installation programs.
Installation program always called setup to conform to convention and enable the add/remove applet to recognise it. If application distributed on several disks the setup program should reside on first - ease finding it. Typical services provided include:
- Prompt for selected options
- Create folders on users hard disk as required
- Copy files from media to disk
- Add registry info for shared DLLs
- Register COM components
- Add information to registry on command to be issued for uninstall (used by add/remove applet)
- Associate file extension with application
- Add entries to Programs menu
- Execute "run-once" code (minimise install size if setup program not copied to hard drive)
- Add or remove selected options from installation if setup invoked again
Users should only need to select installation option and insert media. Recommended installation options:
- Compact - minimal disk space requirements
- Custom - user control over components installed
- Typical - common default suitable for most users
- Silent - unattended installation
Silent required for systems managers who may wish to install across a network.
- Store private .ini files in application directory, or in that returned by GetWindowsDirectory() if shared app.
- Avoid inappropriately copying files to system directories. Fonts reside in system Fonts folder
- Check file does not already exist before copying, if does decide which is more recent - avoid replacing newer versions.
- Supply defaults - user should only have to press ENTER at each prompt for successful installation.
- Avoid reinserting media
- Provide info on required disk space
- Display progress indicator
- Store intermediate files within TEMP directory (if reboot required must ensure TEMP directory is on disk, not held in RAM)
- Allow installation to be cancelled at any point - unwind changes made.
Apps should safely remove all traces of their presence, but not any user generated files. Typically carried out by program called Uninstall or Uninst - sometimes setup written to also act as uninstaller. Name of application more flexible as name and location stored in system registry (to enable add/remove applet to operate).
Prerequisite for Windows compliance logo.
Rarely matter of deleting all files in subdirectory. Have to handle shared resources and registry modifications. Must not delete components other apps rely on - determine by checking usage count for it in registry.
User preference data to HKEY_CURRENT_USERSOFTWARECompanyNameProductNameVersion, application wide to HKEY_LOCAL_MACHINESOFTWARECompanyNameProductNameVersion (italicised dependent on app).
Running app has own PATH environment variable. Apps normally stored in unique directories so path o apps components must be stored in app-specific PATH string.
To register a PATH write desired value to HEKY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionApp Paths key. Create key with name same as application, default value contains fully qualified app location (e.g. C:ProgsMyApp.exe) and Path value contains required directories.
For each shared module installed setup program should consult registry and increment corresponding usage count. When application removed the count should be decremented, if count becomes zero file may be removed (only after asking user).
File containing several other compressed files. Setup reads .cab file, decompresses it and writes result to users hard drive. Can be digitally signed to identify creator and ensure file not tampered with.
Made with MakeCab which creates compressed disk images for use with setup programs. CabArc is consol-based utility to create and extract cabinet files. Both available from SDK.
ASCII script listing keys and values to add to registry. Any hard coded paths in the file can causes problems - if application installed to different location than that specified in file will result in problems -> setup program may need to edit .reg file before using it.
Can use regedit to import .reg files into registry.
Supplied with Professional and Enterprise versions of VC.
Manages install / uninstall (don't need to write latter as is generic tool that reads log file created during setup).
Categorises application into different groups, each containing files relevant to group.
InstallShield scans application folder to determine project dependencies and ships these files in addition to those present in the application folder.
Registering COM Components
In order for COM / ActiveX component to execute registry must be updated to include controls GUID, its location, characteristics (threading model, etc.) and operation information (is it visible, activated inside container, etc.).
ActiveX controls are self-registering - update registry information themselves. Relieves this task from setup program. Other COM components may require the use of .reg files, etc. to achieve their registration.
Invocation of self-registration behaviour achieved by calling DllRegisterServer() entry point on DLL. Normally handed by IE or Setup program (depending on if component downloaded via web or received as part of installation package). Can also use system tool - RegSvr32.exe.
Counterpart to remove control from registry handled by DllUnregisterServer().
To get InstallShield to call registration function must place all self-registering components in own file group with the Self Registered property set.
Disks and CD-ROMS cost effective and convenient. 3.5 inch ubiquitous.
Often used to distribute upgrades - bug correction through new versions. Upgrades should include setup program that installs revised files.
Least expensive. Ideal if app only to serve a set of users linked by LAN or WAN. Disk images placed on network resource available to relevant users.
Increasingly common. Has following advantages:
Time-trial evaluation software popular form of deployment. Users download working version of program for free to try for a specified period. If like users can purchase license that will provide, via email, an unlock code so app can be used indefinitely.
Web excellent method of distributing upgrades. Upgrades placed in password protected (known only to registered users) location which users can periodically check for upgrades.
- inconvenience for new users - may be forced to download many megabytes of data over slow connection.
- Restricted customer base (only those connected to internet)
- Control of access passwords
Deploying ActiveX Controls
If control has dependencies these should be shipped with it. MFC based controls require presence of MFC42.dll. ATL projects can be constructed in such a fashion so as not to require MFC or C runtime DLLs.
If developing group of ATL controls designed to work together may be better to compile with MinSize option and not MinDependency. Produces considerable reduction in footprint but means ATL.DLL must be present.
Browsers can require controls to be signed before they will be downloaded. Signatures prove that:
Obtain digital signature from certifying authority. They validate your identity and issue certificate containing digital signature.
If control is licensed the installation program should handle requirements automatically. Control Wizard generates license file (license.txt) that should be placed in same directory as control. If your control makes use of registry for licensing information then ensure the setup program creates appropriate entries.
Design-time license protection used when developers attempt to use control. If license file not present then when attempt made to insert control into dialog box, etc. Visual C++ will display message informing developer to purchase license.
Run-time license protection used after developers finish with your control. At run-time container passes keyword to control providing proof that license existed during development - consequently license not required on end-users system.
Making ActiveX Control Internet Friendly
First time page viewed containing control it must be downloaded by browser. Minimise size to reduce download time.
Avoid using C run-time - reduces executable size and removes need for MSVCRT.DLL. Tips to avoid CRT:
- Do not include C library calls, instead use alternative OS provided facilities. For example replace strcpy() and strcat() with lstrcpy() and lstrcat().
- Do not make member functions static - requires initialisation by C runtime.
- If using ATL define _ATL_MIN_CRT
Load data asynchronously
Control can become active while browser continues to receive downloaded properties in background. For example, control showing video should not wait for entire clip to be downloaded. Start displaying data already available, using worker thread to continue to receive file in background.
- Make sure application is in release-build, preferably optimised for size
- Ensure dependencies are legally re-distributable
- Users do not require licences for controls (although developers may do). Consequently do not include licenses info in package for container applications
- Ensure help files included in package, if using HTMLhelp need to include HTMLHELP.DLL
- Test setup and uninstall programs thoroughly under different stressful scenarios.
Zero Administration for Windows
Initiative to reduce costs associated with networked corporate environments. Facilitate management of users, software and hardware without need for administrators to touch individual machines.
Automatic Update and Installation
Installation and maintenance normally labour-intensive + error-prone. ZAW simplifies by automation. Windows automatically updates itself with new components when they become available. Systems can be configured to boot-up with minimal configuration and check for new sw, etc.
Cache Data and Configuration
Storing information in registry can be problematic in networked environment where users are mobile between machines. ZAW permits user data to be reflected to servers - allows users to log on to other machines and work within the context of their normal host machine. Data and configuration information following user referred to as persistent caching.
To prevent users installing software, changing settings, etc. the network administrator can hide devices such as hard disks, etc. Users presented with single drive letter representing home directory.
Most important part of ZAW. Automates application installation across network. Benefits over traditional installers include:
- Automatically repair application installation. OS will detect if file accidentally deleted and ensure it is replaced when application restarted.
- Automatic installation on enterprise-wide systems (up to thousands of users)
- Installation on demand where COM components are only installed when first accessed. Speeds installation and prevents unnecessary disk clutter.
Windows Installer not single program, but collection of services.
Systems Management Server
Continually inventories computers on network. Software and hardware detected on machines stored in SQL database through which network administrator has up-to-date inventory of all computers in organisation.
Makes software deployment more efficient. Setup programs can check SMS before deployment, install only on those meeting set of criteria and flagging those not meeting requirements.
Zero Administration Kit
Integral part of Windows 2000, many features already available for NT 4.