Archive: Specify rootkey in runtime


Specify rootkey in runtime
Hi,

My installer detects whether the user has Admin rights. If he has then I install the application for all users, if not I install for the current user only. In the first case I would like to store my registry keys under HKLM and in the second case under HKCU:

Administrator:
WriteRegStr HKLM Yada Yada

PowerUser:
WriteRegStr HKCU Yada Yada

So what I would like to do is the following:
WriteRegStr $MY_ROOT_KEY Yada Yada

I have tried all (?) possible ways to accomplish this, but failed. I have tried to !define MY_ROOT_KEY, but obviously I'm having problems giving a define a value in runtime. I have tried to use Var MY_ROOT_KEY, but WriteRegStr does not seem to like a user variables as root key.

Is there any solution to this (except for having to sets of the WriteRegStr)?


Write a macro that compares the value of the variable and calls one of the WriteRegStr commands.


This is a duplicate thread, please see "Wish registry functions worked with variables for rootkeys". Unfortunately, this can only be done at compile time, not runtime.