Skip to content

dotNetInstaller restarts in infinite loop when administrator_required=True and UAC is off #4

Open
jennings opened this Issue May 4, 2012 · 6 comments

3 participants

@jennings
jennings commented May 4, 2012

I'm using dotNetInstaller.exe version 2.0.81.0. When the following criteria are met, dotNetInstaller seems to enter an infinite loop of relaunching itself:

  • administrator_required=True on the configuration element
  • Operating system is Windows 7
  • UAC is disabled on the system
  • The current user is not an administrator

The log file shows the following (this repeats constantly since the installer is relaunching):

2012-05-04 12:59:41 -------------------------------------------------------------------
2012-05-04 12:59:41 dotNetInstaller (DNI), version 2.0.81.0
2012-05-04 12:59:41 Copyright (c) DevAge, Vestris Inc. & Contributors
2012-05-04 12:59:41 Operating system: Windows 7 SP1
2012-05-04 12:59:41 -------------------------------------------------------------------
2012-05-04 12:59:41 Sequence: install
2012-05-04 12:59:41 UI level: full
2012-05-04 12:59:41 Configuration language id: 1033 
2012-05-04 12:59:41 -- Loading supported components (lcid=1033)
2012-05-04 12:59:41 -- mysetup.msi (display_name='mysetup.msi', os_filter_lcid=, os_filter=, os_filter_min=, os_filter_max=, processor_architecture_filter=): LOADED
2012-05-04 12:59:41 --- Loaded 1 supported component(s)
2012-05-04 12:59:41 -- mysetup.msi (mysetup.msi): NOT INSTALLED
2012-05-04 12:59:41 IsProcessElevated: no
2012-05-04 12:59:41 Restarting as elevated user:  /Autostart
2012-05-04 12:59:42 -------------------------------------------------------------------
2012-05-04 12:59:42 dotNetInstaller (DNI), version 2.0.81.0
2012-05-04 12:59:42 Copyright (c) DevAge, Vestris Inc. & Contributors
2012-05-04 12:59:42 Operating system: Windows 7 SP1
2012-05-04 12:59:42 -------------------------------------------------------------------
2012-05-04 12:59:42 Sequence: install
2012-05-04 12:59:42 UI level: full
2012-05-04 12:59:42 Configuration language id: 1033 
2012-05-04 12:59:42 -- Loading supported components (lcid=1033)
2012-05-04 12:59:42 -- mysetup.msi (display_name='mysetup.msi', os_filter_lcid=, os_filter=, os_filter_min=, os_filter_max=, processor_architecture_filter=): LOADED
2012-05-04 12:59:42 --- Loaded 1 supported component(s)
2012-05-04 12:59:42 -- mysetup.msi (mysetup.msi): NOT INSTALLED
2012-05-04 12:59:42 IsProcessElevated: no
2012-05-04 12:59:42 Autostart: automatically starting install
2012-05-04 12:59:42 Restarting as elevated user:  /Autostart
....

I see that in the dotNetInstallerToolsLib file UACElevation.cpp, there's a method DVLib::ShellElevated(...) that uses ShellExecuteEx with lpVerb="runas". It seems that when UAC is off, passing "runas" is the same as passing "open", and then the child process does the same thing, leading to an infinite loop. Moreover, the manifest doesn't seem to matter, because requireAdministrator doesn't appear to do anything if UAC is off, at least not in this situation.

I tried researching for what to do in this situation (UAC is off, want to programmatically launch a program as an administrator), but I can't figure out what the solution is. Win7 has the verb "runasuser", but Vista doesn't have this. If there's no way to force the "run as different user" prompt, then I think DNI should pop the administrator_required_message dialog immediately on launch.

Configuration:

<?xml version="1.0" encoding="utf-8"?>
<configurations lcid_type="UserExe" show_language_selector="False" language_selector_title="" language_selector_ok="OK" language_selector_cancel="Cancel" configuration_no_match_message="" ui_level="full" fileversion="" productversion="" log_enabled="True" log_file="dotNetInstallerLog.log">
  <schema version="2.0.81.0" generator="dotNetInstaller InstallerEditor" />
  <configuration dialog_caption="Administrator_required test case" dialog_message="Upon clicking &quot;Install&quot;, the installer enters an infinite loop&#xD;&#xA;of restarting itself trying to &quot;elevate&quot; itself." dialog_message_uninstall="" dialog_bitmap="" skip_caption="Skip" install_caption="Install" uninstall_caption="Uninstall" cancel_caption="Close" status_installed="" status_notinstalled="" failed_exec_command_continue="Failed to install %s. Continue with others components?" installation_completed="APPLICATION_NAME installed successfully!" uninstallation_completed="APPLICATION_NAME uninstalled successfully!" installation_none="APPLICATION_NAME is already installed!" uninstallation_none="APPLICATION_NAME is not installed!" installing_component_wait="" uninstalling_component_wait="" reboot_required="To continue the installation you must restart your computer. Restart now?" must_reboot_required="False" dialog_otherinfo_caption="" dialog_otherinfo_link="" complete_command="" complete_command_silent="" complete_command_basic="" wait_for_complete_command="True" auto_close_if_installed="True" auto_close_on_error="False" reload_on_error="True" dialog_show_installed="True" dialog_show_uninstalled="True" dialog_show_required="True" cab_dialog_message="%s" cab_cancelled_message="" cab_dialog_caption="" cab_path="#TEMPPATH\#GUID" cab_path_autodelete="True" dialog_default_button="cancel" dialog_position="" dialog_components_list_position="" dialog_message_position="" dialog_bitmap_position="" dialog_otherinfo_link_position="" dialog_osinfo_position="" dialog_install_button_position="" dialog_cancel_button_position="" dialog_skip_button_position="" auto_start="False" auto_continue_on_reboot="False" reboot_cmd="" show_progress_dialog="True" show_cab_dialog="True" disable_wow64_fs_redirection="False" administrator_required="True" administrator_required_message="APPLICATION_NAME installation requires administration rights." type="install" lcid_filter="" language_id="" language="" os_filter="" os_filter_min="" os_filter_max="" processor_architecture_filter="" supports_install="True" supports_uninstall="True">
    <component package="#APPPATH\mysetup.msi" cmdparameters="" cmdparameters_silent="/qn" cmdparameters_basic="/qb-" uninstall_package="" uninstall_cmdparameters="/qb-" uninstall_cmdparameters_silent="/qn" uninstall_cmdparameters_basic="/qb-" disable_wow64_fs_redirection="False" id="mysetup.msi" display_name="mysetup.msi" uninstall_display_name="" os_filter="" os_filter_min="" os_filter_max="" os_filter_lcid="" type="msi" installcompletemessage="" uninstallcompletemessage="" mustreboot="False" reboot_required="" must_reboot_required="False" failed_exec_command_continue="" allow_continue_on_error="True" default_continue_on_error="False" required_install="True" required_uninstall="True" selected_install="True" selected_uninstall="True" note="" processor_architecture_filter="" status_installed="" status_notinstalled="" supports_install="True" supports_uninstall="True" show_progress_dialog="True" show_cab_dialog="True" />
  </configuration>
</configurations>
@dblock
Owner
dblock commented Jun 15, 2012

Requiring elevation on launch would mean embedding a manifest that says to do so - you have to know upfront that this is going to be a problem. I think the best fix would be to check whether elevation is enabled/disabled and error in this case.

@jennings

Just making sure my description was clear, I tested this both with and without a manifest that has level="requireAdministrator", but the same problem happens regardless.

@dblock
Owner
dblock commented Jun 15, 2012

So it runs but just doesn't elevate? Ouch.

@rscalet
rscalet commented May 18, 2016

@jennings
Were you able to come up with a workaround for this?
Thanks

@jennings

I don't think so, but honestly I don't really remember.

@rscalet
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.