Vous êtes sur la page 1sur 8

64-bit Insider

Volume I, Issue 9

An Introduction to 64-bit
The 64-bit Advantage
Installers: Part 2
The computer industry is
changing, and 64-bit technology
is the next, inevitable step. The
In issue 8 of the 64-bit Insider newsletter, we discussed
64-bit Insider newsletter will help
you adopt this technology by the different settings that should be considered when
providing tips and tricks for a working with installers that deploy 32-bit and 64-bit
successful port. binaries. We learned that only an installer marked as x64
or Itanium can deploy both 32-bit and 64-bit
Development and migration of 64- components. We also learned about the changes that
bit technology is not as
complicated as the 16-bit to 32-bit must be made when the installer needs to explicitly write
transition. However, as with any to the 32-bit section of the registry.
new technology, several areas do
require close examination and In this issue of the 64-bit Insider newsletter, we’ll look at
consideration. The goal of the 64- yet another approach you can follow when working with
bit Insider newsletter is to identify
installers that deploy 32-bit and 64-bit components:
potential migration issues and
provide viable, effective solutions nested installers.
to these issues. With a plethora of
Web sites already focused on 64- Before reading any further, you should understand the
bit technology, the intention of basic concepts behind installers. If you are unfamiliar
this newsletter is not to repeat with this topic or need to refresh your memory, please
previously published information.
Instead, it will focus on 64-bit
read the Visual Studio Installer Quick Start guide at
issues that are somewhat isolated MSDN:
yet extremely important to http://msdn.microsoft.com/library/default.asp?url=/library/enus/vsin
understand. It will also connect stal/html/vehowvisualstudioinstallerquickstart.asp
you to reports and findings from
64-bit experts.

64-bit Insider Newsletter


Volume 1, Issue 9
Page 1/8
Understanding Nested Installers
The idea behind nested installers is to create separate 32-bit and 64-bit installers, and then
merge them together to create one installer. In doing so, you do not have to worry about
explicitly specifying which registry keys each installer must access. Even though there is
one physical installer in the end, the 32-bit portion will only access its corresponding
portion of the registry, as will the 64-bit installer. This interaction is depicted in Figure 1.

Runs as a 32-bit Process


32-bit 32-bit Registry &
Installer FileSystem Modified

64-bit Runs as a 64-bit Process


Installer 64-bit Registry &
FileSystem Modified

Nested
Installer
Figure 1 Nested installer made of separate 32-bit and 64-bit installers

When the installer shown in Figure 1 runs, first, the 32-bit installer will execute, modify
any registry/filesystem settings, and then the 64-bit installer will run and modify its
corresponding sections of the registry and filesystem. The result is a single installer that
installs both 32-bit and 64-bit components without the need to explicitly specify registry
branches. This nesting of installers can be a real time saver if, for example, you have a
32-bit installer that modifies thousands of 32-bit registry keys that need to be used by a
32-bit component. You can either manually change all these keys in the installer setup, or
join your existing 32-bit installer with a 64-bit one and avoid making manual changes.

The Scenario
For the sake of this example, we’ll make the following assumptions:

• You already have an installer for a 32-bit application. (We’ll refer to this as
Registry Reader Installer.)

• You have a 64-bit application that communicates with the 32-bit component, and
has been deployed with its own installer. (We’ll refer to this as Complex
Operation Installer.)

• You want to deploy a single installer that will install both components on your
client computer.

• You do not want to modify the 32-bit installer you already have built.

To accommodate these needs, you should build a nested installer from the existing
installers—a process that consists of two steps:

64-bit Insider Newsletter


Volume 1, Issue 9
Page 2/8
1. Merging the Installers with Microsoft® Installer database (MSIDB)

2. Modifying the Installer Information with One Really Cool Application (ORCA).

Step 1. Merging the Installers with MSDIB


To successfully merge both the 32-bit and 64-bit installers, you will need the msidb.exe
utility. This utility is included with the Platform Software Development Kit (PSDK) and
can be invoked by just running “msidb” in a PSDK build environment. Feel free to run
msidb /? in order to view the different options that this utility has.

To merge the contents of the 32-bit installer into the 64-bit installer, use the following
command:
msidb -d “Complex Operation Installer.msi” -r “Registry Reader Installer.msi”

At this point, even if the installer launches, it still will not work. Now, you must modify
some entries in order to finalize the nested installer.

Step 2. Modifying the Installers with ORCA


ORCA is a utility that is included with the PSDK and that allows database tables to be
edited from MSI installers. ORCA does not install by default; thus, you must use the
ORCA.msi installer (usually found in the bin directory of the PSDK) to install the utility.
You will use ORCA to modify both the Registry Reader Installer and the Complex
Operation Installer.

When we merged the two installers in step 1, the contents of the Registry Reader
Installer were placed inside the Complex Operation Installer. Follow these next steps
to edit the database tables of the Complex Operation Installer.

1. Right-click the Complex Operation Installer, and select Edit with Orca from
the drop-down menu that appears. (See Figure 2.) Orca opens the installer file,
and you will be able to see all the tables and respective entries for the Complex
Operation Installer.

Figure 2 Editing the Complex Operation Installer database

2. From the Tables column, select CustomAction to set a custom action that will
alert the installer to run the 32-bit portion of the installer once it finishes running

64-bit Insider Newsletter


Volume 1, Issue 9
Page 3/8
the Complex Operation Installer. (See Figure 3.)

Figure 3 Complex Operation Installer.msi dialog box

3. From the Tables menu, select Add Row. An Add Row dialog box appears. (See
Figure 4.)

Figure 4 Add Row dialog box

4. Enter the following values in the associated fields:

a. Enter InstallRegistryReader in the Action field. This entry is the name of


the action associated with the installation of the component.

64-bit Insider Newsletter


Volume 1, Issue 9
Page 4/8
b. Enter 7 in the Type field. This number identifies the nested installation of a
product residing in the installation package.

c. Enter the exact name of the installer (in this case Registry Reader
Installer.msi.) that is being nested into the Complex Operation
Installer.msi in the Source field.

d. Leave the Target field blank.

5. Click OK after these changes have been made.

After you have completed the steps required to invoke the 32-bit installer, you must
indicate where the installer should look when uninstalling the 32-bit component. To do
so, follow these steps:

1. From the Tables menu, select Add Row. The Add Row dialog box appears.

2. Enter the following values in the associated fields:

a. Enter UnInstallRegistryReader in the Action field.

b. Enter 7 in the Type field.

c. Enter the exact name of the installer (in this case Registry Reader
Installer.msi.) that is being nested into the Complex Operation
Installer.msi in the Source field.

d. Enter REMOVE=ALL in the Target field. (See


Figure 5.)

Figure 5 Add Row dialog box


64-bit Insider Newsletter
Volume 1, Issue 9
Page 5/8
As a final action, you must let the installer know when to run the 32-bit installer that has
been merged into the application. To do this, follow these steps:

1. From the Tables column, select InstallExecuteSequence. (See Figure 6.)

Figure 6 ‘InstallExecuteSequence’ selection from the Complex Operation Installer.msi dialog box

2. From the Tables menu, select Add Row. The Add Row dialog box appears. (See
Figure 7.)

Figure 7 Add Row dialog box

64-bit Insider Newsletter


Volume 1, Issue 9
Page 6/8
3. Enter the following values in the associated fields:

a. Enter InstallRegistryReader in the Action field.

b. Leave the Condition field blank.

c. Enter 6500 in the Sequence field.

Note: Use 6500 because there is no other sequence using this number, and it is just
before the InstallFinalize action whose value is 6600 in this example. The
InstallFinalize action marks the end of a transaction that begins with the InstallInitialize
action.

To finalize your modifications to the installer table, select Save from the File menu and
then close the ORCA application.

Testing the Installer


Once you have finished creating your nested installer, you should thoroughly test it,
ensuring that both the 32-bit and 64-bit installers act the same whether running
independently or as a nested installer. This testing includes, but is not limited to,
installation, uninstallation, registry key modifications, and file system modifications.

Summary
In issues 8 and 9 and of the 64-bit Insider newsletter, we have explored two different
methods for deploying 32-bit and 64-bit components from the same installer. The first
method involved modifying the installer project in order to write the necessary
information for both the 32-bit and 64-bit components. The second method involved
merging two installers from different bit architectures, to avoid making modifications to
the installer project.

Both approaches have pros and cons. If you have an existing 32-bit installer that does a
lot of registry modifications, you may want to create a nested installer to avoid changing
multiple entries in your installer project. On the other hand, if your 32-bit installer has
few modifications, you may want to follow the mixed-mode installer approach because it
will be more flexible and won’t require a lot of work to allow the 32-bit and 64-bit
simultaneous component installation.

Suggested Reading
Visual Studio Installer Quick Start
http://msdn.microsoft.com/library/default.asp?url=/library/en-
us/vsinstal/html/vehowvisualstudioinstallerquickstart.asp

Msidb.exe
http://msdn.microsoft.com/library/default.asp?url=/library/en-
us/msi/setup/msidb_exe.asp

64-bit Insider Newsletter


Volume 1, Issue 9
Page 7/8
Orca.exe
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/orca_exe.asp

Using 64-Bit Windows Installer Packages


http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/using_64-
bit_windows_installer_packages.asp

64-bit Insider Newsletter


Volume 1, Issue 9
Page 8/8

Vous aimerez peut-être aussi