ExePackage does not run elevated although PerMaschine is set to "yes"

-1

In my WIX-Bundle, i have an ExePackage like the following:

It executes a ConsoleApplication which tries to open an write to a HKLM-Registry entry which fails when triggered out of the bundle. In cmd, everything works fine when executed as admin:

<ExePackage Id="SqlServerAuthConfig"
                  DisplayName="Configuration of SQL-Server Auth-Mode"
                  Compressed="yes"
                  PerMachine="yes"
                  Vital="yes"
                  Name="DatabaseMigrator.exe"
                  SourceFile="Migrator/DatabaseMigrator.exe"
                  InstallCommand="-ac -s &quot;localhost\SQLEXPRESS&quot;>
    <Payload Compressed="yes" SourceFile="Migrator/Common.dll" />
    <Payload Compressed="yes" SourceFile="Migrator/NPoco.dll" />
    <Payload Compressed="yes" SourceFile="Migrator/NLog.dll" />
</ExePackage>

Is there anything that could prevent this package from being executed with eleveated privilieges that i am not aware of? Also, is there a way to get th econsole-output (console-log) of the app into the bundle log for better debugging?

Edit

This is an except from the Bundle-Log regarding the execution of the ExePackage:

[1760:1510][2015-05-27T08:14:26]i301: Applying execute package: SqlServerAuthConfig, action: Install, path: C:\ProgramData\Package Cache\55E9EE89B506B4D626529F73B05E246CA13BE84B\DatabaseMigrator.exe, arguments: '"C:\ProgramData\Package Cache\55E9EE89B506B4D626529F73B05E246CA13BE84B\DatabaseMigrator.exe" -ac -s "localhost\SQLEXPRESS"'
[1760:1510][2015-05-27T08:14:30]e000: Error 0x80070003: Process returned error: 0x3
[1760:1510][2015-05-27T08:14:30]e000: Error 0x80070003: Failed to execute EXE package.
[091C:0094][2015-05-27T08:14:30]e000: Error 0x80070003: Failed to configure per-machine EXE package.
[091C:0094][2015-05-27T08:14:30]i319: Applied execute package: SqlServerAuthConfig, result: 0x80070003, restart: None
[091C:0094][2015-05-27T08:14:30]e000: Error 0x80070003: Failed to execute EXE package.
wix
bootstrapper
elevated-privileges
asked on Stack Overflow May 27, 2015 by nozzleman • edited May 27, 2015 by nozzleman

1 Answer

1

I don't think the problem relates to DatabaseMigrator.exe not running elevated. The burn engine uses the WIN32 API CreateProcess() to run ExePackage, so the ExePackage runs at the same privilege elevation as the burn engine, which is "Administrator".

The return value from running the execute package SqlServerAuthConfig is: 0x3. This could be a WIN32 error or a value returned from the main function of the console program. As a WIN32 error, the value 0x3 corresponds to "The system cannot find the path specified.", which could be from CreateProcess() or from DatabaseMigrator.exe. Suggest double checking file paths relating to DatabaseMigrator.exe.

The InstallCommand attribute doesn't look well formed. Should this be:

InstallCommand="-ac -s &quot;localhost\SQLEXPRESS&quot;">

Is there a way to get the console output? For WIX 3.9 and earlier this is not possible. The burn engine uses the WIN32 API function CreateProcess() to run the ExePackage, but the hStdInput, hStdOutput and hStdError handles are not hooked up to anything in the call, so all output is lost.

answered on Stack Overflow May 27, 2015 by bradfordrg • edited May 27, 2015 by bradfordrg

User contributions licensed under CC BY-SA 3.0