diff options
author | assarbad <none@none> | 2005-08-08 16:10:11 +0400 |
---|---|---|
committer | assarbad <none@none> | 2005-08-08 16:10:11 +0400 |
commit | 8c8ccb47642b73b6fed6e1f201e98d3d77ecd508 (patch) | |
tree | 58dc0af25315908e6de9681cf81e407a87e26e76 /setup | |
parent | fbf265438deeea15ac4c3bc65f9f2468d23932af (diff) |
- Added NSIS scripts and one NT script to create a setup from the release files. Running the NT script will create the setup automagically.
Diffstat (limited to 'setup')
-rw-r--r-- | setup/GatherFilesAndCreateSetup.cmd | 202 | ||||
-rw-r--r-- | setup/WDS.nsi | 363 |
2 files changed, 565 insertions, 0 deletions
diff --git a/setup/GatherFilesAndCreateSetup.cmd b/setup/GatherFilesAndCreateSetup.cmd new file mode 100644 index 0000000..eb13fda --- /dev/null +++ b/setup/GatherFilesAndCreateSetup.cmd @@ -0,0 +1,202 @@ +@echo off +:: ---------------------------------------------------------------------------- +:: Script to create the NSIS installer from a prepared NSIS script +:: +:: Requirements: +:: - NSIS must be installed in %ProgramFiles%\NSIS +:: - WDS.nsi and GetVersion.nsi must exist in the current directory +:: +:: This script will do this: +:: 1. Copy required files into %install% +:: 2. Create %chkver% from GetVersion.nsi +:: 3. Call the created EXE file +:: 4. Parse the output in %verfile% into %vernsi% +:: 5. Search for wdsr* subdirectories in the ..\make directory +:: 6. Extract the names from the .<language>.txt files located there +:: 7. Putting all language information into WDS_Languages.nsi +:: ---------------------------------------------------------------------------- +set install=.\Installer +set nsis=%ProgramFiles%\NSIS\makensis.exe +set verfile=Version.txt +set vernsi=%verfile:.txt=.nsi% +set chkver=GetVersionWDS.exe +set chkfile=%install%\windirstatA.exe +set langfile=WDS_Languages.nsi +set err=Unknown error +if NOT EXIST %nsis% @( + set err=Could not find NSIS compiler at "%nsis%" + goto ERROR +) +echo Copying files to temporary directory ... +echo ------------------------------------------------------------------------------ +if NOT EXIST %install% @( + md %install% > NUL +) +echo license.txt (License) +copy /y /v ..\make\windirstat\res\license.txt "%install%" > NUL +echo *.ico (Icons) +copy /y /v ..\make\windirstat\res\icon1.ico "%install%" > NUL +copy /y /v ..\make\windirstat\res\icon2.ico "%install%" > NUL +echo *.dll (Resource DLLs and shfolder.dll) +copy /y /v ..\release\*.dll "%install%" > NUL +copy /y /v ..\urelease\*.dll "%install%" > NUL +echo *.chm (Help files) +copy /y /v ..\urelease\*.chm "%install%" > NUL +echo *.exe (ANSI and Unicode version) +copy /y /v ..\urelease\windirstat.exe "%install%\windirstatU.exe" > NUL +copy /y /v ..\release\windirstat.exe "%install%\windirstatA.exe" > NUL +echo. +echo Now retrieving the current version +echo ^(from "%install%\windirstatA.exe"^) +echo ------------------------------------------------------------------------------ +if NOT EXIST GetVersion.nsi @( + set err=The NSIS script file which retrieves the version could not be found. Make sure it is in the current directory and accessible! + goto ERROR +) +"%nsis%" "/DInstallerOut=%chkver%" "/DVersionOut=%verfile%" "/DVersionOfFile=%chkfile%" GetVersion.nsi > NUL +:: Delete the old version file, if it exists +if EXIST "%verfile%" del /f /q "%verfile%" +:: Try to call the EXE file created from the script +if EXIST "%chkver%" @( + %chkver% +) else ( + set err=The program to retrieve the WDS version could not be found. Is the current directory read-only? Make sure it's not and try again. + goto ERROR +) +:: Check for existance of the version file +if EXIST "%verfile%" @( + echo Successfully retrieved file version: +) else ( + set err=Could not retrieve the file version of "%chkfile%", please make sure the file is at its place and accessible. + goto ERROR +) +:: Delete the temporary EXE file +if EXIST "%chkver%" del /f /q "%chkver%" +:: Split the version string and then create several defines +for /f "tokens=1,2,3,4 delims=." %%i in (%verfile%) do ( + echo Version %%i.%%j.%%k ^(Build %%l^) + echo ^!define sVersion "%%i.%%j.%%k.%%l" > %vernsi% + echo ^!define sVersionS "%%i.%%j.%%k" >> %vernsi% + echo ^!define sVersionBuild "%%l" >> %vernsi% + echo ^!define dVersionMajor %%i >> %vernsi% + echo ^!define dVersionMinor %%j >> %vernsi% + echo ^!define dVersionRev %%k >> %vernsi% + echo ^!define dVersionBuild %%l >> %vernsi% + echo ^!define sVersionFile "%%i_%%j_%%k" >> %vernsi% + echo ^!define sVersionFull "WinDirStat %%i.%%j.%%k" >> %vernsi% + echo ^!define Installer "%install%" >> %vernsi% +) +:: Delete the Version.txt +if EXIST "%verfile%" del /f /q "%verfile%" +echo. +echo Going to collect information about available languages ... +echo ------------------------------------------------------------------------------ +echo ^!ifdef LANGSECTIONS > "%langfile%" +for /f %%i in ('dir /b /A:D ..\make\wdsr*') do ( + for /f %%j in ('dir /b ..\make\%%i\.*.txt') do ( + call :GetLanguage %%i %%j "%langfile%" AppendLanguage + ) +) +echo ^!endif >> "%langfile%" +echo. >> "%langfile%" +echo ^!ifdef DESCRIBING >> "%langfile%" +for /f %%i in ('dir /b /A:D ..\make\wdsr*') do ( + for /f %%j in ('dir /b ..\make\%%i\.*.txt') do ( + call :GetLanguage %%i %%j "%langfile%" AppendLanguageDesc + ) +) +echo ^!endif >> "%langfile%" +echo. >> "%langfile%" +echo ^!ifdef DELLANGFILES >> "%langfile%" +for /f %%i in ('dir /b /A:D ..\make\wdsr*') do ( + for /f %%j in ('dir /b ..\make\%%i\.*.txt') do ( + call :GetLanguage %%i %%j "%langfile%" AppendLanguageFileDel + ) +) +echo ^!endif >> "%langfile%" +echo. >> "%langfile%" +echo. +echo Now creating the installer. Please wait, this may take a while ... +echo ------------------------------------------------------------------------------ +"%nsis%" WDS.nsi > NUL +if EXIST "%langfile%" del /f /q "%langfile%" +if EXIST "%vernsi%" del /f /q "%vernsi%" +echo Finished! +echo. +goto :END +:ERROR +echo An error occurred: +echo -^> %err% +echo. +goto :END +:: ---------------------------------------------------------------------------- +:: START of functions +:: ---------------------------------------------------------------------------- +goto :EOF +:GetLanguage +setlocal & set RET=%2 +set lang=%1 +set langno=%lang:wdsr=% +set RET=%RET:.txt=% +set RET=%RET:~1% +call :%4 +endlocal & set RET=%RET% +goto :EOF + +:AppendLanguage +setlocal +if EXIST "%install%\wdsr%langno%.dll" ( + echo %RET% + echo ; ----------------------------------------------- >> %langfile% + if EXIST "%install%\wdsh%langno%.chm" ( + echo Section "%RET% + help" %lang% >> %langfile% + ) else ( + echo Section "%RET%" %lang% >> %langfile% + ) + echo SectionIn 1 2 >> %langfile% +rem echo SetOutPath ^$INSTDIR >> %langfile% + echo File %install%\wdsr%langno%.dll >> %langfile% + if EXIST "%install%\wdsh%langno%.chm" ( + echo File %install%\wdsh%langno%.chm >> %langfile% + echo CreateShortCut "$SMPROGRAMS\WinDirStat\Help (%RET%).lnk" "$INSTDIR\wdsh%langno%.chm" >> %langfile% + ) else ( + echo ; No helpfile available: %install%\wdsh%langno%.chm >> %langfile% + ) + echo SectionEnd >> %langfile% + echo. >> %langfile% +) +endlocal +goto :EOF + +:AppendLanguageDesc +setlocal +if EXIST "%install%\wdsr%langno%.dll" ( + if EXIST "%install%\wdsh%langno%.chm" ( + echo ^!insertmacro MUI_DESCRIPTION_TEXT ^${%lang%} "Required for %RET% user interface support (includes help file)" >> %langfile% + ) else ( + echo ^!insertmacro MUI_DESCRIPTION_TEXT ^${%lang%} "Required for %RET% user interface support" >> %langfile% + ) +) +endlocal +goto :EOF + +:AppendLanguageFileDel +setlocal +if EXIST "%install%\wdsr%langno%.dll" ( + echo IfFileExists "$INSTDIR\wdsr%langno%.dll" 0 +2 >> %langfile% + echo Delete "$INSTDIR\wdsr%langno%.dll" >> %langfile% + if EXIST "%install%\wdsh%langno%.chm" ( + echo IfFileExists "$INSTDIR\wdsh%langno%.chm" 0 +2 >> %langfile% + echo Delete "$INSTDIR\wdsh%langno%.chm" >> %langfile% + ) +) +endlocal +goto :EOF + +:: ---------------------------------------------------------------------------- +:: END of functions +:: ---------------------------------------------------------------------------- +:END +if EXIST %install% rd /q /s %install% +pause + diff --git a/setup/WDS.nsi b/setup/WDS.nsi new file mode 100644 index 0000000..aa811c2 --- /dev/null +++ b/setup/WDS.nsi @@ -0,0 +1,363 @@ +;-------------------------------- +;Include Modern UI + + !include "MUI.nsh" + +;-------------------------------- +;General + + !include "Version.nsi" + !include "Sections.nsh" + ;Name and file + Name "${sVersionFull}" + OutFile "windirstat${sVersionFile}_setup.exe" + SetDatablockOptimize on + SetCompress force + SetCompressor /FINAL lzma + CRCCheck on + XPStyle on + LicenseForceSelection checkbox + + ;Default installation folder + InstallDir "$PROGRAMFILES\WinDirStat" + + ;Get installation folder from registry if available + InstallDirRegKey HKCU "Software\Seifert\WinDirStat" "InstDir" + +;-------------------------------- +; Global variables + Var bIsNT + Var dwMajorVersion + Var dwMinorVersion + Var sAnsiFilename + !define SelectSection "!insertmacro SelectSection" + !define UnselectSection "!insertmacro UnselectSection" + !define RestoreSection "!insertmacro RestoreSection" + !define SetSectionFlag "!insertmacro SetSectionFlag" + !define SetSectionInInstType "!insertmacro SetSectionInInstType" + !define ClearSectionInInstType "!insertmacro ClearSectionInInstType" + !define SectionFlagIsSet "!insertmacro SectionFlagIsSet" +;-------------------------------- +;Interface Settings + + !define MUI_ABORTWARNING + !define MUI_COMPONENTSPAGE_SMALLDESC + +;-------------------------------- +;Pages + + !insertmacro MUI_PAGE_LICENSE "${Installer}\license.txt" + !insertmacro MUI_PAGE_COMPONENTS + !insertmacro MUI_PAGE_DIRECTORY + !insertmacro MUI_PAGE_INSTFILES + +; Define some values + !define MUI_FINISHPAGE_LINK "Visit the WinDirStat website for news and hints." + !define MUI_FINISHPAGE_LINK_LOCATION "http://windirstat.sourceforge.net/" + !define MUI_FINISHPAGE_RUN "$INSTDIR\windirstat.exe" + !define MUI_FINISHPAGE_NOREBOOTSUPPORT +; Insert finish page + !insertmacro MUI_PAGE_FINISH + + !insertmacro MUI_UNPAGE_CONFIRM + !insertmacro MUI_UNPAGE_INSTFILES + +;-------------------------------- +;Languages + + !insertmacro MUI_LANGUAGE "English" + +;-------------------------------- +;Version Information + + VIProductVersion "${sVersion}" + VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductName" "WinDirStat" + VIAddVersionKey /LANG=${LANG_ENGLISH} "Comments" "This release contains both, Unicode and ANSI version of WinDirStat" + VIAddVersionKey /LANG=${LANG_ENGLISH} "CompanyName" "WDS Team" + VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalCopyright" "© 2003-2005 WDS Team" + VIAddVersionKey /LANG=${LANG_ENGLISH} "FileDescription" "${sVersionFull}" + VIAddVersionKey /LANG=${LANG_ENGLISH} "FileVersion" "${sVersionS}" + VIAddVersionKey /LANG=${LANG_ENGLISH} "InternalName" "WDS Setup" + VIAddVersionKey /LANG=${LANG_ENGLISH} "OriginalFilename" "WinDirStat${sVersionFile}_setup.exe" + +;-------------------------------- +;Reserve Files + + ;These files should be inserted before other files in the data block + ;Keep these lines before any File command + ;Only for solid compression (by default, solid compression is enabled for BZIP2 and LZMA) + +;-------------------------------- +;Installer Sections + +InstType "Full installation" +InstType "Recommended only" +InstType "Recommended components without languages" + +Icon "${Installer}\icon1.ico" +SubSection /e "Core components (English incl. help)" + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ; Check the major version against 4, if equal or less copy the shfolder.dll + ; which is required on Windows NT 4.0 and 9x/Me only. + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + Section "-Required" + SectionIn RO + SetOutPath $INSTDIR + IntCmpU $dwMajorVersion 4 0 0 +3 + File ${Installer}\shfolder.dll + Goto +2 + DetailPrint "Skipping shfolder.dll (Windows $dwMajorVersion.$dwMinorVersion)" + File ${Installer}\windirstat.chm + ; Store installation folder + WriteRegStr HKCU "Software\Seifert\WinDirStat" "InstDir" $INSTDIR + Call CreateUninstallEntry + SectionEnd + + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ; On Windows 9x/Me you will only get to select the ANSI version of WDS. + ; The EXE file is being copied as "windirstat.exe" then. + ; + ; On the NT platform you *may* select ANSI additionally (Unicode is + ; preselected and cannot be unchecked) in which case it is copied as + ; "windirstatA.exe" + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + Section "ANSI (95/98/Me)" Ansi + SectionIn 1 + StrCmp $bIsNT "0" 0 +3 + ; If not running on NT, use windirstat.exe as filename + StrCpy $sAnsiFilename "windirstat.exe" + Goto +2 + StrCpy $sAnsiFilename "windirstatA.exe" + ; ... else use windirstatA.exe + File /oname=$INSTDIR\$sAnsiFilename ${Installer}\windirstatA.exe + SectionEnd + + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ; This section is only of importance on the NT platform, else the file is + ; being skipped completely. + ; + ; On NT you cannot uncheck Unicode, so it will be installed anyway. + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + Section "Unicode (NT/2K/XP/2003/...)" Unicode + SectionIn 1 + ; If not running on NT, skip this file + StrCmp $bIsNT "0" +2 + File /oname=$INSTDIR\windirstat.exe ${Installer}\windirstatU.exe + SectionEnd + + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ; This will create the following shortcuts under program in the start menu: + ; -> WinDirStat\WinDirStat.lnk + ; (OR, if running on NT platform and additionally ANSI was selected) + ; -> WinDirStat\WinDirStat (Unicode).lnk + ; WinDirStat\WinDirStat (ANSI).lnk + ; ** WinDirStat\Uninstall WinDirStat.lnk + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + Section "Create a program group in startmenu" Startmenu + SectionIn 1 2 3 + CreateDirectory "$SMPROGRAMS\WinDirStat" + StrCmp $bIsNT "0" 0 +3 + CreateShortCut "$SMPROGRAMS\WinDirStat\WinDirStat.lnk" "$INSTDIR\windirstat.exe" + Goto NotNT + ; If ANSI was selected on NT + ${SectionFlagIsSet} ${Ansi} ${SF_SELECTED} 0 OnlyUnicode + CreateShortCut "$SMPROGRAMS\WinDirStat\WinDirStat (ANSI).lnk" "$INSTDIR\windirstatA.exe" + CreateShortCut "$SMPROGRAMS\WinDirStat\WinDirStat (Unicode).lnk" "$INSTDIR\windirstat.exe" + Goto NotNT + ; If only Unicode was selected on NT + OnlyUnicode: + CreateShortCut "$SMPROGRAMS\WinDirStat\WinDirStat.lnk" "$INSTDIR\windirstat.exe" + NotNT: + CreateShortCut "$SMPROGRAMS\WinDirStat\Uninstall WinDirStat.lnk" "$INSTDIR\Uninstall.exe" + CreateShortCut "$SMPROGRAMS\WinDirStat\Help (English).lnk" "$INSTDIR\windirstat.chm" + SectionEnd + + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ; This will create a single shortcut to the recommended program version on + ; the users desktop. + ; ** WinDirStat.lnk + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + Section "Create shortcut on the desktop" Desktop + SectionIn 1 2 3 + CreateShortCut "$DESKTOP\WinDirStat.lnk" "$INSTDIR\windirstat.exe" + SectionEnd +SubSectionEnd + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Automatically created list of supported languages and their names. +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +SubSection /e "Languages" + !define LANGSECTIONS + !include "WDS_Languages.nsi" + !undef LANGSECTIONS +SubSectionEnd + +;-------------------------------- +;Installer Functions + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; This function is a callback being called upon initialization. It checks the +; OS versionon which we run and decides about the available options. +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +Function .onInit + Call CheckOS + StrCmp $bIsNT "0" 0 IsNT +; Hide the unicode section + SectionSetText ${Unicode} "" +; Select ANSI and make if read-only + ${SelectSection} ${Ansi} + ${SetSectionFlag} ${Ansi} ${SF_BOLD} + ${SetSectionFlag} ${Ansi} ${SF_RO} + ${SetSectionInInstType} ${Ansi} ${INSTTYPE_2} + ${SetSectionInInstType} ${Ansi} ${INSTTYPE_3} + ${ClearSectionInInstType} ${Unicode} ${INSTTYPE_1} + ${ClearSectionInInstType} ${Unicode} ${INSTTYPE_2} + ${ClearSectionInInstType} ${Unicode} ${INSTTYPE_3} + SectionSetSize ${Unicode} 0 +IsNT: +; Make the unicode section checked and bold + ${SelectSection} ${Unicode} + ${SetSectionFlag} ${Unicode} ${SF_BOLD} + ${SetSectionFlag} ${Unicode} ${SF_RO} + ${SetSectionInInstType} ${Unicode} ${INSTTYPE_2} + ${SetSectionInInstType} ${Unicode} ${INSTTYPE_3} +; Set default install type (recommended) + SetCurInstType 1 +FunctionEnd + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Check the major and minor version number and check for NT +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +Function CheckOS + Push $0 + Push $1 + System::Call 'kernel32::GetVersion() i .r0' + IntOp $1 $0 & 0xFFFF + IntOp $dwMajorVersion $1 & 0xFF + IntOp $dwMinorVersion $1 >> 8 + IntOp $0 $0 & 0x80000000 + IntCmpU $0 0 IsNT Is9x Is9x +Is9x: + StrCpy $bIsNT "0" + Goto AfterOsCheck +IsNT: + StrCpy $bIsNT "1" +AfterOsCheck: + Pop $1 + Pop $0 +FunctionEnd + +Function CreateUninstallEntry + ; Create the uninstaller + WriteUninstaller "$INSTDIR\Uninstall.exe" + WriteRegExpandStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\WinDirStat" "UninstallString" '"$INSTDIR\Uninstall.exe"' + WriteRegExpandStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\WinDirStat" "InstallLocation" "$INSTDIR" + WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\WinDirStat" "DisplayName" "${sVersionFull}" + WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\WinDirStat" "DisplayIcon" "$INSTDIR\windirstat.exe,0" + WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\WinDirStat" "dwVersionMajor" "${dVersionMajor}" + WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\WinDirStat" "dwVersionMinor" "${dVersionMinor}" + WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\WinDirStat" "dwVersionRev" "${dVersionRev}" + WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\WinDirStat" "dwVersionBuild" "${dVersionBuild}" + WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\WinDirStat" "URLInfoAbout" "http://windirstat.sourceforge.net/" + WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\WinDirStat" "NoModify" "1" + WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\WinDirStat" "NoRepair" "1" +FunctionEnd +; ----------------------------------------------------------------------------- + +;-------------------------------- +;Descriptions + +; USE A LANGUAGE STRING IF YOU WANT YOUR DESCRIPTIONS TO BE LANGAUGE SPECIFIC + +; Assign descriptions to sections +!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN + !insertmacro MUI_DESCRIPTION_TEXT ${Ansi} "Installs the ANSI version of WinDirStat, compatible with any Windows" + !insertmacro MUI_DESCRIPTION_TEXT ${Unicode} "Installs the Unicode version of WinDirStat, compatible with Windows NT/2000/XP/2003. (Recommended!)" + !insertmacro MUI_DESCRIPTION_TEXT ${Startmenu} "Creates a program group in your startmenu." + !insertmacro MUI_DESCRIPTION_TEXT ${Desktop} "Creates a shortcut on the desktop which points to the component shown in bold." + !define DESCRIBING + !include "WDS_Languages.nsi" + !undef DESCRIBING +!insertmacro MUI_FUNCTION_DESCRIPTION_END + +;-------------------------------- +;Uninstaller Section +UninstallIcon "${Installer}\icon2.ico" + +Section "Uninstall" + +; Delete the WDS files + Delete "$INSTDIR\windirstat.exe" + IfFileExists "$INSTDIR\windirstatA.exe" 0 +2 + Delete "$INSTDIR\windirstatA.exe" + IfFileExists "$INSTDIR\shfolder.dll" 0 +2 + Delete "$INSTDIR\shfolder.dll" + Delete "$INSTDIR\windirstat.chm" +; Delete additional languag files. Only these which had been included in the installer! + !define DELLANGFILES + !include "WDS_Languages.nsi" + !undef DELLANGFILES +; Remove the WDS install directory, if empty + RMDir /r "$INSTDIR" + +; Delete program group entries + IfFileExists "$SMPROGRAMS\WinDirStat\WinDirStat.lnk" 0 +2 + Delete "$SMPROGRAMS\WinDirStat\WinDirStat.lnk" + IfFileExists "$SMPROGRAMS\WinDirStat\WinDirStat (ANSI).lnk" 0 +2 + Delete "$SMPROGRAMS\WinDirStat\WinDirStat (ANSI).lnk" + IfFileExists "$SMPROGRAMS\WinDirStat\WinDirStat (Unicode).lnk" 0 +2 + Delete "$SMPROGRAMS\WinDirStat\WinDirStat (Unicode).lnk" + + Delete "$SMPROGRAMS\WinDirStat\Uninstall WinDirStat.lnk" +; Remove the program group, if empty + RMDir /r "$SMPROGRAMS\WinDirStat" + +; Remove desktop link + Delete "$DESKTOP\WinDirStat.lnk" + +; Remove the value for the install directory + DeleteRegValue HKCU "Software\Seifert\WinDirStat" "InstDir" +; Delete the WDS subkey + DeleteRegKey /ifempty HKCU "Software\Seifert\WinDirStat" +; Delete the parent key as well if WDS was the only app in this subkey + DeleteRegKey /ifempty HKCU "Software\Seifert" + + Call un.CreateUninstallEntry +SectionEnd + +;-------------------------------- +;Uninstaller Functions + +Function un.onInit + Call un.CheckOS +FunctionEnd + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Check the major and minor version number and check for NT +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +Function un.CheckOS + Push $0 + Push $1 + System::Call 'kernel32::GetVersion() i .r0' + IntOp $1 $0 & 0xFFFF + IntOp $dwMajorVersion $1 & 0xFF + IntOp $dwMinorVersion $1 >> 8 + IntOp $0 $0 & 0x80000000 + IntCmpU $0 0 IsNT Is9x Is9x +Is9x: + StrCpy $bIsNT "0" + Goto AfterOsCheck +IsNT: + StrCpy $bIsNT "1" +AfterOsCheck: + Pop $1 + Pop $0 +FunctionEnd + +Function un.CreateUninstallEntry +; Delete the uninstaller + Delete "$INSTDIR\Uninstall.exe" + DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\WinDirStat" +FunctionEnd +; ----------------------------------------------------------------------------- + |