[wix-users] Certificate is not removed in my version of IIS custom action

Mihajlo Cvetanović mcvetanovic at gmail.com
Thu Jan 18 14:09:51 PST 2018


It appears that isAction is set to INSTALLSTATE_UNKNOWN when a given
component (holding a certificate) is shared between two different installed
products, and so the component should not be removed at this time. I just
wish that there was a different state that would clearly show this, like
INSTALLSTATE_IGNORESHARED, or something written about it in documentation.

On Tue, Jan 16, 2018 at 3:32 PM, Mihajlo Cvetanović <mcvetanovic at gmail.com>
wrote:

> Bumping the question, and here's the short version: why, during uninstall,
>  MsiGetComponentState sets fourth parameter isAction to
> INSTALLSTATE_UNKNOWN for an installed component, on custom action
> scheduled before RemoveFiles?
>
> On Fri, Jan 12, 2018 at 3:33 PM, Mihajlo Cvetanović <mcvetanovic at gmail.com
> > wrote:
>
>> I want to use my own CA to (un)install certificates, to avoid
>> error 26352. So I took lots of code from wix3 github, tweaked it, and
>> successfully installed certificates when I register them in my own table
>> MyCertificate:
>>
>>     <CustomTable Id="MyCertificate">
>>       <Row>
>>         <Data Column="Certificate">CertRowIdentifier</Data>
>>         <Data Column="Component_">ComponentIdentifier</Data>
>>         <Data Column="Name">Cert friendly name</Data>
>>         <Data Column="StoreLocation">2</Data>
>>         <Data Column="StoreName">root</Data>
>>         <Data Column="Attributes">2</Data>
>>         <Data Column="Binary_">CertBinaryIdentifier</Data>
>>       </Row>
>>     </CustomTable>
>>
>> I believe <iis:Certificate> element does more or less the same thing
>> (just inserts one row in its own Certificate table).
>>
>> Problem is that certificates don't get removed on uninstall. In my
>> version of ConfigureCertificates function (just changed the names of tables
>> and custom actions in string literals) the call to MsiGetComponentStateW
>> sets isInstalled variable to INSTALLSTATE_LOCAL and isAction
>> to INSTALLSTATE_UNKNOWN, and so a couple of lines below the
>> function WcaIsUninstalling returns 0. Even though uninstall is in progress.
>>
>> What am I doing wrong? Here's mentioned code from ConfigureCertificates,
>> so you don't have to consult guthub. BTW WcaLog doesn't write to log file,
>> don't know why:
>>
>>         er = ::MsiGetComponentStateW(WcaGetInstallHandle(),
>> pwzComponent, &isInstalled, &isAction);
>>         hr = HRESULT_FROM_WIN32(er);
>>         ExitOnFailure1(hr, "failed to get state for component: %ls",
>> pwzComponent);
>>
>>         if (!(WcaIsInstalling(isInstalled, isAction) &&
>> SCA_ACTION_INSTALL == saAction) &&
>>             !(WcaIsUninstalling(isInstalled, isAction) &&
>> SCA_ACTION_UNINSTALL == saAction) &&
>>             !(WcaIsReInstalling(isInstalled, isAction)))
>>         {
>>             WcaLog(LOGMSG_VERBOSE, "Skipping non-action certificate:
>> %ls", pwzId);
>>             continue;
>>         }
>>
>> It's maybe important, maybe not, but I commented out the code in
>> scacert.cpp that writes certificate hashes to CertificateHash table
>> (function WcaAddTempRecord(..., L"CertificateHash", ...)), because I
>> don't know how to replicate that part, and simply adding my version of this
>> custom table "doesn't work".
>>
>>
>



More information about the wix-users mailing list