Applying Registry Changes by Creating an MST file with Orca
(This page can be downloaded as a PDF file if you want to use it offline.)|
Adding new registry keys to an existing MSI file is actually a simple task, once you know where everything is supposed to be. While it is possible to edit the MSI and make the changes permanent, I would recommend creating a Transform file instead. This way, when a new version of the MSI file comes out, if the registry keys are still the same, you don’t have to do anything. You simply use the MST file you create here with the new MSI file.
For my example, I am going to use Google Earth Pro 7.1. When I was creating this, Google had just announced that anyone could get a key for the Pro version of Google Earth for free. Anybody could sign up and get a key for 250+ users at no cost. However, there was no easy way to apply the key at install time. Five simple registry keys applied during install would allow you to avoid having to send the key (and instructions) out to all the users. This is a perfect application for using an MST file to add registry keys, especially since it allows me to demonstrate three different types of registry keys; (string, hex, and dword.)
If you want to follow along exactly as I do, then you will need to gather a bit of data first.
[HKEY_USERS\S-1-5-21-(whatever-your-user-key-is)\Software\Google\Google Earth Pro]
You only need the following five entries from that file:
Now that you have those, we’re going to move those keys up to the local system level rather than the user level.
Creating a new MST File
Open the msi file being used with Orca and select the Registry Table in the Tables pane.
We need to begin a new transform file, so click on Transform on the menu bar and select New Transform.
Next, we need to add a new row to the bottom of the registry table. Click on the Tables menu item and select Add Row... to generate a new row at the bottom of the registry table.
When you add a new row, you will be presented with the Add Row dialog box.
Everything here will have to be filled in before we can move forward.
The first item is simply labeled Registry, and is already selected. You can use any name that makes sense to you here.
Since I have five keys to create, I am going to use GEarth01 through GEarth05. This first one will be 01, so I enter that name
in the appropriate box at the bottom:
Once you type the name, you then have to click on the next item called Root at the top. When you do this, the name you
entered for Registry will be moved into the appropriate box at the top.
The Root item is a designator telling the installer "where" to place the registry key. Not the full path to the key,
just which of the Root keys it will go under. There are five possible root keys, and each naturally has its own number here. They
are broken down like this:
As I mentioned above, we are going to be putting our new keys into the HKEY_LOCAL_MACHINE root, so we will be using 2 for this example. So enter a "2"
for the Root value in the Column box at the bottom. Then click on "Key" at the top to move on to that column.
The value entered for Key is the rest of the path to where you want to place you registry entry. For the Google Earth sample, my keys are going to go under:
Now we need to set the Name and Value entries. I need to create two "string" values, two "dword" values, and one "hex" value. Strings are the easiest so we'll start with those.
The two string values are Username and Passport. (Passport is the key that Google provided to you.) We'll start with Username.
Type Username for Name, then click on Value at the top and enter the email address that goes with the key that you have. Then click on the final
line at the top called Component_.
For the Component_ line, this will normally point back to something under the Component table on the left. You may have to look through other registry
entries in the MSI in order to determine exactly which component will work for the installer you are working with.
Here is where you can see what Component any existing registry settings are using:
And here you can see where that would match up to an existing Component already defined in the MSI file:
The Google Earth installer does most of its registry entries under Registry_General.
So enter Registry_General here.
Now, click on the OK button and you should find a new row added to the bottom of the registry table.
The second string value is Passport, so you need to go and do those same steps over, changing the Registry name to GEarth02, substituting Passport for
Username in the Name line, and your key for the Value line.
When you get that done, you should have two new lines in the registry table like this:
Next, we need to create a pair of dword entries; HideUserData and DisableDeactivation. The process is exactly the same until you get to the Value
entry. I'll start with HideUserData. So get your Registry, Root, Key, and Name entries entered like this:
To make a value anything other than a string, you need a prefix on it. There are three options for this prefix:
Since I want to create my dword values first, I will be using "#" here. And since I want my dword to be set to 1, I simply make my Value entry read #1.
Add another row and do the same thing for the other dword value, (DisableDeactivation), and when you are done you should have four new rows at the bottom
of your Registry table. Just one more to create.
The last entry is the hex value called AData. As you can probably already tell, we will use the prefix #x, but there is just a little bit more
to it first. The data that you exported will probably look something like this:
Our Value entry needs to be just the data; no commas, no slashes, etc.
Then I put the prefix onto that like so:
Click on OK and you should now have all five entries created.
Now we just need to finalize the process.
Go to the Transform Menu and select Generate Transform....
Give the file an appropriate name and location.
You can now exit the Orca program. The Transform file is complete.
If you need to edit the MST file later, you will need to do the following:
Simple. Run the MSI installer with the following command line switches:
MSIEXEC /I msifilename.msi /QB TRANSFORMS=filename.mst
So for my Google Earth example, the command line would be:
MSIEXEC /I "Google Earth Pro.msi" /QB TRANSFORMS=EarthPro-Key.mst
If your MST file is not in the same folder as the MSI file, you will need to provide the path in the TRANSFORMS= section.
Additional information on Registry settings above can be found at Microsoft's Page for Registry Tables.