It's more likely related to something that is no longer correct during the
uninstall. Between DeleteServices and InstallFinalize the items that are
uninstalled include registry entries, type libraries, environment variables,
files, and folders. 

Deferred and before InstallFinalize basically means that nothing of your
product is left behind, so I would look for something your script requires
that is no longer there. Permissions don't change in that area of the
uninstall.

Phil  

-----Original Message-----
From: Brownfield, Cory [mailto:cbrownfi...@aeci.org] 
Sent: Friday, May 10, 2013 7:37 AM
To: wix-users@lists.sourceforge.net
Subject: [WiX-users] When are elevated permissions dropped?

To illustrate a problem I'm having with a real project, I created a test
script that runs a custom action that requires elevated privileges during
uninstalls.  If I configure it to run before "InstallFinalize" (deferred, no
impersonation), the uninstall fails to complete.  The event log says "A
program run as part of the setup did not finish as expected" and indicates
the program being called by the custom action.  Changing it to run after
"DeleteServices" works.  I think that this indicates a problem with
permissions.  Shouldn't the elevated permissions remain before
"InstallFinalize"?

Here's the script.  The custom actions and the install execute sequence are
the interesting parts:

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi";>
  <Product Id="*"
           Name="Foo2"
           Language="1033"
           Version="1.0.0.0"
           Manufacturer="Foo"
           UpgradeCode="55369FED-96BF-4D95-99E4-E7D746A54C62">
    <Package InstallerVersion="200"
             Compressed="yes"
             InstallScope="perMachine" />

    <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is
already installed." />
    <MediaTemplate />
    <Condition Message="You need to be an administrator to install this
product.">Privileged</Condition>

    <Feature Id="ProductFeature"
             Title="FooInstaller"
             Level="1">
      <ComponentGroupRef Id="ProductComponents" />
    </Feature>

    <CustomAction Id="AddEndpoint"
                  Execute="deferred"
                  Directory="INSTALLFOLDER"
                  ExeCommand="[SystemFolder]netsh.exe http add urlacl
url=http://+:49260/Foo2/ user=\Everyone"
                  Impersonate="no"
                  Return="check" />
    <CustomAction Id="DeleteEndpoint"
                  Execute="deferred"
                  Directory="INSTALLFOLDER"
                  ExeCommand="[SystemFolder]netsh.exe http delete urlacl
url=http://+:49260/Foo2/";
                  Impersonate="no"
                  Return="check" />

    <InstallExecuteSequence>
      <!-- Configure http ports -->
      <Custom Action="AddEndpoint"
              Before="InstallFinalize"><![CDATA[NOT Installed]]></Custom>
      <Custom Action="DeleteEndpoint"
              Before="InstallFinalize"><![CDATA[Installed AND NOT
REINSTALL]]></Custom>
    </InstallExecuteSequence>
  </Product>

  <Fragment>
    <Directory Id="TARGETDIR"
               Name="SourceDir">
      <Directory Id="ProgramFilesFolder">
        <Directory Id="INSTALLFOLDER"
                   Name="Foo2" />
      </Directory>
    </Directory>
  </Fragment>

  <Fragment>
    <ComponentGroup Id="ProductComponents"
                    Directory="INSTALLFOLDER">
      <Component Id="ProductComponent">
        <File Id="HelloFile"
              Name="HelloFile.txt"
              Source="hello.txt" />
      </Component>
    </ComponentGroup>
  </Fragment>
</Wix>
----------------------------------------------------------------------------
--
Learn Graph Databases - Download FREE O'Reilly Book "Graph Databases" is the
definitive new guide to graph databases and their applications. This
200-page book is written by three acclaimed leaders in the field. The early
access version is available now. 
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users



------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and 
their applications. This 200-page book is written by three acclaimed 
leaders in the field. The early access version is available now. 
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to