Win32 installers: is there a way to write to HKU startup for each user?
-
02-06-2021 - |
Pregunta
Is there a Windows installer that will add to startup for each user like
<user>\Software\Microsoft\Windows\CurrentVersion\Run
for each user on the system? I can't write to HKLM because the program being installed is hardcoded to work with HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run
when toggling the start-on-login preference.
I'm also wondering how to deal with the situation where a user is created after the application is installed. Is there a place where I can put a key in a default registry profile?
Also what installer do you guys use? NSIS? Inno Setup? Advanced Installer?
Thanks
Solución
Windows has a thing called Active Setup, it allows you to "runonce" something for each user on the machine.
NSIS has a helper script called EnumUsersReg, it does its best to give you access to all HKCUs on the local machine as long as you have administrator rights.
To set defaults for a new user, load and edit the correct ntuser.dat.
Otros consejos
A setup can not reliably write to any other users profile.
Having said that, I beleive Windows installer and Windows 7 introduced a way to specify settings that are to be applied to all subsequant users.
This will NOT work in a non MSI based installer without something running for every user login from here to eternity.