+ Reply to Thread
Results 1 to 5 of 5

Thread: How can we change Execution Level runtime

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Aug 2020
    Location
    Pune, India
    Posts
    49

    Default How can we change Execution Level runtime

    Hello,

    I am not sure whether it is possible or not, Can we change UAC execution level dynamically?

    Requirement:
    1. We want to show user 2 options : A. Machine Wide B. Per-User
    2. If user selects Machine Wide option then we want to ask user for permission(UAC) and set installation path in Program Files.(like highestAvailable)
    3. If user selects Per-User option the we don't want to ask user permission and set installation in LocalAppData.(like asInvoker)

    I guess its not possible but can we do installation in Program Files without UAC permission.


    Thanks in Advance!

  2. #2
    Join Date
    Mar 2004
    Posts
    4,307

    Default Re: How can we change Execution Level runtime

    Hello,

    the manifest in an executable determines the execution level. So Windows does not allow to change the execution level "dynamically".

    What you have to do in this case is to use an "asInvoker" wrapper. This runs by default "per-user". Ask the "per-user" / "per-machine" question and if it is a per-machine install, start the main installation elevated from this wrapper.

    BTW, never use "highestAvailable". Use asInvoker or requireAdministrator.

    Windows does not allow to write to protected resources (e.g. Program Files, Windows, HKEY_LOCAL_MACHINE) from a non-elevated running application.

    Friedrich

  3. #3
    Join Date
    Aug 2020
    Location
    Pune, India
    Posts
    49

    Default Re: How can we change Execution Level runtime

    Thanks for the immediate reply!

    What do you mean by wrapper?

    Can you please elaborate "start the main installation elevated from this wrapper." ?

  4. #4
    Join Date
    Mar 2004
    Posts
    4,307

    Default Re: How can we change Execution Level runtime

    Hello,

    You have several different options. I have uploaded a quick-and-dirty demo project:

    https://www.setupbuilder.com/projects/UserOption.zip

    By default, it runs (on UAC-aware) operating systems "asInvoker" (per-user). You can select "per-machine" and it re-starts itself as "requireAdministrator" (per-machine).-

    Does this help?

    Friedrich

  5. #5
    Join Date
    Aug 2020
    Location
    Pune, India
    Posts
    49

    Default Re: How can we change Execution Level runtime

    Yes, it helps us to achieve our requirement.

    Thanks you very much Friedrich for the demo application.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts
  •