Old 22nd November 2012, 08:26   #1
xbarns
Senior Member
 
xbarns's Avatar
 
Join Date: Aug 2007
Location: Frankfurt, Germany
Posts: 187
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

code:

!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?
xbarns is offline   Reply With Quote
Old 22nd November 2012, 20:30   #2
{_trueparuex^}
Senior Member
 
{_trueparuex^}'s Avatar
 
Join Date: Dec 2005
Location: Glow
Posts: 285
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:
code:
${SELECT_SECTION} "${REGKEY}\Components" "Component1" ${UNSEC_Component1}


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


PaR
{_trueparuex^} is offline   Reply With Quote
Old 22nd November 2012, 20:43   #3
xbarns
Senior Member
 
xbarns's Avatar
 
Join Date: Aug 2007
Location: Frankfurt, Germany
Posts: 187
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
xbarns is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump