haskell-platform icon indicating copy to clipboard operation
haskell-platform copied to clipboard

It should be possible to run the Windows installer as non-admin

Open r0ml opened this issue 11 years ago • 1 comments

Current installer almost works when run under a limited user account, but the error message could be more clear. A more ambitious goal is to support a special "limited user" install mode.

r0ml avatar Mar 20 '14 20:03 r0ml

This turned out to be harder than I expected. The recommended way is to just set RequestExecutionLevel to admin, but we can't do that since we also want to allow non-admin users to run the installer in portable mode. The UAC plugin is supposed to help with that, but I can't get the examples to compile ("Invalid command: UAC::_").

I tried doing the following:

!macro CheckAdmin thing
UserInfo::GetAccountType
pop $0
${If} $0 != "admin" ;Require admin rights on NT4+
    MessageBox MB_YESNO "It is recommended to run this \
    ${thing} as administrator. Do you want to try to elevate privileges?" \
    IDNO CheckAdminDone
    SetErrorLevel 740 ;ERROR_ELEVATION_REQUIRED
    Quit
CheckAdminDone:
${EndIf}
!macroend

but the return code seems to have no effect. MultiUser.nsh seems to be old XP-era code that doesn't know about UAC prompts.

If anyone has ideas on how to proceed, I'm eager to listen. For now, I've just added a warning if the installer is run as non-admin.

r0ml avatar Mar 20 '14 20:03 r0ml