PDA

View Full Version : Prerequisite Confusion with MAPI



ekramer11
07-20-2006, 05:01 PM
I am attempting to add a prerequisite to detect the presence of the Windows Messaging Subsystem. This should be able to be accomplished in two ways. One, the MAPI32.DLL should be present in the System32 directory. Or alternatively the registry key : HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Messaging Subsystem should have a string entry named MAPI with a value of 1.


The strange thing is that a system search easilly finds this key and reacts to it's presence or absence.

My prerequisite isn't however. It never actually detects the key so I figure I am doing something wrong. Searching the forums and KB hasn't been all that helpful on this issue.

So, I'm using the IS ide version 12.

I go into Tools>>Prerequisite Editor

In the preprequisite editor I go to Conditions

I add a new condition of type: registry entry has a certain value

( What I am actually trying to do is see if this registry entry exists at all. I don't care what it's value is )

Registry Key Name: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Messaging Subsystem\

Check the following registry: Default

Value Name: MAPI

Value Data: 1

How do you want to compare the data: Is Equal To

Application To run: NTWMS.EXE

Then I went to Application Data>>Redistrubutables and made sure the requirement was checked to be installed.

As I said, System Search can find the value just fine. But when I run the installer the dialog does not appear to install the file.


How it works is that if the MAPI Subsystem hasn't been installed the MAPI entry will not be present under : HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Messaging Subsystem\

If it was, it seems to have a value of 1. I don't really care about the value... just that it exists. I also attempted to use 'A registry key does or does not exist' using a registry key name of : HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Messaging Subsystem\MAPI

and run setup requiremenf of: Not found

Any advice on this?

MichaelU
07-20-2006, 05:43 PM
Have you tried running this prerequisite without any conditions to ensure that the rest of it works fine? I don't see any obvious reason the condition you show would fail, unless the key is already present on the machine you're testing it on.

ekramer11
07-20-2006, 06:14 PM
Does the prerequisite installer dialog only launch when you run setup.exe or when you run the .msi?

As far as running it without a condition, yes. If I do so the prereq dialog pops up and MAPI installs normally. It does so every time I start the installer through the IDE but not when I just run the .msi off of the disk. Of course, when I put in the condition I previously mentioned it still pops up the prereq install dialog every time I start through the IDE. So basically it appears to be behaving the same whether the condition is put in or not.

I just tried using a custom action put at the beginning of the sequence with the variable set by my system search. IS_MAPI32INSTALLED=0 on it's conditional and calling the setup.exe program. It however, cannot stream the setup.exe into the binary table because presumably it hasn't been created yet when I start to compile. Potentially I can use a Custom Action to just call NTWMS.EXE the same way but then I wouldn't gain an inderstanding of how to use prerequisites.

Christopher Painter
07-20-2006, 06:21 PM
Prereq handling is an InstallShield enhancement that is implemented in the setup.exe bootstrapper. MSI has no built in pattern for serializing the installation of packages.

As an aside, I will typically put a duplicate LaunchCondition in the MSI to make sure the MSI is blocked in case the prereq is not installed and the user failed to click on the setup.exe.

ekramer11
07-20-2006, 06:27 PM
I went and changed the value data in the prompt from 1 to 0.

The value actually in my registry is 1. When I did so the prereq dialog showed. When I modified the value in the IS IDE and turned it back to 1, the dialog didn't show up.

So obviously it's able to see the registry entry. What I need to be able to do is determine if the value MAPI is present at all. The Windows Messaging Subsystem key appears to be in the registry by default and when MAPI is installed entries get put underneath it.

Switching the type of condition to 'registry key does or does not exist'

and changing the key to : HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Messaging Subsystem\MAPI

and changing the Run Setup requirement to Not Found

doens't seem to do it. I know that key exists on my system but the prereq install dialog pops up anyway.

What it seems to be doing is for existence, there is only a way to detect if a Key exists or doesn't exit. Not a value entry.

For detecting a value, you can only detect if the value is > < = != a certain value not if it doesn't exist at all.

Neither of which help me, unfortunately.

I want to detect if the MAPI value does or does not exist and then trigger NTWMS.EXE to install if it doesn't.

ekramer11
07-20-2006, 06:38 PM
I achieved the effect I wanted using custom actions.

I create a custom action to run NTWMS.EXE. I add that custom action to the sequences after LaunchConditions with a condition of IS_MAPI32_INSTALLED=0.

I use a System Search to look for that particular key and set IS_MAPI32_INSTALLED to 1 if I find it.

If I now run this on my system ( with MAPI already installed ) I do not reinstall mapi. If I run it on my virtual system ( which doesn't have mapi installed ) it goes and installs it. If I try to run it again it doesn't.

This is basically what I wanted to accomplish, all done with a custom action in the right place. It's good to know that I can do this.

Unfortunately this doesn't really tell me how to do this with a prerequisite. So I'm still confused and back where I started. =)

Can I not detect if a entry value does or doesn't exist in a prerequisite?

ekramer11
07-20-2006, 06:39 PM
Prereq handling is an InstallShield enhancement that is implemented in the setup.exe bootstrapper. MSI has no built in pattern for serializing the installation of packages.

As an aside, I will typically put a duplicate LaunchCondition in the MSI to make sure the MSI is blocked in case the prereq is not installed and the user failed to click on the setup.exe.

That explains why it only happened when I hit setup.exe and not the msi itself.

MichaelU
07-21-2006, 11:30 AM
I slightly misinterpreted your first post - I thought you were seeing it fail to run when you expected it to, rather than seeing it run when you expected it not to. I can't reproduce either problematic behavior - my tests run when and only when I expect them to run.

Perhaps does your registry condition contain a typo in the registry key? You say it works in the comparison case, but since the data isn't shared between the two conditions it's possible it's only incorrectly typed in one.