Archive: Windows version Test and uninstall


Windows version Test and uninstall
Hi,
I have a problem.
My installer muss check the Windows version before installing the components. I define shortly a section for uninstall. After I have run the application with the unstaller, the Windows version test doesn't works any more. I don't know why!!
Thanks for any help!
Here a part of my code:

Section !EPRO ESEC
SetOutPath $INSTDIR
SetOverwrite on
StrCmp $isInstall 1 install_EPRO update_EPRO

install_EPRO:
...

update_EPRO:
...


next_epro:
WriteRegStr HKLM "${REGKEY}\Components" EPRO 1
SetOutPath $INSTDIR

SectionEnd

Section /o !CIMOG CSEC
SetOutPath $INSTDIR
SetOverwrite on
StrCmp $isInstall 1 install_CIMOG update_CIMOG

install_CIMOG:
...

update_CIMOG:

...

next_cimog:
WriteRegStr HKLM "${REGKEY}\Components" CIMOG 1
SetOutPath $INSTDIR

SectionEnd

Section !ArcWrapper ASEC

StrCmp $isSohardCard "true" installArc noSohardCard

installArc:
...

...
WriteRegStr HKLM "${REGKEY}\Components" ArcWrapper 1
GOTO endArcInstall

noSohardCard:
MessageBox MB_OK|MB_ICONEXCLAMATION "$(ArcNetErrString)"
Abort

endArcInstall:

SectionEnd

Section /o "!DDE-Client" DSEC

StrCmp $IsAspicInstalled "true" installDDE
MessageBox MB_OK "Please install ASPIC and try again!"

Abort

installDDE:
...

WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Run" "DDECLI" '"$INSTDIR\DDECLI.exe"'
WriteRegStr HKLM "${REGKEY}\Components" DDE-Client 1
SectionEnd



Section -post PSEC
WriteRegStr HKLM "${REGKEY}" Path $INSTDIR
WriteUninstaller $INSTDIR\uninstall.exe
; !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
; SetOutPath $SMPROGRAMS\$StartMenuGroup
; CreateShortcut "$SMPROGRAMS\$StartMenuGroup\$(^UninstallLink).lnk" $INSTDIR\uninstall.exe
; !insertmacro MUI_STARTMENU_WRITE_END
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayName "$(^Name)"
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayVersion "${VERSION}"
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" Publisher "${COMPANY}"
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayIcon $INSTDIR\uninstall.exe
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" UninstallString $INSTDIR\uninstall.exe
WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" NoModify 1
WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" NoRepair 1
SectionEnd


Section /o un.DDE-Client UNDSEC

RMDir $aspicPath\Backup
Delete /REBOOTOK $aspicPath\DDE-Client\DDECLI.exe"
Delete /REBOOTOK $aspicPath\DDE-Client\Ddetxte.ini
StrCmp $ComponentLang "German" 0 +2
Delete /REBOOTOK $aspicPath\DDE-CLient\ddetxtd.ini
Delete /REBOOTOK $aspicPath\DDE-CLient\DDECLI.ini
RMDir /r /REBOOTOK $INSTDIR
DeleteRegValue HKLM "${REGKEY}\Components" DDE-Client
SectionEnd

Section /o un.ArcWrapper UNASEC
RMDir /r /REBOOTOK $INSTDIR
DeleteRegValue HKLM "${REGKEY}\Components" ArcWrapper
SectionEnd

Section /o un.CIMOG UNCSEC
RMDir /r /REBOOTOK $INSTDIR
DeleteRegValue HKLM "${REGKEY}\Components" CIMOG
SectionEnd

Section /o un.EPRO UNESEC
RMDir /r /REBOOTOK $INSTDIR
DeleteRegValue HKLM "${REGKEY}\Components" EPRO
SectionEnd



Section un.post UNPSEC
DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)"

Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\$(^UninstallLink).lnk"
Delete /REBOOTOK $INSTDIR\uninstall.exe
DeleteRegValue HKLM "${REGKEY}" StartMenuGroup
DeleteRegValue HKLM "${REGKEY}" Path
DeleteRegKey /IfEmpty HKLM "${REGKEY}\Components"
DeleteRegKey /IfEmpty HKLM "${REGKEY}"
RmDir /REBOOTOK $SMPROGRAMS\$StartMenuGroup

SectionEnd
Function un.onInit
ReadRegStr $INSTDIR HKLM "${REGKEY}" Path

MessageBox MB_OK "w"
RMDir /r /REBOOTOK $INSTDIR
!insertmacro SELECT_UNSECTION EPRO ${UNESEC}
!insertmacro SELECT_UNSECTION CIMOG ${UNCSEC}
!insertmacro SELECT_UNSECTION ArcWrapper ${UNASEC}
!insertmacro SELECT_UNSECTION DDE-Client ${UNDSEC}
FunctionEnd

!macro SELECT_UNSECTION SECTION_NAME UNSECTION_ID
Push $R0
ReadRegStr $R0 HKLM "${REGKEY}\Components" "${SECTION_NAME}"
StrCmp $R0 1 0 next${UNSECTION_ID}
!insertmacro SelectSection "${UNSECTION_ID}"
GoTo done${UNSECTION_ID}
next${UNSECTION_ID}:
!insertmacro UnselectSection "${UNSECTION_ID}"
done${UNSECTION_ID}:
Pop $R0
!macroend


Hi mamilo!

I think that you should define a macro called un.SELECT_UNSECTION as well. Have a look at the following thread. You'll find the solution there.

http://forums.winamp.com/showthread....01#post2077301

Cheers

Bruno


Hi,
thanks for your help, but where should I use this un.SECTION__UNSECTION macro? in the function un.onInit as well? or you mean I should define a macro who calls the macro ${un}SECTION__UNSECTION ?
Thanks


I think you should duplicate the macro with

!insertmacro mymacro ""
!insertmacro mymacro "un."

so that you can use it in the uninstaller as well.

Cheers

Bruno