From a5f492acf19664593b040a8cdff1e5e251f65dba Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Mon, 29 Oct 2018 17:17:26 -0400 Subject: SL-9980: Launch the first-run updater via explorer.exe as we used to run the viewer from the installer. Turns out that the peculiar indirection through explorer.exe was a known trick for an elevated-privileges program to launch a program as the logged-in Windows user. (They could have commented that...) But explorer.exe doesn't pass command-line parameters, so if you want to pass any such to the actual target program, you have to launch a shortcut with those parameters. But this target program (the updater) and its parameters (precheck mumble) are specific to the very first viewer run after installation, so delete it after. Having an additional permanent icon that always runs the updater before the viewer would only confuse matters. --- indra/newview/installers/windows/installer_template.nsi | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/indra/newview/installers/windows/installer_template.nsi b/indra/newview/installers/windows/installer_template.nsi index 76187b49a5..adcf8fd0e4 100644 --- a/indra/newview/installers/windows/installer_template.nsi +++ b/indra/newview/installers/windows/installer_template.nsi @@ -705,10 +705,21 @@ Function .onInstSuccess # updater can detect the problem and adapt accordingly. # Once everything is in order, the updater will run the specified # viewer with the specified params. + # 'Exec updater' causes the viewer to inherit elevated Admin privileges. See + # http://mdb-blog.blogspot.com/2013/01/nsis-lunch-program-as-user-from-uac.html + # for workaround: running the updater via explorer.exe. + # Thing is, you can't pass parameters with the explorer.exe trick, so + # you have to create a shortcut or a .bat file. Since we don't want a + # permanent shortcut for the user to relaunch the updater like this + # first time, create it in a temp location and delete it once we've + # used it. # Quote the updater executable and the viewer executable because each # must be a distinct command-line token, but DO NOT quote the language # string because it must decompose into separate command-line tokens. - Exec '"$INSTDIR\$INSTEXE" precheck "$INSTDIR\$VIEWER_EXE" $SHORTCUT_LANG_PARAM' + CreateShortCut "$TEMP\SLFirst.lnk" "$INSTDIR\$INSTEXE" \ + 'precheck "$INSTDIR\$VIEWER_EXE" $SHORTCUT_LANG_PARAM' + Exec '"$WINDIR\explorer.exe" "$TEMP\SLFirst.lnk"' + Delete "$TEMP\SLFirst.lnk" Pop $R0 # FunctionEnd -- cgit v1.2.3