Asked By Micus
13-Nov-09 03:53 PM

Hello,
[VS 2003 Setup/Deployment project, Win Installer v2.0, C++]
I need some advice on CustomActions. My deployment project currently
has a CA during the install phase, which users enter a product key to verify
they are legitimate owners of the software. When the product key is
verified, the CA places an entry in the registry, which is referenced every
time the software is run. The CA is a dll with Install(MSIHANDLE) defined.
Everything works fine on all OS's except for Vista. I have found that with
Vista, any registry modifications have to be done in the Commit phase, not
the Install phase, of installation. If I move the CA to the Commit phase,
the installation is not rolled back when an invalid product key is entered.
What I need is a way to pass data entered in the Install phase CA to a CA in
the Commit phase to write info to the registry.
So far, I have tried defining 2 functions in the CA dll, Install(MSIHANDLE)
and Commit(MSIHANDLE). I tried using MsiSetProperty()/MsiGetProperty() to
pass data between the Install and Commit phases but MsiSetProperty() fails
to create an installer property.
Install(MSIHANDLE mh)
{.
MsiSetProperty(mh, "NewProp", "DataString"); // returns non ERROR_SUCCESS
.}
I have also tried passing the data by writing a temp file in the windows
directory and reading it in the Commit CA - this also fails on Vista. The
file is not written.
The only other option that I can think of is using the clipboard but I was
hoping there was a cleaner way to pass the data. Another solution would be
to give the CA the rights of the user who launched the Install, but the
project does not have options to set the NonImpersonate flag for CAs.
Thanks In Advance,
M