Search code examples
installationwindows-installernsis

NSIS and HKLM, Use of string


I used a wizard to create an NSIS installer, and then reviewed the code: It defined a variable called PRODUCT_UNINST_ROOT_KEY as "HKLM":

!define PRODUCT_UNINST_ROOT_KEY "HKLM"

And then used it like this:

WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"

I was wondering if ${PRODUCT_UNINST_ROOT_KEY} is: HKLM, or "HKLM", and if it still references that directory if the folder is named differently (Mine is called "HKEY_LOCAL_MACHINE").

Thanks!


Solution

  • HKLM is HKEY_LOCAL_MACHINE (It is a pretty common alias) and HKCU is HKEY_CURRENT_USER etc.

    !define PRODUCT_UNINST_ROOT_KEY "HKLM" is the same as !define PRODUCT_UNINST_ROOT_KEY HKLM but you really only need quotes if the string contains a space.