Reboot uses wrong registry key

Dec 8, 2011 at 3:57 PM


I just checked the dotNetInstallerLib/InstallerSession.cpp code file, and for some reason you've setup the app to enable restart using this registry key path:


This requires Administrator privileges, and I'm creating an installer without Admin rights.
Instead you could just use this path:


I've been trying to re-compile the code with this fix, however I'm unfortunately not able to due the missing dependencies which would take me quite some time to setup.
Is there any chance you (or anyone in this community) could re-compile dotNetInstaller with the above small fix?

Here is the only two functions in the file that has been updated:

InstallerSession::EnableRunOnReboot(const std::wstring& add) { std::wstring reboot_cmd = GetRebootCmd(add); std::wstring filename = DVLib::GetFileNameW(DVLib::GetModuleFileNameW()); LOG(L"Writing HKEY_CURRENT_USER\\" << REGISTRY_CURRENTVERSION_RUN << L"\\" << filename << L": " << reboot_cmd); DVLib::RegistrySetStringValue(HKEY_CURRENT_USER, REGISTRY_CURRENTVERSION_RUN, filename, reboot_cmd); }; void InstallerSession::DisableRunOnReboot() { std::wstring name = DVLib::GetFileNameW(DVLib::GetModuleFileNameW()); if (DVLib::RegistryValueExists(HKEY_CURRENT_USER, REGISTRY_CURRENTVERSION_RUN, name)) { DVLib::RegistryDeleteValue(HKEY_CURRENT_USER, REGISTRY_CURRENTVERSION_RUN, name); } }


Dec 11, 2011 at 2:03 PM

Why do you think this should be HKCU? Most software installs per machine, so rerunning the installer is set per-machine. This may need a feature request to allow you to vary HKCU and HKLM for this.

Dec 11, 2011 at 2:20 PM

But what is the benefit of running it as HKLM? All it is used for here is to restart the installer, and it should be safe to assume that it is the same user who started the installer that will finish the installation after restart.

Maybe I'm missing something? :D

I use it for a smooth ClickOnce installer, which doesn't required Administrator rights to install - this is mainly to minimize the number of "Administrator Elevation" popups to provide the easiest installation with minimum number of clicks for best user experience. By accessing HKLM, I need Administrator rights.

Dec 11, 2011 at 11:40 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Dec 11, 2011 at 11:41 PM

I realize I wasn't clear. There's no benefit. Some installations are per-machine (require admin privileges) and some are per-user (don't require admin privileges). Currently DNI supports per-machine only for the reboot scenarios, so this is a feature request. I created - will gladly take a patch that adds an option to use HKCU for reboot.

Dec 12, 2011 at 11:12 AM

Great thanks a lot.

While you are at it, please add an option to remove the "[||] [ ] [ ] [ ] [ ]" loading animation in the small windows while DNI is waiting for the executables to launch (just a UI thing, as they look very DOS-like and unprofessional :) 

Dec 15, 2011 at 7:36 PM

Fyi, if you want this feature you should find a dev to implement it, I wouldn't expect it from anyone I know who's involved in DNI unless they need it.

You can remove the progress animation with the show_progress_dialog option.