skuallpa
22nd July 2009 15:51 UTC
Problem getting start menu folder uninstallation
Hello,
I am working on an updater that overwrite and add some files to my application.
Because I add some files, I have to rewrite my uninstaller also.
But I have trouble in getting the start menu folder uninstallation
This is what I do
!insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder
RMDir /r "$SMPROGRAMS\$StartMenuFolder"
But I am getting during compilation the following error
warning: unknow variable/constant "<MUI_STARTMENUPAGE_Application_DEFAULTFOLDER>" detected, ignoring <macro:MUI_STARTMENU_GETFOLDER:20>
error in macro MUI_STARTMENU_GETFOLDER on macro line 20
The problem seem that I have not define the variable "Application". But this variable is define in my installer like this
;page STARTMENU
Var StartMenuFolder
!insertmacro MUI_PAGE_STARTMENU "Application" $StartMenuFolder
but not in my updater because I don't want to reinstall a Start Menu, just want to get the existing one.
So,how can I get this value?
Thanks in advance for your help
skuallpa
23rd July 2009 14:17 UTC
I have still not find any issue to this problem
I have found another post http://forums.winamp.com/showthread....873#post969873 that explains that we could write in the registry some value to remember of the startmenufolder (that is choosen during installation)
I have reported below the code that Brummelchen has given
;Configuration
;Remember the Start Menu Folder
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKCU"
!define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\<yoursoft>"
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "StartMenuFolder"
;Installer Sections
!insertmacro MUI_STARTMENU_WRITE_BEGIN
;Create shortcuts
CreateDirectory "$SMPROGRAMS\${MUI_STARTMENUPAGE_VARIABLE}"
CreateShortCut "$SMPROGRAMS\${MUI_STARTMENUPAGE_VARIABLE}\<yourapp>.lnk" "$INSTDIR\<yourfile>.ext"
!insertmacro MUI_STARTMENU_WRITE_END
;Uninstaller Section
;must be the first in this sektion
;when you are going to delete the whole key later
; DeleteRegKey HKCU "Software\<yoursoft>"
;Remove shortcuts
Push $R0
;ReadRegStr $R0 HKCU "Software\<yoursoft>" "StartMenuFolder"
ReadRegStr $R0 ${MUI_STARTMENUPAGE_REGISTRY_ROOT} ${MUI_STARTMENUPAGE_REGISTRY_KEY}
${MUI_STARTMENUPAGE_REGISTRY_VALUENAME}
StrCmp $R0 "" noshortcuts
RMDir /r "$SMPROGRAMS\$R0"
Pop $R0
noshortcuts:
But here the user have already installed the software, I work on an updater that overwrite some files. So is it to late to refind the startMenuFolder?
Also I have some trouble to overwrite the uninstaller. Because I have create some new file, I have also to tell the uninstaller to delete these new files.
So, I have rewrite in my updater an uninstaller section, (the code is quite the same as in my installer but with some additional RMDir)
Section "Uninstall"
.....
RMDir /r "$INSTDIR\MyNewFolderAndNewFiles"
SectionEnd
But the uninstaller is not overwrite..
I can't figure out why
Can anyone help?
Thanks in advance
kichik
3rd August 2009 10:00 UTC
Even if you don't use it, you'll have to insert the MUI_PAGE_STARTMENU macro so everything will be properly defined. You can define a pre callback function for it and skip it.
Another solution would be to dig into the MUI macros, figure out where it writes stuff to the registry and just use that directly.