cosmic66
20th November 2003 09:41 UTC
using variables in ReadRegStr
I would like to use my own variables in ReadRegStr:
Var Test1
Var Test2
[...]
StrCpy $Test1 "HKLM"
StrCpy $Test2 "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"
Why does the following not work?
ReadRegStr $1 $Test1 $Test2 "PATH"
Whereas the following works:
ReadRegStr $1 "HKLM" $Test2 "PATH"
Thanks!
kichik
20th November 2003 09:59 UTC
ReadRegStr doesn't process the root key on runtime. If you want to make it change on runtime you'd have to add another line of ReadRegStr. Same goes for all other registry instructions.
cosmic66
20th November 2003 10:24 UTC
I would like to do the following:
In the function .onInit I check if the user has administration
rights, if so, I would like to register the environment variables
for all users, otherwise they are registered for the current user
(thus I have to use different root_key and sub_key for reading and writing the registry keys).
How could I achieve that?
kichik
20th November 2003 10:36 UTC
A simple comparsion. Assuming $0 is set to "admin" if the user can write to HKLM you can use:
StrCmp $0 "admin" goHKLM
WriteRegStr HKCU ....
Goto done
goHKLM:
WriteRegStr HKLM ....
done: