Qt application with autoupdate feature

Answered

Comments

1 comment

  • Avatar
    wojciechka

    The issue is related to UAC feature and is not specific to Qt, but is how Windows Vista and newer versions are designed.

    By default the autoupdate binary is set to run as elevated and this is why you cannot run it as on Windows, non-elevated processes cannot run elevated processes for security reasons.

    What you can do is set autoupdate binary to run as normal binary and have the installer elevated. You can set the autoupdate not to be elevated by doing:

    <autoUpdateProject>
      <shortName>autoupdate</shortName>
      <requestedExecutionLevel>asInvoker</requestedExecutionLevel>
      <!-- any other customizations you might have had for the autoupdate -->
    </autoUpdateProject>
    

    And then building the autoupdate binary by doing:

    C> path\\to\\autoupdate\\bin\\customize build autoupdate-windows.xml windows
    

    This way the autoupdate binary can be run mechanisms such as QProcess.

    However, this will also require that the binary be started as elevated. In this case, autoupdate binary needs to invoke it using "cmd /c start" syntax. It will run the binary using the system shell and prompt the user for elevation (and/or elevated username/password).

    This can be done in <postUpdateDownloadActionList>:

    <autoUpdateProject>
      <shortName>autoupdate</shortName>
      <requestedExecutionLevel>asInvoker</requestedExecutionLevel>
      <postUpdateDownloadActionList>
        <runProgram>
          <program>cmd</program>
          <programArguments>/c start "${downloadedFilePath.dos}" &amp;</programArguments>
        </runProgram>
      </postUpdateDownloadActionList>
      <!-- any other customizations you might have had for the autoupdate -->
    </autoUpdateProject>
    

Please sign in to leave a comment.