rooma
11th April 2008 15:57 UTC
ModernUI and Mixed-mode Installer
Hi,
I'm writing a mixed mode installer (with MultiUser.nsh), usable as both Admin and simple User.
How can I use the MUI language settings and start menu page?
The MUI uses defines for the registry root, but I will know the root only dynamically at runtime since it will be HKLM for Admin and HKCU for User.
Any idea ?
rooma
11th April 2008 16:19 UTC
OK I found it, sorry for the pollution.
Here's the answer in case it's useful for someone else:
The !define must use a variable, and the variable can be set dynamically at runtime:
!define MULTIUSER_EXECUTIONLEVEL Highest
!include MultiUser.nsh
!define MUI_ROOT "$ROOT"
Name MultiUser
OutFile MultiUser.exe
ShowInstDetails show
var ROOT
Function .onInit
!insertmacro MULTIUSER_INIT
StrCmp $MultiUser.Privileges "Admin" 0 +3
StrCpy $ROOT "HKLM"
Goto +2
StrCpy $ROOT "HKCU"
FunctionEnd
Function un.onInit
!insertmacro MULTIUSER_UNINIT
FunctionEnd
Section
DetailPrint $MultiUser.Privileges
DetailPrint ${MUI_ROOT}
SectionEnd
rooma
11th April 2008 17:36 UTC
Well actually it doesn't work for the Modern UI:
!insertmacro: MUI_PAGE_INSTFILES
Usage: WriteRegStr rootkey subkey entry_name new_value_string
root_key=(HKCR|HKLM|HKCU|HKU|HKCC|HKDD|HKPD|SHCTX)
Error in macro MUI_LANGDLL_SAVELANGUAGE on macroline 9
Error in macro MUI_FUNCTION_INSTFILESPAGE on macroline 56
Error in macro MUI_PAGEDECLARATION_INSTFILES on macroline 13
Error in macro MUI_PAGE_INSTFILES on macroline 6
rooma
11th April 2008 23:54 UTC
OK. I should use the SHCTX root key instead of trying to set a variable root key myself.
See this thread