Wednesday, October 14, 2009

How to Use AppSearch RegLocator and LaunchCondition in MSI

Sometimes you might be required to edit MSI directly for the purpose of launch condition.This post will help you in finding the existing versions of products using Appsearch and RegLocator and then applying this in LaunchCondition.

Let us take an Example and find out how to use them.
Use case:You want to display an error to user if the value of the following Registry Entry is less than 7.0.
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Version

You need to have ORCA Editor.Get one here if you do not already have it.

Appsearch is used to search for files, registry keys,folders or Windows Installer components.We will use RegLocator in this particular Exercise.AppSearch locates the specified item and returns the search resuls as a property.We will evaluate this property in launch condition.

Steps to Follow
1.Make an Entry in RegLocator Table
Add a new row to the RegLocator table with the following Data.
Root 2
Key SOFTWARE\Microsoft\Internet Explorer\
Name Version
Type 2

Note:The value of root is 2 for HKEY_LOCAL_MACHINE.You can find the list of all other valid values and more about RegLocator here.
Decide the correct values for Root,Key and Type based on your requirement.

2.Make an Entry in AppSearch.
Add a new row to the AppSearch table with the following Data.
Signature_ FIND_IE_VERSION (Signature value of Reglocator table you entered above)

3.Make an Entry in LaunchCondition.
Let us use the value of FIND_IE_VERSION to evaluate launch Condition.This should be our logic for launch condition.
if (IE_VERSION >="7.0" then )
Make the following entry in LaunchCondition in anew row.
Condition IE_VERSION >="7.0"
Description IE version should be at least 7.0 to proceed with installation.

Save the MSI and test your changes now.You can enable logging and check the value of your new variables inside the log file created in %TEMP% folder.

Note:The AppSearch action searches for file signatures using the CompLocator table first, the RegLocator table next, then the IniLocator table, and finally the DrLocator table.

You can even consider using other tables instead of RegLocator based on your requirement.

About This Blog

This Blog is all about Technology , Web 2.0 ,WebApps.You can also contact the author for advertising on this blog.All the material presented here is the property of author and its reproduction in any form is strictly prohibited.

Contact Us

If you have any suggestions ,queries or comments and want to reach out to me ,then you can reach me here.