Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wix installer CAQuietExec custom action

I'm trying to execute a custom action in a Wix installer, to grant permission to bind to a HTTP socket, on Windows Server 2008. However the installer isn't quite working.

<CustomAction Id="GrantHttpPermission_Cmd" Property="GrantHttpPermission" Value="&quot;[SystemFolder]netsh.exe http add urlacl url=http://+:8732/ user=Service_account&quot;" Execute="immediate"/>
<CustomAction Id="GrantHttpPermission" BinaryKey="WixCA" DllEntry="CAQuietExec" Execute="deferred" Return="check" Impersonate="no"/>

...

<InstallExecuteSequence>
  <Custom Action="GrantHttpPermission_Cmd" After="CostFinalize"/>
  <Custom Action="GrantHttpPermission" After="ConfigureUsers">NOT Installed</Custom>
</InstallExecuteSequence>

Running the installer in debug mode I get the following failure. I also tried running the installer as Administrator, with the same output

MSI (s) (14:20) [11:03:00:440]: Executing op: CustomActionSchedule(Action=GrantHttpPermission,ActionType=3073,Source=BinaryData,Target=CAQuietExec,CustomActionData="C:\Windows\SysWOW64\netsh.exe http add urlacl url=http://+:8732/ user=Service_account")
MSI (s) (14:24) [11:03:00:440]: Invoking remote custom action. DLL: C:\Windows\Installer\MSIF794.tmp, Entrypoint: CAQuietExec
CAQuietExec:  Error 0x80070002: Command failed to execute.
CAQuietExec:  Error 0x80070002: CAQuietExec Failed
CustomAction GrantHttpPermission returned actual error code 1603 (note this may not be 100% accurate if translation happened inside sandbox)
Action ended 11:03:00: InstallFinalize. Return value 3.

Can anyone shed any light on what's up with that command?

like image 220
Ceilingfish Avatar asked Aug 01 '11 10:08

Ceilingfish


2 Answers

Turns out it was to do with correctly quoting the command. The GrantHttpPermission_Cmd line needed the " moving to around the executable, not the entire command, and the [SystemFolder] part was not required. Final command looked like this:

<CustomAction Id="GrantHttpPermission_Cmd" Property="GrantHttpPermission" Value="&quot;netsh.exe&quot; http add urlacl url=http://+:8732/ user=Service_account" Execute="immediate"/>

All the other commands were the same.

like image 51
Ceilingfish Avatar answered Nov 15 '22 09:11

Ceilingfish


Try this:

<CustomAction Id="GrantHttpPermission_Cmd" Property="GrantHttpPermission" Value="[SystemFolder]netsh.exe http add urlacl url=http://+:8732/ user=Service_account" Execute="immediate"/>

If you enclose the value in quotes (&quot;), you will get an invalid command line:

"C:\Windows\System32\netsh.exe http add urlacl url=http://+:8732/ user=Service_account"
like image 44
rmrrm Avatar answered Nov 15 '22 11:11

rmrrm