5

I'm creating msi-installer for a product and I need to launch web url in browser after installation. I use WIX 3.5 to create installer (but this probably doesn't important). The example I found in http://www.tramontana.co.hu/wix/lesson5.php#5.2 not work - installer log say's

"Action ended 15:27:30: LaunchBrowser. Return value 1631.".

I saw many posts about this problem in the internet but nobody provides solution (somebody found problem in multilanguage, somebody contacted Microsoft to solve that).

I can only guess that the problem is somewhere in security of Windows 7 (I encountered problem with it). Maybe windows installer is forbidden to launch exe-files (I tried many other examples with other exe-s but all had the same result).

Has anybody a general solution?

Sasha
  • 8,537
  • 4
  • 49
  • 76
  • What type of custom action are you using? Did you try a simple EXE which uses ShellExecute to launch the URL? – Cosmin Jun 07 '11 at 20:07
  • I'm having the same issue with a type 50 custom action running in asynchronous mode (no wait for completion), so it's actually a 242 type. It used to work in Windows versions previous to Server 2008 R2 – Juan C. Becerra Oct 22 '12 at 22:39

2 Answers2

3

I suppose the problem was really with UAC security. To give a custom actinon administrative permissions we should make it deffered, like this:

<CustomAction Id="LaunchBrowser" Directory="TARGETDIR" Impersonate="no" Execute="deferred" ExeCommand="[BrowserExePath] [LaunchingUrl]" Return="check"/>

And I would highly recommend this blog post about custom actions - it completely changed my vision of them.

Sasha
  • 8,537
  • 4
  • 49
  • 76
  • Doesn't deferred just change *when* the action executes? I believe it is setting Impersonate="no" that actually does the permission change since it makes the CA run with the System account. Also I have found a big cause of 1631 errors is incorrect use of double quoting. Some strings should not be double quoted (e.g. the paths of the EXE to run), while others may need double quotes (e.g. the parameters you put into ExeCommand). – donovan Dec 06 '12 at 03:42
  • No, deffered actions are the only actions that gets elevated permissions. You should read the blog post I recommended in my answer to know this and many other nuances of custom actions – Sasha Dec 06 '12 at 10:45
0

Here is what I did for both install and uninstall.

At first I also got "Return value 1631" and spent a lot of time with UAC security, elevating privileges, Impersonate="yes" and Execute="deferred" which didn't work.

But in the end it was fixed very simply when I correctly set Directory="TARGETDIR" rather than BinaryKey="WixCA"

<Product>

...

<CustomAction Id="LaunchBrowserInstall" Directory="TARGETDIR" Execute="immediate" Impersonate="yes" Return="asyncNoWait" ExeCommand="explorer.exe https://www.example.com/post_install/" />

    <CustomAction Id="LaunchBrowserUninstall" Directory="TARGETDIR" Execute="immediate" Impersonate="yes" Return="asyncNoWait" ExeCommand="explorer.exe https://www.example.com/post_uninstall/" />

    <InstallExecuteSequence>
        <Custom Action="LaunchBrowserInstall" After="InstallFinalize">NOT Installed AND NOT REMOVE</Custom>
        <Custom Action="LaunchBrowserUninstall" After="InstallFinalize">REMOVE ~= "ALL"</Custom>
    </InstallExecuteSequence>

...

</Product>
slfan
  • 8,950
  • 115
  • 65
  • 78
SebK
  • 499
  • 4
  • 2