/* Copyright (C) 2009-2012 JonDos GmbH All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - Neither the name of the JonDos GmbH nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE ############################################## There is one exception to the above mentioned license. The functions FindPortablePath and GetDrivesCallBack are under the following license: Copyright 2007 John T. Haller Website: http://PortableApps.com/ This software is OSI Certified Open Source Software. OSI Certified is a certification mark of the Open Source Initiative. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. EXCEPTION: Can be used with non-GPLed open source apps distributed by PortableApps.com */ /* General Remarks: This installer is generally behaving like a normal one with one exception: You have the opportunity to install JonDo as a normal user in almost every folder you want, with a folder in the startmenugroup for every user with a start-button in the quicklaunch-folder for every user and the appropriate values in the registry. This is achieved with the help of the UAC-Plugin written by Anders, especially his UAC_RealWorldFullyLoaded- DualModeExample.nsi (have a look at http://nsis.sourceforge.net/UAC_plug-in and http://forums.winamp.com/showthread.php?s=&threadid=265780) The idea is, basically, that the user, who hasn't got the rights to install JonDo, e.g. in $PGROGRAMFILES\JonDo, has nevertheless this opportunity if he knows the password of somebody who belongs to the administrator group. If he puts it in the RunAs-Dialog correctly, a new instance of the installer is starting, but this time in Admin-mode. The relevant values and functions below make sure that the user, who installs JonDo, doesn't even get a hint what is going on: He probably thinks that he just changed the user-group, is now Admin and continuing the installation right after the RunAs-Dialog. If somebody is uninstalling JonDo the same thing happens: If he is a normal user the RunAs-Dialog is started and right after it with a new instance of it the user is deinstalling JonDo. For somewhat more detailed information about what and why it is going on behind the scenes, see the comments between the lines below... */ Var detectedJre Var FOUNDPORTABLEAPPSPATH Var PORTABLEAPPS_JAVA Var StartMenuGroup Var InstMode # 0: Single user, 1:All users, >1:elevated instance, perform page jump Var hKey # Reg hive Var hSelModeAdminRadio Var QuickPath Var Win9x Var JonDoPath Var JonDoFoxInstallation Var JDFInstallCheck Var install !define APPNAME "JonDo" !define PORTABLE "JonDoPortable" !define ELEVATIONTITLE "${APPNAME}" ;displayed during elevation on our custom page !define UNINSTALLER_NAME "uninstall.exe" !define VERSION 00.20.001 !define COMPANY "JonDos GmbH" !define URL https://www.anonymous-proxy-servers.net Name "${APPNAME}" OutFile "${APPNAME}Setup.paf.exe" BrandingText "JonDo - The Privacy Generator" ShowInstDetails hide CRCCheck on XPStyle on /* Normally you are using InstallDir in order to define the path, where you want your program to be installed. But you have as well the opportunity to get a string appended to the installation directory which you have chosen via browsing on the directory page. The rule is: everything behind the last back- slash is appended, i.e. if you've chosen $PRORGRAMFILES\99\999 via browsing and you defined Installdir with "\JonDo" your installation path is now: $PROGRAMFILES\99\999\JonDo (If you have "JonDo" instead of "999" nothing gets appended, though). Well, the problem is that InstallDir is a constant which can be defined just once in the beginning and we want to give the user the choice between installing JonDo and JonDoPortable, i.e. between appending JonDo and JonDoPortable. The trick is to define Installdir with an empty variable at first and then fill it with the choice of the user, see http://forums.winamp.com/showthread.php?s=&threadid=258855 */ InstallDir "\$JonDoPath" SetCompressor /SOLID LZMA VIProductVersion "0.20.1.0" VIAddVersionKey ProductName JonDo VIAddVersionKey ProductVersion "${VERSION}" VIAddVersionKey CompanyName "${COMPANY}" VIAddVersionKey Website "${URL}" VIAddVersionKey FileVersion "${VERSION}" VIAddVersionKey FileDescription "JonDo Setup" VIAddVersionKey LegalCopyright "" RequestExecutionLevel user /* RequestExecutionLevel REQUIRED! */ !addincludedir NSIS\include !addplugindir /x86-ansi NSIS\plugins\x86-ansi !addplugindir /x86-unicode NSIS\plugins\x86-unicode !include MUI.nsh !include LogicLib.nsh !include nsDialogs.nsh ;for our custom page !include FileFunc.nsh ;we need to parse the command line !include WordFunc.nsh !include Stack.nsh !insertmacro GetParameters !insertmacro GetOptions !insertmacro GetDrives !insertmacro WordReplace !insertmacro un.WordReplace ;!insertmacro WordFind3XS !define MUI_CUSTOMFUNCTION_ABORT onAbort !define MUI_CUSTOMFUNCTION_GUIINIT onGuiInit !define MUI_COMPONENTSPAGE_NODESC !define MUI_FINISHPAGE_NOAUTOCLOSE !insertmacro MUI_DEFAULT MUI_WELCOMEFINISHPAGE_BITMAP "Data\JonDoWelcomeFinish.bmp" !insertmacro MUI_DEFAULT MUI_UNWELCOMEFINISHPAGE_BITMAP "Data\JonDoWelcomeFinish.bmp" !define MUI_ICON Data\JonDo.ico !define MUI_UNICON Data\JonDo.ico !define MUI_HEADERIMAGE !define MUI_HEADERIMAGE_BITMAP_NOSTRETCH !define MUI_HEADERIMAGE_BITMAP "Data\BackgroundJonDo.bmp" !define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM" !define MUI_STARTMENUPAGE_NODISABLE !define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\JonDoJAP" !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "StartMenuGroup" !define MUI_ABORTWARNING !define MUI_HEADERIMAGE_RIGHT !define MUI_LANGDLL_REGISTRY_ROOT "HKLM" !define MUI_LANGDLL_REGISTRY_KEY "Software\JonDoLang" !define MUI_LANGDLL_REGISTRY_VALUENAME "InstallerLanguage" !define MUI_PAGE_CUSTOMFUNCTION_PRE SkipPageInElvModePreCB !insertmacro MUI_PAGE_WELCOME !define MUI_PAGE_CUSTOMFUNCTION_LEAVE welcomePost Page Custom ModeSelectionPageCreate ModeSelectionPageLeave !define MUI_PAGE_CUSTOMFUNCTION_PRE comp_pre !insertmacro MUI_PAGE_COMPONENTS !define MUI_PAGE_CUSTOMFUNCTION_PRE DirPreCB !define MUI_PAGE_CUSTOMFUNCTION_LEAVE Dir_Post !insertmacro MUI_PAGE_DIRECTORY !define MUI_PAGE_CUSTOMFUNCTION_PRE PortableCheck !insertmacro MUI_PAGE_STARTMENU Application $StartMenuGroup !insertmacro MUI_PAGE_INSTFILES !define MUI_FINISHPAGE_RUN ;!define MUI_FINISHPAGE_RUN_FUNCTION FinishRunCB ;!define MUI_FINISHPAGE_SHOWREADME "" ;!define MUI_FINISHPAGE_SHOWREADME_CHECKED ;!define MUI_FINISHPAGE_SHOWREADME_TEXT "$(JonDoDesktop)" ;!define MUI_FINISHPAGE_SHOWREADME_FUNCTION createDesktopShortcut ;!define MUI_FINISHPAGE_AUTOSTART ;!define MUI_FINISHPAGE_AUTOSTART_TEXT "$(JonDoAutostart)" ;!define MUI_FINISHPAGE_AUTOSTART_FUNCTION setAutostart !define MUI_PAGE_CUSTOMFUNCTION_PRE installModeCheck !define MUI_PAGE_CUSTOMFUNCTION_SHOW checkboxBackground !define MUI_PAGE_CUSTOMFUNCTION_LEAVE FinishInstall !insertmacro MUI_PAGE_FINISH !define MUI_PAGE_CUSTOMFUNCTION_LEAVE un.Welcome_Post !insertmacro MUI_UNPAGE_WELCOME !insertmacro MUI_UNPAGE_INSTFILES !insertmacro MUI_LANGUAGE "English" !insertmacro MUI_LANGUAGE "German" /* If we have to enable or disable a button we are going to use this macro */ !macro EnableCtrl dlg id state push $0 GetDlgItem $0 ${dlg} ${id} EnableWindow $0 ${state} pop $0 !macroend /* In UAC_JonDo.nsh we have added some german language support. Because all the warnings and error messages which may occur during elevating were, of course, just in english. Well, and if we want language support we have to load the UAC_JonDo.nsh after we included the relevant language-macro. */ !include UAC_JonDo.nsh # Reserved Files !insertmacro MUI_RESERVEFILE_LANGDLL ReserveFile "${NSISDIR}\Plugins\x86-ansi\AdvSplash.dll" ############################################################ Function welcomePost MessageBox MB_OK "HUH" FunctionEnd Function GetWin9xVersion Push $R0 Push $R1 ClearErrors ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion IfErrors 0 win_done MessageBox MB_ICONEXCLAMATION $(WinUpdate) StrCpy $Win9x "1" win_done: FunctionEnd Function DetectJava ClearErrors ReadRegStr $R0 HKLM "Software\JavaSoft\Java Runtime Environment" CurrentVersion IfErrors lbl_nosunjreinreg 0 Push 1 Goto lbl_done lbl_nosunjreinreg: /* There was no registry key... */ Push 0 lbl_done: FunctionEnd ############################################################ !macro SetMode IsAdmin !if "${IsAdmin}" > 0 SetShellVarContext all StrCpy $InstMode 1 StrCpy $hKey HKLM !else SetShellVarContext current StrCpy $InstMode 0 StrCpy $hKey HKCU !endif !macroend ############################################################ /* The following two functions check whether there is a USB flash drive with properly installed PortableApps plugged in. */ Function FindPortablePath ${GetOptions} "$CMDLINE" "/DESTINATION=" $R5 IfErrors CheckLegacyDestination StrCpy $INSTDIR "$R5${PORTABLE}" Goto InitDone CheckLegacyDestination: ClearErrors ${GetOptions} "$CMDLINE" "-o" $R5 IfErrors NoDestination StrCpy $INSTDIR "$R5${PORTABLE}" Goto InitDone NoDestination: ClearErrors ${GetDrives} "HDD+FDD" GetDrivesCallBack StrCmp $FOUNDPORTABLEAPPSPATH "" InitDone StrCpy $INSTDIR "$FOUNDPORTABLEAPPSPATH\${PORTABLE}" InitDone: FunctionEnd Function GetDrivesCallBack ;=== Skip usual floppy letters StrCmp $8 "FDD" "" CheckForPortableAppsPath StrCmp $9 "A:\" End StrCmp $9 "B:\" End CheckForPortableAppsPath: IfFileExists "$9PortableApps" "" End StrCpy $FOUNDPORTABLEAPPSPATH "$9PortableApps" End: Push $0 FunctionEnd ######################################################### /* In this function the installation directories are set and the appropriate string to append (if it is needed) is put into InstallDir... */ Function DirPreCB ${If} $JonDoFoxInstallation == "desktop" UAC::IsAdmin ${If} $0 == 0 Quit ${EndIf} ${EndIf} StrCmp $JonDoFoxInstallation "portable" path_done 0 ${If} $InstMode > 1 ${OrIf} $9 > 0 ${OrIf} $JonDoFoxInstallation == "desktop" StrCpy $JonDoPath "${APPNAME}" StrCpy $INSTDIR "$ProgramFiles\${APPNAME}" Call DetectJAPJonDo Call GettingQuickLaunchPath ${Else} StrCpy $JonDoPath "${PORTABLE}" StrCmp $R5 "" 0 path_done StrCmp $FOUNDPORTABLEAPPSPATH "" nopath path nopath: /* Win9x doesn't know anything like $PROFILE. We have to put JonDoPortable somewhere else... */ StrCmp $Win9x "1" 0 +2 StrCpy $INSTDIR "$PROGRAMFILES\${PORTABLE}" StrCpy $INSTDIR "$PROFILE\${PORTABLE}" Goto path_done path: StrCpy $INSTDIR "$FOUNDPORTABLEAPPSPATH\${PORTABLE}" IfFileExists $FOUNDPORTABLEAPPSPATH\CommonFiles\Java\bin\javaw.exe 0 +2 StrCpy $PORTABLEAPPS_JAVA "true" path_done: ${EndIf} ${If} $InstMode > 1 ${AndIf} $detectedJre > 0 ${OrIf} $JonDoFoxInstallation != "" !insertmacro EnableCtrl $HWNDPARENT 3 0 ${EndIf} FunctionEnd ########################################################## /* If the portable path is already existing let's save the config file before we delete the old JonDoPortable and copy it back after that or the user has to choose a new installation directory. */ Function Dir_Post StrCmp $JonDoPath "${PORTABLE}" 0 end IfFileExists $INSTDIR\*.* 0 end MessageBox MB_YESNO $(DeletePortable) IDYES 0 IDNO not_deleting CreateDirectory $DESKTOP\JonDoTemp CopyFiles $INSTDIR\App\JonDo\jap.conf $DESKTOP\JonDoTemp RMDir /r $INSTDIR CreateDirectory $INSTDIR\App\JonDo CopyFiles $DESKTOP\JonDoTemp\jap.conf $INSTDIR\App\JonDo RMDir /r $DESKTOP\JonDoTemp Goto end not_deleting: Abort end: FunctionEnd ########################################################## /* We are checking whether JonDo or JAP is already installed and asking the user whether he wants to uninstall it first (maybe he wants to get rid of all his old config-files) */ Function DetectJAPJonDo ClearErrors ReadRegStr $1 HKLM "Software\JonDo\Components" Main IfErrors JAPtest 0 MessageBox MB_YESNO $(JonDoInstall) IDYES yepJonDo IDNO JAPtest yepJonDo: ClearErrors ReadRegStr $INSTDIR HKLM "Software\JonDo" Path ExecWait "$INSTDIR\uninstall.exe" IfErrors 0 +2 MessageBox MB_OK $(FindUninstallError) JAPtest: ReadRegStr $1 HKLM "Software\JAP\Components" Main IfErrors EndIt 0 MessageBox MB_YESNO $(JAPInstall) IDYES yepJAP IDNO EndIt yepJAP: ClearErrors ReadRegStr $INSTDIR HKLM "Software\JAP" Path ExecWait "$INSTDIR\uninstall.exe" IfErrors 0 +2 MessageBox MB_OK $(FindUninstallError) EndIt: FunctionEnd ################################################## /* We try to figure out whether JonDo is still running. If this is the case the user shall quit it. If he does not do this, JonDo is not properly deleted. We are waiting in a loop until the JonDo.exe is not on the process table anymore and continue afterwards with the uninstall procedure. */ Function un.Welcome_Post Push $5 Push "JonDo.exe" processwork::existsprocess Pop $5 IntCmp $5 0 jondo_done MessageBox MB_YESNO $(JAPJonDoExistence) IDYES true IDNO false true: FindWindow $0 "" "JAP/JonDo" ${If} $0 != 0 Goto window_found ${EndIf} FindWindow $0 "" "JAP / JonDo" ${If} $0 != 0 Goto window_found ${EndIf} FindWindow $0 "" "JAP" ${If} $0 != 0 Goto window_found ${EndIf} FindWindow $0 "" "JonDo" ${If} $0 != 0 Goto window_found ${EndIf} FindWindow $0 "" "JonDo / JAP" ${If} $0 != 0 Goto window_found ${EndIf} FindWindow $0 "" "JonDo/JAP" window_found: SendMessage $0 ${WM_CLOSE} 0 0 Goto done false: Abort done: StrCpy $0 "0" loop: Push $5 Push "JonDo.exe" processwork::existsprocess Pop $5 IntCmp $5 0 jondo_done IntOp $0 $0 + 1 Sleep 1000 StrCmp $0 5 0 +3 MessageBox MB_YESNO $(JonDoClosing) IDYES 0 IDNO jondo_done StrCpy $0 "0" Goto loop jondo_done: FunctionEnd ####################################################### Function .OnInit StrCpy $PORTABLEAPPS_JAVA "false" !insertmacro SetMode 0 ${GetParameters} $R9 /* We check whether the JonDo installer was called by the JonDoFox installer. If so, we save the appropriate values (i.e. portable/desktop, installpath and language) in order to create en even more convenient install process.*/ ${GetOptions} "$R9" "-INSTALLATION=" $0 IfErrors jondofox_checking_done 0 StrCmp $0 "portable" 0 jondofox_desktop ${GetOptions} "$R9" "-INSTALLPATH=" $0 ${WordReplace} "$0" "JonDoFoxPortable" "" "+" $0 StrCpy $INSTDIR "$0${PORTABLE}" ${GetOptions} "$R9" "-LANGUAGE=" $0 StrCpy $LANGUAGE "$0" StrCpy $JonDoFoxInstallation "portable" Goto jondofox_checking_done jondofox_desktop: ${GetOptions} "$R9" "-LANGUAGE=" $0 StrCpy $LANGUAGE "$0" StrCpy $JonDoFoxInstallation "desktop" jondofox_checking_done: ClearErrors ${GetOptions} "$R9" UAC $0 ;look for special /UAC:???? parameter (sort of undocumented) ${Unless} ${Errors} UAC::IsAdmin ${If} $0 < 1 SetErrorLevel 666 ;special return value for outer instance so it knows we did not have admin rights Quit ${EndIf} !insertmacro SetMode 1 StrCpy $InstMode 2 ${EndIf} /* We have to check whether the user is already elevated and if so jump to the end of this functions. Otherwise we wouldn't get a silent second installer. And we would waste time in checking whether we find PortableApps because the user has already declared that he does not want to install the portable JonDo. */ ${If} $InstMode > 1 Goto start_elevated ${EndIf} StrCmp $JonDoFoxInstallation "" 0 start_elevated InitPluginsDir Push $R1 File /oname=$PLUGINSDIR\spltmp.bmp Data\splash.bmp advsplash::show 1000 600 400 -1 $PLUGINSDIR\spltmp Pop $R1 Pop $R1 !insertmacro MUI_LANGDLL_DISPLAY Call FindPortablePath start_elevated: FunctionEnd Function onGuiInit ${If} $InstMode >= 2 ${UAC.GetOuterInstanceHwndParent} $0 ${If} $0 <> 0 System::Call /NOUNLOAD "*(i,i,i,i)i.r1" System::Call /NOUNLOAD 'user32::GetWindowRect(i $0,i r1)i.r2' ${If} $2 <> 0 System::Call /NOUNLOAD "*$1(i.r2,i.r3)" System::Call /NOUNLOAD 'user32::SetWindowPos(i $hwndParent,i0,ir2,ir3,i0,i0,i 4|1)' ${EndIf} ShowWindow $hwndParent ${SW_SHOW} ShowWindow $0 ${SW_HIDE} ;hide outer instance installer window System::Free $1 ${EndIf} ${EndIf} FunctionEnd ###################################################### /* This function was originally developed not to append a string to the chosen installation directory just in case this directory ends with "JonDo" or "JonDoPortable". Well, in the end it turned out that this feature is already implemented using InstallDir and just due to a bug in wine it is not working properly. But maybe it is not working as well when using Windows 7 or some other Windows than XP or Win9x. So we keep it commented within the code. */ /*Function .onVerifyInstDir ${WordFind3XS} "$INSTDIR" "\" "JonDoPortable" "" "E+1" $R5 StrCmp $9 "1" check_jondo StrCmp $R5 "1" done_verify StrCpy $JonDoPath "" Goto done_verify check_jondo: ${WordFind3XS} "$INSTDIR" "\" "JonDo" "" "E+1" $R4 StrCmp $R4 "1" done_verify StrCmp $R5 "0" done_verify StrCpy $JonDoPath "" done_verify: FunctionEnd*/ ###################################################### Function Un.OnInit !insertmacro MUI_UNGETLANGUAGE !insertmacro SetMode 0 ReadRegDWORD $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\JonDoUninstall" InstMode ;We saved the "mode" in the installer ${If} $0 U> 0 ; If it was installed for all users, we have to be admin to uninstall it ${UAC.U.Elevate.AdminOnly} "${UNINSTALLER_NAME}" !insertmacro SetMode 1 ${EndIf} Call un.GettingQuickLaunchPath FunctionEnd ####################################################### Function onAbort ${UAC.Unload} FunctionEnd ####################################################### Function SkipPageInElvModePreCB ${IfThen} $InstMode > 1 ${|} Abort ${|} ;skip this page so we get to the mode selection page ${If} $JonDoFoxInstallation != "" Abort ${EndIf} FunctionEnd ####################################################### Function ModeSelectionPageCreate /* If the user is starting the installer from within PortableApps we skip this and the following pages and assume JonDo portable is to be installed */ ${If} $R5 != "" ${OrIf} $JonDoFoxInstallation == "portable" Abort ${EndIf} /* If the user is already elevated we don't need to choose between JonDo- Desktop and JonDo-Portable anymore: He decided already to install JonDo- Desktop */ ${If} $InstMode > 1 Abort ;skip this page and continue where the "parent" would have gone ${EndIf} !insertmacro MUI_HEADER_TEXT_PAGE $(JonDoInstallType) $(JonDoInstallNew) nsDialogs::Create /NOUNLOAD 1018 Pop $0 ${NSD_CreateLabel} 0 20u 75% 20u "" Pop $0 System::Call "advapi32::GetUserName(t.r0, *i ${NSIS_MAX_STRLEN}r1) i.r2" ${NSD_CreateRadioButton} 0 60u 75% 15u $(JonDoPortable) Pop $0 /* If we don't find a PortableApps-path the JonDo-Desktop button is enabled */ StrCmp $FOUNDPORTABLEAPPSPATH "" +2 SendMessage $0 ${BM_SETCHECK} 1 0 ${NSD_CreateRadioButton} 0 40u 75% 15u $(JonDo) Pop $hSelModeAdminRadio SendMessage $0 ${BM_GETCHECK} 0 0 $9 IntCmp $9 1 portable_checked SendMessage $hSelModeAdminRadio ${BM_SETCHECK} 1 0 portable_checked: /* We don't need to show the custom page in the following situation because the user has already chosen in the JonDoFox installer what kind of JonDo shall be installed. */ StrCmp $JonDoFoxInstallation "desktop" +2 0 nsDialogs::Show FunctionEnd ########################################################## Function ModeSelectionPageLeave SendMessage $hSelModeAdminRadio ${BM_GETCHECK} 0 0 $9 UAC::IsAdmin StrCpy $InstMode "$0" ${If} $9 U> 0 ${AndIf} $0 U< 1 System::Call /NoUnload 'user32::GetWindowText(i $HwndParent,t.R1,i ${NSIS_MAX_STRLEN})' ;get original window title System::Call /NoUnload 'user32::SetWindowText(i $HwndParent,t "${ELEVATIONTITLE}")' ;set out special title StrCpy $2 "" ;reset special return, only gets set when sub process is executed, not when user cancels /* For some reason UAC::ExecCodeSegment does not work properly, so we have to check whether JonDoFox is installed as follows: 1) First let's check whether the installer is not called from within a JonDoFox installer. 2) If so, maybe we can get a hint if we check the the current user's registry entries. 3) If we do not get the value of the InstallerLanguage we can be pretty sure that JonDoFox is not installed. 4) We have to communicate this to the Function FinishInstall where it has to be decided whether the user has to be asked if he wants to install JonDoFox or not. So, if JonDoFox is installed we save a file named "Yes" in a directory where everybody has writing/reading access.*/ ${If} $JonDoFoxInstallation == "" ReadRegStr $JDFInstallCheck HKCU "Software\JonDoFox" "InstallerLanguage" ${If} $JDFInstallCheck != "" SetShellVarContext all FileOpen $0 $APPDATA\Yes w FileClose $0 SetShellVarContext current ${EndIf} ${EndIf} !insertmacro EnableCtrl $HWNDParent 1 0 ;Disable next button, just because it looks good ;) ${UAC.RunElevatedAndProcessMessages} !insertmacro EnableCtrl $HWNDParent 1 1 System::Call 'user32::SetWindowText(i $HwndParent,t "$R1")' ;restore title ${If} $2 = 666 ;our special return, the new process was not admin after all MessageBox MB_ICONEXCLAMATION $(AdminLogin) Abort ${ElseIf} $0 = 1223 ;cancel Abort ${EndIf} Quit ;We now have a new process, the install will continue there, we have nothing left to do here ${EndIf} FunctionEnd ######################################################## /* The next macro and two functions are just concerned with putting a JonDo- Button in the quicklaunch folder of every user. The tricky thing is that you don't have an All-Users folder where you can copy the quicklaunch-stuff. Instead you have to use a loop to get all users out of the registry and put the quicklaunch link in the correct folder. If you are uninstalling JonDo you have to do the same again in order to delete the links. We deploy the macro in order to be able to use the same function both in an installer- and in an uninstaller- section*/ !macro GettingQuickLaunchPath_macro un Function ${un}GettingQuickLaunchPath Push $R0 Push $R1 Push $R2 Push $R3 ReadRegStr $R1 HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" "Common AppData" ExpandEnvStrings $R1 $R1 ExpandEnvStrings $R2 "%ALLUSERSPROFILE%" ${WordReplace} "$R1" "$R2" "" "+" $R3 StrCpy $QuickPath "$R3\Microsoft\Internet Explorer\Quick Launch\$(^InstallLink).lnk" FunctionEnd !macroend !insertmacro GettingQuickLaunchPath_macro "" !insertmacro GettingQuickLaunchPath_macro "un." Function CreateQuickLaunch StrCpy $R0 0 StrCpy $R1 0 ${Do} EnumRegKey $R1 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" $R0 ${If} $R1 != "" ReadRegStr $R1 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\$R1" ProfileImagePath ExpandEnvStrings $R1 $R1 CreateShortCut "$R1$QuickPath" "$INSTDIR\JonDo.exe" IntOp $R0 $R0 + 1 ${EndIf} ${LoopUntil} $R1 == "" FunctionEnd Function un.DeleteQuickLaunch StrCpy $R0 0 StrCpy $R1 0 ${Do} EnumRegKey $R1 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" $R0 ${If} $R1 != "" ReadRegStr $R1 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\$R1" ProfileImagePath ExpandEnvStrings $R1 $R1 Delete "$R1$QuickPath" IntOp $R0 $R0 + 1 ${EndIf} ${LoopUntil} $R1 == "" FunctionEnd ##################################################### Section "!JonDo" SEC0000 SectionIn RO SetOutPath $INSTDIR SetOverwrite on File "JAP\JonDo.exe" File "JAP\japdll.dll" File "JAP\japdll_x64.dll" File "JAP\JAP.jar" WriteUninstaller "$INSTDIR\${UNINSTALLER_NAME}" WriteRegStr HKLM "Software\JonDo\Components" Main 1 WriteRegStr HKLM "Software\JonDo" Path $INSTDIR /* We want that JonDo appears in the Startmenugroup of every user, so we have to set the context to all */ SetShellVarContext all /* Win9x does not have an user management, we can create the quicklaunch link very easy. */ StrCmp $Win9x "1" 0 +3 CreateShortCut "$QUICKLAUNCH\$(^InstallLink).lnk" "$INSTDIR\JonDo.exe" Goto +2 Call CreateQuickLaunch !insertmacro MUI_STARTMENU_WRITE_BEGIN Application CreateDirectory $SMPROGRAMS\$StartMenuGroup SetOutPath $INSTDIR CreateShortCut "$SMPROGRAMS\$StartMenuGroup\$(^InstallLink).lnk" "$INSTDIR\JonDo.exe" CreateShortCut "$SMPrograms\$StartMenuGroup\$(^UninstallLink).lnk" "$INSTDIR\${UNINSTALLER_NAME}" WriteRegStr HKLM "Software\JonDo" LinkPath "$SMPROGRAMS\$StartMenuGroup\$(^InstallLink).lnk" !insertmacro MUI_STARTMENU_WRITE_END SetShellVarContext current /* We are saving the installer mode in order to give the normal user the opportunity to elevate and uninstall JonDo-Desktop */ WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\JonDoUninstall" "DisplayName" "JonDo" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\JonDoUninstall" "UninstallString" "$\"$INSTDIR\${UNINSTALLER_NAME}$\"" WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\JonDoUninstall" "InstMode" $InstMode ${UAC.Unload} SectionEnd ##################################################### Section /o "-JonDoPortable" secPortable SetOutPath $INSTDIR\App\JonDo SetOverwrite on File "JAP\JonDo.exe" File "JAP\japdll.dll" File "JAP\JAP.jar" SetOutPath $INSTDIR StrCmp $PORTABLEAPPS_JAVA "true" 0 +3 AddSize -46000 File /r /x CVS /x jre /x .svn /x Other "JonDoPortable\Files\*.*" Goto done AddSize 46000 File /r /x CVS /x .svn /x Other "JonDoPortable\Files\*.*" done: SectionEnd ##################################################### Section "Java 1.7" secJava /* Adding this amount of space is just trying to give the user a quite realistic impression of how much space the installation is going to need... */ AddSize 81300 SetOutPath $TEMP SetOverwrite on File "jre\jre1.7.offline.exe" ExecWait '"$TEMP\jre1.7.offline.exe"' /* JRE yes, but without a usable Plug-in... */ DeleteRegKey HKLM "Software\JavaSoft\Java Plug-in" SectionEnd ###################################################### LangString JonDoInstallType ${LANG_ENGLISH} "Select Install Type" LangString JonDoInstallType ${LANG_GERMAN} "Auswahl der Installationsart" LangString JonDoInstallNew ${LANG_ENGLISH} "Choose between a portable and a standard installation of JonDo" LangString JonDoInstallNew ${LANG_GERMAN} "Wählen Sie zwischen einer portablen und einer normalen Installation von JonDo" LangString AccountConfig ${LANG_ENGLISH} "Do you want to delete your configuration files and accounts, too?" LangString AccountConfig ${LANG_GERMAN} "Sollen auch die Konfigurationsdateien und Konten entfernt werden?" LangString DeleteFileError ${LANG_ENGLISH} "Some of the installed JonDo files couldn't be deleted!" LangString DeleteFileError ${LANG_GERMAN} "Einige der installierten JonDo-Dateien konnten nicht gel�scht werden!" LangString DeleteUinstError ${LANG_ENGLISH} "The uninstall.exe couldn't be deleted!" LangString DeleteUinstError ${LANG_GERMAN} "Die uninstall.exe konnte nicht gelöscht werden!" LangString DeleteDirError ${LANG_ENGLISH} "The JonDo directory couldn't be deleted!" LangString DeleteDirError ${LANG_GERMAN} "Das JonDo-Installationsverzeichnis konnte nicht gelöscht werden!" LangString JAPJonDoExistence ${LANG_ENGLISH} "JAP/JonDo is still running! Do you want to stop it now?" LangString JAPJonDoExistence ${LANG_GERMAN} "JAP/JonDo läuft noch! Wollen Sie es beenden?" LangString JonDoInstall ${LANG_ENGLISH} "JonDo is already installed! Do you want to uninstall this version first?" LangString JonDoInstall ${LANG_GERMAN} "JonDo ist bereits installiert! Wollen Sie es zuerst deinstallieren?" LangString FindUninstallError ${LANG_ENGLISH} "The uninstall.exe couldn't be found!" LangString FindUninstallError ${LANG_GERMAN} "Die uninstall.exe konnte nicht gefunden werden!" LangString JonDoStart ${LANG_ENGLISH} "Start JonDo" LangString JonDoStart ${LANG_GERMAN} "JonDo starten" LangString JAPInstall ${LANG_ENGLISH} "JAP/JonDo is installed! Do you want to uninstall it first?" LangString JAPInstall ${LANG_GERMAN} "JAP/JonDo ist installiert! Wollen Sie es zuerst deinstallieren?" LangString AdminLogin ${LANG_ENGLISH} "You need to login with an account that is a member of the admin group to continue..." LangString AdminLogin ${LANG_GERMAN} "Sie müssen sich mit einem Account anmelden, der zur Administratorgruppe gehört..." LangString WinUpdate ${LANG_ENGLISH} "Please note: For Windows 95/98/ME, there are no more security updates available since quite a while. Even if you are using security software like JonDo, your computer is in great danger while using the Internet." LangString WinUpdate ${LANG_GERMAN} "Hinweis: Für Windows 95/98/ME sind seit längerem keine Sicherheitsupdates mehr verfügbar. Auch wenn Sie Sicherheitssoftware, wie JonDo, verwenden, ist Ihr Rechner bei der Benutzung des Internets stark gefährdet." LangString JavaWin9x ${LANG_ENGLISH} "If you would like to execute JonDo nevertheless, please install additionally the Java Runtime Environment (JRE) from this URL: http://java.sun.com/javase/downloads/previous.jsp" LangString JavaWin9x ${LANG_GERMAN} "Falls Sie JonDo dennoch ausführen möchten, installieren Sie bitte noch zusätzlich die Java Runtime Environment (JRE) von dieser URL: http://java.sun.com/javase/downloads/previous.jsp" LangString JonDo ${LANG_ENGLISH} "JonDo-Desktop (integration in windows start menu)" LangString JonDo ${LANG_GERMAN} "JonDo-Desktop (Integration in das Windows-Startmenü)" LangString JonDoPortable ${LANG_ENGLISH} "JonDo-Portable (for take-away on USB flash drives)" LangString JonDoPortable ${LANG_GERMAN} "JonDo-Portable (zum Mitnehmen auf USB-Sticks)" LangString DeletePortable ${LANG_ENGLISH} "The directory is already existing! Shall all files (except the jap.conf) be deleted before installing JonDo-Portable?" LangString DeletePortable ${LANG_GERMAN} "Das Verzeichnis existiert bereits! Sollen alle Dateien (bis auf die jap.conf) gelöscht werden, bevor JonDo-Portable installiert wird?" LangString JonDoClosing ${LANG_ENGLISH} "JAP/JonDo is still running! Please terminate it now, if you haven't done it yet. Do you want to wait until JAP/JonDo is finally stopped?" LangString JonDoClosing ${LANG_GERMAN} "JAP/JonDo läuft noch! Bitte beenden Sie es jetzt, falls Sie dies noch nicht getan haben. Wollen Sie warten, bis JAP/JonDo beendet wurde?" LangString InstallingJonDoFox ${LANG_ENGLISH} "In order to surf anonymously you need JonDoFox as well! Do you want to download and install it now?" LangString InstallingJonDoFox ${LANG_GERMAN} "Um anonym zu surfen, benötigen Sie noch JonDoFox! Wollen Sie es jetzt herunterladen und installieren?" LangString InstallingPortableJonDoFox ${LANG_ENGLISH} "Do you want to download JonDoFox and install the portable version as well (necessary for surfing anonymously)?" LangString InstallingPortableJonDoFox ${LANG_GERMAN} "Wollen Sie noch JonDoFox herunterladen und die portable Version installieren (notwendig, um anonym zu surfen)?" LangString JonDoFoxDownload ${LANG_ENGLISH} "Downloading the JonDoFox installer... Please wait." LangString JonDoFoxDownload ${LANG_GERMAN} "Der JonDoFox-Installer wird heruntergeladen... Bitte haben Sie etwas Geduld." LangString DownloadErrorRetry ${LANG_ENGLISH} "Download failed! Do you want to retry?" LangString DownloadErrorRetry ${LANG_GERMAN} "Der Download ist fehlgeschlagen! Wollen Sie es noch einmal versuchen?" /* The following langstrings are part of the button change feature of our uninstaller that is not activated yet */ LangString Yes ${LANG_ENGLISH} "Yes" LangString Yes ${LANG_GERMAN} "Ja" LangString No ${LANG_ENGLISH} "No" LangString No ${LANG_GERMAN} "Nein" LangString JonDoDesktop ${LANG_ENGLISH} "Create JonDo Desktop Shortcut" LangString JonDoDesktop ${LANG_GERMAN} "JonDo-Verknüpfung auf dem Arbeitsplatz anlegen" LangString JonDoAutostart ${LANG_ENGLISH} "Sart JonDo automatically after startup" LangString JonDoAutostart ${LANG_GERMAN} "JonDo nach dem Start des Rechners automatisch starten" ######################################################### /* With this function we basically check whether JonDoFox is already installed and if not we ask the user if he wants it to be downloaded and installed. If so the installer downloads it and executes the installer with user rights. Some parameters are passed to the JonDoFox installer to provide a more convenient installation. */ Function FinishInstall ${If} $install == "portable" StrCmp $JonDoFoxInstallation "" 0 finish_install MessageBox MB_YESNO $(InstallingPortableJonDoFox) IDYES 0 IDNO finish_install ${Else} StrCpy $install "desktop" StrCmp $JonDoFoxInstallation "" 0 finish_install ${If} $InstMode > 1 SetShellVarContext all IfFileExists $APPDATA\Yes 0 desktop_question Delete $APPDATA\Yes SetShellVarContext current Goto finish_install ${Else} ClearErrors ReadRegStr $1 HKCU "Software\JonDoFox" "InstallerLanguage" IfErrors 0 finish_install ${EndIf} desktop_question: MessageBox MB_YESNO $(InstallingJonDoFox) IDYES 0 IDNO finish_install ${EndIf} loop: SetShellVarContext all Inetc::get /CONNECTTIMEOUT=30000 /RECEIVETIMEOUT=30000 /NOPROXY /BANNER "JonDo - JonDoFox Download" $(JonDoFoxDownload) https://www.anonymous-proxy-servers.net/downloads/JonDoFox.paf.exe "$APPDATA\JonDoFox.paf.exe" /END Pop $R0 StrCmp $R0 "OK" +2 MessageBox MB_ICONEXCLAMATION|MB_YESNO $(DownloadErrorRetry) IDYES loop IDNO finish_install UAC::ExecWait '' '"$APPDATA\JonDoFox.paf.exe"' '-INSTALLATION=$install -INSTALLPATH=$INSTDIR -LANGUAGE=$LANGUAGE' '' Sleep 1000 Delete $APPDATA\JonDoFox.paf.exe SetShellVarContext current finish_install: Call FinishRunCB FunctionEnd /* We are preparing our custom checkboxes shown on the finish page: They are both created but dependent on the install mode activated or deactivated by default. */ Function installModeCheck SectionGetFlags ${secPortable} $0 IntOp $0 $0 & 1 ${If} $0 == 1 StrCpy $install "portable" ${Else} StrCpy $install "desktop" ${EndIf} WriteINIStr "$PLUGINSDIR\iospecial.ini" "Settings" "NumFields" "5" WriteINIStr "$PLUGINSDIR\iospecial.ini" "Field 5" "Type" "CheckBox" WriteINIStr "$PLUGINSDIR\iospecial.ini" "Field 5" "Text" "$(JonDoDesktop)" WriteINIStr "$PLUGINSDIR\iospecial.ini" "Field 5" "Left" "120" WriteINIStr "$PLUGINSDIR\iospecial.ini" "Field 5" "Right" "315" WriteINIStr "$PLUGINSDIR\iospecial.ini" "Field 5" "Top" "110" WriteINIStr "$PLUGINSDIR\iospecial.ini" "Field 5" "Bottom" "120" WriteINIStr "$PLUGINSDIR\iospecial.ini" "Settings" "NumFields" "6" WriteINIStr "$PLUGINSDIR\iospecial.ini" "Field 6" "Type" "CheckBox" WriteINIStr "$PLUGINSDIR\iospecial.ini" "Field 6" "Text" "$(JonDoAutostart)" WriteINIStr "$PLUGINSDIR\iospecial.ini" "Field 6" "Left" "120" WriteINIStr "$PLUGINSDIR\iospecial.ini" "Field 6" "Right" "315" WriteINIStr "$PLUGINSDIR\iospecial.ini" "Field 6" "Top" "130" WriteINIStr "$PLUGINSDIR\iospecial.ini" "Field 6" "Bottom" "140" StrCmp $install "portable" portable_selected portable_notselected portable_selected: WriteINIStr "$PLUGINSDIR\iospecial.ini" "Field 5" "State" "0" WriteINIStr "$PLUGINSDIR\iospecial.ini" "Field 6" "State" "0" Goto doneCheckboxes portable_notselected: WriteINIStr "$PLUGINSDIR\iospecial.ini" "Field 5" "State" "1" WriteINIStr "$PLUGINSDIR\iospecial.ini" "Field 6" "State" "1" doneCheckboxes: FunctionEnd /* We want to hide the option to create a desktop shortcut and an entry in the AutoStart folder for JonDoPortable as it does not make sense for it. Additionally, we have to set the background of the custom checkboxes to white ourselves as they are otherwise greyed out. See: http://forums.winamp.com/showthread.php?t=222384 */ Function checkboxBackground StrCmp $install "portable" portable_selected portable_notselected portable_selected: GetDlgItem $R1 $MUI_HWND 1204 ShowWindow $R1 ${SW_HIDE} GetDlgItem $R1 $MUI_HWND 1205 ShowWindow $R1 ${SW_HIDE} Goto settings_done portable_notselected: ReadINIStr $R0 "$PLUGINSDIR\iospecial.ini" "Field 5" "HWND" SetCtlColors $R0 0x000000 0XFFFFFF ReadINIStr $R0 "$PLUGINSDIR\iospecial.ini" "Field 6" "HWND" SetCtlColors $R0 0x000000 0XFFFFFF settings_done: FunctionEnd Function FinishRunCB StrCmp $install "portable" port_selected port_notselected port_selected: ReadINIStr $R0 "$PLUGINSDIR\iospecial.ini" "Field 4" "State" StrCmp $R0 0 launch_done execute execute: UAC::Exec '' '"$INSTDIR\JonDoPortable.exe"' '' '$INSTDIR' Goto launch_done port_notselected: ReadINIStr $R0 "$PLUGINSDIR\iospecial.ini" "Field 4" "State" StrCmp $R0 0 short_desk execute_desktop execute_desktop: UAC::Exec '' '"$INSTDIR\JonDo.exe"' '' '$INSTDIR' short_desk: ReadINIStr $R1 "$PLUGINSDIR\iospecial.ini" "Field 5" "State" StrCmp $R1 0 autocheck shortcut shortcut: SetShellVarContext all CreateShortCut "$DESKTOP\JonDo.lnk" "$INSTDIR\JonDo.exe" autocheck: ReadINIStr $R2 "$PLUGINSDIR\iospecial.ini" "Field 6" "State" StrCmp $R2 0 launch_done autostart autostart: SetShellVarContext all CreateShortCut "$SMSTARTUP\JonDo.lnk" "$INSTDIR\JonDo.exe" "-m -s" launch_done: FunctionEnd /* If installing JonDo-Portable was succesfull and the user had not chosen a PortableApps path we start the explorer because otherwise the user maybe does not find his installed files anymore... */ Function .onInstSuccess SectionGetFlags ${secPortable} $0 IntOp $0 $0 & 1 ${If} $0 = 1 ${If} $INSTDIR != $R5${PORTABLE} ${AndIf} $INSTDIR != $FOUNDPORTABLEAPPSPATH\${PORTABLE} Exec "explorer $INSTDIR" ${EndIf} ${EndIf} FunctionEnd ######################################################## Function PortableCheck SectionGetFlags ${secPortable} $0 IntOp $0 $0 & 1 IntCmp $0 1 0 +2 Abort FunctionEnd ######################################################## /* The following function basically checks whether Java is already installed and enables/disables the relevant installation options accordingly. If we have a Win9x user he is warned again and we show him a link where he can get the appropriate Java Version for his computer. */ Function comp_pre ${If} $JonDoFoxInstallation == "desktop" Call ModeSelectionPageLeave ${EndIf} Call DetectJava Pop $detectedJre IntCmp $detectedJre 0 lbl_done lbl_done lbl_deselect_java /* If no JRE found (or Error) --> changes nothing If JRE detected --> deselect Java... */ lbl_deselect_java: !insertmacro UnselectSection ${secJava} lbl_done: ${If} $R5 != "" Goto PortableJonDo_or_Elevated ${EndIf} IntCmp $9 0 0 NormalJonDo NormalJonDo PortableJonDo_or_Elevated: ${If} $InstMode > 1 ${OrIf} $JonDoFoxInstallation == "desktop" Goto NormalJonDo ${Else} !insertmacro UnselectSection ${SEC0000} !insertmacro SelectSection ${secPortable} !insertmacro UnselectSection ${secJava} Abort ${EndIf} NormalJonDo: Call GetWin9xVersion SectionGetFlags ${secJava} $0 IntOp $0 $0 & 1 IntCmp $0 1 comp_pre_done java_isnotselected java_isnotselected java_isnotselected: Abort comp_pre_done: StrCmp $Win9x "1" 0 done_javawin9x MessageBox MB_ICONEXCLAMATION $(JavaWin9x) !insertmacro UnselectSection ${secJava} Abort done_javawin9x: Abort FunctionEnd ####################################################### Function un.RemoveLastDirectoryFromPath Exch $R0 Push $R1 Push $R2 StrLen $R1 $R0 ;IntOp $R1 $R1 + 1 loop: IntOp $R1 $R1 - 1 StrCpy $R2 $R0 1 $R1 StrCmp $R2 ":" exit2 StrCmp $R2 "\" exit1 Goto loop exit1: StrCpy $R0 $R0 $R1 exit2: Pop $R2 Pop $R1 Exch $R0 FunctionEnd ####################################################### Section Uninstall ReadRegStr $INSTDIR HKLM "Software\JonDo" Path /* We need the LinkPath here as well in order to delete the links in the StartMenuGroup properly (the directory containing the links cannot be hardcoded as the user may rename it as she pleases */ ReadRegStr $R1 HKLM "Software\JonDo" LinkPath /* The idea is to have the "No" button on the left side and the "Yes" button on the right side (the "No" button is acctivated by default) in order to make it harder for the user to delete her JonDo settings files accidentally. But first we have to make sure that the stack is empty. See: http://www.phacai.com/ resolve-the-extra-help-button-when-using-messagebox-plug-in-for-nsis*/ ${stack::ns_clear} MessageBox::show 0 2 MB_YESNO 0 0 $(AccountConfig) "JonDo Deinstallation" "/but1 $(No)" "/but2 $(Yes)" Pop $0 StrCmp $0 "1" notok ok ok: UAC::ExecWait '' '"$INSTDIR\JonDo.exe"' '--uninstall' '' notok: ClearErrors Delete $INSTDIR\JonDo.exe Delete $INSTDIR\JAP.jar Delete $INSTDIR\japdll.dll Delete $INSTDIR\japdll_x64.dll IfErrors 0 +2 MessageBox MB_OK $(DeleteFileError) DeleteRegValue HKLM "Software\JonDo\Components" Main ClearErrors Delete $INSTDIR\uninstall.exe IfErrors 0 +2 MessageBox MB_OK $(DeleteUinstError) DeleteRegKey HKLM "Software\JonDo" DeleteRegKey HKLM "Software\JonDoJAP" DeleteRegKey HKLM "Software\JonDoLang" SetShellVarContext all Delete $DESKTOP\JonDo.lnk Delete $SMSTARTUP\JonDo.lnk Push $R1 Call un.RemoveLastDirectoryFromPath Pop $R0 /* This will delete the links as well... */ RMDir /r /REBOOTOK $R0 ClearErrors ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion IfErrors 0 +3 Delete "$QUICKLAUNCH\$(^InstallLink).lnk" Goto +2 Call un.DeleteQuickLaunch SetShellVarContext current ClearErrors RMDir /r $INSTDIR IfErrors 0 +2 MessageBox MB_OK $(DeleteDirError) DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\JonDoUninstall" ${UAC.Unload} SectionEnd ##################################################### # Installer Language Strings LangString ^UninstallLink ${LANG_GERMAN} "Lösche $(^Name)" LangString ^UninstallLink ${LANG_ENGLISH} "Uninstall $(^Name)" LangString ^InstallLink ${LANG_GERMAN} "Starte $(^Name)" LangString ^InstallLink ${LANG_ENGLISH} "Start $(^Name)"