Archive: Dynamic Selection of Uninstall Sections does not work


Dynamic Selection of Uninstall Sections does not work
Hi all,

i have a problem with my uninstaller, every section i execute on install, places a reference in the registry using.

WriteRegStr HKLM "${REGKEY}\Components" "Component1" 1

now on uninstall i have


!macro _SELECT_SECTION SECTION_REGISTRY SECTION_NAME SECTION_ID

Push $R0
ReadRegStr $R0 HKLM "${SECTION_REGISTRY}" "${SECTION_NAME}"
MessageBox MB_OK "${SECTION_REGISTRY}-${SECTION_NAME}-${SECTION_ID}"
${IF} $R0 = 1
MessageBox MB_OK "SELECT-${SECTION_ID}"
!insertmacro SelectSection "${SECTION_ID}"
${ELSE}
MessageBox MB_OK "UNSELECT-${SECTION_ID}"
!insertmacro UnselectSection "${SECTION_ID}"
${ENDIF}
Pop $R0
!macroend
!define SELECT_SECTION `!insertmacro _SELECT_SECTION`

(Messageboxes are for Debug!)

Section "-un.Component1" UNSEC_Component1
MessageBox MB_OK "Removing Component1"
SectionEnd

Function un.onInit
${SELECT_SECTION} "${REGKEY}\Components" "Component1" UNSEC_Component1
FunctionEnd



Now i get all the needed MessageBoxes from the macro telling me the section is selected but it never executes the section....

Any ideas?

The way you pass the section ID to the SelectSection and UnselectSection macro is wrong. You call the macros with the name of the define, that contains the section ID, instead of calling the macros with the value of the define.

Either call your macro this way:

${SELECT_SECTION} "${REGKEY}\Components" "Component1" ${UNSEC_Component1}


Or, change you macro to call the SelectSection and UnselectSection this way:
!insertmacro SelectSection "${${SECTION_ID}}"


PaR

PaR

we have a saying here that roughly translates to

"I didn't see the forest because of all the trees..."

I was so convinced that the last parameter is right that i didn't even bother to look into it, now that you have mentioned it i remember having other installers where i work with sections and ${} around the ID.

Thanks a lot!

x