Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/windirstat/windirstat.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/setup
diff options
context:
space:
mode:
authorassarbad <none@none>2005-12-11 06:53:57 +0300
committerassarbad <none@none>2005-12-11 06:53:57 +0300
commit8e85c40740ccaa6355eeadb460dd1863263a1324 (patch)
tree2643e7da5b769d3a8f5cdeee697b24642172eb2b /setup
parentf59edec314daade049ccfc4408063a331441c8d7 (diff)
First version of the NSIS installer script to be released publicly. Autoselects the current language (if matching is found), contains language names in English and the native languages respectively.
Script fully self-contained. Extracts WDS version automatically as well as language strings. No silent option, yet. Will be implemented later.
Diffstat (limited to 'setup')
-rw-r--r--setup/GatherFilesAndCreateSetup.cmd158
-rw-r--r--setup/WDS.nsi139
2 files changed, 241 insertions, 56 deletions
diff --git a/setup/GatherFilesAndCreateSetup.cmd b/setup/GatherFilesAndCreateSetup.cmd
index eb13fda..2e8d8a6 100644
--- a/setup/GatherFilesAndCreateSetup.cmd
+++ b/setup/GatherFilesAndCreateSetup.cmd
@@ -4,29 +4,50 @@
::
:: Requirements:
:: - NSIS must be installed in %ProgramFiles%\NSIS
-:: - WDS.nsi and GetVersion.nsi must exist in the current directory
+:: - WDS.nsi must exist in the current directory (which has to be writable!)
::
:: This script will do this:
+:: 0. Create temporary NSI scripts WDS_GetVersion.nsi and WDS_Languages.nsi
:: 1. Copy required files into %install%
-:: 2. Create %chkver% from GetVersion.nsi
+:: 2. Create %chkver(A|U)% from WDS_GetVersion.nsi
:: 3. Call the created EXE file
-:: 4. Parse the output in %verfile% into %vernsi%
+:: 4. Parse the output in %verfile(A|U)% 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
+:: 7. Putting all language information into WDS_LanguagesTemp.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 verfileA=VersionA.txt
+set verfileU=VersionU.txt
+set vernsi=WDS_LangAnd%verfileA:A.txt=.nsi%
+set chkverA=GetVersionWDS_A.exe
+set chkverU=GetVersionWDS_U.exe
+set chkfileA=%install%\windirstatA.exe
+set chkfileU=%install%\windirstatU.exe
+set langfile=WDS_LanguagesTemp.nsi
+set langs=langs.txt
+set langsexe=langs.exe
+set getvernsi=WDS_GetVersion.nsi
+set langsnsi=WDS_Languages.nsi
+set wdsmain=WDS_Main.nsi
set err=Unknown error
if NOT EXIST %nsis% @(
set err=Could not find NSIS compiler at "%nsis%"
goto ERROR
)
+:: ----------------------------------------------------------------------------
+echo Creation of temporary scripts
+echo ------------------------------------------------------------------------------
+echo !define WDSMAIN_NSI > %wdsmain%
+echo !define LANGANDVER ^"%vernsi%^" >> %wdsmain%
+echo !define LANGTEMP ^"%langfile%^" >> %wdsmain%
+type WDS.nsi >> %wdsmain%
+echo !define LANGUAGES_NSI > %langsnsi%
+type WDS.nsi >> %langsnsi%
+echo !define GETVERSION_NSI > %getvernsi%
+type WDS.nsi >> %getvernsi%
+:: ----------------------------------------------------------------------------
echo Copying files to temporary directory ...
echo ------------------------------------------------------------------------------
if NOT EXIST %install% @(
@@ -46,51 +67,82 @@ 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 Now retrieving the current (ANSI) version
echo ^(from "%install%\windirstatA.exe"^)
echo ------------------------------------------------------------------------------
-if NOT EXIST GetVersion.nsi @(
+if NOT EXIST %getvernsi% @(
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
+"%nsis%" "/DInstallerOut=%chkverA%" "/DVersionOut=%verfileA%" "/DVersionOfFile=%chkfileA%" %getvernsi% > NUL
+"%nsis%" "/DInstallerOut=%chkverU%" "/DVersionOut=%verfileU%" "/DVersionOfFile=%chkfileU%" %getvernsi% > NUL
:: Delete the old version file, if it exists
-if EXIST "%verfile%" del /f /q "%verfile%"
+if EXIST "%verfileA%" del /f /q "%verfileA%"
+if EXIST "%verfileU%" del /f /q "%verfileU%"
:: Try to call the EXE file created from the script
-if EXIST "%chkver%" @(
- %chkver%
+if EXIST "%chkverA%" @(
+ %chkverA%
) 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.
+ set err=The program to retrieve the WDS ANSI version could not be found. Is the current directory read-only? Make sure it's not and try again.
+ goto ERROR
+)
+if EXIST "%chkverU%" @(
+ %chkverU%
+) else (
+ set err=The program to retrieve the WDS Unicode 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:
+if EXIST "%verfileA%" @(
+ echo Successfully retrieved ANSI file version:
+) else (
+ set err=Could not retrieve the file version of "%chkfileA%", please make sure the file is at its place and accessible.
+ goto ERROR
+)
+if EXIST "%verfileU%" @(
+ echo Successfully retrieved Unicode file version:
) else (
- set err=Could not retrieve the file version of "%chkfile%", please make sure the file is at its place and accessible.
+ set err=Could not retrieve the file version of "%chkfileU%", 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%"
+if EXIST "%chkverA%" del /f /q "%chkverA%"
+if EXIST "%chkverU%" del /f /q "%chkverU%"
:: 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%
+for /f "tokens=1,2,3,4 delims=." %%i in (%verfileA%) do (
+ echo ANSI Version %%i.%%j.%%k ^(Build %%l^)
+ echo ^!define sVersion_Ansi "%%i.%%j.%%k.%%l" > %vernsi%
+ echo ^!define sVersionBuild_Ansi "%%l" >> %vernsi%
+ echo ^!define dVersionBuild_Ansi %%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%
)
+:: The same for the unicode executable
+for /f "tokens=1,2,3,4 delims=." %%i in (%verfileU%) do (
+ echo Unicode Version %%i.%%j.%%k ^(Build %%l^)
+ echo ^!define sVersion_Unicode "%%i.%%j.%%k.%%l" >> %vernsi%
+ echo ^!define sVersionBuild_Unicode "%%l" >> %vernsi%
+ echo ^!define dVersionBuild_Unicode %%l >> %vernsi%
+)
:: Delete the Version.txt
-if EXIST "%verfile%" del /f /q "%verfile%"
+if EXIST "%verfileA%" del /f /q "%verfileA%"
+if EXIST "%verfileU%" del /f /q "%verfileU%"
echo.
echo Going to collect information about available languages ...
echo ------------------------------------------------------------------------------
+if EXIST "%langs%" del /f /q "%langs%"
+:: Prepare language strings
+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%" PrepareLanguageStrings
+ )
+)
+:: Now the actual parsing of the languages
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 (
@@ -115,12 +167,26 @@ for /f %%i in ('dir /b /A:D ..\make\wdsr*') do (
)
echo ^!endif >> "%langfile%"
echo. >> "%langfile%"
+echo ^!ifdef LANGCURRLANG >> "%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%" AppendCurrentLangChoice
+ )
+)
+echo ^!endif >> "%langfile%"
+echo. >> "%langfile%"
+:: Cleanup language strings
+if EXIST "%langs%" del /f /q "%langs%"
echo.
echo Now creating the installer. Please wait, this may take a while ...
echo ------------------------------------------------------------------------------
-"%nsis%" WDS.nsi > NUL
+"%nsis%" %wdsmain% > NUL
if EXIST "%langfile%" del /f /q "%langfile%"
if EXIST "%vernsi%" del /f /q "%vernsi%"
+:: Cleanup temporary scripts
+if EXIST "%getvernsi%" del /f /q "%getvernsi%"
+if EXIST "%langsnsi%" del /f /q "%langsnsi%"
+if EXIST "%wdsmain%" del /f /q "%wdsmain%"
echo Finished!
echo.
goto :END
@@ -143,22 +209,32 @@ call :%4
endlocal & set RET=%RET%
goto :EOF
+:PrepareLanguageStrings
+setlocal
+if EXIST "%install%\wdsr%langno%.dll" (
+ "%nsis%" "/DInstallerOut=%langsexe%" "/DLangOut=%vernsi%" /DLCID=0x%langno% /DLANGID=%langno% %langsnsi% > NUL
+ %langsexe%
+ if EXIST "%langsexe%" del /f /q "%langsexe%"
+)
+endlocal
+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%
+ echo Section "${LangEngName%langno%} (${LangNatName%langno%}/${LangShoName%langno%}) + help" %lang% >> %langfile%
) else (
- echo Section "%RET%" %lang% >> %langfile%
+ echo Section "${LangEngName%langno%} (${LangNatName%langno%}/${LangShoName%langno%})" %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%
+ echo CreateShortCut "$SMPROGRAMS\WinDirStat\Help (${LangEngName%langno%} - ${LangNatName%langno%}).lnk" "$INSTDIR\wdsh%langno%.chm" >> %langfile%
) else (
echo ; No helpfile available: %install%\wdsh%langno%.chm >> %langfile%
)
@@ -172,9 +248,9 @@ goto :EOF
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%
+ echo ^!insertmacro MUI_DESCRIPTION_TEXT ^${%lang%} "Required for ${LangEngName%langno%} (${LangNatName%langno%}/${LangShoName%langno%}) user interface support (includes help file)" >> %langfile%
) else (
- echo ^!insertmacro MUI_DESCRIPTION_TEXT ^${%lang%} "Required for %RET% user interface support" >> %langfile%
+ echo ^!insertmacro MUI_DESCRIPTION_TEXT ^${%lang%} "Required for ${LangEngName%langno%} (${LangNatName%langno%}/${LangShoName%langno%}) user interface support" >> %langfile%
)
)
endlocal
@@ -193,6 +269,24 @@ if EXIST "%install%\wdsr%langno%.dll" (
endlocal
goto :EOF
+:AppendCurrentLangChoice
+setlocal
+if EXIST "%install%\wdsr%langno%.dll" (
+ echo Push $0 >> %langfile%
+ echo IntCmp $0 0x%langno% 0 Unselect%langno% Unselect%langno% >> %langfile%
+ echo ${SetSectionFlag} ${%lang%} ${SF_BOLD} >> %langfile%
+ echo ${SelectSection} ${%lang%} >> %langfile%
+ echo Goto EndSel%langno% >> %langfile%
+ echo Unselect%langno%: >> %langfile%
+ echo ${ClearSectionFlag} ${%lang%} ${SF_BOLD} >> %langfile%
+ echo ${UnselectSection} ${%lang%} >> %langfile%
+ echo EndSel%langno%: >> %langfile%
+ echo Pop $0 >> %langfile%
+
+)
+endlocal
+goto :EOF
+
:: ----------------------------------------------------------------------------
:: END of functions
:: ----------------------------------------------------------------------------
diff --git a/setup/WDS.nsi b/setup/WDS.nsi
index a2fe498..c458b4f 100644
--- a/setup/WDS.nsi
+++ b/setup/WDS.nsi
@@ -1,28 +1,32 @@
+; Define the following symbols to get the intended functionality
+; LANGUAGES_NSI
+; GETVERSION_NSI
+; WDSMAIN_NSI
+!ifdef WDSMAIN_NSI
;--------------------------------
-;Include Modern UI
+; Include Modern UI
!include "MUI.nsh"
;--------------------------------
-;General
+; General
- !include "Version.nsi"
+ !include "${LANGANDVER}"
!include "Sections.nsh"
- ;Name and file
+ ; Name and file
Name "${sVersionFull}"
BrandingText "http://windirstat.sourceforge.net"
OutFile "windirstat${sVersionFile}_setup.exe"
SetDatablockOptimize on
SetCompress force
SetCompressor /FINAL lzma
- CRCCheck on
+ CRCCheck force
XPStyle on
LicenseForceSelection checkbox
- ;Default installation folder
+ ; Default installation folder
InstallDir "$PROGRAMFILES\WinDirStat"
-
- ;Get installation folder from registry if available
+ ; Get installation folder from registry if available
InstallDirRegKey HKCU "Software\Seifert\WinDirStat" "InstDir"
;--------------------------------
@@ -35,17 +39,18 @@
!define UnselectSection "!insertmacro UnselectSection"
!define RestoreSection "!insertmacro RestoreSection"
!define SetSectionFlag "!insertmacro SetSectionFlag"
+ !define ClearSectionFlag "!insertmacro ClearSectionFlag"
!define SetSectionInInstType "!insertmacro SetSectionInInstType"
!define ClearSectionInInstType "!insertmacro ClearSectionInInstType"
!define SectionFlagIsSet "!insertmacro SectionFlagIsSet"
;--------------------------------
-;Interface Settings
+; Interface Settings
!define MUI_ABORTWARNING
!define MUI_COMPONENTSPAGE_SMALLDESC
;--------------------------------
-;Pages
+; Pages
!insertmacro MUI_PAGE_LICENSE "${Installer}\license.txt"
!insertmacro MUI_PAGE_COMPONENTS
@@ -69,9 +74,9 @@
!insertmacro MUI_LANGUAGE "English"
;--------------------------------
-;Version Information
+; Version Information
- VIProductVersion "${sVersion}"
+ VIProductVersion "${sVersion_Ansi}"
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"
@@ -80,20 +85,21 @@
VIAddVersionKey /LANG=${LANG_ENGLISH} "FileVersion" "${sVersionS}"
VIAddVersionKey /LANG=${LANG_ENGLISH} "InternalName" "WDS Setup"
VIAddVersionKey /LANG=${LANG_ENGLISH} "OriginalFilename" "WinDirStat${sVersionFile}_setup.exe"
+ VIAddVersionKey /LANG=${LANG_ENGLISH} "SpecialBuild" "This setup is still a beta version!"
;--------------------------------
-;Reserve Files
+; 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
+; Installer Sections
InstType "Full installation"
-InstType "Recommended only"
-InstType "Recommended components without languages"
+InstType "Recommended only (all languages)"
+InstType "Recommended only (without languages)"
Icon "${Installer}\icon1.ico"
SubSection /e "Core components (English incl. help)"
@@ -189,7 +195,7 @@ SubSectionEnd
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
SubSection /e "Languages"
!define LANGSECTIONS
- !include "WDS_Languages.nsi"
+ !include "${LANGTEMP}"
!undef LANGSECTIONS
SubSectionEnd
@@ -222,8 +228,13 @@ IsNT:
${SetSectionFlag} ${Unicode} ${SF_RO}
${SetSectionInInstType} ${Unicode} ${INSTTYPE_2}
${SetSectionInInstType} ${Unicode} ${INSTTYPE_3}
-; Set default install type (recommended)
- SetCurInstType 1
+; Set default install type to "recommended"
+ SetCurInstType 2
+; Now check current thread locale
+ System::Call "kernel32::GetThreadLocale() i .r0"
+ !define LANGCURRLANG
+ !include "${LANGTEMP}"
+ !undef LANGCURRLANG
FunctionEnd
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -258,7 +269,7 @@ Function CreateUninstallEntry
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}"
+ WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\WinDirStat" "dwVersionBuild" "${dVersionBuild_Ansi}"
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"
@@ -272,12 +283,12 @@ FunctionEnd
; 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 ${Ansi} "Installs the ANSI version of WinDirStat, compatible with any Windows version. [Version ${sVersion_Ansi}]"
+ !insertmacro MUI_DESCRIPTION_TEXT ${Unicode} "Installs the Unicode version of WinDirStat, compatible with Windows NT/2000/XP/2003. [Version ${sVersion_Unicode}]"
!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"
+ !include "${LANGTEMP}"
!undef DESCRIBING
!insertmacro MUI_FUNCTION_DESCRIPTION_END
@@ -296,7 +307,7 @@ Section "Uninstall"
Delete "$INSTDIR\windirstat.chm"
; Delete additional languag files. Only these which had been included in the installer!
!define DELLANGFILES
- !include "WDS_Languages.nsi"
+ !include "${LANGTEMP}"
!undef DELLANGFILES
; Remove the WDS install directory, if empty
RMDir /r "$INSTDIR"
@@ -361,4 +372,84 @@ Function un.CreateUninstallEntry
DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\WinDirStat"
FunctionEnd
; -----------------------------------------------------------------------------
+!endif ; WDSMAIN_NSI
+
+!ifdef LANGUAGES_NSI
+OutFile "${InstallerOut}"
+
+Function .onInit
+
+; Write it to a !define for use in main script
+ FileOpen $R0 "$EXEDIR\${LangOut}" a
+ FileSeek $R0 0 END
+ Push $0 ;save
+ Call LangNameEnglish
+ Pop $0
+ FileWrite $R0 '!define LangEngName${LANGID} "'
+ FileWrite $R0 '$0"$\r$\n'
+ Call LangNameNative
+ Pop $0
+ FileWrite $R0 '!define LangNatName${LANGID} "'
+ FileWrite $R0 '$0"$\r$\n'
+ Call LangNameShort
+ Pop $0
+ FileWrite $R0 '!define LangShoName${LANGID} "'
+ FileWrite $R0 '$0"$\r$\n'
+ Pop $0 ; restore
+ FileClose $R0
+
+ Abort
+FunctionEnd
+
+Function LangNameEnglish
+ Push $0 ; push the old value of variable $0
+ System::Alloc "${NSIS_MAX_STRLEN}"
+ Pop $0 ; get the return value of System::Alloc
+ System::Call "Kernel32::GetLocaleInfo(i,i,t,i)i(${LCID},0x00001001,.r0,${NSIS_MAX_STRLEN})i"
+ Exch $0 ; restore old value of variable $0
+FunctionEnd
+
+Function LangNameNative
+ Push $0 ; push the old value of variable $0
+ System::Alloc "${NSIS_MAX_STRLEN}"
+ Pop $0 ; get the return value of System::Alloc
+ System::Call "Kernel32::GetLocaleInfo(i,i,t,i)i(${LCID},0x00000004,.r0,${NSIS_MAX_STRLEN})i"
+ Exch $0 ; restore old value of variable $0
+FunctionEnd
+
+Function LangNameShort
+ Push $0 ; push the old value of variable $0
+ System::Alloc "${NSIS_MAX_STRLEN}"
+ Pop $0 ; get the return value of System::Alloc
+ System::Call "Kernel32::GetLocaleInfo(i,i,t,i)i(${LCID},0x00000003,.r0,${NSIS_MAX_STRLEN})i"
+ Exch $0 ; restore old value of variable $0
+FunctionEnd
+
+Section
+SectionEnd
+!endif ; LANGUAGES_NSI
+
+!ifdef GETVERSION_NSI
+OutFile "${InstallerOut}"
+
+Function .onInit
+; Get file version
+ GetDllVersion "${VersionOfFile}" $R0 $R1
+ IntOp $R2 $R0 / 0x00010000
+ IntOp $R3 $R0 & 0x0000FFFF
+ IntOp $R4 $R1 / 0x00010000
+ IntOp $R5 $R1 & 0x0000FFFF
+ StrCpy $R1 "$R2.$R3.$R4.$R5"
+
+; Write it to a !define for use in main script
+ FileOpen $R0 "$EXEDIR\${VersionOut}" w
+ FileWrite $R0 '$R1'
+ FileClose $R0
+
+ Abort
+FunctionEnd
+
+Section
+SectionEnd
+!endif ; GETVERSION_NSI