I want the installer/uninstaller to check if any of the possible components are installed, and display only relevan components (installer should display only components not already installed and uninstaller should display only already-installed components)

I'm using MUI.

The component section of my .nsi looks something like this:

```
; Section descriptions
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
    !insertmacro MUI_DESCRIPTION_TEXT ${Component1} "Component1 Description"
    !insertmacro MUI_DESCRIPTION_TEXT ${Component2} "Component2 Description."
    !insertmacro MUI_DESCRIPTION_TEXT ${Component3} "Component3 Description."
!insertmacro MUI_FUNCTION_DESCRIPTION_END

```

I've tried a couple of different ways:

First, I tried using [this macro](http://nsis.sourceforge.net/Check_for_a_Registry_Key) for checking if a registry exists:

```
!insertmacro IfKeyExists HKEY_LOCAL_MACHINE SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall "Component1"
Pop $R0
${If} $R0 == 0 #Not installed yet. Display.
    !insertmacro MUI_DESCRIPTION_TEXT ${Component1} "Component1"
${EndIf}

```

This didn't work.

Then I tried using the [Registry Plug-In](http://nsis.sourceforge.net/Registry_plug-in#KeyExists_.28check_if_registry_key_exists.29):

```
${registry::KeyExists} "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Component1" $R0
${If} $R0 == 0 #Not installed yet. Display.
    !insertmacro MUI_DESCRIPTION_TEXT ${Component1} "Component1"
${EndIf}

```

This didn't work either.

So then I thought maybe there was some other more basic problem, and I tried this:

```
StrCpy $0 "0"
${If} $0 == "1"
    !insertmacro MUI_DESCRIPTION_TEXT ${Component1} "Component1 Description."
${EndIf}

```

But even then I still saw "Component1" as a possible component during installation!

What am I doing wrong and how can I go about achieving my goal?

Thanks in advance!