And I wanted to use it this way:
${If} $OSgen == "Win9x" ; Windows 95/98/ME
StrCpy $RootKey "HKLM"
${Else} ; WinNT/Win2000,WinXP
${Select} $UserRights
${Case2} "User" "Guest"
StrCpy $RootKey "HKCU"
${Case2} "Admin" "Power"
${If} ${Context} == "1" ; context selected during instalation, 1=All users, 0=Current user
StrCpy $RootKey "HKLM"
${Else}
StrCpy $RootKey "HKCU"
${EndIf}
${EndSelect}
${EndIf}
WriteRegStr $RootKey "Software\${Company}\${ProductName}" "Key1" "Value"
But finally I have found that registry functions don't accept variables for rootkey. So this is my feature suggestion for next version of NSIS.