Archive: access without administration rights


access without administration rights
I run installer with RequestExecutionLevel user and

Function .onInit
!insertmacro useUAC
!insertmacro MULTIUSER_INIT
...

then run silent installer RequestExecutionLevel user and

Function .onInit
!insertmacro useUAC
!insertmacro MULTIUSER_INIT
....

1) I call two !insertmacro useUAC - it is bad
2) not have rights for delete or change key in registry
Function un.onInit
!insertmacro useUAC
!insertmacro MULTIUSER_UNINIT


If i run subinstaller without !insertmacro useUAC i cant access to registry and Program Files


Please do not use the UAC plugin for getting admin access. It is much too complex for such a simple task. And if I recall correctly, it cannot be used together with multiuser.nsh. In fact, multiuser.nsh isn't really designed for new versions of Windows. You're better off not using it if you ask me.

What you need can be done much simpler:
1) use "requestexecutionlevel admin"
2) in .onInit, use the UserInfo plugin to verify that the user really has admin access
3) Always install for all users. Admin-level installers should always install for all users, *especially* if the user running the installer is not an administrator himself. This is how windows is designed to be used.


bad idea
1) use use "requestexecutionlevel admin"
then all nsis const return path like administation
installer write all in application data admin
i want say when i write in registry i write in admin account key


If you're writing to HKLM, you should also be writing to all users's appdata. As I said, that's how Windows is designed to be used. If your application requires some files to be present in the *user's* appdata, you need to code your app to copy those files from alluser appdata (if they don't exist in the user's appdata yet).

(Edit: The reason why the app should do this, and not the installer itself, is that there's no way for the installer to know which users will be running the app. You cannot extract files if the installer doesn't know where they need to go.)


I know but i want change Internet explorer key. I most write in the curent user, Or i most run application and in app change reg key ?


If you want to change a registry key in HKLM, you should install as all users, using admin access.
If you want to change a registry key in HKU, you can install for a single user, using userlevel access.

What key do you want to change?


HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main

but if i run with userlevel access. i change registry but can not create folder and register dll in the system

but if i run with admin access i can reg dll but cant change registry key


Maybe better for change registry write small *.bat or *exe file on с++/Delphi


There are several ways you can do this (enumusersreg, uac plugin, runas through system plugin...), but I still say they are all wrong. I don't know what it is you want to do in HKCU\IE\Main, but I'd make sure that there isn't some all-user setting for this before messing with userlevel settings for an alluser-type application.

If there's really no other way: You can use enumusersreg to change the HKCU of every user if you want to install for every single user separately, or you can use the UAC plugin to only install for the user who executed the installer (expert option, I don't recommend it).


Thanks for EnumUsersReg. If i have any problem i write in this post within a week.


How i can Push my params in then EnumUsersReg function ?


I have next problem:
i write install with admin righth

install applixation on user without admin rights + UAC
1)
when i uninstall application uninstall not have righths for program files, unreg dll file, clear registry, and etc!!!

When I add UAC function in the uninstall section all good but uninstall runs twice.

Function un.onInit
;!insertmacro useUAC
!insertmacro MULTIUSER_UNINIT

2)
in user user without admin rights + UAC I can not run *.exe file i try
- !insertmacro UAC_AsUser_ExecShell "open" "${FF_REGISTRATION}" "" "" ""
- Exec "$INSTDIR\${FF_REGISTRATION}"
not work


Again, please do not use the UAC plugin for this.

Use "requestexecutionlevel admin", and in both .onInit AND un.onInit use the UserInfo plugin to verify that the installer really has admin access (and if it doesn't, show a MessageBox error and quit).


HOW? in Windows7 this code not work!
System::Call "kernel32::GetModuleHandle(t 'shell32.dll') i .s"
System::Call "kernel32::GetProcAddress(i s, i 680) i .r0"
System::Call "::$0() i .r0"
${If} $0 == 0
MessageBox MB_OK "You must have Administrator privileges to install this application.$\nPlease log in as Administrator and start the installation again."
Quit
${EndIf}


Why are you calling IsUserAnAdmin by ordinal?

Use the UserInfo plugin!


http://nsis.sourceforge.net/Examples...o/UserInfo.nsi - fuk, not work always say that i am administrator group


If it says it has admin access, then it's working, isn't it? Isn't that what you've been trying to accomplish?


then it's working, isn't it? - No because i login as USER accoun.

let's try from start: I want in user in windows7:
1) write in registry &
2) register dll file
3) run exe file

and all that in one installer. I try write two silent install one for write in the registry and dll registry with admin right and two with user rughts + !includemacro useUAC for run Exe file. but did not work two silent installer run not correctly


The userinfo plugin is to ensure that you have admin access to begin with. It doesn't have anything to do with running a userlevel exe from an admin installer.

To run a userlevel exe from an admin installer, you can either use the UAC plugin (see the example nsi scripts shipped with the plugin!), or use the ShellExecAsUser plugin.

Once again, I repeat that what you want to accomplish is NOT easy to do for a beginner. You should probably rethink your installer strategy, instead.


i know it`s hard, because I wrote this for you so that you have helped me in. ok thanks for help. if you have any ideas write me in the post or send mail.