Install Time™ Help - Application Search


This section describes how to author an installation package in such a way that it will search for a file/directory, registry value, Ini value or Windows Installer component.

What is in this section

  • Overview
  • Typical Use
  • Component Search
  • File or Directory Search
  • INI Value Search
  • Registry key Search

Overview

Windows Installer can search for a specific file, directory, registry key, ini value or Windows Installer component during an installation. File or directory searches are used to determine whether a user has already installed a version of an application. Install Time™ provides a means for the installation author to add searchs to an installation and set Windows Installer Properties based on the results of the search.

Typical Use

Does your installation have specific requirements before the installation executes, such as the existence of a specific operating system or the installation of another application? By creating launch conditions, you can specify certain requirements for your installation. Launch conditions are system or software requirements that your installation needs to run successfully. If the requirements are not met, your installation displays a message to the user and then terminates.

You can easily specify the following system requirements by using the Prerequisites page under the Project settings tab.
  • Windows Version
  • Windows NT Version
  • Internet Explorer Version
  • Windows Installer Runtime Version

To create additional system requirements, you can search the system and use the result to set a launch condition.

For example, your application requires that the older version of the software, RequiredApplication, needs to be installed on the destination computer. Due to this requirement, your installation verifies if RequiredApplication is installed. If RequiredApplication is not on the computer, a message appears that states the requirements are not met, and then the installation is aborted.

Before modifying your installation, establish a registry key, Windows Installer Component, or file that is unique to RequiredApplication. To determine if RequiredApplication is installed, the installation searches for this file or registry key. The following steps demonstrate how to create a search using the Applicaiton Search page. You can then use that search to create a launch condition.

In the following procedure, you will search for the registry value InstallationPath in the registry key HKEY_LOCAL_MACHINE\Software\RequiredApplication. If the search locates this registry key, the installation recognizes that RequiredApplication installed on the destination computer.

On the Application Search page, select the "Add" button on from the right hand side. From the options available select "Registry". At this point a new Registry key look up has been created. To complete the details for the seach, fill in the property window as follows...

  #1 Create a property that will contain the results of the search. In the property field type "RegAppSearch".
  #2 Select the "Root" drop down list and navigate to "HKEY_LOCAL_MACHINE".
  #3 In the "Key path" field, type "Software\RequiredApplication".
  This will complete the search path for the registry key in question.
  #4 Finally, type "MyOldApp" in the Key name field.

The search setup is now complete. The property "RegAppSearch" will contain the value of the registry key "MyOldApp" which can be used to determine if the old application is installed.

Note: If your .MSI supports silent installation, complete the steps display a dialog to the end user in the Execute Immediate sequence. During a silent installation, the User Interface sequence does not execute therfore logging and aborting the installation is reccommended in cases where multiple versions of a single product can not run side by side.

Component Search

In order to perform a component search, you must know the component's ID. It may (and likely) be the component ID of a component belonging to another product installed on the computer. To obtain this ID, you must have access to the .MSI file of the installation which contains the component. You can find the component's GUID in the Component table. Simply use Install Time™ to open the MSI (Windows Installer file) that contains the componet being searched, select the tables tab and select the Component table from the table list. It is recommended that you copy and paste the component GUID verse typing it out. Select the component GUID from the ComponetID column and using CTRL-C copy the desired component to search.

From Install Time, Select the component search item or create a new one from the Appliction Search page. Paste (CTRL-V) the component GUID to search for in the property window, Component GUID field. If the component is present in the current working installation, you can select the componet ID from the provided dropdown in the Component GUID field.

From the value type field select whether this is a unique file signature or a directory componet search. This is determined by whether the component key of the component that is being searched is a file or a directory. Select the type of entry for the property:

To read directory name from component keypath select directory if the component you are searching for contains only an empty directory (a Create Directory item) and has an empty key path. This operation returns a directory path. (Example: C:\Program Files\Application\.)

NOTE: If the keypath for this component is a file, ODBC item, or registry item, this operation fails.

To read a file pathname from a component search, select file in the type field. The component you are searching for must have a file for a key path.

In this case, it returns the directory path. Example: C:\Program Files\Application\ where the file is located.

Specify a property in the Property field. This property will hold the result of the search, which is a file name, directory path, or other value, depending on the operation performed by the search. If you've already defined a new public property (all uppercase) you can select it from the list; otherwise enter a new property name (all uppercase). If the seach fails to find the specified component the property value will be null and will be false if used in a condition.

NOTE: If the component's key path is a file, you need to specify Type="file" and if the key path is a directory, you need to specify Type="directory."

File or Directory Search

On the Application Search page, you can set up a search for a directory that contains a specific file on the destination computer. When you search for a file, Windows Installer stops searching as soon as it finds the first file or directory that matches your specification. Therefore, it's important that you specify unique file or directory attributes for your search. The return value will be the directory path that contains the file.

  1. Select Project tab > Application Search page.
  2. Click Add and select File or Directory.
  3. Complete the details in the property window:

Property Window Details:
File Name: Enter the name of the file being searched (Example: SearchMe.exe)

Path:
Although you can enter a specific path here, it is best to enter one of the predefined folder properties that are listed in the Directory table located on the Tables tab. Example: Entering [Windows] searches the default Windows directory, regardless of its name or location.

Root Path Search:
This column is the signature of the parent directory of the file or directory in the Signature_ column. If this field is null, and the Path column does not expand to a full path, then all the fixed drives of the user's system are searched by using the Path.

Languages:
Enter a language code (0 for neutral) in this field to search for specific languages which the file supports and only set the property if the specific file attirbute is found. To search for different language versions of a file, you must have a separate entry for each language version. If multiple languages are provided in the Languages column, then the search is for a file that supports all of those languages.

Search Depth:
Enter how many directories below the search directory to search. The default, 0, searches only the top level of the directory specified in Search Directory. If you are searching all fixed drives for a file, then 0 searches the root directories only. Enter 1 to search both the top level and the top level's child directories, 2 to search two levels of child directories, and so on.

Min and Max file version:
If the file located or found is outside the Min/Max version range Windows Installer will continue to search.

Min and Max Size:
If the file located or found is outside the Min/Max Size range Windows Installer will continue to search.

Min and Max Modified date:
If the file located or found is outside the Min/Max Modified date range Windows Installer will continue to search.

Property:
Specify a property name. It will hold the result of the search, which is a file name or directory path. If you've already defined a new public property (all uppercase), then you can select it from the list; otherwise enter a new property name (all uppercase). If the search fails to find a match, the property value will be null and will be false if used in a condition.

Key:
Specifies the primary key used in the Signiture table and cooresponding DrLocator table. This must be unique and the default value is provided as assistance in creation.

NOTE: To search all fixed drives leave both the Root Path Search and Path fields blank.

INI Search

On the Application Search page, you can set up a search for a value contained in an .INI file. The return value will be the directory path that contains the file.


  1. Select Project tab > Application Search page
  2. Click Add and select Ini Entry
  3. Complete the details in the property window:

Property:
Specify a property name. It will hold the result of the search, which is a file name, directory path, or other value, depending on the operation performed by the search. If you've already defined a new public property (all uppercase) you can select it from the list; otherwise enter a new property name (all uppercase). If you enter a new property name, and the search fails to find a match, the property value will be null and will be false if used in a condition.

Key:
Specifies the primary key used in the Signiture table and cooresponding IniLocator table. This must be unique and the default value is provided as assistance in creation. Operation:

INI File Name:
The name of the .INI file. (Not case-sensitive.)

INI Section Name:
The section name that contains the item you're searching for. Although section names are enclosed in brackets, don't include the brackets. (Not case sensitive.)

INI Entry Name:
Enter the name of the item that contains the value you're searching for. (Not case-sensitive.)

Field:
This is enabled if you select Read raw value from INI file in the Operation field. If the item you're searching for contains several values, separated by commas, enter the number of the value's position in the list of values or enter 0 to get all values.

Value Type:
The return can be either a path (Directory), a file name or raw data (undefined). Select which value type best matches the search needs.

Use read directory name from INI file only if the .INI information you are searching for is a directory path. A search of this type returns the entire directory path. (Example: E:\Application\). If you use this operation on .INI information that's in the form of a file path, or any other form, then this type of search fails. The search also fails if there is more than one value listed for the item, separated by commas.

Use Read file pathname from INI file only if the .INI information you are searching for is a file path. (Example: E:\Application\Application.exe). However, the file name itself is dropped from the search result. A search of this type returns the directory path only, minus the file name. (Example: E:\Application\).

If you use this operation on .INI information that's in the form of a directory path, or any other form, then this type of search fails. The search also fails if there is more than one value listed for the item, separated by commas.

Use read raw value from INI file to find any type of .INI information.
This type of search has the added benefit of letting you specify the Item Field, which determines which value in a comma-delimited list of values to retrieve. (Example: If you set the Item Field to 2 and search this item: Colors=red,blue,green; "blue" is returned because it is the second field in the item)

NOTE: When you run the installation, the property you specified will hold the results of the search. If it is empty, the search failed.

Registry Search

On the Application Search page, you can set up a search for a registry value on the destination computer. You can either search for a generic value, or do a special search that's tailored specifically for a file path or directory path.


  1. Select Project tab > Application Search page.
  2. Click Add and select Registry.
  3. Complete the details in the property window:

Property: Specify a property name. It will hold the result of the search, which is a file name, directory path, or other value, depending on the operation performed by the search. If you’ve already defined a new public property (all uppercase) you can select it from the list; otherwise enter a new property name (all uppercase). If you enter a new property name, and the search fails to find a match, the property value will be null and will be false if used in a condition.

Value Type: The return can be either a path (Directory), a file name or raw data (undefined). Select which value type best matches the search needs.

Use read directory name from registry only if the registry information you are searching for is a directory path. A search of this type returns the entire directory path. (Example: E:\Application\). If you use this operation on registry information that's not in the form of a file path, the search fails.

Use Read file pathname from registry only if the registry information you are searching for is a file path (Example: E:\Application\Application.exe). However, the file name itself is dropped from the search result. A search of this type returns the directory path only, minus the file name (Example: E:\Application\). If you use this operation on registry information that's not in the form of a directory path, the search fails.

Use read raw value from registry to find any type of registry information.

Root: Select the root folder that contains the registry value to search for.

Key path: Enter an entire key path, separating key names with backslashes (Example: Software\Application\Common).

Key name: Enter the name of the registry value. To find the default registry value, leave this blank.

Value type: Search 64-bit portion of the registry (64-bit installations only.) Select true to find registry keys that are designated as 64-bit components.

NOTE: When you run the installation, the property you specified will hold the results of the search. If it is empty, the search failed.




All trademarks and copyrights on this page are owned by their respective owners.