1

We had deployed our Notification area (Tray) app with a fault. It had no top level window and therefore did not receive WM_CLOSE events. In short, if Windows Installer tries to close it with its built in functions during an upgrade or uninstall (it shows a dialog to shut down the app), it will fail closing the app. The tray process is still running in Taskmanager and the exe file is therefore locked.

I would like to have the following:

The setup should kill the running tray application up until a specific file/install version. Or, if this is not possible prevent installation for old versions and tell the user to manually remove it.

I tried to start Notepad (as test) for old versions before the "please shutdown" dialog appears but did not succeeded.

I tried to start it with Before="ValidateInstall" but it did not run. I tried to start it with After="ValidateInstall" then notepad opened but ran AFTER the setup detected that the file is running.

Perhaps not all properties are set Before="ValidateInstall"?

Perhaps my Custom Actions are somehow autmatically deferred?

Some code snippets:

<Product Id="*" 
    Codepage="65001" 
    Language="!(loc.LANGUAGE)" 
    Manufacturer="$(var.AppManufacturer)" 
    Name="$(var.AppCode), $(var.AppVersion)"
    UpgradeCode="$(var.AppUpgradeCode)"
    Version="$(var.AppVersion)">

    <Package Comments="$(var.AppCode), 
            $(var.AppVersion)" 
            Compressed="yes" 
            InstallPrivileges="limited"
            InstallScope="perUser" 
            InstallerVersion="301" 
            Languages="!(loc.LANGUAGE)" 
            Manufacturer="$(var.AppManufacturer)" 
            Platform="x86"  
            SummaryCodepage="1252"/>

    <Property Id="PROP_APP_IGNORES_SHUTDOWN">
       <DirectorySearch Id="DirSrch_PIAS_Version" Path="[DIR_ID_USERPROGRAMFOLDER]">
           <FileSearch Name="$(var.MyExe.TargetFileName)"
                       MaxVersion="6.1.3432.99999"/> 
       </DirectorySearch>
    </Property>

    <Property Id="QtExecCmdLine" 
            Value='"$(var.SysSystem32)\taskkill.exe" /F /IM $(var.MyExe.TargetFileName)'/>
    <CustomAction  Id="CA_KillApp" 
                BinaryKey="WixCA" 
                DllEntry="CAQuietExec" 
                Execute="immediate" 
                Impersonate="yes" 
                Return="ignore" />

    <Property Id='NOTEPAD'>$(var.SysWindir)\Notepad.exe</Property>
    <CustomAction Id="CA_OpenNotepad" 
                Property="NOTEPAD" 
                ExeCommand="" 
                Return="asyncNoWait" />

    <MajorUpgrade Schedule="afterInstallValidate" 
              DowngradeErrorMessage="[VSDVERSIONMSG]" 
              AllowDowngrades="no"  
              AllowSameVersionUpgrades="yes" />
    <InstallExecuteSequence>
        <Custom Action="CA_OpenNotepad" Before="CA_KillApp">PROP_APP_IGNORES_SHUTDOWN</Custom>
        <Custom Action="CA_KillApp" Before="InstallValidate">PROP_APP_IGNORES_SHUTDOWN</Custom>
    </InstallExecuteSequence>
</Product>
Rob Mensching
  • 33,834
  • 5
  • 90
  • 130
user2334883
  • 401
  • 4
  • 4

0 Answers0