diff --git a/Docs/src/SConscript b/Docs/src/SConscript
index bc63e5e7..fc413112 100644
--- a/Docs/src/SConscript
+++ b/Docs/src/SConscript
@@ -1,7 +1,7 @@
config_but = 'config.but'
chapters = 5
-appendices = 8
+appendices = 9
htmls = Split('IndexPage.html Contents.html') \
+ map(lambda ch: 'Chapter' + str(ch + 1) + '.html', range(chapters)) \
@@ -47,6 +47,7 @@ buts = Split("""
library.but
usefulfunc.but
usefulinfos.but
+ headers.but
history.but
build.but
credits.but
diff --git a/Docs/src/headers.but b/Docs/src/headers.but
new file mode 100644
index 00000000..351c9d75
--- /dev/null
+++ b/Docs/src/headers.but
@@ -0,0 +1,2504 @@
+\A{headers} Useful Headers
+
+
+\H{filefunc} File Functions Header
+
+
+\S1{} Introduction
+
+Include header:
+
+\c !include "FileFunc.nsh"
+
+
+Include function "GetFileExt" for install and "GetParent" for uninstall:
+
+\c !insertmacro GetFileExt
+\c !insertmacro un.GetParent
+
+
+Call functions:
+
+\c Section Install
+\c ${GetFileExt} "C:\My Downloads\Index.html" $R0
+\c ; $R0="html"
+\c SectionEnd
+
+\c Section un.Install
+\c ${un.GetParent} "C:\My Downloads\Index.html" $R0
+\c ; $R0="C:\My Downloads"
+\c SectionEnd
+
+
+\S1{} Locate
+
+\b Find files, directories and empty directories with mask and size options.
+
+\\Syntax:\\
+
+\c ${Locate} "[Path]" "[Options]" "Function"
+
+\c "[Path]" ; Disk or Directory
+\c ;
+\c "[Options]" ; /L=[FD|F|D|DE|FDE]
+\c ; /L=FD - Locate Files and Directories (default)
+\c ; /L=F - Locate Files only
+\c ; /L=D - Locate Directories only
+\c ; /L=DE - Locate Empty Directories only
+\c ; /L=FDE - Locate Files and Empty Directories
+\c ; /M=[mask]
+\c ; /M=*.* - Locate all (default)
+\c ; /M=*.doc - Locate Work.doc, 1.doc ...
+\c ; /M=Pho* - Locate PHOTOS, phone.txt ...
+\c ; /M=win???.exe - Locate winamp.exe, winver.exe ...
+\c ; /M=winamp.exe - Locate winamp.exe only
+\c ; /S=No:No[B|K|M|G]
+\c ; /S= - Don't locate file size (faster) (default)
+\c ; /S=0:0B - Locate only files of 0 Bytes exactly
+\c ; /S=5:9K - Locate only files of 5 to 9 Kilobytes
+\c ; /S=:10M - Locate only files of 10 Megabyte or less
+\c ; /S=1G - Locate only files of 1 Gigabyte or more
+\c ; /G=[1|0]
+\c ; /G=1 - Locate with subdirectories (default)
+\c ; /G=0 - Locate without subdirectories
+\c ; /B=[0|1]
+\c ; /B=0 - Banner isn't used (default)
+\c ; /B=1 - Banner is used. Callback when function
+\c ; start to search in new directory
+\c "Function" ; Callback function then found
+\c
+\c Function "Function"
+\c ; $R9 "path\name"
+\c ; $R8 "path"
+\c ; $R7 "name"
+\c ; $R6 "size" ($R6="" if directory, $R6="0" if file with /S=)
+\c
+\c ; $R0-$R5 are not used (save data in them).
+\c ; ...
+\c
+\c Push $var ; If $var="StopLocate" Then exit from function
+\c FunctionEnd
+
+\\Note:\\
+\\
-Error flag if disk or directory isn't exist
+\\
-Error flag if syntax error
+
+
+\\Example (Find one file):\\
+
+\c Section
+\c ${Locate} "C:\ftp" "/L=F /M=RPC DCOM.rar /S=1K" "Example1"
+\c ; 'RPC DCOM.rar' file in 'C:\ftp' with size 1 Kb or more
+\c
+\c IfErrors 0 +2
+\c MessageBox MB_OK "Error" IDOK +2
+\c MessageBox MB_OK "$$R0=$R0"
+\c SectionEnd
+\c
+\c Function Example1
+\c StrCpy $R0 $R9
+\c ; $R0="C:\ftp\files\RPC DCOM.rar"
+\c
+\c MessageBox MB_YESNO '$R0$\n$\nFind next?' IDYES +2
+\c StrCpy $0 StopLocate
+\c
+\c Push $0
+\c FunctionEnd
+
+\\Example (Write founded in text file):\\
+
+\c Section
+\c GetTempFileName $R0
+\c FileOpen $R1 $R0 w
+\c ${Locate} "C:\ftp" "/S=:2M /G=0" "Example2"
+\c ; folders and all files with size 2 Mb or less
+\c ; don't scan subdirectories
+\c FileClose $R1
+\c
+\c IfErrors 0 +2
+\c MessageBox MB_OK "Error" IDOK +2
+\c Exec '"notepad.exe" "$R0"'
+\c SectionEnd
+\c
+\c Function Example2
+\c StrCmp $R6 '' 0 +3
+\c FileWrite $R1 "Directory=$R9$\r$\n"
+\c goto +2
+\c FileWrite $R1 "File=$R9 Size=$R6 Mb$\r$\n"
+\c
+\c Push $0
+\c FunctionEnd
+
+\\Example (Write founded in INI file):\\
+
+\c Section
+\c GetTempFileName $R0
+\c ${Locate} "C:\ftp" "/L=F /S=0K" "Example3"
+\c ; all files in 'C:\ftp' with size detect in Kb
+\c
+\c IfErrors 0 +2
+\c MessageBox MB_OK "Error" IDOK +2
+\c Exec '"notepad.exe" "$R0"'
+\c SectionEnd
+\c
+\c Function Example3
+\c WriteINIStr $R0 "$R8" "$R7" "$R6 Kb"
+\c
+\c Push $0
+\c FunctionEnd
+
+\\Example (Delete empty directories):\\
+
+\c Section
+\c StrCpy $R2 0
+\c StrCpy $R3 0
+\c
+\c loop:
+\c StrCpy $R1 0
+\c ${Locate} "C:\ftp" "/L=DE" "Example4"
+\c IntOp $R3 $R3 + 1
+\c IntOp $R2 $R2 + $R1
+\c StrCmp $R0 StopLocate +2
+\c StrCmp $R1 0 0 loop
+\c
+\c IfErrors 0 +2
+\c MessageBox MB_OK 'error' IDOK +2
+\c MessageBox MB_OK '$R2 directories were removed$\n$R3 loops'
+\c SectionEnd
+\c
+\c Function Example4
+\c MessageBox MB_YESNOCANCEL 'Delete empty "$R9"?' IDNO end IDCANCEL cancel
+\c RMDir $R9
+\c IntOp $R1 $R1 + 1
+\c goto end
+\c
+\c cancel:
+\c StrCpy $R0 StopLocate
+\c
+\c end:
+\c Push $R0
+\c FunctionEnd
+
+\\Example (Move all files into one folder):\\
+
+\c Section
+\c StrCpy $R0 "C:\ftp" ;Directory move from
+\c StrCpy $R1 "C:\ftp2" ;Directory move into
+\c
+\c StrCpy $R2 0
+\c StrCpy $R3 0
+\c ${Locate} "$R0" "/L=F" "Example5"
+\c
+\c IfErrors 0 +2
+\c MessageBox MB_OK 'error' IDOK +4
+\c StrCmp $R3 0 0 +2
+\c MessageBox MB_OK '$R2 files were moved' IDOK +2
+\c MessageBox MB_OK '$R2 files were moved$\n$R3 files were NOT moved'
+\c SectionEnd
+\c
+\c Function Example5
+\c StrCmp $R8 $R1 +6
+\c IfFileExists '$R1\$R7' +4
+\c Rename $R9 '$R1\$R7'
+\c IntOp $R2 $R2 + 1
+\c goto +2
+\c IntOp $R3 $R3 + 1
+\c
+\c Push $0
+\c FunctionEnd
+
+\\Example (Copy files with log):\\
+
+\c Section
+\c StrCpy $R0 "C:\ftp" ;Directory copy from
+\c StrCpy $R1 "C:\ftp2" ;Directory copy into
+\c StrLen $R2 $R0
+\c
+\c GetTempFileName $0
+\c FileOpen $R3 $0 w
+\c ${Locate} "$R0" "/L=FDE" "Example6"
+\c FileClose $R3
+\c
+\c IfErrors 0 +2
+\c MessageBox MB_OK 'error'
+\c
+\c Exec '"notepad.exe" "$0"' ;view log
+\c SectionEnd
+\c
+\c Function Example6
+\c StrCpy $1 $R8 '' $R2
+\c
+\c StrCmp $R6 '' 0 +3
+\c CreateDirectory '$R1$1\$R7'
+\c goto end
+\c CreateDirectory '$R1$1'
+\c CopyFiles /SILENT $R9 '$R1$1'
+\c
+\c IfFileExists '$R1$1\$R7' 0 +3
+\c FileWrite $R3 "-old:$R9 -new:$R1$1\$R7 -success$\r$\n"
+\c goto +2
+\c FileWrite $R3 "-old:$R9 -new:$R1$1\$R7 -failed$\r$\n"
+\c
+\c end:
+\c Push $0
+\c FunctionEnd
+
+\\Example (Recreate directory structure):\\
+
+\c Section
+\c StrCpy $R0 "C:\ftp" ;Directory structure from
+\c StrCpy $R1 "C:\ftp2" ;Directory structure into
+\c StrLen $R2 $R0
+\c
+\c ${Locate} "$R0" "/L=D" "Example7"
+\c
+\c IfErrors 0 +2
+\c MessageBox MB_OK 'error'
+\c SectionEnd
+\c
+\c Function Example7
+\c StrCpy $1 $R9 '' $R2
+\c CreateDirectory '$R1$1'
+\c
+\c Push $0
+\c FunctionEnd
+
+\\Example (Locate with banner - "NxS" plugin required):\\
+
+\c Section
+\c nxs::Show /NOUNLOAD `$(^Name) Setup` /top `Setup searching something$\r$\nPlease wait... If you can..` /h 1 /can 1 /end
+\c ${Locate} "C:\WINDOWS" "/L=F /M=*.inf /B=1" "Example8"
+\c nxs::Destroy
+\c SectionEnd
+\c
+\c Function Example8
+\c StrCmp $R0 $R8 abortcheck
+\c StrCpy $R0 $R8
+\c nxs::Update /NOUNLOAD /sub "$R8" /pos 78 /end
+\c
+\c abortcheck:
+\c nxs::HasUserAborted /NOUNLOAD
+\c Pop $0
+\c StrCmp $0 1 0 +2
+\c StrCpy $0 StopLocate
+\c
+\c StrCmp $R9 '' end
+\c ;...
+\c
+\c end:
+\c Push $0
+\c FunctionEnd
+
+\S1{} GetSize
+
+\b Find the size of a file, files mask or directory.
+
+\b Find the sum of the files, directories and subdirectories.
+
+\\Syntax:\\
+
+\c ${GetSize} "[Path]" "[Options]" $var1 $var2 $var3
+
+\c "[Path]" ; Disk or Directory
+\c ;
+\c "[Options]" ; /M=[mask]
+\c ; /M=*.* - Find all (default)
+\c ; /M=*.doc - Find Work.doc, 1.doc ...
+\c ; /M=Pho* - Find PHOTOS, phone.txt ...
+\c ; /M=win???.exe - Find winamp.exe, winver.exe ...
+\c ; /M=winamp.exe - Find winamp.exe only
+\c ; /S=No:No[B|K|M|G]
+\c ; /S= - Don't find file size (faster) (default)
+\c ; /S=0:0B - Find only files of 0 Bytes exactly
+\c ; /S=5:9K - Find only files of 5 to 9 Kilobytes
+\c ; /S=:10M - Find only files of 10 Megabyte or less
+\c ; /S=1G - Find only files of 1 Gigabyte or more
+\c ; /G=[1|0]
+\c ; /G=1 - Find with subdirectories (default)
+\c ; /G=0 - Find without subdirectories
+\c ;
+\c $var1 ; Result1: Size
+\c $var2 ; Result2: Sum of files
+\c $var3 ; Result3: Sum of directories
+
+\\Note:\\
+\\
-Error flag if disk or directory isn't exist
+\\
-Error flag if syntax error
+
+
+\\Example (1):\\
+
+\c Section
+\c ; Find file size "C:\WINDOWS\Explorer.exe" in kilobytes
+\c
+\c ${GetSize} "C:\WINDOWS" "/M=Explorer.exe /S=0K /G=0" $0 $1 $2
+\c ; $0="220" Kb
+\c ; $1="1" files
+\c ; $2="" directories
+\c
+\c IfErrors 0 +2
+\c MessageBox MB_OK "Error"
+\c SectionEnd
+
+\\Example (2):\\
+
+\c Section
+\c ; Find folder size "C:\Installs\Reanimator\Drivers" in megabytes
+\c
+\c ${GetSize} "C:\Installs\Reanimator\Drivers" "/S=0M" $0 $1 $2
+\c ; $0="132" Mb
+\c ; $1="555" files
+\c ; $2="55" directories
+\c
+\c IfErrors 0 +2
+\c MessageBox MB_OK "Error"
+\c SectionEnd
+
+\\Example (3):\\
+
+\c Section
+\c ; Find sum of files and folders "C:\WINDOWS" (no subfolders)
+\c
+\c ${GetSize} "C:\WINDOWS" "/G=0" $0 $1 $2
+\c ; $0="" size
+\c ; $1="253" files
+\c ; $2="46" directories
+\c
+\c IfErrors 0 +2
+\c MessageBox MB_OK "Error"
+\c SectionEnd
+
+\S1{} DriveSpace
+
+\b Get total, occupied or free space of the drive.
+
+\\Syntax:\\
+
+\c ${GetSize} "[Drive]" "[Options]" $var
+
+\c "[Drive]" ; Disk to check
+\c ;
+\c "[Options]" ; /D=[T|O|F]
+\c ; /D=T - Total space (default)
+\c ; /D=O - Occupied space
+\c ; /D=F - Free space
+\c ; /S=[B|K|M|G]
+\c ; /S=B - size in Bytes (default)
+\c ; /S=K - size in Kilobytes
+\c ; /S=M - size in Megabytes
+\c ; /S=G - size in Gigabytes
+\c ;
+\c $var ; Result: Size
+
+\\Note:\\
+\\
-Error flag if disk isn't exist or not ready
+\\
-Error flag if syntax error
+
+
+\\Example:\\
+
+\c Section
+\c ${DriveSpace} "C:\" "/D=F /S=M" $R0
+\c ; $R0="2530" megabytes free on drive C:
+\c SectionEnd
+
+\S1{} GetDrives
+
+\b Find all available drives in the system.
+
+\\Syntax:\\
+
+\c ${GetDrives} "[Option]" "Function"
+
+\c "[Option]" ; [FDD+HDD+CDROM+NET+RAM]
+\c ; FDD Floppy Disk Drives
+\c ; HDD Hard Disk Drives
+\c ; CDROM CD-ROM Drives
+\c ; NET Network Drives
+\c ; RAM RAM Disk Drives
+\c ;
+\c ; [ALL]
+\c ; Find all drives by letter (default)
+\c ;
+\c "Function" ; Callback function then found
+\c
+\c Function "Function"
+\c ; $9 "drive letter" (a:\ c:\ ...)
+\c ; $8 "drive type" (FDD HDD ...)
+\c
+\c ; $R0-$R9 are not used (save data in them).
+\c ; ...
+\c
+\c Push $var ; If $var="StopGetDrives" Then exit from function
+\c FunctionEnd
+
+\\Example1:\\
+
+\c Section
+\c ${GetDrives} "FDD+CDROM" "Example1"
+\c SectionEnd
+\c
+\c Function Example1
+\c MessageBox MB_OK "$9 ($8 Drive)"
+\c
+\c Push $0
+\c FunctionEnd
+
+\\Example2:\\
+
+\c Section
+\c ${GetDrives} "ALL" "Example2"
+\c SectionEnd
+\c
+\c Function Example2
+\c MessageBox MB_OK "$9 ($8 Drive)"
+\c
+\c Push $0
+\c FunctionEnd
+
+\\Example3 (Get type of drive):\\
+
+\c Section
+\c StrCpy $R0 "D:\" ;Drive letter
+\c StrCpy $R1 "invalid"
+\c
+\c ${GetDrives} "ALL" "Example3"
+\c
+\c MessageBox MB_OK "Type of drive $R0 is $R1"
+\c SectionEnd
+\c
+\c Function Example3
+\c StrCmp $9 $R0 0 +3
+\c StrCpy $R1 $8
+\c StrCpy $0 StopGetDrives
+\c
+\c Push $0
+\c FunctionEnd
+
+\S1{} GetTime
+
+\b Get local time.
+
+\b Get file time (access, creation and modification).
+
+\\Syntax:\\
+
+\c ${GetTime} "[File]" "[Option]" $var1 $var2 $var3 $var4 $var5 $var6 $var7
+
+\c "[File]" ; Ignored if "L"
+\c ;
+\c "[Option]" ; [Options]
+\c ; L Local time
+\c ; A last Access file time
+\c ; C Creation file time
+\c ; M Modification file time
+\c ;
+\c $var1 ; Result1: day
+\c $var2 ; Result2: month
+\c $var3 ; Result3: year
+\c $var4 ; Result4: day of week name
+\c $var5 ; Result5: hour
+\c $var6 ; Result6: minute
+\c $var7 ; Result7: seconds
+
+\\Note:\\
+\\
-Error flag if file isn't exist
+\\
-Error flag if syntax error
+
+
+\\Example (Get local time):\\
+
+\c Section
+\c ${GetTime} "" "L" $0 $1 $2 $3 $4 $5 $6
+\c ; $0="01" day
+\c ; $1="04" month
+\c ; $2="2005" year
+\c ; $3="Friday" day of week name
+\c ; $4="16" hour
+\c ; $5="05" minute
+\c ; $6="50" seconds
+\c
+\c MessageBox MB_OK 'Date=$0/$1/$2 ($3)$\nTime=$4:$5:$6'
+\c SectionEnd
+
+\\Example (Get file time):\\
+
+\c Section
+\c ${GetTime} "$WINDIR\Explorer.exe" "C" $0 $1 $2 $3 $4 $5 $6
+\c ; $0="12" day
+\c ; $1="10" month
+\c ; $2="2004" year
+\c ; $3="Tuesday" day of week name
+\c ; $4="2" hour
+\c ; $5="32" minute
+\c ; $6="03" seconds
+\c
+\c IfErrors 0 +2
+\c MessageBox MB_OK "Error" IDOK +2
+\c MessageBox MB_OK 'Date=$0/$1/$2 ($3)$\nTime=$4:$5:$6'
+\c SectionEnd
+
+\S1{} GetFileAttributes
+
+\b Get attributes of file or directory.
+
+\\Syntax:\\
+
+\c ${GetFileAttributes} "[File]" "[Attributes]" $var
+
+\c "[File]" ; File or directory
+\c ;
+\c "[Attributes]" ; "ALL" (default)
+\c ; -all attributes of file combined with "|" to output
+\c ;
+\c ; "READONLY|HIDDEN|SYSTEM|DIRECTORY|ARCHIVE|
+\c ; DEVICE|NORMAL|TEMPORARY|SPARSE_FILE|REPARSE_POINT|
+\c ; COMPRESSED|OFFLINE|NOT_CONTENT_INDEXED|ENCRYPTED"
+\c ; -file must have specified attributes
+\c ;
+\c $var ; Result:
+\c ; $var=attr1|attr2|... (if used "ALL")
+\c ; $var=1 file has specified attributes
+\c ; $var=0 file has no specified attributes
+
+\\Note:\\
+\\
-Error flag if file isn't exist
+
+
+\\Example1:\\
+
+\c Section
+\c ${GetFileAttributes} "C:\MSDOS.SYS" "ALL" $R0
+\c ; $R0=READONLY|HIDDEN|SYSTEM|ARCHIVE
+\c SectionEnd
+
+\\Example2:\\
+
+\c Section
+\c ${GetFileAttributes} "C:\MSDOS.SYS" "SYSTEM|HIDDEN" $R0
+\c ; $R0=1
+\c SectionEnd
+
+\\Example3:\\
+
+\c Section
+\c ${GetFileAttributes} "C:\MSDOS.SYS" "NORMAL" $R0
+\c ; $R0=0
+\c SectionEnd
+
+\S1{} GetFileVersion
+
+\b Get version information from executable file.
+
+\\Syntax:\\
+
+\c ${GetFileVersion} "[Executable]" $var
+
+\c "[Executable]" ; Executable file (*.exe *.dll ...)
+\c $var ; Result: Version number
+
+\\Note:\\
+\\
-Error flag if file isn't exist
+\\
-Error flag if file isn't contain version information
+
+
+\\Example:\\
+
+\c Section
+\c ${GetFileVersion} "C:\ftp\program.exe" $R0
+\c ; $R0="1.1.0.12"
+\c SectionEnd
+
+\S1{} GetExeName
+
+\b Get installer filename (also valid case for Windows 9X).
+
+\\Syntax:\\
+
+\c ${GetExeName} $var
+
+\\Example:\\
+
+\c Section
+\c ${GetExeName} $R0
+\c ; $R0="C:\ftp\program.exe"
+\c SectionEnd
+
+\S1{} GetExePath
+
+\b Get installer pathname ($EXEDIR with valid case for Windows 9X).
+
+\\Syntax:\\
+
+\c ${GetExePath} $var
+
+\\Example:\\
+
+\c Section
+\c ${GetExePath} $R0
+\c ; $R0="C:\ftp"
+\c SectionEnd
+
+\S1{} GetParameters
+
+\b Get command line parameters.
+
+\\Syntax:\\
+
+\c ${GetParameters} $var
+
+\\Example:\\
+
+\c Section
+\c ${GetParameters} $R0
+\c ; $R0="[parameters]"
+\c SectionEnd
+
+\S1{} GetOptions
+
+\b Get options from command line parameters.
+
+\\Syntax:\\
+
+\c ${GetOptions} "[Parameters]" "[Option]" $var
+
+\c "[Parameters]" ; command line parameters
+\c ;
+\c "[Option]" ; option name
+\c ;
+\c $var ; Result: option string
+
+\\Note:\\
+\\
-First option symbol it is delimiter
+
+
+\\Example1:\\
+
+\c Section
+\c ${GetOptions} "/INSTDIR=Temp /SILENT=yes /ADMIN=qwerty" "/ADMIN=" $R0
+\c ;$R0=qwerty
+\c SectionEnd
+
+\\Example2:\\
+
+\c Section
+\c ${GetOptions} "-INSTDIR=C:\Program Files\Common Files -SILENT=yes" "-INSTDIR=" $R0
+\c ;$R0=C:\Program Files\Common Files
+\c SectionEnd
+
+\\Example3:\\
+
+\c Section
+\c ${GetOptions} '/SILENT=yes /INSTDIR="C:/Program Files/Common Files" /ADMIN=password' "/INSTDIR=" $R0
+\c ;$R0=C:/Program Files/Common Files
+\c SectionEnd
+
+\\Example4:\\
+
+\c Section
+\c ${GetOptions} `-SILENT=yes -INSTDIR='"C:/Program Files/Common Files"' -ADMIN=password` "-INSTDIR=" $R0
+\c ;$R0="C:/Program Files/Common Files"
+\c SectionEnd
+
+\S1{} GetRoot
+
+\b Get root directory.
+
+\\Syntax:\\
+
+\c ${GetRoot} "[FullPath]" $var
+
+\\Example1:\\
+
+\c Section
+\c ${GetRoot} "C:\Program Files\NSIS" $R0
+\c ; $R0="C:"
+\c SectionEnd
+
+\\Example2:\\
+
+\c Section
+\c ${GetRoot} "\\SuperPimp\NSIS\Source\exehead\Ui.c" $R0
+\c ; $R0="\\SuperPimp\NSIS"
+\c SectionEnd
+
+\S1{} GetParent
+
+\b Get parent directory.
+
+\\Syntax:\\
+
+\c ${GetParent} "[PathString]" $var
+
+\\Example:\\
+
+\c Section
+\c ${GetParent} "C:\Program Files\Winamp\uninstwa.exe" $R0
+\c ; $R0="C:\Program Files\Winamp"
+\c SectionEnd
+
+\S1{} GetFileName
+
+\b Get last part from directory path.
+
+\\Syntax:\\
+
+\c ${GetFileName} "[PathString]" $var
+
+\\Example:\\
+
+\c Section
+\c ${GetFileName} "C:\Program Files\Winamp\uninstwa.exe" $R0
+\c ; $R0="uninstwa.exe"
+\c SectionEnd
+
+\S1{} GetBaseName
+
+\b Get file name without extension.
+
+\\Syntax:\\
+
+\c ${GetBaseName} "[FileString]" $var
+
+\\Example:\\
+
+\c Section
+\c ${GetBaseName} "C:\ftp\program.exe" $R0
+\c ; $R0="program"
+\c SectionEnd
+
+\S1{} GetFileExt
+
+\b Get extention of file.
+
+\\Syntax:\\
+
+\c ${GetFileExt} "[FileString]" $var
+
+\\Example:\\
+
+\c Section
+\c ${GetFileExt} "C:\ftp\program.exe" $R0
+\c ; $R0="exe"
+\c SectionEnd
+
+\S1{} BannerTrimPath
+
+\b Trim string path for banner.
+
+\\Syntax:\\
+
+\c ${BannerTrimPath} "[PathString]" "[Option]" $var
+
+\c "[PathString]" ;
+\c ;
+\c "[Option]" ; [Lenght][A|B|C]
+\c ;
+\c ; Lenght -Maximum string lenght
+\c ; A -Trim center path (default)
+\c ; (C:\root\...\third path)
+\c ; If A mode not possible Then will be used B mode
+\c ; If B mode not possible Then will be used C mode
+\c ; B -Trim right path
+\c ; (C:\root\second path\...)
+\c ; If B mode not possible Then will be used C mode
+\c ; C -Trim right string
+\c ; (C:\root\second path\third p...)
+\c ;
+\c $var ; Result: Trimmed path
+
+\\Example:\\
+
+\c Section
+\c ${BannerTrimPath} "C:\Server\Documents\Terminal\license.htm" "35A" $R0
+\c ;$R0=C:\Server\...\Terminal\license.htm
+\c SectionEnd
+
+\\Example (Banner plugin):\\
+
+\c !include "WinMessages.nsh"
+\c !include "FileFunc.nsh"
+\c !insertmacro Locate
+\c Section
+\c Banner::show /NOUNLOAD "Starting..."
+\c Banner::getWindow /NOUNLOAD
+\c Pop $R1
+\c ${Locate} "$WINDIR" "/L=F /M=*.* /B=1" "LocateCallback"
+\c Banner::destroy
+\c SectionEnd
+\c
+\c Function LocateCallback
+\c StrCmp $R0 $R8 code
+\c StrCpy $R0 $R8
+\c ${BannerTrimPath} "$R8" "38B" $R8
+\c GetDlgItem $1 $R1 1030
+\c SendMessage $1 ${WM_SETTEXT} 0 "STR:$R8"
+\c
+\c code:
+\c StrCmp $R9 '' end
+\c ;...
+\c
+\c end:
+\c Push $0
+\c FunctionEnd
+
+\\Example (nxs plugin):\\
+
+\c !include "FileFunc.nsh"
+\c !insertmacro Locate
+\c Section
+\c nxs::Show /NOUNLOAD `$(^Name) Setup`\
+\c /top `Setup searching something$\nPlease wait$\nIf you can...`\
+\c /h 1 /can 1 /end
+\c ${Locate} "$WINDIR" "/L=F /M=*.* /B=1" "LocateCallback"
+\c nxs::Destroy
+\c SectionEnd
+\c
+\c Function LocateCallback
+\c StrCmp $R0 $R8 abortcheck
+\c StrCpy $R0 $R8
+\c ${BannerTrimPath} "$R8" "55A" $R8
+\c nxs::Update /NOUNLOAD /sub "$R8" /pos 78 /end
+\c
+\c abortcheck:
+\c nxs::HasUserAborted /NOUNLOAD
+\c Pop $0
+\c StrCmp $0 1 0 +2
+\c StrCpy $0 StopLocate
+\c
+\c StrCmp $R9 '' end
+\c ;...
+\c
+\c end:
+\c Push $0
+\c FunctionEnd
+
+\S1{} DirState
+
+\b Check directory full, empty or not exist.
+
+\\Syntax:\\
+
+\c ${DirState} "[path]" $var
+
+\c "[path]" ; Directory
+\c $var ; Result:
+\c ; $var=0 (empty)
+\c ; $var=1 (full)
+\c ; $var=-1 (directory not found)
+
+\\Example:\\
+
+\c Section
+\c ${DirState} "$TEMP" $R0
+\c ; $R0="1" directory is full
+\c SectionEnd
+
+\S1{} RefreshShellIcons
+
+\b After changing file associations, you can call this function to refresh the shell immediatly.
+
+\\Syntax:\\
+
+\c ${RefreshShellIcons}
+
+\\Example:\\
+
+\c Section
+\c WriteRegStr HKCR "Winamp.File\DefaultIcon" "" "$PROGRAMFILES\Winamp\WINAMP.EXE,2"
+\c
+\c ${RefreshShellIcons}
+\c SectionEnd
+
+
+\H{textfunc} Text Functions Header
+
+
+\S1{} Introduction
+
+Include header:
+
+\c !include "TextFunc.nsh"
+
+
+Include function "LineRead" for install and "TrimNewLines" for uninstall:
+
+\c !insertmacro LineRead
+\c !insertmacro un.TrimNewLines
+
+
+Call functions:
+
+\c Section Install
+\c ${LineRead} "C:\a.log" "-1" $R0
+\c ; $R0="Last line$\r$\n"
+\c SectionEnd
+
+\c Section un.Install
+\c ${un.TrimNewLines} "Last line$\r$\n" $R0
+\c ; $R0="Last line"
+\c SectionEnd
+
+
+\S1{} LineFind
+
+\b Find specified lines in text file and edit or view this lines in callback function.
+
+\\Syntax:\\
+
+\c ${LineFind} "[File1]" "[File2|/NUL]" "[LineNumbers]" "Function"
+
+\c "[File1]" ; Input text file
+\c ;
+\c "[File2|/NUL]" ; [File2]
+\c ; Output text file
+\c ; If empty then File2=File1
+\c ; [/NUL]
+\c ; No output text file (only read File1)
+\c ;
+\c "[LineNumbers]" ; [No|-No|No:No|{No}|{-No}|{No:No}]
+\c ; 1:-1 all lines to change (default)
+\c ; 2 second line from start
+\c ; -3 third line from end
+\c ; 5:9 range of lines from 5 to 9
+\c ; {2} only second line from start to output
+\c ; {-3} only third line from end to output
+\c ; {5:9} only range of lines from 5 to 9 to output
+\c ;
+\c "Function" ; Callback function for specified lines
+\c
+\c Function "Function"
+\c ; $R9 current line
+\c ; $R8 current line number
+\c ; $R7 current line negative number
+\c ; $R6 current range of lines
+\c ; $R5 handle of a file opened to read
+\c ; $R4 handle of a file opened to write ($R4="" if "/NUL")
+\c
+\c ; you can use any string functions
+\c ; $R0-$R3 are not used (save data in them).
+\c ; ...
+\c
+\c Push $var ; If $var="StopLineFind" Then exit from function
+\c ; If $var="SkipWrite" Then skip current line (ignored if "/NUL")
+\c FunctionEnd
+
+\\Note:\\
+\\
-Error flag if input file isn't exists
+\\
-Error flag if output file path isn't exists
+\\
-Ranges must be specified on growth (2 4:5 9:-8 -5:-4 -2:-1)
+\\
-Output file will not be updated if no changes made.
+
+\\Example1 (delete first two symbols):\\
+
+\c Section
+\c ${LineFind} "C:\a.log" "C:\a-edited.log" "3:-1" "Example1"
+\c IfErrors 0 +2
+\c MessageBox MB_OK "Error"
+\c SectionEnd
+\c
+\c Function Example1
+\c ${TrimNewLines} '$R9' $R9
+\c StrCpy $R9 $R9 '' 2
+\c StrCpy $R9 '$R9$\r$\n'
+\c ;start from 3 line and delete first two symbols
+\c
+\c Push $0
+\c FunctionEnd
+
+\\Example2 (show changed lines):\\
+
+\c Section
+\c ${LineFind} "C:\a.log" "a.log" "{5:12 15 -6:-5 -1}" "Example2"
+\c IfErrors 0 +2
+\c MessageBox MB_OK "Error"
+\c SectionEnd
+\c
+\c Function Example2
+\c ${TrimNewLines} '$R9' $R9
+\c StrCpy $R9 "$R9 ~Changed line ($R8)~$\r$\n"
+\c
+\c Push $0
+\c FunctionEnd
+
+\\Example3 (delete lines):\\
+
+\c Section
+\c ${LineFind} "C:\a.log" "\logs\a.log" "2:3 10:-5 -3:-2" "Example3"
+\c IfErrors 0 +2
+\c MessageBox MB_OK "Error"
+\c SectionEnd
+\c
+\c Function Example3
+\c StrCpy $0 SkipWrite
+\c
+\c Push $0
+\c FunctionEnd
+
+\\Example4 (insert lines):\\
+
+\c Section
+\c ${LineFind} "C:\a.log" "" "10" "Example4
+\c IfErrors 0 +2
+\c MessageBox MB_OK "Error"
+\c SectionEnd
+\c
+\c Function Example4
+\c FileWrite $R4 "---First Line---$\r$\n"
+\c FileWrite $R4 "---Second Line ...---$\r$\n"
+\c
+\c Push $0
+\c FunctionEnd
+
+\\Example5 (replace in file with count of changes - "WordFunc.nsh" required):\\
+
+\c !include "WordFunc.nsh"
+\c !insertmacro WordReplace
+\c
+\c Section
+\c StrCpy $R0 0
+\c ${LineFind} "C:\a.log" "C:\logs\a.log" "1:-1" "Example5"
+\c IfErrors 0 +2
+\c MessageBox MB_OK "Error" IDOK +2
+\c MessageBox MB_OK "Changed lines=$R0"
+\c SectionEnd
+\c
+\c Function Example5
+\c StrCpy $1 $R9
+\c
+\c ${WordReplace} '$R9' ' ' '_' '+*' $R9
+\c
+\c StrCmp $1 $R9 +2
+\c IntOp $R0 $R0 + 1
+\c ;$R0 count of changed lines
+\c
+\c Push $0
+\c FunctionEnd
+
+\\Example6 (line string to cut or delete):\\
+
+\c Section
+\c ${LineFind} "\a.log" "C:\logs\a.log" "" "Example6"
+\c IfErrors 0 +2
+\c MessageBox MB_OK "Error" IDOK +2
+\c MessageBox MB_OK "Processed lines=$R1:$R2"
+\c SectionEnd
+\c
+\c Function Example6
+\c ;(Cut lines from a line to another line (also including that line))
+\c StrCmp $R0 finish stop
+\c StrCmp $R0 start finish
+\c StrCmp $R9 'Start Line$\r$\n' 0 skip
+\c StrCpy $R0 start
+\c StrCpy $R1 $R8
+\c goto code
+\c finish:
+\c StrCmp $R9 'Finish Line$\r$\n' 0 code
+\c StrCpy $R0 finish
+\c StrCpy $R2 $R8
+\c goto code
+\c skip:
+\c StrCpy $0 SkipWrite
+\c goto output
+\c stop:
+\c StrCpy $0 StopLineFind
+\c goto output
+\c
+\c ;;(Delete lines from a line to another line (also including that line))
+\c ; StrCmp $R0 finish code
+\c ; StrCmp $R0 start finish
+\c ; StrCmp $R9 'Start Line$\r$\n' 0 code
+\c ; StrCpy $R0 start
+\c ; StrCpy $R1 $R8
+\c ; goto skip
+\c ; finish:
+\c ; StrCmp $R9 'Finish Line$\r$\n' 0 skip
+\c ; StrCpy $R0 finish
+\c ; StrCpy $R2 $R8
+\c ; skip:
+\c ; StrCpy $0 SkipWrite
+\c ; goto output
+\c
+\c code:
+\c ;...
+\c
+\c output:
+\c Push $0
+\c FunctionEnd
+
+\\Example7 (read lines):\\
+
+\c Section
+\c ${LineFind} "C:\a.log" "/NUL" "1:-1" "Example7"
+\c IfErrors 0 +2
+\c MessageBox MB_OK "Error"
+\c SectionEnd
+\c
+\c Function Example7
+\c MessageBox MB_OKCANCEL '$$R9 "Line"=[$R9]$\n$$R8 "#" =[$R8]' IDOK +2
+\c StrCpy $0 StopLineFind
+\c
+\c Push $0
+\c FunctionEnd
+
+\S1{} LineRead
+
+\b Get line in file specified with number.
+
+\\Syntax:\\
+
+\c ${LineRead} "[File]" "[LineNumber]" $var
+
+\c "[File]" ; Input text file
+\c ;
+\c "[LineNumber]" ; [No|-No]
+\c ; 3 line number from start
+\c ; -5 line number from end
+\c ;
+\c $var ; Result: Line
+
+\\Note:\\
+\\
-Error flag if input file isn't exists
+\\
-Error flag if line number not found
+
+\\Example:\\
+
+\c Section
+\c ${LineRead} "C:\a.log" "-1" $R0
+\c ; $R0="Last line$\r$\n"
+\c SectionEnd
+
+\S1{} FileReadFromEnd
+
+\b Read text file from end line by line.
+
+\\Syntax:\\
+
+\c ${FileReadFromEnd} "[File]" "Function"
+
+\c "[File]" ; Input text file
+\c "Function" ; Callback function
+\c
+\c Function "Function"
+\c ; $9 current line
+\c ; $8 current line number
+\c ; $7 current line negative number
+\c
+\c ; $R0-$R9 are not used (save data in them).
+\c ; ...
+\c
+\c Push $var ; If $var="StopFileReadFromEnd" Then exit from function
+\c FunctionEnd
+
+\\Note:\\
+\\
-Error flag if input file isn't exists
+
+\\Example1:\\
+
+\c Section
+\c ${FileReadFromEnd} "C:\a.log" "Example1"
+\c
+\c IfErrors 0 +2
+\c MessageBox MB_OK "Error"
+\c SectionEnd
+\c
+\c Function Example1
+\c MessageBox MB_OKCANCEL '"Line"=[$9]$\n "#"=[$8]$\n "-#"=[$7]' IDOK +2
+\c StrCpy $0 StopFileReadFromEnd
+\c
+\c Push $0
+\c FunctionEnd
+
+\\Example2 (Reverse text file):\\
+
+\c Section
+\c GetTempFileName $R0
+\c FileOpen $R1 $R0 w
+\c ${FileReadFromEnd} "C:\a.log" "Example2"
+\c FileClose $R1
+\c
+\c IfErrors 0 +2
+\c MessageBox MB_OK "Error" IDOK +2
+\c Exec '"notepad.exe" "$R0"'
+\c SectionEnd
+\c
+\c Function Example2
+\c StrCmp $7 -1 0 +5
+\c StrCpy $1 $9 1 -1
+\c StrCmp $1 '$\n' +3
+\c StrCmp $1 '$\r' +2
+\c StrCpy $9 '$9$\r$\n'
+\c
+\c FileWrite $R1 "$9"
+\c
+\c Push $0
+\c FunctionEnd
+
+\S1{} LineSum
+
+\b Get sum of lines in text file.
+
+\\Syntax:\\
+
+\c ${LineSum} "[File]" $var
+
+\c "[File]" ; Input file
+\c $var ; Result: Sum of lines
+
+\\Note:\\
+\\
-Error flag if input file isn't exists
+
+\\Example:\\
+
+\c Section
+\c ${LineSum} "C:\a.log" $R0
+\c ; $R0="54"
+\c SectionEnd
+
+\S1{} FileJoin
+
+\b Join two files in one (File1 + File2 = File3).
+
+\\Syntax:\\
+
+\c ${FileJoin} "[File1]" "[File2]" "[File3]"
+
+\c "[File1]" ; Input File1
+\c "[File2]" ; Input File2
+\c "[File3]" ; Output File3
+\c ; If [File3]="" Then add [File2] to [File1]
+
+\\Note:\\
+\\
-Error flag if input files aren't exists
+\\
-Error flag if output file path isn't exists
+
+\\Example1 (Join: a.log + b.log = Z.log):\\
+
+\c Section
+\c ${FileJoin} "C:\a.log" "C:\logs\b.log" "C:\Z.log"
+\c SectionEnd
+
+\\Example2 (Add: a.log + b.log = a.log):\\
+
+\c Section
+\c ${FileJoin} "C:\a.log" "C:\logs\b.log" "C:\a.log"
+\c SectionEnd
+
+\S1{} TextCompare
+
+\b Compare two text files.
+
+\\Syntax:\\
+
+\c ${TextCompare} "[File1]" "[File2]" "[Option]" "Function"
+
+\c "[File1]" ; File1 Compare these lines
+\c "[File2]" ; File2 Compare with these lines
+\c "[Options]" ; (line-by-line):
+\c ; FastDiff Compare line N (File1) with line N (File2)
+\c ; Call function if Different lines found
+\c ; FastEqual Compare line N (File1) with line N (File2)
+\c ; Call function if Equal lines found
+\c ; (line number independent):
+\c ; SlowDiff Compare line N (File1) with all lines (File2)
+\c ; Call function if line N (File1) Different
+\c ; SlowEqual Compare line N (File1) with all lines (File2)
+\c ; Call function if line N (File1) Equal
+\c "Function" ; Callback function
+\c
+\c Function "Function"
+\c ; $9 "Line File1"
+\c ; $8 "Line number"
+\c ; $7 "Line File2" (empty if SlowDiff)
+\c ; $6 "Line number" (empty if SlowDiff)
+\c
+\c ; $R0-$R9 are not used (save data in them).
+\c ; ...
+\c
+\c Push $var ; If $var="StopTextCompare" Then exit from function
+\c FunctionEnd
+
+\\Note:\\
+\\
-Error flag if File1 or File2 isn't exist
+\\
-Error flag if syntax error
+
+\\Example (Different or Equal):\\
+
+\c Section
+\c StrCpy $R0 ''
+\c ${TextCompare} "C:\1.txt" "C:\2.txt" "FastDiff" "Example1"
+\c IfErrors 0 +2
+\c MessageBox MB_OK "Error" IDOK +4
+\c
+\c StrCmp $R0 NotEqual 0 +2
+\c MessageBox MB_OK "Files differ" IDOK +2
+\c MessageBox MB_OK "Files identical"
+\c SectionEnd
+\c
+\c Function Example1
+\c StrCpy $R0 NotEqual
+\c StrCpy $0 StopTextCompare
+\c
+\c Push $0
+\c FunctionEnd
+
+\\Example (Compare line-by-line - Different):\\
+
+\c Section
+\c StrCpy $R0 'Text1.txt'
+\c StrCpy $R1 'Text2.txt'
+\c
+\c GetTempFileName $R2
+\c FileOpen $R3 $R2 w
+\c FileWrite $R3 "$R0 | $R1$\r$\n"
+\c ${TextCompare} "$R0" "$R1" "FastDiff" "Example2"
+\c IfErrors 0 +2
+\c MessageBox MB_OK "Error" IDOK +2
+\c
+\c Exec "notepad.exe $R2"
+\c FunctionEnd
+\c
+\c Function Example2
+\c FileWrite $R3 '$8=$9'
+\c FileWrite $R3 '$6=$7$\r$\n'
+\c
+\c Push $0
+\c FunctionEnd
+
+\\Example (Compare line-by-line - Equal):\\
+
+\c Section
+\c StrCpy $R0 'Text1.txt'
+\c StrCpy $R1 'Text2.txt'
+\c
+\c GetTempFileName $R2
+\c FileOpen $R3 $R2 w
+\c FileWrite $R3 "$R0 | $R1$\r$\n"
+\c ${TextCompare} "$R0" "$R1" "FastEqual" "Example3"
+\c IfErrors 0 +2
+\c MessageBox MB_OK "Error" IDOK +2
+\c
+\c Exec "notepad.exe $R2"
+\c FunctionEnd
+\c
+\c Function Example3
+\c FileWrite $R3 '$8|$6=$9'
+\c
+\c Push $0
+\c FunctionEnd
+
+\\Example (Compare all lines - Different):\\
+
+\c Section
+\c StrCpy $R0 'Text1.txt'
+\c StrCpy $R1 'Text2.txt'
+\c
+\c GetTempFileName $R2
+\c FileOpen $R3 $R2 w
+\c FileWrite $R3 "$R0 | $R1$\r$\n"
+\c ${TextCompare} "$R0" "$R1" "SlowDiff" "Example4"
+\c IfErrors 0 +2
+\c MessageBox MB_OK "Error" IDOK end
+\c
+\c FileWrite $R3 "$\r$\n$R1 | $R0$\r$\n"
+\c ${TextCompare} "$R1" "$R0" "SlowDiff" "Example4"
+\c FileClose $R3
+\c IfErrors 0 +2
+\c MessageBox MB_OK "Error" IDOK end
+\c
+\c Exec "notepad.exe $R2"
+\c
+\c end:
+\c FunctionEnd
+\c
+\c Function Example4
+\c FileWrite $R3 '$8=$9'
+\c
+\c Push $0
+\c FunctionEnd
+
+\\Example (Compare all lines - Equal):\\
+
+\c Section
+\c StrCpy $R0 'Text1.txt'
+\c StrCpy $R1 'Text2.txt'
+\c
+\c GetTempFileName $R2
+\c FileOpen $R3 $R2 w
+\c FileWrite $R3 "$R0 | $R1$\r$\n"
+\c ${TextCompare} "$R0" "$R1" "SlowEqual" "Example5"
+\c IfErrors 0 +2
+\c MessageBox MB_OK "Error" IDOK +2
+\c
+\c Exec "notepad.exe $R2"
+\c FunctionEnd
+\c
+\c Function Example5
+\c FileWrite $R3 '$8|$6=$9'
+\c
+\c Push $0
+\c FunctionEnd
+
+\\Example (Show variables):\\
+
+\c Section
+\c ${TextCompare} "C:\1.txt" "C:\2.txt" "FastDiff" "Example6"
+\c
+\c IfErrors 0 +2
+\c MessageBox MB_OK "Error"
+\c SectionEnd
+\c
+\c Function Example6
+\c MessageBox MB_OKCANCEL '$$9 "Line File1" =[$9]$\n$$8 "Line #" =[$8]$\n$$7 "Line File2" =[$7]$\n$$6 "Line #" =[$6]' IDOK +2
+\c StrCpy $0 StopTextCompare
+\c
+\c Push $0
+\c FunctionEnd
+
+\S1{} ConfigRead
+
+\b Read value from entry name in config file.
+
+\\Syntax:\\
+
+\c ${ConfigRead} "[File]" "[Entry]" $var
+
+\c "[File]" ; config file
+\c ;
+\c "[Entry]" ; entry name
+\c ;
+\c $var ; Result: Value
+
+\\Note:\\
+\\
-Error flag if file isn't exist
+
+\\Example1:\\
+
+\c Section
+\c ${ConfigRead} "C:\AUTOEXEC.BAT" "SET winbootdir=" $R0
+\c ;$R0=C:\WINDOWS
+\c SectionEnd
+
+\\Example2:\\
+
+\c Section
+\c ${ConfigRead} "C:\apache\conf\httpd.conf" "Timeout " $R0
+\c ;$R0=30
+\c SectionEnd
+
+\S1{} ConfigWrite
+
+\b Write value from entry name in config file.
+
+\\Syntax:\\
+
+\c ${ConfigWrite} "[File]" "[Entry]" "[Value]" $var
+
+\c "[File]" ; config file
+\c ;
+\c "[Entry]" ; entry name
+\c ;
+\c "[Value]" ; value name
+\c ; if "" then delete Entry
+\c ;
+\c $var ; Result:
+\c ; $var=CHANGED Value is written
+\c ; $var=DELETED Entry is deleted
+\c ; $var=ADDED Entry and Value are added
+\c ; $var=SAME Entry and Value already exist
+
+\\Note:\\
+\\
-Error flag if file isn't exist
+\\
-Error flag if file can't be opened
+
+\\Example1:\\
+
+\c Section
+\c ${ConfigWrite} "C:\AUTOEXEC.BAT" "SET winbootdir=" "D:\WINDOWS" $R0
+\c ;$R0=CHANGED
+\c SectionEnd
+
+\\Example2:\\
+
+\c Section
+\c ${ConfigWrite} "C:\apache\conf\httpd.conf" "Timeout " "30" $R0
+\c ;$R0=SAME
+\c SectionEnd
+
+\\Example3:\\
+
+\c Section
+\c ${ConfigWrite} "C:\apache\conf\httpd.conf" "Timeout " "" $R0
+\c ;$R0=DELETED
+\c SectionEnd
+
+\S1{} FileRecode
+
+\b Recode text file from DOS to Windows format and vice-versa.
+
+\\Syntax:\\
+
+\c ${FileRecode} "[File]" "[Format]"
+
+\c "[File]" ;
+\c ;
+\c "[Format]" ; OemToChar -from DOS to Windows
+\c ; CharToOem -from Windows to DOS
+
+\\Note:\\
+\\
-Error flag if file isn't exist
+\\
-Error flag if syntax error
+
+\\Example:\\
+
+\c Section
+\c ${FileRecode} "C:\SCANDISK.LOG" "CharToOem"
+\c SectionEnd
+
+\S1{} TrimNewLines
+
+\b Trim newlines in a string.
+
+\\Syntax:\\
+
+\c ${TrimNewLines} "[string]" $var
+
+\c "[string]" ; Input string
+\c $var ; Result: String without '$\r' and '$\n' at the end
+
+\\Example:\\
+
+\c Section
+\c ${TrimNewLines} "Text line$\r$\n" $R0
+\c ; $R0="Text line"
+\c SectionEnd
+
+
+\H{wordfunc} Word Functions Header
+
+
+\S1{} Introduction
+
+Include header:
+
+\c !include "WordFunc.nsh"
+
+
+Include function "WordFind" for install and "WordReplace" for uninstall:
+
+\c !insertmacro WordFind
+\c !insertmacro un.WordReplace
+
+
+Call functions:
+
+\c Section Install
+\c ${WordFind} "A--H---S" "-" "+2" $R0
+\c ; $R0="H"
+\c SectionEnd
+
+\c Section un.Install
+\c ${un.WordReplace} "A--H---S" "-" "x" "+3*" $R0
+\c ; $R0="A--HxS"
+\c SectionEnd
+
+
+\S1{} WordFind
+
+\b Multi-features string function.
+
+\c Strings:
+\c "[word+1][delimiter][word+2][delimiter][word+3]..."
+\c "[delimiter][word+1][delimiter][word+2][delimiter]..."
+\c "[delimiter][delimiter][word+1][delimiter][delimiter][delimiter]..."
+\c "...[word-3][delimiter][word-2][delimiter][word-1]"
+\c "...[delimiter][word-2][delimiter][word-1][delimiter]"
+\c "...[delimiter][delimiter][word-1][delimiter][delimiter][delimiter]"
+
+\\Syntax: \\
+
+\c ${WordFind} "[string]" "[delimiter]" "[E][options]" $var
+
+\c "[string]" ;[string]
+\c ; input string
+\c "[delimiter]" ;[delimiter]
+\c ; one or several symbols
+\c "[E][options]" ;[options]
+\c ; +number : word number from start
+\c ; -number : word number from end
+\c ; +number} : delimiter number from start
+\c ; all space after this
+\c ; delimiter to output
+\c ; +number{ : delimiter number from start
+\c ; all space before this
+\c ; delimiter to output
+\c ; +number}} : word number from start
+\c ; all space after this word
+\c ; to output
+\c ; +number{{ : word number from start
+\c ; all space before this word
+\c ; to output
+\c ; +number{} : word number from start
+\c ; all space before and after
+\c ; this word (word exclude)
+\c ; +number*} : word number from start
+\c ; all space after this
+\c ; word to output with word
+\c ; +number{* : word number from start
+\c ; all space before this
+\c ; word to output with word
+\c ; # : sum of words to output
+\c ; * : sum of delimiters to output
+\c ; /word : number of word to output
+\c ;
+\c ;[E]
+\c ; with errorlevel output
+\c ; IfErrors:
+\c ; $var=1 delimiter not found
+\c ; $var=2 no such word number
+\c ; $var=3 syntax error (Use: +1,-1},#,*,/word,...)
+\c ;[]
+\c ; no errorlevel output (default)
+\c ; If some errors found then (result=input string)
+\c ;
+\c $var ;output (result)
+
+\\Note:\\
+\\
-Accepted numbers 1,01,001,...
+
+\\Example (Find word by number):\\
+
+\c Section
+\c ${WordFind} "C:\io.sys C:\Program Files C:\WINDOWS" " C:\" "-02" $R0
+\c ; $R0="Program Files"
+\c SectionEnd
+
+\\Example (Delimiter exclude):\\
+
+\c Section
+\c ${WordFind} "C:\io.sys C:\logo.sys C:\WINDOWS" "sys" "-2}" $R0
+\c ; $R0=" C:\logo.sys C:\WINDOWS"
+\c SectionEnd
+
+\\Example (Sum of words):\\
+
+\c Section
+\c ${WordFind} "C:\io.sys C:\logo.sys C:\WINDOWS" " C:\" "#" $R0
+\c ; $R0="3"
+\c SectionEnd
+
+\\Example (Sum of delimiters):\\
+
+\c Section
+\c ${WordFind} "C:\io.sys C:\logo.sys C:\WINDOWS" "sys" "*" $R0
+\c ; $R0="2"
+\c SectionEnd
+
+\\Example (Find word number):\\
+
+\c Section
+\c ${WordFind} "C:\io.sys C:\Program Files C:\WINDOWS" " " "/Files" $R0
+\c ; $R0="3"
+\c SectionEnd
+
+\\Example ( \}\} ):\\
+
+\c Section
+\c ${WordFind} "C:\io.sys C:\logo.sys C:\WINDOWS" " " "+2}}" $R0
+\c ; $R0=" C:\WINDOWS"
+\c SectionEnd
+
+\\Example ( \{\} ):\\
+
+\c Section
+\c ${WordFind} "C:\io.sys C:\logo.sys C:\WINDOWS" " " "+2{}" $R0
+\c ; $R0="C:\io.sys C:\WINDOWS"
+\c SectionEnd
+
+\\Example ( *\} ):\\
+
+\c Section
+\c ${WordFind} "C:\io.sys C:\logo.sys C:\WINDOWS" " " "+2*}" $R0
+\c ; $R0="C:\logo.sys C:\WINDOWS"
+\c SectionEnd
+
+\\Example (Get parent directory):\\
+
+\c Section
+\c StrCpy $R0 "C:\Program Files\NSIS\NSIS.chm"
+\c ; "C:\Program Files\NSIS\Include\"
+\c ; "C:\\Program Files\\NSIS\\NSIS.chm"
+\c
+\c ${WordFind} "$R0" "\" "-2{*" $R0
+\c ; $R0="C:\Program Files\NSIS"
+\c ; "C:\\Program Files\\NSIS"
+\c SectionEnd
+
+\\Example (Coordinates):\\
+
+\c Section
+\c ${WordFind} "C:\io.sys C:\logo.sys C:\WINDOWS" ":\lo" "E+1{" $R0
+\c ; $R0="C:\io.sys C"
+\c IfErrors end
+\c
+\c StrLen $0 $R0 ; $0 = Start position of word (11)
+\c StrLen $1 ':\lo' ; $1 = Word leght (4)
+\c ; StrCpy $R0 $R1 $1 $0 ; $R0 = :\lo
+\c
+\c end:
+\c SectionEnd
+
+\\Example (With errorlevel output):\\
+
+\c Section
+\c ${WordFind} "[string]" "[delimiter]" "E[options]" $R0
+\c
+\c IfErrors 0 end
+\c StrCmp $R0 1 0 +2 ; errorlevel 1?
+\c MessageBox MB_OK 'delimiter not found' IDOK end
+\c StrCmp $R0 2 0 +2 ; errorlevel 2?
+\c MessageBox MB_OK 'no such word number' IDOK end
+\c StrCmp $R0 3 0 +2 ; errorlevel 3?
+\c MessageBox MB_OK 'syntax error'
+\c
+\c end:
+\c SectionEnd
+
+\\Example (Without errorlevel output):\\
+
+\c Section
+\c ${WordFind} "C:\io.sys C:\logo.sys" "_" "+1" $R0
+\c
+\c ; $R0="C:\io.sys C:\logo.sys" (error: delimiter "_" not found)
+\c SectionEnd
+
+\\Example (If found):\\
+
+\c Section
+\c ${WordFind} "C:\io.sys C:\logo.sys" ":\lo" "E+1{" $R0
+\c
+\c IfErrors notfound found
+\c found:
+\c MessageBox MB_OK 'Found' IDOK end
+\c notfound:
+\c MessageBox MB_OK 'Not found'
+\c
+\c end:
+\c SectionEnd
+
+\\Example (If found 2):\\
+
+\c Section
+\c ${WordFind} "C:\io.sys C:\logo.sys" ":\lo" "+1{" $R0
+\c
+\c StrCmp $R0 "C:\io.sys C:\logo.sys" notfound found ; error?
+\c found:
+\c MessageBox MB_OK 'Found' IDOK end
+\c notfound:
+\c MessageBox MB_OK 'Not found'
+\c
+\c end:
+\c SectionEnd
+
+\\Example (To accept one word in string if delimiter not found):\\
+
+\c Section
+\c StrCpy $0 'OneWord'
+\c StrCpy $1 1
+\c
+\c loop:
+\c ${WordFind} "$0" " " "E+$1" $R0
+\c IfErrors 0 code
+\c StrCmp $1$R0 11 0 error
+\c StrCpy $R0 $0
+\c goto end
+\c
+\c code:
+\c ; ...
+\c IntOp $1 $1 + 1
+\c goto loop
+\c
+\c error:
+\c StrCpy $1 ''
+\c StrCpy $R0 ''
+\c
+\c end:
+\c ; $R0="OneWord"
+\c SectionEnd
+
+\S1{} WordFind2X
+
+\b Find word between two delimiters.
+
+\c Strings:
+\c "[delimiter1][word+1][delimiter2][delimiter1][word+2][delimiter2]..."
+\c "[text][delimiter1][text][delimiter1][word+1][delimiter2][text]..."
+\c "...[delimiter1][word-2][delimiter2][delimiter1][word-1][delimiter2]"
+\c "...[text][delimiter1][text][delimiter1][word-1][delimiter2][text]"
+
+\\Syntax:\\
+
+\c ${WordFind2X} "[string]" "[delimiter1]" "[delimiter2]" "[E][options]" $var
+
+\c "[string]" ;[string]
+\c ; input string
+\c "[delimiter1]" ;[delimiter1]
+\c ; first delimiter
+\c "[delimiter2]" ;[delimiter2]
+\c ; second delimiter
+\c "[E][options]" ;[options]
+\c ; +number : word number from start
+\c ; -number : word number from end
+\c ; +number}} : word number from start all space
+\c ; after this word to output
+\c ; +number{{ : word number from end all space
+\c ; before this word to output
+\c ; +number{} : word number from start
+\c ; all space before and after
+\c ; this word (word exclude)
+\c ; +number*} : word number from start
+\c ; all space after this
+\c ; word to output with word
+\c ; +number{* : word number from start
+\c ; all space before this
+\c ; word to output with word
+\c ; # : sum of words to output
+\c ; /word : number of word to output
+\c ;
+\c ;[E]
+\c ; with errorlevel output
+\c ; IfErrors:
+\c ; $var=1 no words found
+\c ; $var=2 no such word number
+\c ; $var=3 syntax error (Use: +1,-1,#)
+\c ;[]
+\c ; no errorlevel output (default)
+\c ; If some errors found then (result=input string)
+\c ;
+\c $var ;output (result)
+
+\\Example (1):\\
+
+\c Section
+\c ${WordFind2X} "[C:\io.sys];[C:\logo.sys];[C:\WINDOWS]" "[C:\" "];" "+2" $R0
+\c ; $R0="logo.sys"
+\c SectionEnd
+
+\\Example (2):\\
+
+\c Section
+\c ${WordFind2X} "C:\WINDOWS C:\io.sys C:\logo.sys" "\" "." "-1" $R0
+\c ; $R0="logo"
+\c SectionEnd
+
+\\Example (3):\\
+
+\c Section
+\c ${WordFind2X} "C:\WINDOWS C:\io.sys C:\logo.sys" "\" "." "-1{{" $R0
+\c ; $R0="C:\WINDOWS C:\io.sys C:"
+\c SectionEnd
+
+\\Example (4):\\
+
+\c Section
+\c ${WordFind2X} "C:\WINDOWS C:\io.sys C:\logo.sys" "\" "." "-1{}" $R0
+\c ; $R0="C:\WINDOWS C:\io.sys C:sys"
+\c SectionEnd
+
+\\Example (5):\\
+
+\c Section
+\c ${WordFind2X} "C:\WINDOWS C:\io.sys C:\logo.sys" "\" "." "-1{*" $R0
+\c ; $R0="C:\WINDOWS C:\io.sys C:\logo."
+\c SectionEnd
+
+\\Example (6):\\
+
+\c Section
+\c ${WordFind2X} "C:\WINDOWS C:\io.sys C:\logo.sys" "\" "." "/logo" $R0
+\c ; $R0="2"
+\c SectionEnd
+
+\\Example (With errorlevel output):\\
+
+\c Section
+\c ${WordFind2X} "[io.sys];[C:\logo.sys]" "\" "];" "E+1" $R0
+\c ; $R0="1" ("\...];" not found)
+\c
+\c IfErrors 0 noerrors
+\c MessageBox MB_OK 'Errorlevel=$R0' IDOK end
+\c
+\c noerrors:
+\c MessageBox MB_OK 'No errors'
+\c
+\c end:
+\c SectionEnd
+
+\S1{} WordFind3X
+
+\b Find word, that contain string, between two delimiters.
+
+\\Syntax:\\
+
+\c ${WordFind3X} "[string]" "[delimiter1]" "[center]" "[delimiter2]" "[E][options]" $var
+
+\c "[string]" ;[string]
+\c ; input string
+\c "[delimiter1]" ;[delimiter1]
+\c ; first delimiter
+\c "[center]" ;[center]
+\c ; center string
+\c "[delimiter2]" ;[delimiter2]
+\c ; second delimiter
+\c "[E][options]" ;[options]
+\c ; +number : word number from start
+\c ; -number : word number from end
+\c ; +number}} : word number from start all space
+\c ; after this word to output
+\c ; +number{{ : word number from end all space
+\c ; before this word to output
+\c ; +number{} : word number from start
+\c ; all space before and after
+\c ; this word (word exclude)
+\c ; +number*} : word number from start
+\c ; all space after this
+\c ; word to output with word
+\c ; +number{* : word number from start
+\c ; all space before this
+\c ; word to output with word
+\c ; # : sum of words to output
+\c ; /word : number of word to output
+\c ;
+\c ;[E]
+\c ; with errorlevel output
+\c ; IfErrors:
+\c ; $var=1 no words found
+\c ; $var=2 no such word number
+\c ; $var=3 syntax error (Use: +1,-1,#)
+\c ;[]
+\c ; no errorlevel output (default)
+\c ; If some errors found then (result=input string)
+\c ;
+\c $var ;output (result)
+
+\\Example (1):\\
+
+\c Section
+\c ${WordFind3X} "[1.AAB];[2.BAA];[3.BBB];" "[" "AA" "];" "+1" $R0
+\c ; $R0="1.AAB"
+\c SectionEnd
+
+\\Example (2):\\
+
+\c Section
+\c ${WordFind3X} "[1.AAB];[2.BAA];[3.BBB];" "[" "AA" "];" "-1" $R0
+\c ; $R0="2.BAA"
+\c SectionEnd
+
+\\Example (3):\\
+
+\c Section
+\c ${WordFind3X} "[1.AAB];[2.BAA];[3.BBB];" "[" "AA" "];" "-1{{" $R0
+\c ; $R0="[1.AAB];"
+\c SectionEnd
+
+\\Example (4):\\
+
+\c Section
+\c ${WordFind3X} "[1.AAB];[2.BAA];[3.BBB];" "[" "AA" "];" "-1{}" $R0
+\c ; $R0="[1.AAB];[3.BBB];"
+\c SectionEnd
+
+\\Example (5):\\
+
+\c Section
+\c ${WordFind3X} "[1.AAB];[2.BAA];[3.BBB];" "[" "AA" "];" "-1{*" $R0
+\c ; $R0="[1.AAB];[2.BAA];"
+\c SectionEnd
+
+\\Example (6):\\
+
+\c Section
+\c ${WordFind3X} "[1.AAB];[2.BAA];[3.BBB];" "[" "AA" "];" "/2.BAA" $R0
+\c ; $R0="2"
+\c SectionEnd
+
+\\Example (With errorlevel output):\\
+
+\c Section
+\c ${WordFind3X} "[1.AAB];[2.BAA];[3.BBB];" "[" "XX" "];" "E+1" $R0
+\c ; $R0="1" ("[...XX...];" not found)
+\c
+\c IfErrors 0 noerrors
+\c MessageBox MB_OK 'Errorlevel=$R0' IDOK end
+\c
+\c noerrors:
+\c MessageBox MB_OK 'No errors'
+\c
+\c end:
+\c SectionEnd
+
+\S1{} WordReplace
+
+\b Replace or delete word from string.
+
+\\Syntax:\\
+
+\c ${WordReplace} "[string]" "[word1]" "[word2]" "[E][options]" $var
+
+\c "[string]" ;[string]
+\c ; input string
+\c "[word1]" ;[word1]
+\c ; word to replace or delete
+\c "[word2]" ;[word2]
+\c ; replace with (if empty delete)
+\c "[E][options]" ;[options]
+\c ; +number : word number from start
+\c ; -number : word number from end
+\c ; +number* : word number from start multiple-replace
+\c ; -number* : word number from end multiple-replace
+\c ; + : replace or delete all founded
+\c ; +* : multiple-replace all founded
+\c ; {} : if exists replace or delete all delimiters
+\c ; from edges (no errorlevel output)
+\c ; {}* : if exists multiple-replace all delimiters
+\c ; from edges (no errorlevel output)
+\c ;
+\c ;[E]
+\c ; with errorlevel output
+\c ; IfErrors:
+\c ; $var=1 word to replace or delete not found
+\c ; $var=2 no such word number
+\c ; $var=3 syntax error (Use: +1,-1,+1*,-1*,+,+*,{},{}*)
+\c ;[]
+\c ; no errorlevel output (default)
+\c ; If some errors found then (result=input string)
+\c ;
+\c $var ;output (result)
+
+\\Example (replace):\\
+
+\c Section
+\c ${WordReplace} "C:\io.sys C:\logo.sys C:\WINDOWS" "SYS" "bmp" "+2" $R0
+\c ; $R0="C:\io.sys C:\logo.bmp C:\WINDOWS"
+\c SectionEnd
+
+\\Example (delete):\\
+
+\c Section
+\c ${WordReplace} "C:\io.sys C:\logo.sys C:\WINDOWS" "SYS" "" "+" $R0
+\c ; $R0="C:\io. C:\logo. C:\WINDOWS"
+\c SectionEnd
+
+\\Example (multiple-replace 1):\\
+
+\c Section
+\c ${WordReplace} "C:\io.sys C:\logo.sys C:\WINDOWS" " " " " "+1*" $R0
+\c ; +1* or +2* or +3* or +4* or +5* or +6*
+\c ; $R0="C:\io.sys C:\logo.sys C:\WINDOWS"
+\c SectionEnd
+
+\\Example (multiple-replace 2):\\
+
+\c Section
+\c ${WordReplace} "C:\io.sys C:\logo.sysSYSsys C:\WINDOWS" "sys" "bmp" "+*" $R0
+\c ; $R0="C:\io.bmp C:\logo.bmp C:\WINDOWS"
+\c SectionEnd
+
+\\Example (multiple-replace 3):\\
+
+\c Section
+\c ${WordReplace} "sysSYSsysC:\io.sys C:\logo.sys C:\WINDOWSsysSYSsys" "sys" "|" "{}*" $R0
+\c ; $R0="|C:\io.sys C:\logo.sys C:\WINDOWS|"
+\c SectionEnd
+
+\\Example (With errorlevel output):\\
+
+\c Section
+\c ${WordReplace} "C:\io.sys C:\logo.sys" "sys" "bmp" "E+3" $R0
+\c ; $R0="2" (no such word number "+3")
+\c
+\c IfErrors 0 noerrors
+\c MessageBox MB_OK 'Errorlevel=$R0' IDOK end
+\c
+\c noerrors:
+\c MessageBox MB_OK 'No errors'
+\c
+\c end:
+\c SectionEnd
+
+\S1{} WordAdd
+
+\b Add words to string1 from string2 if not exist or delete words if exist.
+
+\\Syntax:\\
+
+\c ${WordAdd} "[string1]" "[delimiter]" "[E][options]" $var
+
+\c "[string1]" ;[string1]
+\c ; string for addition or removing
+\c "[delimiter]" ;[delimiter]
+\c ; one or several symbols
+\c "[E][options]" ;[options]
+\c ; +string2 : words to add
+\c ; -string2 : words to delete
+\c ;
+\c ;[E]
+\c ; with errorlevel output
+\c ; IfErrors:
+\c ; $var=1 delimiter is empty
+\c ; $var=3 syntax error (use: +text,-text)
+\c ;[]
+\c ; no errorlevel output (default)
+\c ; If some errors found then (result=input string)
+\c ;
+\c $var ;output (result)
+
+\\Example (add):\\
+
+\c Section
+\c ${WordAdd} "C:\io.sys C:\WINDOWS" " " "+C:\WINDOWS C:\config.sys" $R0
+\c ; $R0="C:\io.sys C:\WINDOWS C:\config.sys"
+\c SectionEnd
+
+\\Example (delete):\\
+
+\c Section
+\c ${WordAdd} "C:\io.sys C:\logo.sys C:\WINDOWS" " " "-C:\WINDOWS C:\config.sys C:\IO.SYS" $R0
+\c ; $R0="C:\logo.sys"
+\c SectionEnd
+
+\\Example (add to one):\\
+
+\c Section
+\c ${WordAdd} "C:\io.sys" " " "+C:\WINDOWS C:\config.sys C:\IO.SYS" $R0
+\c ; $R0="C:\io.sys C:\WINDOWS C:\config.sys"
+\c SectionEnd
+
+\\Example (delete one):\\
+
+\c Section
+\c ${WordAdd} "C:\io.sys C:\logo.sys C:\WINDOWS" " " "-C:\WINDOWS" $R0
+\c ; $R0="C:\io.sys C:\logo.sys"
+\c SectionEnd
+
+\\Example (No new words found):\\
+
+\c Section
+\c ${WordAdd} "C:\io.sys C:\logo.sys" " " "+C:\logo.sys" $R0
+\c StrCmp $R0 "C:\io.sys C:\logo.sys" 0 +2
+\c MessageBox MB_OK "No new words found to add"
+\c SectionEnd
+
+\\Example (No words deleted):\\
+
+\c Section
+\c ${WordAdd} "C:\io.sys C:\logo.sys" " " "-C:\config.sys" $R0
+\c StrCmp $R0 "C:\io.sys C:\logo.sys" 0 +2
+\c MessageBox MB_OK "No words found to delete"
+\c SectionEnd
+
+\\Example (With errorlevel output):\\
+
+\c Section
+\c ${WordAdd} "C:\io.sys C:\logo.sys" "" "E-C:\logo.sys" $R0
+\c ; $R0="1" (delimiter is empty "")
+\c
+\c IfErrors 0 noerrors
+\c MessageBox MB_OK 'Errorlevel=$R0' IDOK end
+\c
+\c noerrors:
+\c MessageBox MB_OK 'No errors'
+\c
+\c end:
+\c SectionEnd
+
+\S1{} WordInsert
+
+\b Insert word in string.
+
+\\Syntax:\\
+
+\c ${WordInsert} "[string]" "[delimiter]" "[word]" "[E][options]" $var
+
+\c "[string]" ;[string]
+\c ; input string
+\c "[delimiter]" ;[delimiter]
+\c ; one or several symbols
+\c "[word]" ;[word]
+\c ; word to insert
+\c "[E][options]" ;[options]
+\c ; +number : word number from start
+\c ; -number : word number from end
+\c ;
+\c ;[E]
+\c ; with errorlevel output
+\c ; IfErrors:
+\c ; $var=1 delimiter is empty
+\c ; $var=2 wrong word number
+\c ; $var=3 syntax error (Use: +1,-1)
+\c ;[]
+\c ; no errorlevel output (default)
+\c ; If some errors found then (result=input string)
+\c ;
+\c $var ;output (result)
+
+\\Example (1):\\
+
+\c Section
+\c ${WordInsert} "C:\io.sys C:\WINDOWS" " " "C:\logo.sys" "-2" $R0
+\c ; $R0="C:\io.sys C:\logo.sys C:\WINDOWS"
+\c SectionEnd
+
+\\Example (2):\\
+
+\c Section
+\c ${WordInsert} "C:\io.sys" " " "C:\WINDOWS" "+2" $R0
+\c ; $R0="C:\io.sys C:\WINDOWS"
+\c SectionEnd
+
+\\Example (3):\\
+
+\c Section
+\c ${WordInsert} "" " " "C:\WINDOWS" "+1" $R0
+\c ; $R0="C:\WINDOWS "
+\c SectionEnd
+
+\\Example (With errorlevel output):\\
+
+\c Section
+\c ${WordInsert} "C:\io.sys C:\logo.sys" " " "C:\logo.sys" "E+4" $R0
+\c ; $R0="2" (wrong word number "+4")
+\c
+\c IfErrors 0 noerrors
+\c MessageBox MB_OK 'Errorlevel=$R0' IDOK end
+\c
+\c noerrors:
+\c MessageBox MB_OK 'No errors'
+\c
+\c end:
+\c SectionEnd
+
+\S1{} StrFilter
+
+\b Convert string to uppercase or lowercase.
+
+\b Set symbol filter.
+
+\\Syntax:\\
+
+\c ${StrFilter} "[string]" "[options]" "[symbols1]" "[symbols2]" $var
+
+\c "[string]" ;[string]
+\c ; input string
+\c ;
+\c "[options]" ;[+|-][1|2|3|12|23|31][eng|rus]
+\c ; + : covert string to uppercase
+\c ; - : covert string to lowercase
+\c ; 1 : only Digits
+\c ; 2 : only Letters
+\c ; 3 : only Special
+\c ; 12 : only Digits + Letters
+\c ; 23 : only Letters + Special
+\c ; 31 : only Special + Digits
+\c ; eng : English symbols (default)
+\c ; rus : Russian symbols
+\c ;
+\c "[symbols1]" ;[symbols1]
+\c ; symbols include (not changeable)
+\c ;
+\c "[symbols2]" ;[symbols2]
+\c ; symbols exclude
+\c ;
+\c $var ;output (result)
+
+\\Note:\\
+\\
-Error flag if syntax error
+\\
-Same symbol to include & to exclude = to exclude
+
+\\Example (UpperCase):\\
+
+\c Section
+\c ${StrFilter} "123abc 456DEF 7890|%#" "+" "" "" $R0
+\c ; $R0="123ABC 456DEF 7890|%#"
+\c SectionEnd
+
+\\Example (LowerCase):\\
+
+\c Section
+\c ${StrFilter} "123abc 456DEF 7890|%#" "-" "ef" "" $R0
+\c ; $R0="123abc 456dEF 7890|%#"
+\c SectionEnd
+
+\\Example (Filter1):\\
+
+\c Section
+\c ${StrFilter} "123abc 456DEF 7890|%#" "2" "|%" "" $R0
+\c ; $R0="abcDEF|%" ;only Letters + |%
+\c SectionEnd
+
+\\Example (Filter2):\\
+
+\c Section
+\c ${StrFilter} "123abc 456DEF 7890|%#" "13" "af" "4590" $R0
+\c ; $R0="123a 6F 78|%#" ;only Digits + Special + af - 4590
+\c SectionEnd
+
+\\Example (Filter3):\\
+
+\c Section
+\c ${StrFilter} "123abc 456DEF 7890|%#" "+12" "b" "def" $R0
+\c ; $R0="123AbC4567890" ;only Digits + Letters + b - def
+\c SectionEnd
+
+\\Example (Filter4):\\
+
+\c Section
+\c ${StrFilter} "123abcÀÁÂ 456DEFãäå 7890|%#" "+12rus" "ä" "ãå" $R0
+\c ; $R0="123ÀÁÂ456ä7890" ;only Digits + Letters + ä - ãå
+\c SectionEnd
+
+\\Example (English + Russian Letters):\\
+
+\c Section
+\c ${StrFilter} "123abcÀÁÂ 456DEFãäå 7890|%#" "2rus" "" "" $R0
+\c ; $R0="ÀÁÂãäå" ;only Russian Letters
+\c ${StrFilter} "123abcÀÁÂ 456DEFãäå 7890|%#" "2" "$R0" "" $R0
+\c ; $R0="abcÀÁÂDEFãäå" ;only English + Russian Letters
+\c SectionEnd
+
+\\Example (Word Capitalize):\\
+
+\c Section
+\c Push "_01-PERPETUOUS_DREAMER__-__THE_SOUND_OF_GOODBYE_(ORIG._MIX).MP3_"
+\c Call Capitalize
+\c Pop $R0
+\c ; $R0="_01-Perpetuous_Dreamer__-__The_Sound_Of_Goodbye_(Orig._Mix).mp3_"
+\c
+\c ${WordReplace} "$R0" "_" " " "+*" $R0
+\c ; $R0=" 01-Perpetuous Dreamer - The Sound Of Goodbye (Orig. Mix).mp3 "
+\c
+\c ${WordReplace} "$R0" " " "" "{}" $R0
+\c ; $R0="01-Perpetuous Dreamer - The Sound Of Goodbye (Orig. Mix).mp3"
+\c SectionEnd
+\c
+\c Function Capitalize
+\c Exch $R0
+\c Push $0
+\c Push $1
+\c Push $2
+\c
+\c ${StrFilter} '$R0' '-eng' '' '' $R0
+\c ${StrFilter} '$R0' '-rus' '' '' $R0
+\c
+\c StrCpy $0 0
+\c
+\c loop:
+\c IntOp $0 $0 + 1
+\c StrCpy $1 $R0 1 $0
+\c StrCmp $1 '' end
+\c StrCmp $1 ' ' +5
+\c StrCmp $1 '_' +4
+\c StrCmp $1 '-' +3
+\c StrCmp $1 '(' +2
+\c StrCmp $1 '[' 0 loop
+\c IntOp $0 $0 + 1
+\c StrCpy $1 $R0 1 $0
+\c StrCmp $1 '' end
+\c
+\c ${StrFilter} '$1' '+eng' '' '' $1
+\c ${StrFilter} '$1' '+rus' '' '' $1
+\c
+\c StrCpy $2 $R0 $0
+\c IntOp $0 $0 + 1
+\c StrCpy $R0 $R0 '' $0
+\c IntOp $0 $0 - 2
+\c StrCpy $R0 '$2$1$R0'
+\c goto loop
+\c
+\c end:
+\c Pop $2
+\c Pop $1
+\c Pop $0
+\c Exch $R0
+\c FunctionEnd
+
+\S1{} VersionCompare
+
+\b Compare version numbers.
+
+\\Syntax:\\
+
+\c ${VersionCompare} "[Version1]" "[Version2]" $var
+
+\c "[Version1]" ; First version
+\c "[Version2]" ; Second version
+\c $var ; Result:
+\c ; $var=0 Versions are equal
+\c ; $var=1 Version1 is newer
+\c ; $var=2 Version2 is newer
+
+\\Example:\\
+
+\c Section
+\c ${VersionCompare} "1.1.1.9" "1.1.1.01" $R0
+\c ; $R0="1"
+\c SectionEnd
+
+\S1{} VersionConvert
+
+\b Convert version in the numerical format which can be compared.
+
+\\Syntax:\\
+
+\c ${VersionConvert} "[Version]" "[CharList]" $var
+
+\c "[Version]" ; Version
+\c ;
+\c "[CharList]" ; List of characters, which will be replaced by numbers
+\c ; "abcdefghijklmnopqrstuvwxyz" (default)
+\c ;
+\c $var ; Result: converted version
+
+\\Note:\\
+\\
-Converted letters are separated with dot
+\\
-If character is non-digit and not in list then it will be converted to dot
+
+\\Example1:\\
+
+\c Section
+\c ${VersionConvert} "9.0a" "" $R0
+\c ; $R0="9.0.01"
+\c
+\c ${VersionConvert} "9.0c" "" $R1
+\c ; $R1="9.0.03"
+\c
+\c ${VersionCompare} "$R0" "$R1" $R2
+\c ; $R2="2" version2 is newer
+\c SectionEnd
+
+\\Example2:\\
+
+\c Section
+\c ${VersionConvert} "0.15c-9m" "" $R0
+\c ; $R0="0.15.03.9.13"
+\c
+\c ${VersionConvert} "0.15c-1n" "" $R1
+\c ; $R1="0.15.03.1.14"
+\c
+\c ${VersionCompare} "$R0" "$R1" $R2
+\c ; $R2="1" version1 is newer
+\c SectionEnd
+
+\\Example3:\\
+
+\c Section
+\c ${VersionConvert} "0.15c+" "abcdefghijklmnopqrstuvwxyz+" $R0
+\c ; $R0="0.15.0327"
+\c
+\c ${VersionConvert} "0.15c" "abcdefghijklmnopqrstuvwxyz+" $R1
+\c ; $R1="0.15.03"
+\c
+\c ${VersionCompare} "$R0" "$R1" $R2
+\c ; $R2="1" version1 is newer
+\c SectionEnd
diff --git a/Examples/FileFunc.ini b/Examples/FileFunc.ini
new file mode 100644
index 00000000..5b227f41
--- /dev/null
+++ b/Examples/FileFunc.ini
@@ -0,0 +1,91 @@
+[Settings]
+NumFields=11
+NextButtonText=&Enter
+
+[Field 1]
+Type=Droplist
+Flags=NOTIFY
+State=" 1. Locate"
+ListItems=| 1. Locate| 2. GetSize (file)| (directory)| (no size, no subdir)| 3. DriveSpace| 4. GetDrives (by type)| (all by letter)| 5. GetTime (local time)| (file time)| 6. GetFileAttributes| 7. GetFileVersion| 8. GetExeName| 9. GetExePath|10. GetParameters|11. GetOptions|12. GetRoot|13. GetParent|14. GetFileName|15. GetBaseName|16. GetFileExt|17. BannerTrimPath|18. DirState|19. RefreshShellIcons
+Left=44
+Right=190
+Top=1
+Bottom=210
+
+[Field 2]
+Type=FileRequest
+Left=44
+Right=-10
+Top=22
+Bottom=33
+
+[Field 3]
+Type=DirRequest
+Left=44
+Right=-10
+Top=22
+Bottom=33
+
+[Field 4]
+Type=Text
+Left=44
+Right=-10
+Top=36
+Bottom=49
+
+[Field 5]
+Type=Text
+State=LocateCallback
+Left=44
+Right=232
+Top=53
+Bottom=66
+
+[Field 6]
+Type=Button
+Text=view
+Flags=NOTIFY
+Left=236
+Right=255
+Top=54
+Bottom=65
+
+[Field 7]
+Type=Text
+Flags=MULTILINE|VSCROLL|HSCROLL|READONLY
+Left=44
+Right=-10
+Top=73
+Bottom=128
+
+[Field 8]
+Type=Label
+Text=Path
+Left=10
+Right=43
+Top=24
+Bottom=36
+
+[Field 9]
+Type=Label
+Text=Options
+Left=10
+Right=43
+Top=40
+Bottom=52
+
+[Field 10]
+Type=Label
+Text=Function
+Left=10
+Right=44
+Top=56
+Bottom=67
+
+[Field 11]
+Type=Label
+Text=Result:
+Left=12
+Right=42
+Top=94
+Bottom=102
diff --git a/Examples/FileFunc.nsi b/Examples/FileFunc.nsi
new file mode 100644
index 00000000..28002a4a
--- /dev/null
+++ b/Examples/FileFunc.nsi
@@ -0,0 +1,751 @@
+;_____________________________________________________________________________
+;
+; File Functions
+;_____________________________________________________________________________
+;
+; 2005 Shengalts Aleksander aka Instructor (Shengalts@mail.ru)
+
+Name "File Functions"
+OutFile "FileFunc.exe"
+Caption "$(^Name)"
+XPStyle on
+
+!include "WinMessages.nsh"
+!include "FileFunc.nsh"
+
+!insertmacro Locate
+!insertmacro GetSize
+!insertmacro DriveSpace
+!insertmacro GetDrives
+!insertmacro GetTime
+!insertmacro GetFileAttributes
+!insertmacro GetFileVersion
+!insertmacro GetExeName
+!insertmacro GetExePath
+!insertmacro GetParameters
+!insertmacro GetOptions
+!insertmacro GetRoot
+!insertmacro GetParent
+!insertmacro GetFileName
+!insertmacro GetBaseName
+!insertmacro GetFileExt
+!insertmacro BannerTrimPath
+!insertmacro DirState
+!insertmacro RefreshShellIcons
+
+Var INI
+Var HWND
+Var STATE
+Var FUNCTION
+Var LOCATE1
+Var LOCATE2
+Var GETSIZE1
+Var GETSIZE2
+Var GETSIZE3
+Var GETSIZE4
+Var GETSIZE5
+Var GETSIZE6
+Var DRIVESPACE1
+Var DRIVESPACE2
+Var GETDRIVES1
+Var GETTIME1
+Var GETTIME2
+Var GETFILEATTRIBUTES1
+Var GETFILEATTRIBUTES2
+Var GETFILEVERSION1
+Var GETOPTIONS1
+Var GETOPTIONS2
+Var GETROOT1
+Var GETPARENT1
+Var GETFILENAME1
+Var GETBASENAME1
+Var GETFILEEXT1
+Var BANNERTRIMPATH1
+Var BANNERTRIMPATH2
+Var DIRSTATE1
+
+Page Custom ShowCustom LeaveCustom
+
+Function ShowCustom
+ InstallOptions::initDialog /NOUNLOAD "$INI"
+ Pop $hwnd
+ GetDlgItem $1 $HWND 1201
+ ShowWindow $1 0
+ GetDlgItem $1 $HWND 1202
+ ShowWindow $1 0
+ GetDlgItem $1 $HWND 1206
+ EnableWindow $1 0
+ SendMessage $1 ${WM_ENABLE} 1 0
+ StrCpy $LOCATE1 $DOCUMENTS
+ StrCpy $LOCATE2 '/L=FD /M=*.* /S=0B /G=1 /B=0'
+ StrCpy $GETSIZE1 '$WINDIR'
+ StrCpy $GETSIZE2 '/M=Explorer.exe /S=0K /G=0'
+ StrCpy $GETSIZE3 '$PROGRAMFILES\Common Files'
+ StrCpy $GETSIZE4 '/S=0M'
+ StrCpy $GETSIZE5 '$WINDIR'
+ StrCpy $GETSIZE6 '/G=0'
+ StrCpy $DRIVESPACE1 'C:\'
+ StrCpy $DRIVESPACE2 '/D=F /S=M'
+ StrCpy $GETDRIVES1 'FDD+CDROM'
+ StrCpy $GETTIME1 '$WINDIR\Explorer.exe'
+ StrCpy $GETTIME2 'C'
+ StrCpy $GETFILEATTRIBUTES1 'C:\IO.SYS'
+ StrCpy $GETFILEATTRIBUTES2 'ALL'
+ StrCpy $GETFILEVERSION1 '$WINDIR\Explorer.exe'
+ StrCpy $GETOPTIONS1 '/SILENT=yes /INSTDIR="$PROGRAMFILES\Common Files"'
+ StrCpy $GETOPTIONS2 '/INSTDIR='
+ StrCpy $GETROOT1 'C:\path\file.dll'
+ StrCpy $GETPARENT1 'C:\path\file.dll'
+ StrCpy $GETFILENAME1 'C:\path\file.dll'
+ StrCpy $GETBASENAME1 'C:\path\file.dll'
+ StrCpy $GETFILEEXT1 'C:\path\file.dll'
+ StrCpy $BANNERTRIMPATH1 'C:\Server\Documents\Terminal\license.htm'
+ StrCpy $BANNERTRIMPATH2 '35A'
+ StrCpy $DIRSTATE1 '$TEMP'
+
+ GetDlgItem $1 $HWND 1203
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:$LOCATE1"
+ GetDlgItem $1 $HWND 1205
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:$LOCATE2"
+ InstallOptions::show
+ Pop $0
+FunctionEnd
+
+Function LeaveCustom
+ ReadINIStr $STATE $INI "Field 1" "State"
+ ReadINIStr $R1 $INI "Field 2" "State"
+ ReadINIStr $R2 $INI "Field 3" "State"
+ ReadINIStr $R3 $INI "Field 4" "State"
+ ReadINIStr $R4 $INI "Field 5" "State"
+ ReadINIStr $0 $INI "Settings" "State"
+ StrCmp $0 6 view
+ StrCmp $0 0 Enter
+ goto main
+
+ view:
+ StrCpy $0 '$$'
+ StrCpy $1 'n'
+ StrCpy $2 'r'
+ StrCmp $R4 "LocateCallback" 0 +3
+ StrCpy $R0 `Function LocateCallback$\r$\n MessageBox MB_OKCANCEL '$0$$R9 "path\name"=[$$R9]$0\$1$0$$R8 "path" =[$$R8]$0\$1$0$$R7 "name" =[$$R7]$0\$1$0$$R6 "size" =[$$R6]' IDOK +2$\r$\n StrCpy $$R0 StopLocate$\r$\n$\r$\n Push $$R0$\r$\nFunctionEnd`
+ goto send
+ StrCmp $R4 "GetDrivesCallback" 0 error
+ StrCpy $R0 `Function GetDrivesCallback$\r$\n MessageBox MB_OKCANCEL '$0$$9 "drive letter"=[$$9]$0\$1$0$$8 "drive type" =[$$8]' IDOK +2$\r$\n StrCpy $$R0 StopGetDrives$\r$\n StrCpy $$R5 '$$R5$$9 [$$8 Drive]$$\$2$$\$1'$\r$\n$\r$\n Push $$R0$\r$\nFunctionEnd`
+ goto send
+
+ main:
+ StrCmp $FUNCTION '' DefaultSend
+ StrCmp $FUNCTION Locate 0 +4
+ StrCpy $LOCATE1 $R2
+ StrCpy $LOCATE2 $R3
+ goto DefaultSend
+ StrCmp $FUNCTION GetSize1 0 +4
+ StrCpy $GETSIZE1 $R2
+ StrCpy $GETSIZE2 $R3
+ goto DefaultSend
+ StrCmp $FUNCTION GetSize2 0 +4
+ StrCpy $GETSIZE3 $R2
+ StrCpy $GETSIZE4 $R3
+ goto DefaultSend
+ StrCmp $FUNCTION GetSize3 0 +4
+ StrCpy $GETSIZE5 $R2
+ StrCpy $GETSIZE6 $R3
+ goto DefaultSend
+ StrCmp $FUNCTION DriveSpace 0 +4
+ StrCpy $DRIVESPACE1 $R1
+ StrCpy $DRIVESPACE2 $R3
+ goto DefaultSend
+ StrCmp $FUNCTION GetDrives 0 +3
+ StrCpy $GETDRIVES1 $R1
+ goto DefaultSend
+ StrCmp $FUNCTION GetTime 0 +4
+ StrCpy $GETTIME1 $R1
+ StrCpy $GETTIME2 $R3
+ goto DefaultSend
+ StrCmp $FUNCTION GetFileAttributes 0 +4
+ StrCpy $GETFILEATTRIBUTES1 $R1
+ StrCpy $GETFILEATTRIBUTES2 $R3
+ goto DefaultSend
+ StrCmp $FUNCTION GetFileVersion 0 +3
+ StrCpy $GETFILEVERSION1 $R1
+ goto DefaultSend
+ StrCmp $FUNCTION GetOptions 0 +4
+ StrCpy $GETOPTIONS1 $R1
+ StrCpy $GETOPTIONS2 $R3
+ goto DefaultSend
+ StrCmp $FUNCTION GetRoot 0 +3
+ StrCpy $GETROOT1 $R1
+ goto DefaultSend
+ StrCmp $FUNCTION GetParent 0 +3
+ StrCpy $GETPARENT1 $R1
+ goto DefaultSend
+ StrCmp $FUNCTION GetFileName 0 +3
+ StrCpy $GETFILENAME1 $R1
+ goto DefaultSend
+ StrCmp $FUNCTION GetBaseName 0 +3
+ StrCpy $GETBASENAME1 $R1
+ goto DefaultSend
+ StrCmp $FUNCTION GetFileExt 0 +3
+ StrCpy $GETFILEEXT1 $R1
+ goto DefaultSend
+ StrCmp $FUNCTION BannerTrimPath 0 +4
+ StrCpy $BANNERTRIMPATH1 $R1
+ StrCpy $BANNERTRIMPATH2 $R3
+ goto DefaultSend
+ StrCmp $FUNCTION DirState 0 +2
+ StrCpy $DIRSTATE1 $R2
+
+ DefaultSend:
+ GetDlgItem $1 $HWND 1201
+ EnableWindow $1 1
+ ShowWindow $1 0
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:"
+ GetDlgItem $1 $HWND 1202
+ EnableWindow $1 1
+ ShowWindow $1 0
+ GetDlgItem $1 $HWND 1203
+ EnableWindow $1 1
+ ShowWindow $1 0
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:"
+ GetDlgItem $1 $HWND 1204
+ EnableWindow $1 1
+ ShowWindow $1 0
+ GetDlgItem $1 $HWND 1205
+ EnableWindow $1 1
+ GetDlgItem $1 $HWND 1206
+ ShowWindow $1 0
+ EnableWindow $1 0
+ GetDlgItem $1 $HWND 1207
+ ShowWindow $1 0
+ GetDlgItem $1 $HWND 1208
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:"
+ GetDlgItem $1 $HWND 1209
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:"
+ GetDlgItem $1 $HWND 1210
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:"
+ GetDlgItem $1 $HWND 1211
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:"
+
+ ReadINIStr $0 $INI "Field 1" "State"
+ StrCmp $0 " 1. Locate" 0 GetSize1Send
+ StrCpy $FUNCTION Locate
+ GetDlgItem $1 $HWND 1203
+ ShowWindow $1 1
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:$LOCATE1"
+ GetDlgItem $1 $HWND 1204
+ ShowWindow $1 1
+ GetDlgItem $1 $HWND 1205
+ ShowWindow $1 1
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:$LOCATE2"
+ GetDlgItem $1 $HWND 1206
+ ShowWindow $1 1
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:LocateCallback"
+ GetDlgItem $1 $HWND 1207
+ ShowWindow $1 1
+ GetDlgItem $1 $HWND 1209
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:Path"
+ GetDlgItem $1 $HWND 1210
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:Options"
+ GetDlgItem $1 $HWND 1211
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:Function"
+ abort
+
+ GetSize1Send:
+ StrCmp $0 " 2. GetSize (file)" 0 GetSize2Send
+ StrCpy $FUNCTION 'GetSize1'
+ GetDlgItem $1 $HWND 1203
+ ShowWindow $1 1
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:$GETSIZE1"
+ GetDlgItem $1 $HWND 1204
+ ShowWindow $1 1
+ GetDlgItem $1 $HWND 1205
+ ShowWindow $1 1
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:$GETSIZE2"
+ GetDlgItem $1 $HWND 1209
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:File"
+ GetDlgItem $1 $HWND 1210
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:Options"
+ Abort
+
+ GetSize2Send:
+ StrCmp $0 " (directory)" 0 GetSize3Send
+ StrCpy $FUNCTION 'GetSize2'
+ GetDlgItem $1 $HWND 1203
+ ShowWindow $1 1
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:$GETSIZE3"
+ GetDlgItem $1 $HWND 1204
+ ShowWindow $1 1
+ GetDlgItem $1 $HWND 1205
+ ShowWindow $1 1
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:$GETSIZE4"
+ GetDlgItem $1 $HWND 1209
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:Directory"
+ GetDlgItem $1 $HWND 1210
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:Options"
+ Abort
+
+ GetSize3Send:
+ StrCmp $0 " (no size, no subdir)" 0 DriveSpaceSend
+ StrCpy $FUNCTION 'GetSize3'
+ GetDlgItem $1 $HWND 1203
+ ShowWindow $1 1
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:$GETSIZE5"
+ GetDlgItem $1 $HWND 1204
+ ShowWindow $1 1
+ GetDlgItem $1 $HWND 1205
+ ShowWindow $1 1
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:$GETSIZE6"
+ GetDlgItem $1 $HWND 1209
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:Directory"
+ GetDlgItem $1 $HWND 1210
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:Options"
+ Abort
+
+ DriveSpaceSend:
+ StrCmp $0 " 3. DriveSpace" 0 GetDrivesSend
+ StrCpy $FUNCTION DriveSpace
+ GetDlgItem $1 $HWND 1201
+ ShowWindow $1 1
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:$DRIVESPACE1"
+ GetDlgItem $1 $HWND 1202
+ ShowWindow $1 1
+ EnableWindow $1 0
+ GetDlgItem $1 $HWND 1205
+ ShowWindow $1 1
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:$DRIVESPACE2"
+ GetDlgItem $1 $HWND 1206
+ ShowWindow $1 0
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:"
+ GetDlgItem $1 $HWND 1207
+ ShowWindow $1 0
+ GetDlgItem $1 $HWND 1209
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:Drive"
+ GetDlgItem $1 $HWND 1210
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:Options"
+ abort
+
+ GetDrivesSend:
+ StrCmp $0 " 4. GetDrives (by type)" 0 GetDrives2Send
+ StrCpy $FUNCTION GetDrives
+ GetDlgItem $1 $HWND 1201
+ ShowWindow $1 1
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:$GETDRIVES1"
+ GetDlgItem $1 $HWND 1202
+ ShowWindow $1 1
+ EnableWindow $1 0
+ GetDlgItem $1 $HWND 1205
+ ShowWindow $1 0
+ GetDlgItem $1 $HWND 1206
+ ShowWindow $1 1
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:GetDrivesCallback"
+ GetDlgItem $1 $HWND 1207
+ ShowWindow $1 1
+ GetDlgItem $1 $HWND 1209
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:Option"
+ GetDlgItem $1 $HWND 1211
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:Function"
+ abort
+
+ GetDrives2Send:
+ StrCmp $0 " (all by letter)" 0 GetTime1Send
+ StrCpy $FUNCTION ''
+ GetDlgItem $1 $HWND 1201
+ ShowWindow $1 1
+ EnableWindow $1 0
+ SendMessage $1 ${WM_ENABLE} 1 0
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:ALL"
+ GetDlgItem $1 $HWND 1202
+ ShowWindow $1 1
+ EnableWindow $1 0
+ GetDlgItem $1 $HWND 1205
+ ShowWindow $1 0
+ GetDlgItem $1 $HWND 1206
+ ShowWindow $1 1
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:GetDrivesCallback"
+ GetDlgItem $1 $HWND 1207
+ ShowWindow $1 1
+ GetDlgItem $1 $HWND 1209
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:Option"
+ GetDlgItem $1 $HWND 1211
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:Function"
+ abort
+
+ GetTime1Send:
+ StrCmp $0 " 5. GetTime (local time)" 0 GetTime2Send
+ StrCpy $FUNCTION ''
+ GetDlgItem $1 $HWND 1201
+ ShowWindow $1 1
+ EnableWindow $1 0
+ SendMessage $1 ${WM_ENABLE} 1 0
+ GetDlgItem $1 $HWND 1202
+ ShowWindow $1 1
+ EnableWindow $1 0
+ GetDlgItem $1 $HWND 1205
+ ShowWindow $1 1
+ EnableWindow $1 0
+ SendMessage $1 ${WM_ENABLE} 1 0
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:L"
+ GetDlgItem $1 $HWND 1210
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:Option"
+ Abort
+
+ GetTime2Send:
+ StrCmp $0 " (file time)" 0 GetFileAttributesSend
+ StrCpy $FUNCTION GetTime
+ GetDlgItem $1 $HWND 1201
+ ShowWindow $1 1
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:$GETTIME1"
+ GetDlgItem $1 $HWND 1202
+ ShowWindow $1 1
+ GetDlgItem $1 $HWND 1205
+ ShowWindow $1 1
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:$GETTIME2"
+ GetDlgItem $1 $HWND 1209
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:File"
+ GetDlgItem $1 $HWND 1210
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:Option"
+ Abort
+
+ GetFileAttributesSend:
+ StrCmp $0 " 6. GetFileAttributes" 0 GetFileVersionSend
+ StrCpy $FUNCTION GetFileAttributes
+ GetDlgItem $1 $HWND 1201
+ ShowWindow $1 1
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:$GETFILEATTRIBUTES1"
+ GetDlgItem $1 $HWND 1202
+ ShowWindow $1 1
+ GetDlgItem $1 $HWND 1205
+ ShowWindow $1 1
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:$GETFILEATTRIBUTES2"
+ GetDlgItem $1 $HWND 1209
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:Path"
+ GetDlgItem $1 $HWND 1210
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:Attrib"
+ Abort
+
+ GetFileVersionSend:
+ StrCmp $0 " 7. GetFileVersion" 0 GetCmdSend
+ StrCpy $FUNCTION GetFileVersion
+ GetDlgItem $1 $HWND 1201
+ ShowWindow $1 1
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:$GETFILEVERSION1"
+ GetDlgItem $1 $HWND 1202
+ ShowWindow $1 1
+ GetDlgItem $1 $HWND 1205
+ ShowWindow $1 0
+ GetDlgItem $1 $HWND 1209
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:File"
+ Abort
+
+ GetCmdSend:
+ StrCmp $0 " 8. GetExeName" +3
+ StrCmp $0 " 9. GetExePath" +2
+ StrCmp $0 "10. GetParameters" 0 GetOptionsSend
+ StrCpy $FUNCTION ''
+ GetDlgItem $1 $HWND 1205
+ ShowWindow $1 0
+ Abort
+
+ GetOptionsSend:
+ StrCmp $0 "11. GetOptions" 0 GetRootSend
+ StrCpy $FUNCTION GetOptions
+ GetDlgItem $1 $HWND 1201
+ ShowWindow $1 1
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:$GETOPTIONS1"
+ GetDlgItem $1 $HWND 1202
+ ShowWindow $1 1
+ EnableWindow $1 0
+ GetDlgItem $1 $HWND 1205
+ ShowWindow $1 1
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:$GETOPTIONS2"
+ GetDlgItem $1 $HWND 1209
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:Parameters"
+ GetDlgItem $1 $HWND 1210
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:Option"
+ Abort
+
+ GetRootSend:
+ StrCmp $0 "12. GetRoot" 0 GetParentSend
+ StrCpy $FUNCTION GetRoot
+ GetDlgItem $1 $HWND 1201
+ ShowWindow $1 1
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:$GETROOT1"
+ GetDlgItem $1 $HWND 1202
+ ShowWindow $1 1
+ GetDlgItem $1 $HWND 1205
+ ShowWindow $1 0
+ GetDlgItem $1 $HWND 1209
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:FullPath"
+ Abort
+
+ GetParentSend:
+ StrCmp $0 "13. GetParent" 0 GetFileNameSend
+ StrCpy $FUNCTION GetParent
+ GetDlgItem $1 $HWND 1201
+ ShowWindow $1 1
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:$GETPARENT1"
+ GetDlgItem $1 $HWND 1202
+ ShowWindow $1 1
+ GetDlgItem $1 $HWND 1205
+ ShowWindow $1 0
+ GetDlgItem $1 $HWND 1209
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:PathString"
+ Abort
+
+ GetFileNameSend:
+ StrCmp $0 "14. GetFileName" 0 GetBaseNameSend
+ StrCpy $FUNCTION GetFileName
+ GetDlgItem $1 $HWND 1201
+ ShowWindow $1 1
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:$GETFILENAME1"
+ GetDlgItem $1 $HWND 1202
+ ShowWindow $1 1
+ GetDlgItem $1 $HWND 1205
+ ShowWindow $1 0
+ GetDlgItem $1 $HWND 1209
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:PathString"
+ Abort
+
+ GetBaseNameSend:
+ StrCmp $0 "15. GetBaseName" 0 GetFileExtSend
+ StrCpy $FUNCTION GetBaseName
+ GetDlgItem $1 $HWND 1201
+ ShowWindow $1 1
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:$GETBASENAME1"
+ GetDlgItem $1 $HWND 1202
+ ShowWindow $1 1
+ GetDlgItem $1 $HWND 1205
+ ShowWindow $1 0
+ GetDlgItem $1 $HWND 1209
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:FileString"
+ Abort
+
+ GetFileExtSend:
+ StrCmp $0 "16. GetFileExt" 0 BannerTrimPathSend
+ StrCpy $FUNCTION GetFileExt
+ GetDlgItem $1 $HWND 1201
+ ShowWindow $1 1
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:$GETFILEEXT1"
+ GetDlgItem $1 $HWND 1202
+ ShowWindow $1 1
+ GetDlgItem $1 $HWND 1205
+ ShowWindow $1 0
+ GetDlgItem $1 $HWND 1209
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:FileString"
+ Abort
+
+ BannerTrimPathSend:
+ StrCmp $0 "17. BannerTrimPath" 0 DirStateSend
+ StrCpy $FUNCTION BannerTrimPath
+ GetDlgItem $1 $HWND 1201
+ ShowWindow $1 1
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:$BANNERTRIMPATH1"
+ GetDlgItem $1 $HWND 1202
+ ShowWindow $1 1
+ EnableWindow $1 0
+ GetDlgItem $1 $HWND 1205
+ ShowWindow $1 1
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:$BANNERTRIMPATH2"
+ GetDlgItem $1 $HWND 1209
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:PathString"
+ GetDlgItem $1 $HWND 1210
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:Option"
+ Abort
+
+ DirStateSend:
+ StrCmp $0 "18. DirState" 0 RefreshShellIconsSend
+ StrCpy $FUNCTION DirState
+ GetDlgItem $1 $HWND 1203
+ ShowWindow $1 1
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:$DIRSTATE1"
+ GetDlgItem $1 $HWND 1204
+ ShowWindow $1 1
+ GetDlgItem $1 $HWND 1205
+ ShowWindow $1 0
+ GetDlgItem $1 $HWND 1209
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:Directory"
+ Abort
+
+ RefreshShellIconsSend:
+ StrCmp $0 "19. RefreshShellIcons" 0 Abort
+ StrCpy $FUNCTION ''
+ GetDlgItem $1 $HWND 1205
+ ShowWindow $1 0
+
+ Abort:
+ Abort
+
+;=Enter=
+ Enter:
+ StrCpy $R0 ''
+ StrCpy $R5 ''
+
+ StrCmp $STATE " 1. Locate" Locate
+ StrCmp $STATE " 2. GetSize (file)" GetSize
+ StrCmp $STATE " (directory)" GetSize
+ StrCmp $STATE " (no size, no subdir)" GetSize
+ StrCmp $STATE " 3. DriveSpace" DriveSpace
+ StrCmp $STATE " 4. GetDrives (by type)" GetDrives
+ StrCmp $STATE " (all by letter)" GetDrives
+ StrCmp $STATE " 5. GetTime (local time)" GetTime
+ StrCmp $STATE " (file time)" GetTime
+ StrCmp $STATE " 6. GetFileAttributes" GetFileAttributes
+ StrCmp $STATE " 7. GetFileVersion" GetFileVersion
+ StrCmp $STATE " 8. GetExeName" GetExeName
+ StrCmp $STATE " 9. GetExePath" GetExePath
+ StrCmp $STATE "10. GetParameters" GetParameters
+ StrCmp $STATE "11. GetOptions" GetOptions
+ StrCmp $STATE "12. GetRoot" GetRoot
+ StrCmp $STATE "13. GetParent" GetParent
+ StrCmp $STATE "14. GetFileName" GetFileName
+ StrCmp $STATE "15. GetBaseName" GetBaseName
+ StrCmp $STATE "16. GetFileExt" GetFileExt
+ StrCmp $STATE "17. BannerTrimPath" BannerTrimPath
+ StrCmp $STATE "18. DirState" DirState
+ StrCmp $STATE "19. RefreshShellIcons" RefreshShellIcons
+ Abort
+
+ Locate:
+ ${Locate} "$R2" "$R3" "LocateCallback"
+ IfErrors error
+ StrCmp $R0 StopLocate 0 +3
+ StrCpy $R0 'stopped'
+ goto send
+ StrCpy $R0 'done'
+ goto send
+
+ GetSize:
+ ${GetSize} "$R2" "$R3" $0 $1 $2
+ IfErrors error
+ StrCpy $R0 "Size=$0$\r$\nFiles=$1$\r$\nFolders=$2"
+ goto send
+
+ DriveSpace:
+ ${DriveSpace} "$R1" "$R3" $0
+ IfErrors error
+ StrCpy $R0 "$0"
+ goto send
+
+ GetDrives:
+ ${GetDrives} "$R1" "GetDrivesCallback"
+ StrCmp $R0 StopGetDrives 0 +3
+ StrCpy $R0 '$R5stopped'
+ goto send
+ StrCpy $R0 '$R5done'
+ goto send
+
+ GetTime:
+ ${GetTime} "$R1" "$R3" $0 $1 $2 $3 $4 $5 $6
+ IfErrors error
+ StrCpy $R0 'Date=$0/$1/$2 ($3)$\r$\nTime=$4:$5:$6'
+ goto send
+
+ GetFileAttributes:
+ ${GetFileAttributes} "$R1" "$R3" $0
+ IfErrors error
+ StrCpy $R0 '$0'
+ goto send
+
+ GetFileVersion:
+ ${GetFileVersion} "$R1" $0
+ IfErrors error
+ StrCpy $R0 '$0'
+ goto send
+
+ GetExeName:
+ ${GetExeName} $0
+ StrCpy $R0 '$0'
+ goto send
+
+ GetExePath:
+ ${GetExePath} $0
+ StrCpy $R0 '$0'
+ goto send
+
+ GetParameters:
+ ${GetParameters} $0
+ StrCpy $R0 '$0'
+ StrCmp $R0 '' 0 send
+ StrCpy $R0 'no parameters'
+ goto send
+
+ GetOptions:
+ ${GetOptions} "$R1" "$R3" $0
+ StrCpy $R0 '$0'
+ goto send
+
+ GetRoot:
+ ${GetRoot} "$R1" $0
+ StrCpy $R0 '$0'
+ goto send
+
+ GetParent:
+ ${GetParent} "$R1" $0
+ StrCpy $R0 '$0'
+ goto send
+
+ GetFileName:
+ ${GetFileName} "$R1" $0
+ StrCpy $R0 '$0'
+ goto send
+
+ GetBaseName:
+ ${GetBaseName} "$R1" $0
+ StrCpy $R0 '$0'
+ goto send
+
+ GetFileExt:
+ ${GetFileExt} "$R1" $0
+ StrCpy $R0 '$0'
+ goto send
+
+ BannerTrimPath:
+ ${BannerTrimPath} "$R1" "$R3" $0
+ StrCpy $R0 '$0'
+ goto send
+
+ DirState:
+ ${DirState} "$R2" $0
+ StrCpy $R0 '$0'
+ goto send
+
+ RefreshShellIcons:
+ ${RefreshShellIcons}
+ StrCpy $R0 'done'
+ goto send
+
+ error:
+ StrCpy $R0 'error'
+
+ send:
+ GetDlgItem $1 $HWND 1208
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:$R0"
+
+ abort
+FunctionEnd
+
+Function LocateCallback
+ MessageBox MB_OKCANCEL '$$R9 "path\name"=[$R9]$\n$$R8 "path" =[$R8]$\n$$R7 "name" =[$R7]$\n$$R6 "size" =[$R6]' IDOK +2
+ StrCpy $R0 StopLocate
+
+ Push $R0
+FunctionEnd
+
+Function GetDrivesCallback
+ MessageBox MB_OKCANCEL '$$9 "drive letter"=[$9]$\n$$8 "drive type" =[$8]' IDOK +2
+ StrCpy $R0 StopGetDrives
+ StrCpy $R5 '$R5$9 [$8 Drive]$\r$\n'
+
+ Push $R0
+FunctionEnd
+
+Function .onInit
+ InitPluginsDir
+ GetTempFileName $INI $PLUGINSDIR
+ File /oname=$INI "FileFunc.ini"
+FunctionEnd
+
+Page instfiles
+
+Section "Empty"
+SectionEnd
diff --git a/Examples/FileFuncTest.nsi b/Examples/FileFuncTest.nsi
new file mode 100644
index 00000000..9e8e3810
--- /dev/null
+++ b/Examples/FileFuncTest.nsi
@@ -0,0 +1,508 @@
+;_____________________________________________________________________________
+;
+; File Functions Test
+;_____________________________________________________________________________
+;
+; 2005 Shengalts Aleksander aka Instructor (Shengalts@mail.ru)
+
+Name "File Functions Test"
+OutFile "FileFuncTest.exe"
+Caption "$(^Name)"
+ShowInstDetails show
+XPStyle on
+
+Var FUNCTION
+Var OUT1
+Var OUT2
+Var OUT3
+Var OUT4
+Var OUT5
+Var OUT6
+Var OUT7
+
+!include "FileFunc.nsh"
+
+!insertmacro Locate
+!insertmacro GetSize
+!insertmacro DriveSpace
+!insertmacro GetDrives
+!insertmacro GetTime
+!insertmacro GetFileAttributes
+!insertmacro GetFileVersion
+!insertmacro GetExeName
+!insertmacro GetExePath
+!insertmacro GetParameters
+!insertmacro GetOptions
+!insertmacro GetRoot
+!insertmacro GetParent
+!insertmacro GetFileName
+!insertmacro GetBaseName
+!insertmacro GetFileExt
+!insertmacro BannerTrimPath
+!insertmacro DirState
+!insertmacro RefreshShellIcons
+
+!insertmacro un.Locate
+!insertmacro un.GetSize
+!insertmacro un.GetDrives
+!insertmacro un.DriveSpace
+!insertmacro un.GetTime
+!insertmacro un.GetFileAttributes
+!insertmacro un.GetFileVersion
+!insertmacro un.GetExeName
+!insertmacro un.GetExePath
+!insertmacro un.GetParameters
+!insertmacro un.GetOptions
+!insertmacro un.GetRoot
+!insertmacro un.GetParent
+!insertmacro un.GetFileName
+!insertmacro un.GetBaseName
+!insertmacro un.GetFileExt
+!insertmacro un.BannerTrimPath
+!insertmacro un.DirState
+!insertmacro un.RefreshShellIcons
+
+
+
+;############### INSTALL ###############
+
+!define StackVerificationStart `!insertmacro StackVerificationStart`
+!macro StackVerificationStart _FUNCTION
+ StrCpy $FUNCTION ${_FUNCTION}
+ Call StackVerificationStart
+!macroend
+
+!define StackVerificationEnd `!insertmacro StackVerificationEnd`
+!macro StackVerificationEnd
+ Call StackVerificationEnd
+!macroend
+
+Function StackVerificationStart
+ StrCpy $0 !0
+ StrCpy $1 !1
+ StrCpy $2 !2
+ StrCpy $3 !3
+ StrCpy $4 !4
+ StrCpy $5 !5
+ StrCpy $6 !6
+ StrCpy $7 !7
+ StrCpy $8 !8
+ StrCpy $9 !9
+ StrCpy $R0 !R0
+ StrCpy $R1 !R1
+ StrCpy $R2 !R2
+ StrCpy $R3 !R3
+ StrCpy $R4 !R4
+ StrCpy $R5 !R5
+ StrCpy $R6 !R6
+ StrCpy $R7 !R7
+ StrCpy $R8 !R8
+ StrCpy $R9 !R9
+FunctionEnd
+
+Function StackVerificationEnd
+ IfErrors +3
+ DetailPrint 'PASSED $FUNCTION no errors'
+ goto +2
+ DetailPrint 'FAILED $FUNCTION error'
+
+ StrCmp $0 '!0' 0 error
+ StrCmp $1 '!1' 0 error
+ StrCmp $2 '!2' 0 error
+ StrCmp $3 '!3' 0 error
+ StrCmp $4 '!4' 0 error
+ StrCmp $5 '!5' 0 error
+ StrCmp $6 '!6' 0 error
+ StrCmp $7 '!7' 0 error
+ StrCmp $8 '!8' 0 error
+ StrCmp $9 '!9' 0 error
+ StrCmp $R0 '!R0' 0 error
+ StrCmp $R1 '!R1' 0 error
+ StrCmp $R2 '!R2' 0 error
+ StrCmp $R3 '!R3' 0 error
+ StrCmp $R4 '!R4' 0 error
+ StrCmp $R5 '!R5' 0 error
+ StrCmp $R6 '!R6' 0 error
+ StrCmp $R7 '!R7' 0 error
+ StrCmp $R8 '!R8' 0 error
+ StrCmp $R9 '!R9' 0 error
+ DetailPrint 'PASSED $FUNCTION stack'
+ goto end
+
+ error:
+ DetailPrint 'FAILED $FUNCTION stack'
+; MessageBox MB_OKCANCEL '$$0={$0}$\n$$1={$1}$\n$$2={$2}$\n$$3={$3}$\n$$4={$4}$\n$$5={$5}$\n$$6={$6}$\n$$7={$7}$\n$$8={$8}$\n$$9={$9}$\n$$R0={$R0}$\n$$R1={$R1}$\n$$R2={$R2}$\n$$R3={$R3}$\n$$R4={$R4}$\n$$R5={$R5}$\n$$R6={$R6}$\n$$R7={$R7}$\n$$R8={$R8}$\n$$R9={$R9}' IDOK +2
+; quit
+
+ end:
+FunctionEnd
+
+
+
+Section Locate
+ ${StackVerificationStart} Locate
+
+ ${Locate} '$DOCUMENTS' '/L=FD /M=*.* /S=0B /G=0' 'LocateCallback'
+
+ ${StackVerificationEnd}
+SectionEnd
+
+Function LocateCallback
+; MessageBox MB_YESNO '$$0={$0}$\n$$1={$1}$\n$$2={$2}$\n$$3={$3}$\n$$4={$4}$\n$$5={$5}$\n$$6={$6}$\n$$7={$7}$\n$$8={$8}$\n$$9={$9}$\n$$R0={$R0}$\n$$R1={$R1}$\n$$R2={$R2}$\n$$R3={$R3}$\n$$R4={$R4}$\n$$R5={$R5}$\n$$R6={$R6}$\n$$R7={$R7}$\n$$R8={$R8}$\n$$R9={$R9}$\n$\nContinue?' IDYES +2
+; StrCpy $0 StopLocate
+
+ Push $0
+FunctionEnd
+
+
+Section GetSize
+ ${StackVerificationStart} GetSize
+
+ ${GetSize} '$WINDIR' '/M=Explorer.exe /S=0K /G=0' $OUT1 $OUT2 $OUT3
+
+ ${StackVerificationEnd}
+SectionEnd
+
+
+Section DriveSpace
+ ${StackVerificationStart} DriveSpace
+
+ ${DriveSpace} 'C:\' '/D=F /S=M' $OUT1
+
+ ${StackVerificationEnd}
+SectionEnd
+
+
+Section GetDrives
+ ${StackVerificationStart} GetDrives
+
+ ${GetDrives} 'FDD+CDROM' 'GetDrivesCallback'
+
+ ${StackVerificationEnd}
+SectionEnd
+
+Function GetDrivesCallback
+; MessageBox MB_YESNO '$$0={$0}$\n$$1={$1}$\n$$2={$2}$\n$$3={$3}$\n$$4={$4}$\n$$5={$5}$\n$$6={$6}$\n$$7={$7}$\n$$8={$8}$\n$$9={$9}$\n$$R0={$R0}$\n$$R1={$R1}$\n$$R2={$R2}$\n$$R3={$R3}$\n$$R4={$R4}$\n$$R5={$R5}$\n$$R6={$R6}$\n$$R7={$R7}$\n$$R8={$R8}$\n$$R9={$R9}$\n$\nContinue?' IDYES +2
+; StrCpy $0 StopGetDrives
+
+ Push $0
+FunctionEnd
+
+
+Section GetTime
+ ${StackVerificationStart} GetTime
+
+ ${GetTime} '' 'L' $OUT1 $OUT2 $OUT3 $OUT4 $OUT5 $OUT6 $OUT7
+
+ ${StackVerificationEnd}
+SectionEnd
+
+
+Section GetFileAttributes
+ ${StackVerificationStart} GetFileAttributes
+
+ ${GetFileAttributes} '$WINDIR\explorer.exe' 'ALL' $OUT1
+
+ ${StackVerificationEnd}
+SectionEnd
+
+
+Section GetFileVersion
+ ${StackVerificationStart} GetFileVersion
+
+ ${GetFileVersion} '$WINDIR\explorer.exe' $OUT1
+
+ ${StackVerificationEnd}
+SectionEnd
+
+
+Section GetExeName
+ ${StackVerificationStart} GetExeName
+
+ ${GetExeName} $OUT1
+
+ ${StackVerificationEnd}
+SectionEnd
+
+
+Section GetExePath
+ ${StackVerificationStart} GetExePath
+
+ ${GetExePath} $OUT1
+
+ ${StackVerificationEnd}
+SectionEnd
+
+
+Section GetParameters
+ ${StackVerificationStart} GetParameters
+
+ ${GetParameters} $OUT1
+
+ ${StackVerificationEnd}
+SectionEnd
+
+
+Section GetOptions
+ ${StackVerificationStart} GetOptions
+
+ ${GetOptions} '/INSTDIR=C:\Program Files\Common Files /SILENT=yes' '/INSTDIR=' $OUT1
+ StrCmp $OUT1 'C:\Program Files\Common Files' 0 error
+
+ ${GetOptions} '-TMP=temp.tmp -INSTDIR="C:/Program Files/Common Files" -SILENT=yes' '-INSTDIR=' $OUT1
+ StrCmp $OUT1 'C:/Program Files/Common Files' 0 error
+
+ ${GetOptions} "/INSTDIR='C:/Program Files/Common Files' /SILENT=yes" '/INSTDIR=' $OUT1
+ StrCmp $OUT1 'C:/Program Files/Common Files' 0 error
+
+ StrCpy $OUT1 '/INSTDIR=`C:/Program Files/Common Files` /SILENT=yes'
+ ${GetOptions} '$OUT1' '/INSTDIR=' $OUT1
+ StrCmp $OUT1 'C:/Program Files/Common Files' 0 error
+
+ ${GetOptions} '/SILENT=yes /INSTDIR=C:\Program Files\Common Files' '/INSTDIR=' $OUT1
+ StrCmp $OUT1 'C:\Program Files\Common Files' 0 error
+
+ ${GetOptions} "/INSTDIR=common directory: 'C:\Program Files\Common Files' /SILENT=yes" '/INSTDIR=' $OUT1
+ StrCmp $OUT1 "common directory: 'C:\Program Files\Common Files'" 0 error
+
+ ${GetOptions} '/INSTDIR=WxxxW /SILENT=yes' '/INSTDIR=' $OUT1
+ StrCmp $OUT1 'WxxxW' 0 error
+
+ ${GetOptions} `/INSTDIR='"C:/Program Files/Common Files"' /SILENT=yes` '/INSTDIR=' $OUT1
+ StrCmp $OUT1 '"C:/Program Files/Common Files"' 0 error
+
+ ${GetOptions} `/INSTDIR='"C:/Program Files/Common Files"' /SILENT=yes` '/INSTDIR*=' $OUT1
+ StrCmp $OUT1 '' 0 error
+
+ ${GetOptions} `/INSTDIR=''C:/Program Files/Common Files'' /SILENT=yes` '' $OUT1
+ StrCmp $OUT1 '' 0 error
+
+ goto +2
+ error:
+ SetErrors
+
+ ${StackVerificationEnd}
+SectionEnd
+
+
+Section GetRoot
+ ${StackVerificationStart} GetRoot
+
+ ${GetRoot} 'C:\Program Files\NSIS' $OUT1
+ StrCmp $OUT1 'C:' 0 error
+
+ ${GetRoot} '\\SuperPimp\NSIS\Source\exehead\Ui.c' $OUT1
+ StrCmp $OUT1 '\\SuperPimp\NSIS' 0 error
+
+ ${GetRoot} '\\Program Files\NSIS' $OUT1
+ StrCmp $OUT1 '\\Program Files\NSIS' 0 error
+
+ ${GetRoot} '\\Program Files\NSIS\' $OUT1
+ StrCmp $OUT1 '\\Program Files\NSIS' 0 error
+
+ ${GetRoot} '\\Program Files\NSIS\Source\exehead\Ui.c' $OUT1
+ StrCmp $OUT1 '\\Program Files\NSIS' 0 error
+
+ ${GetRoot} '\Program Files\NSIS' $OUT1
+ StrCmp $OUT1 '' 0 error
+
+ goto +2
+ error:
+ SetErrors
+
+ ${StackVerificationEnd}
+SectionEnd
+
+
+Section GetParent
+ ${StackVerificationStart} GetParent
+
+ ${GetParent} 'C:\Program Files\Winamp\uninstwa.exe' $OUT1
+ StrCmp $OUT1 'C:\Program Files\Winamp' 0 error
+
+ ${GetParent} 'C:\Program Files\Winamp\plugins' $OUT1
+ StrCmp $OUT1 'C:\Program Files\Winamp' 0 error
+
+ ${GetParent} 'C:\Program Files\Winamp\plugins\' $OUT1
+ StrCmp $OUT1 'C:\Program Files\Winamp' 0 error
+
+ ${GetParent} 'C:\' $OUT1
+ StrCmp $OUT1 '' 0 error
+
+ goto +2
+ error:
+ SetErrors
+
+ ${StackVerificationEnd}
+SectionEnd
+
+
+Section GetFileName
+ ${StackVerificationStart} GetFileName
+
+ ${GetFileName} 'C:\Program Files\Winamp\uninstwa.exe' $OUT1
+ StrCmp $OUT1 'uninstwa.exe' 0 error
+
+ ${GetFileName} 'uninstwa.exe' $OUT1
+ StrCmp $OUT1 'uninstwa.exe' 0 error
+
+ ${GetFileName} 'C:\Program Files\Winamp\plugins' $OUT1
+ StrCmp $OUT1 'plugins' 0 error
+
+ ${GetFileName} 'C:\Program Files\Winamp\plugins\' $OUT1
+ StrCmp $OUT1 'plugins' 0 error
+
+ goto +2
+ error:
+ SetErrors
+
+ ${StackVerificationEnd}
+SectionEnd
+
+
+Section GetBaseName
+ ${StackVerificationStart} GetBaseName
+
+ ${GetBaseName} 'C:\Program Files\Winamp\uninstwa.exe' $OUT1
+ StrCmp $OUT1 'uninstwa' 0 error
+
+ ${GetBaseName} 'uninstwa.exe' $OUT1
+ StrCmp $OUT1 'uninstwa' 0 error
+
+ ${GetBaseName} 'C:\Program Files\Winamp\plugins' $OUT1
+ StrCmp $OUT1 'plugins' 0 error
+
+ ${GetBaseName} 'C:\Program Files\Winamp\plugins\' $OUT1
+ StrCmp $OUT1 '' 0 error
+
+ goto +2
+ error:
+ SetErrors
+
+ ${StackVerificationEnd}
+SectionEnd
+
+
+Section GetFileExt
+ ${StackVerificationStart} GetFileExt
+
+ ${GetFileExt} 'C:\Program Files\Winamp\uninstwa.exe' $OUT1
+ StrCmp $OUT1 'exe' 0 error
+
+ ${GetFileExt} 'uninstwa.exe' $OUT1
+ StrCmp $OUT1 'exe' 0 error
+
+ ${GetFileExt} 'C:\Program Files\Winamp\plugins' $OUT1
+ StrCmp $OUT1 '' 0 error
+
+ ${GetFileExt} 'C:\Program Files\Winamp\plugins\' $OUT1
+ StrCmp $OUT1 '' 0 error
+
+ goto +2
+ error:
+ SetErrors
+
+ ${StackVerificationEnd}
+SectionEnd
+
+
+Section BannerTrimPath
+ ${StackVerificationStart} BannerTrimPath
+
+ ${BannerTrimPath} 'C:\Server\Documents\Terminal\license.htm' '35A' $OUT1
+ StrCmp $OUT1 'C:\Server\...\Terminal\license.htm' 0 error
+
+ ${BannerTrimPath} 'C:\12\3456\789' '3A' $OUT1
+ StrCmp $OUT1 '' 0 error
+
+ ${BannerTrimPath} 'C:\12\3456\789' '4A' $OUT1
+ StrCmp $OUT1 'C...' 0 error
+
+ ${BannerTrimPath} 'C:\12\3456\789' '11A' $OUT1
+ StrCmp $OUT1 'C:\12\...' 0 error
+
+ ${BannerTrimPath} 'C:\12\3456\789' '13A' $OUT1
+ StrCmp $OUT1 'C:\12\...\789' 0 error
+
+ ${BannerTrimPath} 'C:\12\3456\789' '14A' $OUT1
+ StrCmp $OUT1 'C:\12\3456\789' 0 error
+
+ ${BannerTrimPath} 'C:\12\3456\789' '14A' $OUT1
+ StrCmp $OUT1 'C:\12\3456\789' 0 error
+
+ ${BannerTrimPath} 'C:\12\3456\789' '11B' $OUT1
+ StrCmp $OUT1 'C:\12\...' 0 error
+
+ ${BannerTrimPath} 'C:\12\3456\789' '5B' $OUT1
+ StrCmp $OUT1 'C:...' 0 error
+
+ ${BannerTrimPath} 'C:\12\3456\789' '5B' $OUT1
+ StrCmp $OUT1 'C:...' 0 error
+
+ ${BannerTrimPath} 'C:\12\3456\789' '11C' $OUT1
+ StrCmp $OUT1 'C:\12\34...' 0 error
+
+ goto +2
+ error:
+ SetErrors
+
+ ${StackVerificationEnd}
+SectionEnd
+
+
+Section DirState
+ ${StackVerificationStart} DirState
+
+ ${DirState} '$TEMP' $OUT1
+
+ ${StackVerificationEnd}
+SectionEnd
+
+
+Section RefreshShellIcons
+ ${StackVerificationStart} RefreshShellIcons
+
+ ${RefreshShellIcons}
+
+ ${StackVerificationEnd}
+SectionEnd
+
+
+Section WriteUninstaller
+ goto +2
+ WriteUninstaller '$EXEDIR\un.FileFuncTest.exe'
+SectionEnd
+
+
+
+;############### UNINSTALL ###############
+
+Section un.Uninstall
+ ${un.Locate} '$DOCUMENTS' '/L=FD /M=*.* /S=0B /G=0' 'un.LocateCallback'
+ ${un.GetSize} '$WINDIR' '/M=Explorer.exe /S=0K /G=0' $OUT1 $OUT2 $OUT3
+ ${un.DriveSpace} 'C:\' '/D=F /S=M' $OUT1
+ ${un.GetDrives} 'FDD+CDROM' 'un.GetDrivesCallback'
+ ${un.GetTime} '' 'L' $OUT1 $OUT2 $OUT3 $OUT4 $OUT5 $OUT6 $OUT7
+ ${un.GetFileAttributes} '$WINDIR\explorer.exe' 'ALL' $OUT1
+ ${un.GetFileVersion} '$WINDIR\explorer.exe' $OUT1
+ ${un.GetExeName} $OUT1
+ ${un.GetExePath} $OUT1
+ ${un.GetParameters} $OUT1
+ ${un.GetOptions} '/INSTDIR=C:\Program Files\Common Files /SILENT=yes' '/INSTDIR=' $OUT1
+ ${un.GetRoot} 'C:\Program Files\NSIS' $OUT1
+ ${un.GetParent} 'C:\Program Files\Winamp\uninstwa.exe' $OUT1
+ ${un.GetFileName} 'C:\Program Files\Winamp\uninstwa.exe' $OUT1
+ ${un.GetBaseName} 'C:\Program Files\Winamp\uninstwa.exe' $OUT1
+ ${un.GetFileExt} 'C:\Program Files\Winamp\uninstwa.exe' $OUT1
+ ${un.BannerTrimPath} 'C:\Server\Documents\Terminal\license.htm' '35A' $OUT1
+ ${un.DirState} '$TEMP' $OUT1
+ ${un.RefreshShellIcons}
+SectionEnd
+
+Function un.LocateCallback
+ Push $0
+FunctionEnd
+
+Function un.GetDrivesCallback
+ Push $0
+FunctionEnd
diff --git a/Examples/TextFunc.ini b/Examples/TextFunc.ini
new file mode 100644
index 00000000..5b9a7bc4
--- /dev/null
+++ b/Examples/TextFunc.ini
@@ -0,0 +1,130 @@
+[Settings]
+NumFields=15
+NextButtonText=&Enter
+
+[Field 1]
+Type=Droplist
+Flags=NOTIFY
+State=1. LineFind
+ListItems=1. LineFind|2. LineRead|3. FileReadFromEnd|4. LineSum|5. FileJoin|6. TextCompare|7. ConfigRead|8. ConfigWrite|9. FileRecode
+Left=44
+Right=139
+Top=9
+Bottom=100
+
+[Field 2]
+Type=FileRequest
+Left=44
+Right=-17
+Top=30
+Bottom=41
+
+[Field 3]
+Type=FileRequest
+Left=44
+Right=-17
+Top=46
+Bottom=57
+
+[Field 4]
+Type=FileRequest
+State=3:-1
+Left=44
+Right=-17
+Top=62
+Bottom=75
+
+[Field 5]
+Type=Droplist
+Flags=NOTIFY
+State=Example1 (delete first two symbols)
+ListItems=Example1 (delete first two symbols)|Example2 (show changed lines)|Example3 (delete lines)|Example4 (insert lines)|Example5 (replace in file - WordFunc.nsh required)|Example6 (line string to cut or delete)|Example7 (read lines)
+Left=44
+Right=-36
+Top=81
+Bottom=155
+
+[Field 6]
+Type=Droplist
+Flags=NOTIFY
+State=Example1 (Different or Equal)
+ListItems=Example1 (Different or Equal)|Example2 (Compare line-by-line - Different)|Example3 (Compare line-by-line - Equal)|Example4 (Compare all lines - Different)|Example5 (Compare all lines - Equal)
+Left=44
+Right=-36
+Top=81
+Bottom=140
+
+[Field 7]
+Type=Droplist
+State=FileReadFromEndCallback
+ListItems=FileReadFromEndCallback
+Left=44
+Right=-36
+Top=81
+Bottom=92
+
+[Field 8]
+Type=Text
+Flags=READONLY
+Left=9
+Right=-36
+Top=108
+Bottom=120
+
+[Field 9]
+Type=Button
+Text=Edit
+Flags=NOTIFY
+Left=234
+Right=256
+Top=81
+Bottom=92
+
+[Field 10]
+Type=Button
+Text=Log
+Flags=NOTIFY|DISABLED
+Left=234
+Right=256
+Top=108
+Bottom=120
+
+[Field 11]
+Type=Label
+Text=InputFile
+Left=10
+Right=43
+Top=32
+Bottom=44
+
+[Field 12]
+Type=Label
+Text=OutputFile
+Left=10
+Right=43
+Top=48
+Bottom=60
+
+[Field 13]
+Type=Label
+Text=Range
+Left=10
+Right=44
+Top=65
+Bottom=75
+
+[Field 14]
+Type=Label
+Text=Function
+Left=10
+Right=43
+Top=81
+Bottom=92
+
+[Field 15]
+Type=Label
+Text=Result:
+Left=10
+Right=229
+Top=97
+Bottom=105
diff --git a/Examples/TextFunc.nsi b/Examples/TextFunc.nsi
new file mode 100644
index 00000000..bf2cbfd7
--- /dev/null
+++ b/Examples/TextFunc.nsi
@@ -0,0 +1,833 @@
+;_____________________________________________________________________________
+;
+; Text Functions
+;_____________________________________________________________________________
+;
+; 2005 Shengalts Aleksander aka Instructor (Shengalts@mail.ru)
+
+Name "Text Functions"
+OutFile "TextFunc.exe"
+Caption "$(^Name)"
+XPStyle on
+
+!include "WinMessages.nsh"
+!include "TextFunc.nsh"
+
+!insertmacro LineFind
+!insertmacro LineRead
+!insertmacro FileReadFromEnd
+!insertmacro LineSum
+!insertmacro FileJoin
+!insertmacro ConfigRead
+!insertmacro ConfigWrite
+!insertmacro FileRecode
+
+Var HWND
+Var INI
+Var LOG
+Var PROJECT
+Var CALLBACK
+Var VIEW
+Var FUNCTION
+Var LINEFIND1
+Var LINEFIND2
+Var LINEFIND3
+Var LINEREAD1
+Var LINEREAD2
+Var FILEREADFROMEND1
+Var LINESUM1
+Var FILEJOIN1
+Var FILEJOIN2
+Var FILEJOIN3
+Var TEXTCOMPARE1
+Var TEXTCOMPARE2
+Var TEXTCOMPARE3
+Var CONFIGREAD1
+Var CONFIGREAD2
+Var CONFIGWRITE1
+Var CONFIGWRITE2
+Var CONFIGWRITE3
+Var FILERECODE1
+Var FILERECODE2
+
+Page Custom ShowCustom LeaveCustom
+
+Function ShowCustom
+ InstallOptions::initDialog /NOUNLOAD "$INI"
+ Pop $hwnd
+ GetDlgItem $0 $HWND 1206
+ ShowWindow $0 0
+ GetDlgItem $0 $HWND 1208
+ ShowWindow $0 0
+ GetDlgItem $0 $HWND 1209
+ ShowWindow $0 0
+ StrCpy $FUNCTION LineFind
+ StrCpy $LINEREAD2 10
+ StrCpy $TEXTCOMPARE3 FastDiff
+ StrCpy $CONFIGREAD1 "$WINDIR\system.ini"
+ StrCpy $CONFIGREAD2 "shell="
+ StrCpy $FILERECODE2 CharToOem
+ InstallOptions::show
+ Pop $0
+FunctionEnd
+
+Function LeaveCustom
+ ReadINIStr $0 $INI "Settings" "State"
+ ReadINIStr $R0 $INI "Field 1" "State"
+ ReadINIStr $R1 $INI "Field 2" "State"
+ ReadINIStr $R2 $INI "Field 3" "State"
+ ReadINIStr $R3 $INI "Field 4" "State"
+ ReadINIStr $R4 $INI "Field 5" "State"
+ ReadINIStr $R5 $INI "Field 6" "State"
+ StrCpy $R4 $R4 8
+ StrCpy $R5 $R5 8
+ StrCpy $6 0
+ StrCpy $7 '$${'
+ StrCpy $8 'r'
+ StrCpy $9 'n'
+
+ StrCmp $0 10 Log
+ StrCmp $0 9 ViewOrEdit
+ StrCmp $0 0 Enter
+ goto MainSend
+
+ Log:
+ Exec 'notepad.exe $LOG'
+ Abort
+
+ ViewOrEdit:
+ StrCmp $FUNCTION FileReadFromEnd 0 Edit
+ StrCmp $VIEW '' 0 ViewFileReadFromEndCallback
+ GetTempFileName $VIEW $PLUGINSDIR
+ StrCpy $7 '$$'
+ FileOpen $0 $VIEW w
+ FileWrite $0 `Function FileReadFromEndCallback$\r$\n`
+ FileWrite $0 ` MessageBox MB_OKCANCEL '$7$$9 "Line"=[$$9]$7\$9$7$$8 "#"=[$$8]$7\$9$7$$7 "-#"=[$$7]' IDOK +2$\r$\n`
+ FileWrite $0 ` StrCpy $$R0 StopFileReadFromEnd$\r$\n$\r$\n`
+ FileWrite $0 ` Push $$R0$\r$\n`
+ FileWrite $0 `FunctionEnd$\r$\n`
+ FileClose $0
+ StrCpy $7 '$${'
+ SetFileAttributes $VIEW READONLY
+ ViewFileReadFromEndCallback:
+ Exec 'notepad.exe $VIEW'
+ Abort
+
+ Edit:
+ StrCmp $CALLBACK '' +5
+ StrCmp $6$R6 '0$R0$R4$R5' showproject
+ StrCmp $R6 '$R0$R4$R5' +3
+ Delete $CALLBACK
+ StrCpy $CALLBACK ''
+ StrCpy $R6 '$R0$R4$R5'
+
+ #Project#
+ StrCmp $6$R0 "01. LineFind" 0 +5
+ IfFileExists $CALLBACK +2
+ GetTempFileName $CALLBACK $PLUGINSDIR
+ FileOpen $0 $CALLBACK w
+ goto function
+ IfFileExists $PROJECT +2
+ GetTempFileName $PROJECT $PLUGINSDIR
+ FileOpen $0 $PROJECT w
+
+ #Name#
+ FileWrite $0 'Name "$FUNCTION"$\r$\n'
+ FileWrite $0 'OutFile "$PROJECT.exe"$\r$\n$\r$\n'
+
+ #!include#
+ StrCmp $R0$R4 '1. LineFindExample5' 0 TextFuncInclude
+ IfFileExists '$EXEDIR\WordFunc.nsh' 0 +3
+ FileWrite $0 '!include "$EXEDIR\WordFunc.nsh"$\r$\n'
+ goto +2
+ FileWrite $0 '!include "WordFunc.nsh"$\r$\n'
+ FileWrite $0 '!insertmacro WordFind$\r$\n'
+ FileWrite $0 '!insertmacro WordFind2X$\r$\n'
+ FileWrite $0 '!insertmacro WordFind3X$\r$\n'
+ FileWrite $0 '!insertmacro WordReplace$\r$\n'
+ FileWrite $0 '!insertmacro WordAdd$\r$\n'
+ FileWrite $0 '!insertmacro WordInsert$\r$\n'
+ FileWrite $0 '!insertmacro StrFilter$\r$\n'
+ TextFuncInclude:
+ IfFileExists '$EXEDIR\TextFunc.nsh' 0 +3
+ FileWrite $0 '!include "$EXEDIR\TextFunc.nsh"$\r$\n'
+ goto +2
+ FileWrite $0 '!include "TextFunc.nsh"$\r$\n'
+ FileWrite $0 '!insertmacro $FUNCTION$\r$\n'
+ StrCmp $FUNCTION TextCompare +2
+ FileWrite $0 '!insertmacro TrimNewLines$\r$\n'
+
+ #Section#
+ FileWrite $0 '$\r$\nSection -empty$\r$\n'
+ FileWrite $0 'SectionEnd$\r$\n$\r$\n'
+
+ #Function .onInit#
+ FileWrite $0 'Function .onInit$\r$\n'
+ StrCmp $R0$R5 "6. TextCompareExample1" 0 TextCompareExample235
+ FileWrite $0 ' StrCpy $$R0 ""$\r$\n'
+ FileWrite $0 ' $7TextCompare} "$R1" "$R2" "$R3" "$R5"$\r$\n'
+ FileWrite $0 ' IfErrors error$\r$\n'
+ FileWrite $0 ' StrCmp $$R0 NotEqual 0 +2$\r$\n'
+ FileWrite $0 ' MessageBox MB_OK " Files differ" IDOK +2$\r$\n'
+ FileWrite $0 ' MessageBox MB_OK " Files identical"$\r$\n'
+ FileWrite $0 ' goto end$\r$\n$\r$\n'
+ goto endoninit
+ TextCompareExample235:
+ StrCmp $R0$R5 "6. TextCompareExample2" +3
+ StrCmp $R0$R5 "6. TextCompareExample3" +2
+ StrCmp $R0$R5 "6. TextCompareExample5" 0 TextCompareExample4
+ FileWrite $0 ' StrCpy $$R0 "$R1"$\r$\n'
+ FileWrite $0 ' StrCpy $$R1 "$R2"$\r$\n$\r$\n'
+ FileWrite $0 ' GetTempFileName $$R2$\r$\n'
+ FileWrite $0 ' FileOpen $$R3 $$R2 w$\r$\n'
+ FileWrite $0 ' FileWrite $$R3 "$$R0 | $$R1$$\$8$$\$9"$\r$\n'
+ FileWrite $0 ' $7TextCompare} "$$R0" "$$R1" "$R3" "$R5"$\r$\n'
+ FileWrite $0 ' IfErrors error$\r$\n'
+ FileWrite $0 ' Exec "notepad.exe $$R2"$\r$\n'
+ FileWrite $0 ' goto end$\r$\n$\r$\n'
+ goto endoninit
+ TextCompareExample4:
+ StrCmp $R0$R5 "6. TextCompareExample4" 0 LineFindExample123456
+ FileWrite $0 ' StrCpy $$R0 "$R1"$\r$\n'
+ FileWrite $0 ' StrCpy $$R1 "$R2"$\r$\n$\r$\n'
+ FileWrite $0 ' GetTempFileName $$R2$\r$\n'
+ FileWrite $0 ' FileOpen $$R3 $$R2 w$\r$\n'
+ FileWrite $0 ' FileWrite $$R3 "$$R0 | $$R1$$\$8$$\$9"$\r$\n'
+ FileWrite $0 ' $7TextCompare} "$$R0" "$$R1" "$R3" "$R5"$\r$\n'
+ FileWrite $0 ' IfErrors error$\r$\n'
+ FileWrite $0 ' FileWrite $$R3 "$$\$8$$\$9$$R1 | $$R0$$\$8$$\$9"$\r$\n'
+ FileWrite $0 ' $7TextCompare} "$$R1" "$$R0" "$R3" "$R5"$\r$\n'
+ FileWrite $0 ' FileClose $$R3$\r$\n'
+ FileWrite $0 ' IfErrors error$\r$\n'
+ FileWrite $0 ' Exec "notepad.exe $$R2"$\r$\n$\r$\n'
+ FileWrite $0 ' goto end$\r$\n$\r$\n'
+ goto endoninit
+ LineFindExample123456:
+ FileWrite $0 ' $7$FUNCTION} "$R1" "$R2" "$R3" "$R4"$\r$\n'
+ FileWrite $0 ' IfErrors error$\r$\n'
+ FileWrite $0 ' MessageBox MB_YESNO " Open output file?" IDNO end$\r$\n'
+ FileWrite $0 ' StrCmp "$R2" "" 0 +3$\r$\n'
+ FileWrite $0 ` Exec 'notepad.exe "$R1"'$\r$\n`
+ FileWrite $0 ' goto end$\r$\n'
+ FileWrite $0 ' SearchPath $$R2 "$R2"$\r$\n'
+ FileWrite $0 ` Exec 'notepad.exe "$$R2"'$\r$\n`
+ FileWrite $0 ' goto end$\r$\n$\r$\n'
+ endoninit:
+ FileWrite $0 ' error:$\r$\n'
+ FileWrite $0 ' MessageBox MB_OK "Error"$\r$\n$\r$\n'
+ FileWrite $0 ' end:$\r$\n'
+ FileWrite $0 ' Quit$\r$\n'
+ FileWrite $0 'FunctionEnd$\r$\n$\r$\n'
+ #FunctionEnd#
+
+
+ #Function CallBack#
+ StrCmp $CALLBACK '' 0 close
+ function:
+ StrCmp $R0 '1. LineFind' 0 +8
+ FileWrite $0 'Function $R4$\r$\n'
+ StrCmp $R4 "Example1" Example1LF
+ StrCmp $R4 "Example2" Example2LF
+ StrCmp $R4 "Example3" Example3LF
+ StrCmp $R4 "Example4" Example4LF
+ StrCmp $R4 "Example5" Example5LF
+ StrCmp $R4 "Example6" Example6LF
+
+ FileWrite $0 'Function $R5$\r$\n'
+ StrCmp $R5 "Example1" Example1TC
+ StrCmp $R5 "Example2" Example2TC
+ StrCmp $R5 "Example3" Example3TC
+ StrCmp $R5 "Example4" Example4TC
+ StrCmp $R5 "Example5" Example3TC
+
+ Example1LF:
+ FileWrite $0 " $7TrimNewLines} '$$R9' $$R9$\r$\n"
+ FileWrite $0 " StrCpy $$R9 $$R9 '' 2 ;delete first two symbols$\r$\n"
+ FileWrite $0 " StrCpy $$R9 '$$R9$$\$8$$\$9'$\r$\n$\r$\n"
+ goto endwrite
+ Example2LF:
+ FileWrite $0 " $7TrimNewLines} '$$R9' $$R9$\r$\n"
+ FileWrite $0 " StrCpy $$R9 '$$R9 ~Changed line ($$R8)~$$\$8$$\$9'$\r$\n$\r$\n"
+ goto endwrite
+ Example3LF:
+ FileWrite $0 " StrCpy $$0 SkipWrite$\r$\n$\r$\n"
+ goto endwrite
+ Example4LF:
+ FileWrite $0 " FileWrite $$R4 '---First Line---$$\$8$$\$9'$\r$\n"
+ FileWrite $0 " FileWrite $$R4 '---Second Line ...---$$\$8$$\$9'$\r$\n$\r$\n"
+ goto endwrite
+ Example5LF:
+ FileWrite $0 " ; Use any of WordFunctions:$\r$\n"
+ FileWrite $0 " ; $7WordFind}|$7WordFind2X}|$7WordFind3X}|$\r$\n"
+ FileWrite $0 " ; $7WordReplace}|$7WordAdd}|$7WordInsert}|$7StrFilter}$\r$\n$\r$\n"
+ FileWrite $0 " $7WordReplace} '$$R9' ' ' '_' '+*' $$R9$\r$\n$\r$\n"
+ goto endwrite
+ Example6LF:
+ FileWrite $0 ' ;(Cut lines from a line to another line (also including that line))$\r$\n'
+ FileWrite $0 ' StrCmp $$R0 finish stop$\r$\n'
+ FileWrite $0 ' StrCmp $$R0 start finish$\r$\n'
+ FileWrite $0 ' StrCmp $$R9 "Start Line$$\$8$$\$9" 0 skip$\r$\n'
+ FileWrite $0 ' StrCpy $$R0 start$\r$\n'
+ FileWrite $0 ' StrCpy $$R1 $$R9$\r$\n'
+ FileWrite $0 ' goto code$\r$\n'
+ FileWrite $0 ' finish:$\r$\n'
+ FileWrite $0 ' StrCmp $$R9 "Finish Line$$\$8$$\$9" 0 code$\r$\n'
+ FileWrite $0 ' StrCpy $$R0 finish$\r$\n'
+ FileWrite $0 ' StrCpy $$R2 $$R8$\r$\n'
+ FileWrite $0 ' goto code$\r$\n'
+ FileWrite $0 ' skip:$\r$\n'
+ FileWrite $0 ' StrCpy $$0 SkipWrite$\r$\n'
+ FileWrite $0 ' goto output$\r$\n'
+ FileWrite $0 ' stop:$\r$\n'
+ FileWrite $0 ' StrCpy $$0 StopLineFind$\r$\n'
+ FileWrite $0 ' goto output$\r$\n$\r$\n'
+ FileWrite $0 ' ;;(Delete lines from a line to another line (also including that line))$\r$\n'
+ FileWrite $0 ' ; StrCmp $$R0 finish code$\r$\n'
+ FileWrite $0 ' ; StrCmp $$R0 start finish$\r$\n'
+ FileWrite $0 ' ; StrCmp $$R9 "Start Line$$\$8$$\$9" 0 code$\r$\n'
+ FileWrite $0 ' ; StrCpy $$R0 start$\r$\n'
+ FileWrite $0 ' ; StrCpy $$R1 $$R8$\r$\n'
+ FileWrite $0 ' ; goto skip$\r$\n'
+ FileWrite $0 ' ; finish:$\r$\n'
+ FileWrite $0 ' ; StrCmp $$R9 "Finish Line$$\$8$$\$9" 0 skip$\r$\n'
+ FileWrite $0 ' ; StrCpy $$R0 finish$\r$\n'
+ FileWrite $0 ' ; StrCpy $$R2 $$R8$\r$\n'
+ FileWrite $0 ' ; skip:$\r$\n'
+ FileWrite $0 ' ; StrCpy $$0 SkipWrite$\r$\n'
+ FileWrite $0 ' ; goto output$\r$\n$\r$\n'
+ FileWrite $0 ' code:$\r$\n'
+ FileWrite $0 ' ;...$\r$\n$\r$\n'
+ FileWrite $0 ' output:$\r$\n'
+ goto endwrite
+ Example1TC:
+ FileWrite $0 " StrCpy $$R0 NotEqual$\r$\n"
+ FileWrite $0 " StrCpy $$0 StopTextCompare$\r$\n$\r$\n"
+ goto endwrite
+ Example2TC:
+ FileWrite $0 " FileWrite $$R3 '$$8=$$9'$\r$\n"
+ FileWrite $0 " FileWrite $$R3 '$$6=$$7$$\$8$$\$9'$\r$\n$\r$\n"
+ goto endwrite
+ Example3TC:
+ FileWrite $0 " FileWrite $$R3 '$$8|$$6=$$9'$\r$\n$\r$\n"
+ goto endwrite
+ Example4TC:
+ FileWrite $0 " FileWrite $$R3 '$$8=$$9'$\r$\n$\r$\n"
+ goto endwrite
+ endwrite:
+ FileWrite $0 ' Push $$0$\r$\n'
+ FileWrite $0 'FunctionEnd$\r$\n'
+ close:
+ FileClose $0
+ goto $6
+ #FunctionEnd#
+
+ showproject:
+ StrCmp $R0 '1. LineFind' 0 +3
+ ExecWait 'notepad.exe $CALLBACK'
+ goto +4
+ SetFileAttributes $PROJECT READONLY
+ ExecWait 'notepad.exe $PROJECT'
+ SetFileAttributes $PROJECT NORMAL
+ Abort
+
+ MainSend:
+ GetDlgItem $0 $HWND 1210
+ SendMessage $0 ${WM_SETTEXT} 1 "STR:"
+ GetDlgItem $0 $HWND 1203
+ ShowWindow $0 1
+ EnableWindow $0 1
+ GetDlgItem $0 $HWND 1204
+ ShowWindow $0 1
+ EnableWindow $0 1
+ GetDlgItem $0 $HWND 1205
+ EnableWindow $0 1
+ GetDlgItem $0 $HWND 1206
+ ShowWindow $0 0
+ GetDlgItem $0 $HWND 1207
+ ShowWindow $0 0
+ GetDlgItem $0 $HWND 1208
+ ShowWindow $0 0
+ GetDlgItem $0 $HWND 1209
+ ShowWindow $0 0
+ GetDlgItem $0 $HWND 1211
+ EnableWindow $0 1
+
+ StrCmp $FUNCTION LineFind 0 +5
+ StrCpy $LINEFIND1 $R1
+ StrCpy $LINEFIND2 $R2
+ StrCpy $LINEFIND3 $R3
+ goto LineFindSend
+ StrCmp $FUNCTION LineRead 0 +4
+ StrCpy $LINEREAD1 $R1
+ StrCpy $LINEREAD2 $R2
+ goto LineFindSend
+ StrCmp $FUNCTION FileReadFromEnd 0 +3
+ StrCpy $FILEREADFROMEND1 $R1
+ goto LineFindSend
+ StrCmp $FUNCTION LineSum 0 +3
+ StrCpy $LINESUM1 $R1
+ goto LineFindSend
+ StrCmp $FUNCTION FileJoin 0 +5
+ StrCpy $FILEJOIN1 $R1
+ StrCpy $FILEJOIN2 $R2
+ StrCpy $FILEJOIN3 $R3
+ goto LineFindSend
+ StrCmp $FUNCTION TextCompare 0 +5
+ StrCpy $TEXTCOMPARE1 $R1
+ StrCpy $TEXTCOMPARE2 $R2
+ StrCpy $TEXTCOMPARE3 $R3
+ goto LineFindSend
+ StrCmp $FUNCTION ConfigRead 0 +4
+ StrCpy $CONFIGREAD1 $R1
+ StrCpy $CONFIGREAD2 $R2
+ goto LineFindSend
+ StrCmp $FUNCTION ConfigWrite 0 +5
+ StrCpy $CONFIGWRITE1 $R1
+ StrCpy $CONFIGWRITE2 $R2
+ StrCpy $CONFIGWRITE3 $R3
+ goto LineFindSend
+ StrCmp $FUNCTION FileRecode 0 +3
+ StrCpy $FILERECODE1 $R1
+ StrCpy $FILERECODE2 $R2
+
+ LineFindSend:
+ StrCmp $R0 "1. LineFind" 0 LineReadSend
+ StrCmp $FUNCTION LineFind 0 LineFindSend2
+ StrCmp $R4 "Example1" 0 +3
+ StrCpy $LINEFIND3 "3:-1"
+ goto LineFindSend2
+ StrCmp $R4 "Example2" 0 +3
+ StrCpy $LINEFIND3 "{5:12 15 -6:-5 -1}"
+ goto LineFindSend2
+ StrCmp $R4 "Example3" 0 +3
+ StrCpy $LINEFIND3 "2:3 10:-5 -3:-2"
+ goto LineFindSend2
+ StrCmp $R4 "Example4" 0 +3
+ StrCpy $LINEFIND3 "10"
+ goto LineFindSend2
+ StrCmp $R4 "Example5" 0 +3
+ StrCpy $LINEFIND3 "1:-1"
+ goto LineFindSend2
+ StrCmp $R4 "Example6" 0 +3
+ StrCpy $LINEFIND3 ""
+ goto LineFindSend2
+ StrCmp $R4 "Example7" 0 +2
+ StrCpy $LINEFIND3 "1:-1"
+
+ LineFindSend2:
+ StrCpy $FUNCTION LineFind
+ StrCmp $LINEFIND2 '/NUL' 0 +2
+ StrCpy $LINEFIND2 ''
+ GetDlgItem $0 $HWND 1201
+ SendMessage $0 ${WM_SETTEXT} 1 "STR:$LINEFIND1"
+ GetDlgItem $0 $HWND 1203
+ SendMessage $0 ${WM_SETTEXT} 1 "STR:$LINEFIND2"
+ GetDlgItem $0 $HWND 1205
+ ShowWindow $0 1
+ SendMessage $0 ${WM_SETTEXT} 1 "STR:$LINEFIND3"
+ GetDlgItem $0 $HWND 1207
+ ShowWindow $0 1
+ GetDlgItem $0 $HWND 1211
+ ShowWindow $0 1
+ SendMessage $0 ${WM_SETTEXT} 1 "STR:Edit"
+ GetDlgItem $0 $HWND 1212
+ ShowWindow $0 1
+ StrCmp $LOG '' +2
+ EnableWindow $0 1
+ GetDlgItem $0 $HWND 1213
+ SendMessage $0 ${WM_SETTEXT} 1 "STR:InputFile"
+ GetDlgItem $0 $HWND 1214
+ SendMessage $0 ${WM_SETTEXT} 1 "STR:OutputFile"
+ GetDlgItem $0 $HWND 1215
+ SendMessage $0 ${WM_SETTEXT} 1 "STR:Range"
+ GetDlgItem $0 $HWND 1216
+ SendMessage $0 ${WM_SETTEXT} 1 "STR:Function"
+
+ StrCmp $R4 "Example7" 0 +9
+ GetDlgItem $0 $HWND 1203
+ EnableWindow $0 0
+ SendMessage $0 ${WM_ENABLE} 1 0
+ SendMessage $0 ${WM_SETTEXT} 1 "STR:/NUL"
+ GetDlgItem $0 $HWND 1204
+ EnableWindow $0 0
+ GetDlgItem $0 $HWND 1211
+ EnableWindow $0 0
+ abort
+
+
+ LineReadSend:
+ StrCmp $R0 "2. LineRead" 0 FileReadFromEndSend
+ StrCpy $FUNCTION LineRead
+ GetDlgItem $0 $HWND 1201
+ SendMessage $0 ${WM_SETTEXT} 1 "STR:$LINEREAD1"
+ GetDlgItem $0 $HWND 1203
+ ShowWindow $0 1
+ SendMessage $0 ${WM_SETTEXT} 1 "STR:$LINEREAD2"
+ GetDlgItem $0 $HWND 1204
+ ShowWindow $0 0
+ GetDlgItem $0 $HWND 1205
+ ShowWindow $0 0
+ GetDlgItem $0 $HWND 1211
+ ShowWindow $0 0
+ GetDlgItem $0 $HWND 1212
+ ShowWindow $0 0
+ GetDlgItem $0 $HWND 1213
+ SendMessage $0 ${WM_SETTEXT} 1 "STR:InputFile"
+ GetDlgItem $0 $HWND 1214
+ SendMessage $0 ${WM_SETTEXT} 1 "STR:Line #"
+ GetDlgItem $0 $HWND 1215
+ SendMessage $0 ${WM_SETTEXT} 1 "STR:"
+ GetDlgItem $0 $HWND 1216
+ SendMessage $0 ${WM_SETTEXT} 1 "STR:"
+ Abort
+
+ FileReadFromEndSend:
+ StrCmp $R0 "3. FileReadFromEnd" 0 LineSumSend
+ StrCpy $FUNCTION FileReadFromEnd
+ GetDlgItem $0 $HWND 1201
+ SendMessage $0 ${WM_SETTEXT} 1 "STR:$FILEREADFROMEND1"
+ GetDlgItem $0 $HWND 1203
+ ShowWindow $0 0
+ GetDlgItem $0 $HWND 1204
+ ShowWindow $0 0
+ GetDlgItem $0 $HWND 1205
+ ShowWindow $0 0
+ GetDlgItem $0 $HWND 1209
+ ShowWindow $0 1
+ GetDlgItem $0 $HWND 1211
+ ShowWindow $0 1
+ SendMessage $0 ${WM_SETTEXT} 1 "STR:View"
+ GetDlgItem $0 $HWND 1212
+ ShowWindow $0 0
+ GetDlgItem $0 $HWND 1213
+ SendMessage $0 ${WM_SETTEXT} 1 "STR:InputFile"
+ GetDlgItem $0 $HWND 1214
+ SendMessage $0 ${WM_SETTEXT} 1 "STR:"
+ GetDlgItem $0 $HWND 1215
+ SendMessage $0 ${WM_SETTEXT} 1 "STR:"
+ GetDlgItem $0 $HWND 1216
+ SendMessage $0 ${WM_SETTEXT} 1 "STR:Function"
+ Abort
+
+ LineSumSend:
+ StrCmp $R0 "4. LineSum" 0 FileJoinSend
+ StrCpy $FUNCTION LineSum
+ GetDlgItem $0 $HWND 1201
+ SendMessage $0 ${WM_SETTEXT} 1 "STR:$LINESUM1"
+ GetDlgItem $0 $HWND 1203
+ ShowWindow $0 0
+ GetDlgItem $0 $HWND 1204
+ ShowWindow $0 0
+ GetDlgItem $0 $HWND 1205
+ ShowWindow $0 0
+ GetDlgItem $0 $HWND 1211
+ ShowWindow $0 0
+ GetDlgItem $0 $HWND 1212
+ ShowWindow $0 0
+ GetDlgItem $0 $HWND 1213
+ SendMessage $0 ${WM_SETTEXT} 1 "STR:InputFile"
+ GetDlgItem $0 $HWND 1214
+ SendMessage $0 ${WM_SETTEXT} 1 "STR:"
+ GetDlgItem $0 $HWND 1215
+ SendMessage $0 ${WM_SETTEXT} 1 "STR:"
+ GetDlgItem $0 $HWND 1216
+ SendMessage $0 ${WM_SETTEXT} 1 "STR:"
+ Abort
+
+ FileJoinSend:
+ StrCmp $R0 "5. FileJoin" 0 TextCompareSend
+ StrCpy $FUNCTION FileJoin
+ GetDlgItem $0 $HWND 1201
+ SendMessage $0 ${WM_SETTEXT} 1 "STR:$FILEJOIN1"
+ GetDlgItem $0 $HWND 1203
+ ShowWindow $0 1
+ SendMessage $0 ${WM_SETTEXT} 1 "STR:$FILEJOIN2"
+ GetDlgItem $0 $HWND 1204
+ ShowWindow $0 1
+ GetDlgItem $0 $HWND 1205
+ ShowWindow $0 1
+ EnableWindow $0 1
+ SendMessage $0 ${WM_SETTEXT} 1 "STR:$FILEJOIN3"
+ GetDlgItem $0 $HWND 1206
+ ShowWindow $0 1
+ GetDlgItem $0 $HWND 1211
+ ShowWindow $0 0
+ GetDlgItem $0 $HWND 1212
+ ShowWindow $0 0
+ GetDlgItem $0 $HWND 1213
+ SendMessage $0 ${WM_SETTEXT} 1 "STR:InputFile1"
+ GetDlgItem $0 $HWND 1214
+ SendMessage $0 ${WM_SETTEXT} 1 "STR:InputFile2"
+ GetDlgItem $0 $HWND 1215
+ SendMessage $0 ${WM_SETTEXT} 1 "STR:OutputFile"
+ GetDlgItem $0 $HWND 1216
+ SendMessage $0 ${WM_SETTEXT} 1 "STR:"
+ Abort
+
+ TextCompareSend:
+ StrCmp $R0 "6. TextCompare" 0 ConfigReadSend
+ StrCmp $FUNCTION TextCompare 0 TextCompareSend2
+ StrCmp $R5 "Example1" 0 +3
+ StrCpy $TEXTCOMPARE3 "FastDiff"
+ goto TextCompareSend2
+ StrCmp $R5 "Example2" 0 +3
+ StrCpy $TEXTCOMPARE3 "FastDiff"
+ goto TextCompareSend2
+ StrCmp $R5 "Example3" 0 +3
+ StrCpy $TEXTCOMPARE3 "FastEqual"
+ goto TextCompareSend2
+ StrCmp $R5 "Example4" 0 +3
+ StrCpy $TEXTCOMPARE3 "SlowDiff"
+ goto TextCompareSend2
+ StrCmp $R5 "Example5" 0 +2
+ StrCpy $TEXTCOMPARE3 "SlowEqual"
+
+ TextCompareSend2:
+ StrCpy $FUNCTION TextCompare
+ GetDlgItem $0 $HWND 1201
+ SendMessage $0 ${WM_SETTEXT} 1 "STR:$TEXTCOMPARE1"
+ GetDlgItem $0 $HWND 1203
+ SendMessage $0 ${WM_SETTEXT} 1 "STR:$TEXTCOMPARE2"
+ GetDlgItem $0 $HWND 1204
+ ShowWindow $0 1
+ GetDlgItem $0 $HWND 1205
+ ShowWindow $0 1
+ EnableWindow $0 0
+ SendMessage $0 ${WM_ENABLE} 1 0
+ SendMessage $0 ${WM_SETTEXT} 1 "STR:$TEXTCOMPARE3"
+ GetDlgItem $0 $HWND 1208
+ ShowWindow $0 1
+ GetDlgItem $0 $HWND 1211
+ ShowWindow $0 1
+ SendMessage $0 ${WM_SETTEXT} 1 "STR:View"
+ GetDlgItem $0 $HWND 1212
+ ShowWindow $0 1
+ GetDlgItem $0 $HWND 1213
+ SendMessage $0 ${WM_SETTEXT} 1 "STR:TextFile1"
+ GetDlgItem $0 $HWND 1214
+ SendMessage $0 ${WM_SETTEXT} 1 "STR:TextFile2"
+ GetDlgItem $0 $HWND 1215
+ SendMessage $0 ${WM_SETTEXT} 1 "STR:Option"
+ GetDlgItem $0 $HWND 1216
+ SendMessage $0 ${WM_SETTEXT} 1 "STR:Function"
+ abort
+
+ ConfigReadSend:
+ StrCmp $R0 "7. ConfigRead" 0 ConfigWriteSend
+ StrCpy $FUNCTION ConfigRead
+ GetDlgItem $0 $HWND 1201
+ SendMessage $0 ${WM_SETTEXT} 1 "STR:$CONFIGREAD1"
+ GetDlgItem $0 $HWND 1203
+ ShowWindow $0 1
+ SendMessage $0 ${WM_SETTEXT} 1 "STR:$CONFIGREAD2"
+ GetDlgItem $0 $HWND 1204
+ ShowWindow $0 0
+ GetDlgItem $0 $HWND 1205
+ ShowWindow $0 0
+ GetDlgItem $0 $HWND 1211
+ ShowWindow $0 0
+ GetDlgItem $0 $HWND 1212
+ ShowWindow $0 0
+ GetDlgItem $0 $HWND 1213
+ SendMessage $0 ${WM_SETTEXT} 1 "STR:InputFile"
+ GetDlgItem $0 $HWND 1214
+ SendMessage $0 ${WM_SETTEXT} 1 "STR:Entry"
+ GetDlgItem $0 $HWND 1215
+ SendMessage $0 ${WM_SETTEXT} 1 "STR:"
+ GetDlgItem $0 $HWND 1216
+ SendMessage $0 ${WM_SETTEXT} 1 "STR:"
+ Abort
+
+ ConfigWriteSend:
+ StrCmp $R0 "8. ConfigWrite" 0 FileRecodeSend
+ StrCpy $FUNCTION ConfigWrite
+ GetDlgItem $0 $HWND 1201
+ SendMessage $0 ${WM_SETTEXT} 1 "STR:$CONFIGWRITE1"
+ GetDlgItem $0 $HWND 1203
+ ShowWindow $0 1
+ SendMessage $0 ${WM_SETTEXT} 1 "STR:$CONFIGWRITE2"
+ GetDlgItem $0 $HWND 1204
+ ShowWindow $0 0
+ GetDlgItem $0 $HWND 1205
+ ShowWindow $0 1
+ SendMessage $0 ${WM_SETTEXT} 1 "STR:$CONFIGWRITE3"
+ GetDlgItem $0 $HWND 1211
+ ShowWindow $0 0
+ GetDlgItem $0 $HWND 1212
+ ShowWindow $0 0
+ GetDlgItem $0 $HWND 1213
+ SendMessage $0 ${WM_SETTEXT} 1 "STR:InputFile"
+ GetDlgItem $0 $HWND 1214
+ SendMessage $0 ${WM_SETTEXT} 1 "STR:Entry"
+ GetDlgItem $0 $HWND 1215
+ SendMessage $0 ${WM_SETTEXT} 1 "STR:Value"
+ GetDlgItem $0 $HWND 1216
+ SendMessage $0 ${WM_SETTEXT} 1 "STR:"
+ Abort
+
+ FileRecodeSend:
+ StrCmp $R0 "9. FileRecode" 0 Abort
+ StrCpy $FUNCTION FileRecode
+ GetDlgItem $0 $HWND 1201
+ SendMessage $0 ${WM_SETTEXT} 1 "STR:$FILERECODE1"
+ GetDlgItem $0 $HWND 1203
+ ShowWindow $0 1
+ SendMessage $0 ${WM_SETTEXT} 1 "STR:$FILERECODE2"
+ GetDlgItem $0 $HWND 1204
+ ShowWindow $0 0
+ GetDlgItem $0 $HWND 1205
+ ShowWindow $0 0
+ GetDlgItem $0 $HWND 1211
+ ShowWindow $0 0
+ GetDlgItem $0 $HWND 1212
+ ShowWindow $0 0
+ GetDlgItem $0 $HWND 1213
+ SendMessage $0 ${WM_SETTEXT} 1 "STR:InputFile"
+ GetDlgItem $0 $HWND 1214
+ SendMessage $0 ${WM_SETTEXT} 1 "STR:Format"
+ GetDlgItem $0 $HWND 1215
+ SendMessage $0 ${WM_SETTEXT} 1 "STR:"
+ GetDlgItem $0 $HWND 1216
+ SendMessage $0 ${WM_SETTEXT} 1 "STR:"
+ Abort
+
+;=Enter=
+ Enter:
+ StrCmp $R1 '' 0 +3
+ StrCpy $0 'Choose InputFile'
+ goto send
+ IfFileExists $R1 +3
+ StrCpy $0 'InputFile is not exist'
+ goto send
+
+ StrCmp $R0 "1. LineFind" LineFindRead
+ StrCmp $R0 "2. LineRead" LineRead
+ StrCmp $R0 "3. FileReadFromEnd" FileReadFromEnd
+ StrCmp $R0 "4. LineSum" LineSum
+ StrCmp $R0 "5. FileJoin" FileJoin
+ StrCmp $R0 "6. TextCompare" LineFind-TextCompare
+ StrCmp $R0 "7. ConfigRead" ConfigRead
+ StrCmp $R0 "8. ConfigWrite" ConfigWrite
+ StrCmp $R0 "9. FileRecode" FileRecode
+ Abort
+
+ LineFindRead:
+ StrCmp $R4 "Example7" 0 LineFind-TextCompare
+ ${LineFind} '$R1' '/NUL' '$R3' LineFindCallback
+ IfErrors error
+ StrCmp $R0 StopLineFind 0 done
+ StrCpy $0 'stopped'
+ goto send
+
+ LineFind-TextCompare:
+ GetLabelAddress $6 LineFindBack
+ goto Edit
+ LineFindBack:
+ FileClose $0
+ StrCmp $R0 "6. TextCompare" Compile
+ StrCmp $CALLBACK '' Compile
+ ${FileJoin} "$PROJECT" "$CALLBACK" ""
+
+ Compile:
+ StrCmp $LOG '' 0 +4
+ GetTempFileName $LOG $PLUGINSDIR
+ GetDlgItem $0 $HWND 1212
+ EnableWindow $0 1
+ ReadRegStr $0 HKLM "SOFTWARE\NSIS" ""
+ IfErrors 0 +2
+ StrCpy $0 "${NSISDIR}"
+ nsExec::Exec '"$0\makensis.exe" /O$LOG $PROJECT'
+ Pop $0
+ StrCmp $0 0 0 +6
+ ExecWait '$PROJECT.exe' $0
+ Delete $PROJECT
+ Delete $PROJECT.exe
+ StrCpy $PROJECT ''
+ goto done
+ MessageBox MB_YESNO|MB_ICONEXCLAMATION "Compile error. Open log?" IDNO +2
+ Exec 'notepad.exe $LOG'
+ StrCpy $0 "Compile Error"
+ goto send
+
+ LineRead:
+ ${LineRead} "$R1" "$R2" $0
+ IfErrors error send
+
+ FileReadFromEnd:
+ ${FileReadFromEnd} "$R1" "FileReadFromEndCallback"
+ IfErrors error
+ StrCmp $R0 StopFileReadFromEnd 0 done
+ StrCpy $0 'stopped'
+ goto send
+
+ LineSum:
+ ${LineSum} "$R1" $0
+ IfErrors error send
+
+ FileJoin:
+ ${FileJoin} "$R1" "$R2" "$R3"
+ IfErrors error
+ MessageBox MB_YESNO " Open output file?" IDNO done
+ StrCmp $R3 '' 0 +3
+ Exec '"notepad.exe" "$R1"'
+ goto done
+ Exec '"notepad.exe" "$R3"'
+ goto done
+
+ ConfigRead:
+ ${ConfigRead} "$R1" "$R2" $0
+ IfErrors error send
+
+ ConfigWrite:
+ ${ConfigWrite} "$R1" "$R2" "$R3" $0
+ IfErrors error
+ MessageBox MB_YESNO " Open output file?" IDNO send
+ Exec '"notepad.exe" "$R1"'
+ goto send
+
+ FileRecode:
+ ${FileRecode} "$R1" "$R2"
+ IfErrors error
+ MessageBox MB_YESNO " Open output file?" IDNO done
+ Exec '"notepad.exe" "$R1"'
+ goto done
+
+ error:
+ StrCpy $0 'error'
+ goto send
+
+ done:
+ StrCpy $0 'Done'
+
+ send:
+ GetDlgItem $1 $HWND 1210
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:$0"
+
+ abort:
+ Abort
+FunctionEnd
+
+Function LineFindCallback
+ MessageBox MB_OKCANCEL '$$R9 "Line"=[$R9]$\n$$R8 "#"=[$R8]$\n$$R7 "-#"=[$R7]$\n$$R6 "Range"=[$R6]$\n$$R5 "Read"=[$R5]$\n$$R4 "Write"=[$R4]' IDOK +2
+ StrCpy $R0 StopLineFind
+
+ Push $R0
+FunctionEnd
+
+Function FileReadFromEndCallback
+ MessageBox MB_OKCANCEL '$$9 "Line"=[$9]$\n$$8 "#"=[$8]$\n$$7 "-#"=[$7]' IDOK +2
+ StrCpy $R0 StopFileReadFromEnd
+
+ Push $R0
+FunctionEnd
+
+Function .onInit
+ InitPluginsDir
+ GetTempFileName $INI $PLUGINSDIR
+ File /oname=$INI "TextFunc.ini"
+FunctionEnd
+
+Page instfiles
+
+Section -Empty
+SectionEnd
diff --git a/Examples/TextFuncTest.nsi b/Examples/TextFuncTest.nsi
new file mode 100644
index 00000000..35809e68
--- /dev/null
+++ b/Examples/TextFuncTest.nsi
@@ -0,0 +1,380 @@
+;_____________________________________________________________________________
+;
+; Text Functions Test
+;_____________________________________________________________________________
+;
+; 2005 Shengalts Aleksander aka Instructor (Shengalts@mail.ru)
+
+Name "Text Functions Test"
+OutFile "TextFuncTest.exe"
+Caption "$(^Name)"
+ShowInstDetails show
+XPStyle on
+
+Var FUNCTION
+Var TEMPFILE1
+Var TEMPFILE2
+Var TEMPFILE3
+Var HANDLE
+Var OUT
+
+!include "TextFunc.nsh"
+
+!insertmacro LineFind
+!insertmacro LineRead
+!insertmacro FileReadFromEnd
+!insertmacro LineSum
+!insertmacro FileJoin
+!insertmacro TextCompare
+!insertmacro ConfigRead
+!insertmacro ConfigWrite
+!insertmacro FileRecode
+!insertmacro TrimNewLines
+
+!insertmacro un.LineFind
+!insertmacro un.LineRead
+!insertmacro un.FileReadFromEnd
+!insertmacro un.LineSum
+!insertmacro un.FileJoin
+!insertmacro un.TextCompare
+!insertmacro un.ConfigRead
+!insertmacro un.ConfigWrite
+!insertmacro un.FileRecode
+!insertmacro un.TrimNewLines
+
+
+
+;############### INSTALL ###############
+
+!define StackVerificationStart `!insertmacro StackVerificationStart`
+!macro StackVerificationStart _FUNCTION
+ StrCpy $FUNCTION ${_FUNCTION}
+ Call StackVerificationStart
+!macroend
+
+!define StackVerificationEnd `!insertmacro StackVerificationEnd`
+!macro StackVerificationEnd
+ Call StackVerificationEnd
+!macroend
+
+Function StackVerificationStart
+ StrCpy $0 !0
+ StrCpy $1 !1
+ StrCpy $2 !2
+ StrCpy $3 !3
+ StrCpy $4 !4
+ StrCpy $5 !5
+ StrCpy $6 !6
+ StrCpy $7 !7
+ StrCpy $8 !8
+ StrCpy $9 !9
+ StrCpy $R0 !R0
+ StrCpy $R1 !R1
+ StrCpy $R2 !R2
+ StrCpy $R3 !R3
+ StrCpy $R4 !R4
+ StrCpy $R5 !R5
+ StrCpy $R6 !R6
+ StrCpy $R7 !R7
+ StrCpy $R8 !R8
+ StrCpy $R9 !R9
+FunctionEnd
+
+Function StackVerificationEnd
+ IfErrors +3
+ DetailPrint 'PASSED $FUNCTION no errors'
+ goto +2
+ DetailPrint 'FAILED $FUNCTION error'
+
+ StrCmp $0 '!0' 0 error
+ StrCmp $1 '!1' 0 error
+ StrCmp $2 '!2' 0 error
+ StrCmp $3 '!3' 0 error
+ StrCmp $4 '!4' 0 error
+ StrCmp $5 '!5' 0 error
+ StrCmp $6 '!6' 0 error
+ StrCmp $7 '!7' 0 error
+ StrCmp $8 '!8' 0 error
+ StrCmp $9 '!9' 0 error
+ StrCmp $R0 '!R0' 0 error
+ StrCmp $R1 '!R1' 0 error
+ StrCmp $R2 '!R2' 0 error
+ StrCmp $R3 '!R3' 0 error
+ StrCmp $R4 '!R4' 0 error
+ StrCmp $R5 '!R5' 0 error
+ StrCmp $R6 '!R6' 0 error
+ StrCmp $R7 '!R7' 0 error
+ StrCmp $R8 '!R8' 0 error
+ StrCmp $R9 '!R9' 0 error
+ DetailPrint 'PASSED $FUNCTION stack'
+ goto end
+
+ error:
+ DetailPrint 'FAILED $FUNCTION stack'
+; MessageBox MB_OKCANCEL '$$0={$0}$\n$$1={$1}$\n$$2={$2}$\n$$3={$3}$\n$$4={$4}$\n$$5={$5}$\n$$6={$6}$\n$$7={$7}$\n$$8={$8}$\n$$9={$9}$\n$$R0={$R0}$\n$$R1={$R1}$\n$$R2={$R2}$\n$$R3={$R3}$\n$$R4={$R4}$\n$$R5={$R5}$\n$$R6={$R6}$\n$$R7={$R7}$\n$$R8={$R8}$\n$$R9={$R9}' IDOK +2
+; quit
+
+ end:
+FunctionEnd
+
+
+
+Section CreateTestFile
+ GetTempFileName $TEMPFILE1 $PLUGINSDIR
+ FileOpen $HANDLE $TEMPFILE1 w
+ FileWrite $HANDLE '1=a$\r$\n'
+ FileWrite $HANDLE '2=b$\r$\n'
+ FileWrite $HANDLE '3=c$\r$\n'
+ FileWrite $HANDLE '4=d$\r$\n'
+ FileWrite $HANDLE '5=e$\r$\n'
+ FileClose $HANDLE
+ GetTempFileName $TEMPFILE2 $PLUGINSDIR
+ GetTempFileName $TEMPFILE3 $PLUGINSDIR
+SectionEnd
+
+
+Section LineFind
+ ${StackVerificationStart} LineFind
+
+ ${LineFind} '$TEMPFILE1' '/NUL' '1:-4 3 -1' 'LineFindCallback1'
+ IfErrors error
+ StrCmp $OUT '|1:2|-5|1|1=a$\r$\n|1:2|-4|2|2=b$\r$\n|3:3|-3|3|3=c$\r$\n' 0 error
+
+ StrCpy $OUT ''
+ SetDetailsPrint none
+ ${LineFind} '$TEMPFILE1' '$TEMPFILE2' '1:-1' 'LineFindCallback2'
+ SetDetailsPrint both
+ IfErrors error
+ StrCmp $OUT '|1:-1||1|1=a$\r$\n|1:-1||2|4=d$\r$\n|1:-1||3|3=c$\r$\n|1:-1||4|2=x$\r$\n|1:-1||5|5=e$\r$\n' 0 error
+
+ goto +2
+ error:
+ SetErrors
+
+ ${StackVerificationEnd}
+SectionEnd
+
+Function LineFindCallback1
+ StrCpy $OUT '$OUT|$R6|$R7|$R8|$R9'
+ StrCmp $R8 3 0 +2
+ StrCpy $0 StopLineFind
+
+ Push $0
+FunctionEnd
+
+Function LineFindCallback2
+ StrCmp $R8 2 0 +2
+ StrCpy $R9 '4=d$\r$\n'
+ StrCmp $R8 4 0 +2
+ StrCpy $R9 '2=x$\r$\n'
+
+ StrCpy $OUT '$OUT|$R6|$R7|$R8|$R9'
+
+ Push $0
+FunctionEnd
+
+
+Section LineRead
+ ${StackVerificationStart} LineRead
+
+ ${LineRead} '$TEMPFILE1' '-1' $OUT
+ IfErrors error
+ StrCmp $OUT '5=e$\r$\n' 0 error
+
+ goto +2
+ error:
+ SetErrors
+
+ ${StackVerificationEnd}
+SectionEnd
+
+
+Section FileReadFromEnd
+ ${StackVerificationStart} FileReadFromEnd
+
+ StrCpy $OUT ''
+ ${FileReadFromEnd} '$TEMPFILE1' 'FileReadFromEndCallback'
+ IfErrors error
+ StrCmp $OUT '|-1|5|5=e$\r$\n|-2|4|4=d$\r$\n|-3|3|3=c$\r$\n|-4|2|2=b$\r$\n' 0 error
+
+ goto +2
+ error:
+ SetErrors
+
+ ${StackVerificationEnd}
+SectionEnd
+
+Function FileReadFromEndCallback
+ StrCpy $OUT '$OUT|$7|$8|$9'
+ StrCmp $8 2 0 +2
+ StrCpy $0 StopFileReadFromEnd
+
+ Push $0
+FunctionEnd
+
+
+Section LineSum
+ ${StackVerificationStart} LineSum
+
+ ${LineSum} '$TEMPFILE1' $OUT
+ IfErrors error
+ StrCmp $OUT '5' 0 error
+
+ goto +2
+ error:
+ SetErrors
+
+ ${StackVerificationEnd}
+SectionEnd
+
+
+Section FileJoin
+ ${StackVerificationStart} FileJoin
+
+ SetDetailsPrint none
+ ${FileJoin} '$TEMPFILE1' '$TEMPFILE2' '$TEMPFILE3'
+ SetDetailsPrint both
+
+ ${StackVerificationEnd}
+SectionEnd
+
+
+Section TextCompare
+ ${StackVerificationStart} TextCompare
+
+ StrCpy $OUT ''
+ ${TextCompare} '$TEMPFILE1' '$TEMPFILE2' 'FastDiff' 'TextCompareCallback'
+ StrCmp $OUT '|2|4=d$\r$\n|2|2=b$\r$\n|4|2=x$\r$\n|4|4=d$\r$\n' 0 error
+
+ StrCpy $OUT ''
+ ${TextCompare} '$TEMPFILE1' '$TEMPFILE2' 'FastEqual' 'TextCompareCallback'
+ StrCmp $OUT '|1|1=a$\r$\n|1|1=a$\r$\n|3|3=c$\r$\n|3|3=c$\r$\n|5|5=e$\r$\n|5|5=e$\r$\n' 0 error
+
+ StrCpy $OUT ''
+ ${TextCompare} '$TEMPFILE1' '$TEMPFILE2' 'SlowDiff' 'TextCompareCallback'
+ StrCmp $OUT '|||2|2=b$\r$\n' 0 error
+
+ StrCpy $OUT ''
+ ${TextCompare} '$TEMPFILE1' '$TEMPFILE2' 'SlowEqual' 'TextCompareCallback'
+ StrCmp $OUT '|1|1=a$\r$\n|1|1=a$\r$\n|3|3=c$\r$\n|3|3=c$\r$\n|2|4=d$\r$\n|4|4=d$\r$\n|5|5=e$\r$\n|5|5=e$\r$\n' 0 error
+
+ goto +2
+ error:
+ SetErrors
+
+ ${StackVerificationEnd}
+SectionEnd
+
+Function TextCompareCallback
+ StrCpy $OUT '$OUT|$6|$7|$8|$9'
+
+ Push $0
+FunctionEnd
+
+
+Section ConfigRead
+ ${StackVerificationStart} ConfigRead
+
+ ${ConfigRead} '$TEMPFILE1' '3=' $OUT
+ StrCmp $OUT 'c' 0 error
+
+ ${ConfigRead} '$TEMPFILE1' '6=' $OUT
+ StrCmp $OUT '' 0 error
+
+ goto +2
+ error:
+ SetErrors
+
+ ${StackVerificationEnd}
+SectionEnd
+
+
+Section ConfigWrite
+ ${StackVerificationStart} ConfigWrite
+
+ ${ConfigWrite} '$TEMPFILE1' '5=' 'e**' $OUT
+ StrCmp $OUT 'CHANGED' 0 error
+
+ ${ConfigWrite} '$TEMPFILE1' '2=' '' $OUT
+ StrCmp $OUT 'DELETED' 0 error
+
+ ${ConfigWrite} '$TEMPFILE1' '3=' 'c' $OUT
+ StrCmp $OUT 'SAME' 0 error
+
+ ${ConfigWrite} '$TEMPFILE1' '6=' '*' $OUT
+ StrCmp $OUT 'ADDED' 0 error
+
+ goto +2
+ error:
+ SetErrors
+
+ ${StackVerificationEnd}
+SectionEnd
+
+
+Section FileRecode
+ ${StackVerificationStart} FileRecode
+
+ ${FileRecode} '$TEMPFILE1' 'CharToOem'
+
+ ${StackVerificationEnd}
+SectionEnd
+
+
+Section TrimNewLines
+ ${StackVerificationStart} TrimNewLines
+
+ ${TrimNewLines} 'Text Line$\r$\n' $OUT
+ StrCmp $OUT 'Text Line' 0 error
+
+ ${TrimNewLines} 'Text Line' $OUT
+ StrCmp $OUT 'Text Line' 0 error
+
+ ${TrimNewLines} 'Text Line$\n' $OUT
+ StrCmp $OUT 'Text Line' 0 error
+
+ goto +2
+ error:
+ SetErrors
+
+ ${StackVerificationEnd}
+SectionEnd
+
+
+Section WriteUninstaller
+ goto +2
+ WriteUninstaller '$EXEDIR\un.TextFuncTest.exe'
+SectionEnd
+
+
+Function .onInit
+ InitPluginsDir
+FunctionEnd
+
+
+;############### UNINSTALL ###############
+
+Section un.Uninstall
+ ${un.LineFind} '$TEMPFILE1' '/NUL' '1:-1' 'un.LineFindCallback'
+ ${un.LineRead} '$TEMPFILE1' '-1' $OUT
+ ${un.FileReadFromEnd} '$TEMPFILE1' 'un.FileReadFromEndCallback'
+ ${un.LineSum} '$TEMPFILE1' $OUT
+ ${un.FileJoin} '$TEMPFILE1' '$TEMPFILE2' '$TEMPFILE3'
+ ${un.TextCompare} '$TEMPFILE1' '$TEMPFILE2' 'FastDiff' 'un.TextCompareCallback'
+ ${un.ConfigRead} '$TEMPFILE1' '3=' $OUT
+ ${un.ConfigWrite} '$TEMPFILE1' '5=' 'e**' $OUT
+ ${un.FileRecode} '$TEMPFILE1' 'CharToOem'
+ ${un.TrimNewLines} 'Text Line$\r$\n' $OUT
+SectionEnd
+
+Function un.LineFindCallback
+ Push $0
+FunctionEnd
+
+Function un.FileReadFromEndCallback
+ Push $0
+FunctionEnd
+
+Function un.TextCompareCallback
+ Push $0
+FunctionEnd
diff --git a/Examples/WordFunc.ini b/Examples/WordFunc.ini
new file mode 100644
index 00000000..38c748d8
--- /dev/null
+++ b/Examples/WordFunc.ini
@@ -0,0 +1,107 @@
+[Settings]
+NumFields=13
+NextButtonText=&Enter
+
+[Field 1]
+Type=Droplist
+Flags=NOTIFY
+State=1. WordFind (Find word by number)
+ListItems=1. WordFind (Find word by number)| (Delimiter exclude)| (Sum of words)| (Sum of delimiters)| (Find word number)| ( }} )| ( {} )| ( *} )|2. WordFind2X|3. WordReplace (Replace)| (Delete)| (Multiple-replace)|4. WordAdd (Add)| (Delete) |5. WordInsert|6. StrFilter (UpperCase)| (LowerCase)| (Filter)|7. VersionCompare|8. VersionConvert
+Left=44
+Right=190
+Top=10
+Bottom=191
+
+[Field 2]
+Type=Text
+State=C:\io.sys|C:\logo.sys|C:\Program Files|C:\WINDOWS
+Left=44
+Right=-10
+Top=30
+Bottom=41
+
+[Field 3]
+Type=Text
+State=|C:\
+Left=44
+Right=-10
+Top=46
+Bottom=59
+
+[Field 4]
+Type=Text
+Flags=DISABLED
+Left=44
+Right=-10
+Top=62
+Bottom=75
+
+[Field 5]
+Type=Text
+State=-4
+Left=44
+Right=-10
+Top=80
+Bottom=92
+
+[Field 6]
+Type=Text
+Left=10
+Right=-30
+Top=108
+Bottom=120
+
+[Field 7]
+Type=Text
+Left=-22
+Right=-10
+Top=108
+Bottom=120
+
+[Field 8]
+Type=Label
+Text=String
+Left=10
+Right=43
+Top=32
+Bottom=44
+
+[Field 9]
+Type=Label
+Text=Delimiter
+Left=10
+Right=43
+Top=48
+Bottom=60
+
+[Field 10]
+Type=Label
+Left=10
+Right=44
+Top=65
+Bottom=76
+
+[Field 11]
+Type=Label
+Text=Word #
+Left=10
+Right=43
+Top=81
+Bottom=94
+
+[Field 12]
+Type=Label
+Text=Result (Word):
+Left=10
+Right=236
+Top=97
+Bottom=110
+
+[Field 13]
+Type=Label
+Text=EL
+Left=-21
+Right=-10
+Top=97
+Bottom=110
+
diff --git a/Examples/WordFunc.nsi b/Examples/WordFunc.nsi
new file mode 100644
index 00000000..67acf299
--- /dev/null
+++ b/Examples/WordFunc.nsi
@@ -0,0 +1,543 @@
+;_____________________________________________________________________________
+;
+; Word Functions
+;_____________________________________________________________________________
+;
+; 2005 Shengalts Aleksander aka Instructor (Shengalts@mail.ru)
+
+Name "Word Functions"
+OutFile "WordFunc.exe"
+Caption "$(^Name)"
+XPStyle on
+
+Var INI
+Var HWND
+Var STATE
+
+!include "WinMessages.nsh"
+!include "WordFunc.nsh"
+
+!insertmacro WordFind
+!insertmacro WordFind2X
+!insertmacro WordReplace
+!insertmacro WordAdd
+!insertmacro WordInsert
+!insertmacro StrFilter
+!insertmacro VersionCompare
+!insertmacro VersionConvert
+
+Page Custom ShowCustom LeaveCustom
+
+Function ShowCustom
+ InstallOptions::initDialog /NOUNLOAD "$INI"
+ Pop $hwnd
+ InstallOptions::show
+ Pop $0
+FunctionEnd
+
+Function LeaveCustom
+ ReadINIStr $0 $INI "Settings" "State"
+ StrCmp $0 0 Enter
+
+ GetDlgItem $1 $HWND 1202
+ EnableWindow $1 1
+ GetDlgItem $1 $HWND 1203
+ ShowWindow $1 1
+ GetDlgItem $1 $HWND 1204
+ ShowWindow $1 1
+ GetDlgItem $1 $HWND 1206
+ EnableWindow $1 1
+ GetDlgItem $1 $HWND 1205
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:"
+ GetDlgItem $1 $HWND 1206
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:"
+
+ ReadINIStr $0 $INI "Field 1" "State"
+ StrCmp $0 "1. WordFind (Find word by number)" 0 WordFind2Send
+ GetDlgItem $1 $HWND 1202
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:|C:\"
+ GetDlgItem $1 $HWND 1204
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:-4"
+ GetDlgItem $1 $HWND 1210
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:Word #"
+ GetDlgItem $1 $HWND 1211
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:Result (Word):"
+ goto WordFindSend
+
+ WordFind2Send:
+ StrCmp $0 " (Delimiter exclude)" 0 WordFind3Send
+ GetDlgItem $1 $HWND 1202
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:|C:\"
+ GetDlgItem $1 $HWND 1204
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:E-2{"
+ GetDlgItem $1 $HWND 1210
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:Word #"
+ GetDlgItem $1 $HWND 1211
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:Result (Before{ or }after delimiter):"
+ goto WordFindSend
+
+ WordFind3Send:
+ StrCmp $0 " (Sum of words)" 0 WordFind4Send
+ GetDlgItem $1 $HWND 1202
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:|C:\"
+ GetDlgItem $1 $HWND 1204
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:#"
+ GetDlgItem $1 $HWND 1210
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:Option"
+ GetDlgItem $1 $HWND 1211
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:Result (Sum of words):"
+ goto WordFindSend
+
+ WordFind4Send:
+ StrCmp $0 " (Sum of delimiters)" 0 WordFind5Send
+ GetDlgItem $1 $HWND 1202
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:|"
+ GetDlgItem $1 $HWND 1204
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:E*"
+ GetDlgItem $1 $HWND 1210
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:Option"
+ GetDlgItem $1 $HWND 1211
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:Result (Sum of delimiters):"
+ goto WordFindSend
+
+ WordFind5Send:
+ StrCmp $0 " (Find word number)" 0 WordFind6Send
+ GetDlgItem $1 $HWND 1202
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:|C:\"
+ GetDlgItem $1 $HWND 1204
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:/Program Files"
+ GetDlgItem $1 $HWND 1210
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:/Word"
+ GetDlgItem $1 $HWND 1211
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:Result (Word #):"
+ goto WordFindSend
+
+ WordFind6Send:
+ StrCmp $0 " ( }} )" 0 WordFind7Send
+ GetDlgItem $1 $HWND 1202
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:|C:\"
+ GetDlgItem $1 $HWND 1204
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:E+2}}"
+ GetDlgItem $1 $HWND 1210
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:Word #"
+ GetDlgItem $1 $HWND 1211
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:Result (Before{{ or }}after word):"
+ goto WordFindSend
+
+ WordFind7Send:
+ StrCmp $0 " ( {} )" 0 WordFind8Send
+ GetDlgItem $1 $HWND 1202
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:|C:\"
+ GetDlgItem $1 $HWND 1204
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:+2{}"
+ GetDlgItem $1 $HWND 1210
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:Word #"
+ GetDlgItem $1 $HWND 1211
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:Result (Without word):"
+ goto WordFindSend
+
+ WordFind8Send:
+ StrCmp $0 " ( *} )" 0 WordFind2XSend
+ GetDlgItem $1 $HWND 1202
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:|C:\"
+ GetDlgItem $1 $HWND 1204
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:E+2*}"
+ GetDlgItem $1 $HWND 1210
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:Word #"
+ GetDlgItem $1 $HWND 1211
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:Result (Before{* or *}after word with word):"
+ goto WordFindSend
+
+ WordFind2XSend:
+ StrCmp $0 "2. WordFind2X" 0 WordReplace1Send
+ GetDlgItem $1 $HWND 1201
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:[C:\io.sys];[C:\logo.sys];[C:\WINDOWS]"
+ GetDlgItem $1 $HWND 1202
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:[C:\"
+ GetDlgItem $1 $HWND 1203
+ EnableWindow $1 1
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:];"
+ GetDlgItem $1 $HWND 1204
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:E+2"
+ GetDlgItem $1 $HWND 1207
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:String"
+ GetDlgItem $1 $HWND 1208
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:Delimiter1"
+ GetDlgItem $1 $HWND 1209
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:Delimiter2"
+ GetDlgItem $1 $HWND 1210
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:Word #"
+ GetDlgItem $1 $HWND 1211
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:Result (Word):"
+ abort
+
+ WordReplace1Send:
+ StrCmp $0 "3. WordReplace (Replace)" 0 WordReplace2Send
+ GetDlgItem $1 $HWND 1201
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:C:\io.sys|C:\logo.sys|C:\WINDOWS"
+ GetDlgItem $1 $HWND 1202
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:SYS"
+ GetDlgItem $1 $HWND 1203
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:bmp"
+ GetDlgItem $1 $HWND 1204
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:+2"
+ goto WordReplaceSend
+
+ WordReplace2Send:
+ StrCmp $0 " (Delete)" 0 WordReplace3Send
+ GetDlgItem $1 $HWND 1201
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:C:\io.sys|C:\logo.sys|C:\WINDOWS"
+ GetDlgItem $1 $HWND 1202
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:SYS"
+ GetDlgItem $1 $HWND 1203
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:"
+ GetDlgItem $1 $HWND 1204
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:E+"
+ goto WordReplaceSend
+
+ WordReplace3Send:
+ StrCmp $0 " (Multiple-replace)" 0 WordAdd1Send
+ GetDlgItem $1 $HWND 1201
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:C:\io.sys||||||C:\logo.sys|||C:\WINDOWS"
+ GetDlgItem $1 $HWND 1202
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:|"
+ GetDlgItem $1 $HWND 1203
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:|"
+ GetDlgItem $1 $HWND 1204
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:+1*"
+ goto WordReplaceSend
+
+ WordAdd1Send:
+ StrCmp $0 "4. WordAdd (Add)" 0 WordAdd2Send
+ GetDlgItem $1 $HWND 1204
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:+C:\WINDOWS|C:\config.sys|C:\IO.SYS"
+ GetDlgItem $1 $HWND 1211
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:Result (String1 + String2):"
+ goto WordAddSend
+
+ WordAdd2Send:
+ StrCmp $0 " (Delete) " 0 WordInsertSend
+ GetDlgItem $1 $HWND 1204
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:E-C:\WINDOWS|C:\config.sys|C:\IO.SYS"
+ GetDlgItem $1 $HWND 1211
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:Result (String1 - String2):"
+ goto WordAddSend
+
+ WordInsertSend:
+ StrCmp $0 "5. WordInsert" 0 StrFilter1Send
+ GetDlgItem $1 $HWND 1201
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:C:\io.sys|C:\WINDOWS"
+ GetDlgItem $1 $HWND 1202
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:|"
+ GetDlgItem $1 $HWND 1203
+ EnableWindow $1 1
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:C:\logo.sys"
+ GetDlgItem $1 $HWND 1204
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:E+2"
+ GetDlgItem $1 $HWND 1207
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:String"
+ GetDlgItem $1 $HWND 1208
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:Delimiter"
+ GetDlgItem $1 $HWND 1209
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:Word"
+ GetDlgItem $1 $HWND 1210
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:Word #"
+ GetDlgItem $1 $HWND 1211
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:Result:"
+ abort
+
+ StrFilter1Send:
+ StrCmp $0 "6. StrFilter (UpperCase)" 0 StrFilter2Send
+ GetDlgItem $1 $HWND 1201
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:123abc 456DEF 7890|%#"
+ GetDlgItem $1 $HWND 1202
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:+"
+ GetDlgItem $1 $HWND 1203
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:"
+ GetDlgItem $1 $HWND 1204
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:"
+ GetDlgItem $1 $HWND 1211
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:Result (String in uppercase):"
+ goto StrFilterSend
+
+ StrFilter2Send:
+ StrCmp $0 " (LowerCase)" 0 StrFilter3Send
+ GetDlgItem $1 $HWND 1201
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:123abc 456DEF 7890|%#"
+ GetDlgItem $1 $HWND 1202
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:-"
+ GetDlgItem $1 $HWND 1203
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:ef"
+ GetDlgItem $1 $HWND 1204
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:"
+ GetDlgItem $1 $HWND 1211
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:Result (String in lowercase except EF):"
+ goto StrFilterSend
+
+ StrFilter3Send:
+ StrCmp $0 " (Filter)" 0 VersionCompareSend
+ GetDlgItem $1 $HWND 1201
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:123abc 456DEF 7890|%#"
+ GetDlgItem $1 $HWND 1202
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:+12"
+ GetDlgItem $1 $HWND 1203
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:b"
+ GetDlgItem $1 $HWND 1204
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:def"
+ GetDlgItem $1 $HWND 1211
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:Result (String Digits + Letters + b - def):"
+ goto StrFilterSend
+
+ VersionCompareSend:
+ StrCmp $0 "7. VersionCompare" 0 VersionConvertSend
+ GetDlgItem $1 $HWND 1201
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:1.1.1.9"
+ GetDlgItem $1 $HWND 1202
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:1.1.1.01"
+ GetDlgItem $1 $HWND 1203
+ ShowWindow $1 0
+ GetDlgItem $1 $HWND 1204
+ ShowWindow $1 0
+ GetDlgItem $1 $HWND 1206
+ EnableWindow $1 0
+ GetDlgItem $1 $HWND 1207
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:Version1"
+ GetDlgItem $1 $HWND 1208
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:Version2"
+ GetDlgItem $1 $HWND 1209
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:"
+ GetDlgItem $1 $HWND 1210
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:"
+ GetDlgItem $1 $HWND 1211
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:Result (0-equal 1-newer 2-older):"
+ abort
+
+ VersionConvertSend:
+ StrCmp $0 "8. VersionConvert" 0 Abort
+ GetDlgItem $1 $HWND 1201
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:9.0c"
+ GetDlgItem $1 $HWND 1202
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:"
+ GetDlgItem $1 $HWND 1203
+ ShowWindow $1 0
+ GetDlgItem $1 $HWND 1204
+ ShowWindow $1 0
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:"
+ GetDlgItem $1 $HWND 1206
+ EnableWindow $1 0
+ GetDlgItem $1 $HWND 1207
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:Version"
+ GetDlgItem $1 $HWND 1208
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:CharList"
+ GetDlgItem $1 $HWND 1209
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:"
+ GetDlgItem $1 $HWND 1210
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:"
+ GetDlgItem $1 $HWND 1211
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:Result (numerical version format):"
+ abort
+
+ Abort:
+ Abort
+
+ WordFindSend:
+ GetDlgItem $1 $HWND 1203
+ EnableWindow $1 0
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:"
+ GetDlgItem $1 $HWND 1201
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:C:\io.sys|C:\logo.sys|C:\Program Files|C:\WINDOWS"
+ GetDlgItem $1 $HWND 1207
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:String"
+ GetDlgItem $1 $HWND 1208
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:Delimiter"
+ GetDlgItem $1 $HWND 1209
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:"
+ Abort
+
+ WordReplaceSend:
+ GetDlgItem $1 $HWND 1203
+ EnableWindow $1 1
+ GetDlgItem $1 $HWND 1207
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:String"
+ GetDlgItem $1 $HWND 1208
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:Replace it"
+ GetDlgItem $1 $HWND 1209
+ SendMessage $1 ${WM_SETTEXT} 1 "STR: with"
+ GetDlgItem $1 $HWND 1210
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:Word #"
+ GetDlgItem $1 $HWND 1211
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:Result:"
+ Abort
+
+ WordAddSend:
+ GetDlgItem $1 $HWND 1203
+ EnableWindow $1 0
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:"
+ GetDlgItem $1 $HWND 1201
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:C:\io.sys|C:\logo.sys|C:\WINDOWS"
+ GetDlgItem $1 $HWND 1202
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:|"
+ GetDlgItem $1 $HWND 1207
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:String1"
+ GetDlgItem $1 $HWND 1208
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:Delimiter"
+ GetDlgItem $1 $HWND 1209
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:"
+ GetDlgItem $1 $HWND 1210
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:String2"
+ Abort
+
+ StrFilterSend:
+ GetDlgItem $1 $HWND 1203
+ EnableWindow $1 1
+ GetDlgItem $1 $HWND 1206
+ EnableWindow $1 0
+ GetDlgItem $1 $HWND 1207
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:String"
+ GetDlgItem $1 $HWND 1208
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:Filter"
+ GetDlgItem $1 $HWND 1209
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:Include"
+ GetDlgItem $1 $HWND 1210
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:Exclude"
+ Abort
+
+;=Enter=
+ Enter:
+ StrCpy $0 ''
+ ReadINIStr $STATE $INI "Field 1" "State"
+ ReadINIStr $R1 $INI "Field 2" "State"
+ ReadINIStr $R2 $INI "Field 3" "State"
+ ReadINIStr $R3 $INI "Field 4" "State"
+ ReadINIStr $R4 $INI "Field 5" "State"
+
+ StrCmp $STATE "1. WordFind (Find word by number)" WordFind
+ StrCmp $STATE " (Delimiter exclude)" WordFind
+ StrCmp $STATE " (Find in string)" WordFind
+ StrCmp $STATE " (Sum of words)" WordFind
+ StrCmp $STATE " (Sum of delimiters)" WordFind
+ StrCmp $STATE " (Find word number)" WordFind
+ StrCmp $STATE " ( }} )" WordFind
+ StrCmp $STATE " ( {} )" WordFind
+ StrCmp $STATE " ( *} )" WordFind
+ StrCmp $STATE "2. WordFind2X" WordFind2X
+ StrCmp $STATE "3. WordReplace (Replace)" WordReplace
+ StrCmp $STATE " (Delete)" WordReplace
+ StrCmp $STATE " (Multiple-replace)" WordReplace
+ StrCmp $STATE "4. WordAdd (Add)" WordAdd
+ StrCmp $STATE " (Delete) " WordAdd
+ StrCmp $STATE "5. WordInsert" WordInsert
+ StrCmp $STATE "6. StrFilter (UpperCase)" StrFilter
+ StrCmp $STATE " (LowerCase)" StrFilter
+ StrCmp $STATE " (Filter)" StrFilter
+ StrCmp $STATE "7. VersionCompare" VersionCompare
+ StrCmp $STATE "8. VersionConvert" VersionConvert
+ Abort
+
+ WordFind:
+ ${WordFind} "$R1" "$R2" "$R4" $R0
+ IfErrors 0 Send
+ StrCpy $0 $R0
+ StrCmp $R0 3 0 +3
+ StrCpy $3 '"+1" "-1" "+1}" "+1{" "#" "/word"'
+ goto error3
+ StrCmp $R0 2 0 error1
+ StrCpy $R4 $R4 '' 1
+ StrCpy $1 $R4 1
+ StrCmp $1 / 0 error2
+ StrCpy $R4 $R4 '' 1
+ StrCpy $R0 '"$R4" no such word.'
+ goto Send
+
+ WordFind2X:
+ ${WordFind2X} "$R1" "$R2" "$R3" "$R4" $R0
+ IfErrors 0 Send
+ StrCpy $0 $R0
+ StrCmp $R0 3 0 +3
+ StrCpy $3 '"+1" "-1"'
+ goto error3
+ StrCmp $R0 2 +3
+ StrCpy $R0 '"$R2...$R3" no words found.'
+ goto Send
+ StrCpy $R4 $R4 '' 1
+ StrCpy $1 $R4 1
+ StrCmp $1 / 0 +2
+ StrCpy $R4 $R4 '' 1
+ StrCpy $R0 '"$R4" no such word.'
+ goto Send
+
+ WordReplace:
+ ${WordReplace} "$R1" "$R2" "$R3" "$R4" $R0
+ IfErrors 0 Send
+ StrCpy $0 $R0
+ StrCmp $R0 3 0 +3
+ StrCpy $3 '"+1" "+1*" "+" "+*" "{}"'
+ goto error3
+ StrCmp $R0 2 0 error1
+ StrCpy $R4 $R4 '' 1
+ goto error2
+
+ WordAdd:
+ ${WordAdd} "$R1" "$R2" "$R4" $R0
+ IfErrors 0 Send
+ StrCpy $0 $R0
+ StrCmp $R0 3 0 error1empty
+ StrCpy $3 '"+text" "-text"'
+ goto error3
+
+ WordInsert:
+ ${WordInsert} "$R1" "$R2" "$R3" "$R4" $R0
+ IfErrors 0 Send
+ StrCpy $0 $R0
+ StrCmp $R0 3 0 +3
+ StrCpy $3 '"+1" "-1"'
+ goto error3
+ StrCmp $R0 2 0 error1empty
+ StrCpy $R4 $R4 '' 1
+ goto error2
+
+ StrFilter:
+ ${StrFilter} "$R1" "$R2" "$R3" "$R4" $R0
+ IfErrors 0 Send
+ StrCpy $R0 'Syntax error'
+ goto Send
+
+ VersionCompare:
+ ${VersionCompare} "$R1" "$R2" $R0
+ goto Send
+
+ VersionConvert:
+ ${VersionConvert} "$R1" "$R2" $R0
+ goto Send
+
+ error3:
+ StrCpy $R0 '"$R4" syntax error ($3)'
+ goto Send
+ error2:
+ StrCpy $R0 '"$R4" no such word number'
+ goto Send
+ error1empty:
+ StrCpy $R0 '"$R2" delimiter is empty'
+ goto Send
+ error1:
+ StrCpy $R0 '"$R2" delimiter not found in string'
+ goto Send
+
+ Send:
+ GetDlgItem $1 $HWND 1205
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:$R0"
+ GetDlgItem $1 $HWND 1206
+ SendMessage $1 ${WM_SETTEXT} 1 "STR:$0"
+ abort
+FunctionEnd
+
+Function .onInit
+ InitPluginsDir
+ GetTempFileName $INI $PLUGINSDIR
+ File /oname=$INI "WordFunc.ini"
+FunctionEnd
+
+Page instfiles
+
+Section "Empty"
+SectionEnd
diff --git a/Examples/WordFuncTest.nsi b/Examples/WordFuncTest.nsi
new file mode 100644
index 00000000..1f7ce3e6
--- /dev/null
+++ b/Examples/WordFuncTest.nsi
@@ -0,0 +1,486 @@
+;_____________________________________________________________________________
+;
+; Word Functions Test
+;_____________________________________________________________________________
+;
+; 2005 Shengalts Aleksander aka Instructor (Shengalts@mail.ru)
+
+Name "Word Functions Test"
+OutFile "WordFuncTest.exe"
+Caption "$(^Name)"
+ShowInstDetails show
+XPStyle on
+
+Var FUNCTION
+Var OUT
+
+!include "WordFunc.nsh"
+
+!insertmacro WordFind
+!insertmacro WordFind2X
+!insertmacro WordFind3X
+!insertmacro WordReplace
+!insertmacro WordAdd
+!insertmacro WordInsert
+!insertmacro StrFilter
+!insertmacro VersionCompare
+!insertmacro VersionConvert
+
+!insertmacro un.WordFind
+!insertmacro un.WordFind2X
+!insertmacro un.WordFind3X
+!insertmacro un.WordReplace
+!insertmacro un.WordAdd
+!insertmacro un.WordInsert
+!insertmacro un.StrFilter
+!insertmacro un.VersionCompare
+!insertmacro un.VersionConvert
+
+
+
+;############### INSTALL ###############
+
+!define StackVerificationStart `!insertmacro StackVerificationStart`
+!macro StackVerificationStart _FUNCTION
+ StrCpy $FUNCTION ${_FUNCTION}
+ Call StackVerificationStart
+!macroend
+
+!define StackVerificationEnd `!insertmacro StackVerificationEnd`
+!macro StackVerificationEnd
+ Call StackVerificationEnd
+!macroend
+
+Function StackVerificationStart
+ StrCpy $0 !0
+ StrCpy $1 !1
+ StrCpy $2 !2
+ StrCpy $3 !3
+ StrCpy $4 !4
+ StrCpy $5 !5
+ StrCpy $6 !6
+ StrCpy $7 !7
+ StrCpy $8 !8
+ StrCpy $9 !9
+ StrCpy $R0 !R0
+ StrCpy $R1 !R1
+ StrCpy $R2 !R2
+ StrCpy $R3 !R3
+ StrCpy $R4 !R4
+ StrCpy $R5 !R5
+ StrCpy $R6 !R6
+ StrCpy $R7 !R7
+ StrCpy $R8 !R8
+ StrCpy $R9 !R9
+FunctionEnd
+
+Function StackVerificationEnd
+ IfErrors +3
+ DetailPrint 'PASSED $FUNCTION no errors'
+ goto +2
+ DetailPrint 'FAILED $FUNCTION error'
+
+ StrCmp $0 '!0' 0 error
+ StrCmp $1 '!1' 0 error
+ StrCmp $2 '!2' 0 error
+ StrCmp $3 '!3' 0 error
+ StrCmp $4 '!4' 0 error
+ StrCmp $5 '!5' 0 error
+ StrCmp $6 '!6' 0 error
+ StrCmp $7 '!7' 0 error
+ StrCmp $8 '!8' 0 error
+ StrCmp $9 '!9' 0 error
+ StrCmp $R0 '!R0' 0 error
+ StrCmp $R1 '!R1' 0 error
+ StrCmp $R2 '!R2' 0 error
+ StrCmp $R3 '!R3' 0 error
+ StrCmp $R4 '!R4' 0 error
+ StrCmp $R5 '!R5' 0 error
+ StrCmp $R6 '!R6' 0 error
+ StrCmp $R7 '!R7' 0 error
+ StrCmp $R8 '!R8' 0 error
+ StrCmp $R9 '!R9' 0 error
+ DetailPrint 'PASSED $FUNCTION stack'
+ goto end
+
+ error:
+ DetailPrint 'FAILED $FUNCTION stack'
+; MessageBox MB_OKCANCEL '$$0={$0}$\n$$1={$1}$\n$$2={$2}$\n$$3={$3}$\n$$4={$4}$\n$$5={$5}$\n$$6={$6}$\n$$7={$7}$\n$$8={$8}$\n$$9={$9}$\n$$R0={$R0}$\n$$R1={$R1}$\n$$R2={$R2}$\n$$R3={$R3}$\n$$R4={$R4}$\n$$R5={$R5}$\n$$R6={$R6}$\n$$R7={$R7}$\n$$R8={$R8}$\n$$R9={$R9}' IDOK +2
+; quit
+
+ end:
+FunctionEnd
+
+
+
+Section WordFind
+ ${StackVerificationStart} WordFind
+
+ ${WordFind} '||io.sys|||Program Files|||WINDOWS' '||' '-02' $OUT
+ StrCmp $OUT '|Program Files' 0 error
+
+ ${WordFind} '||io.sys||||Program Files||||WINDOWS' '||' '-2' $OUT
+ StrCmp $OUT 'Program Files' 0 error
+
+ ${WordFind} 'C:\io.sys|||logo.sys|||WINDOWS' '||' '-2}' $OUT
+ StrCmp $OUT '|logo.sys|||WINDOWS' 0 error
+
+ ${WordFind} 'C:\io.sys|||logo.sys|||WINDOWS' '||' '#' $OUT
+ StrCmp $OUT '3' 0 error
+
+ ${WordFind} 'C:\io.sys|||logo.sys|||WINDOWS' '||' '*' $OUT
+ StrCmp $OUT '2' 0 error
+
+ ${WordFind} 'C:\io.sys|||Program Files|||WINDOWS' '||' '/|Program Files' $OUT
+ StrCmp $OUT '2' 0 error
+
+ ${WordFind} 'C:\io.sys|||logo.sys|||WINDOWS' '||' '+2}}' $OUT
+ StrCmp $OUT '|||WINDOWS' 0 error
+
+ ${WordFind} 'C:\io.sys|||logo.sys|||WINDOWS' '||' '+2{}' $OUT
+ StrCmp $OUT 'C:\io.sys|||WINDOWS' 0 error
+
+ ${WordFind} 'C:\io.sys|||logo.sys|||WINDOWS' '||' '+2*}' $OUT
+ StrCmp $OUT '|logo.sys|||WINDOWS' 0 error
+
+ ${WordFind} 'C:\\Program Files\\NSIS\\NSIS.chm' '\' '-2{*' $OUT
+ StrCmp $OUT 'C:\\Program Files\\NSIS' 0 error
+
+ ${WordFind} 'C:\io.sys|||Program Files|||WINDOWS|||' '||' '-1' $OUT
+ StrCmp $OUT '|' 0 error
+
+ ${WordFind} '||C:\io.sys|||logo.sys|||WINDOWS||' '||' '-1}' $OUT
+ StrCmp $OUT '' 0 error
+
+ ${WordFind} '||C:\io.sys|||logo.sys|||WINDOWS||' '||' '+1{' $OUT
+ StrCmp $OUT '' 0 error
+
+ ${WordFind} 'C:\io.sys|||logo.sys' '_' 'E+1' $OUT
+ IfErrors 0 error
+ StrCmp $OUT 1 0 error
+
+ ${WordFind} 'C:\io.sys|||logo.sys|||' '\' 'E+3' $OUT
+ IfErrors 0 error
+ StrCmp $OUT 2 0 error
+
+ ${WordFind} 'C:\io.sys|||logo.sys' '\' 'E1' $OUT
+ IfErrors 0 error
+ StrCmp $OUT 3 0 error
+
+ goto +2
+ error:
+ SetErrors
+
+ ${StackVerificationEnd}
+SectionEnd
+
+
+Section WordFind2X
+ ${StackVerificationStart} WordFind2X
+
+ ${WordFind2X} '[C:\io.sys];[C:\logo.sys];[C:\WINDOWS]' '[C:\' '];' '+2' $OUT
+ StrCmp $OUT 'logo.sys' 0 error
+
+ ${WordFind2X} 'C:\WINDOWS C:\io.sys C:\logo.sys' '\' '.' '-1' $OUT
+ StrCmp $OUT 'logo' 0 error
+
+ ${WordFind2X} 'C:\WINDOWS C:\io.sys C:\logo.sys' '\' '.' '-1{{' $OUT
+ StrCmp $OUT 'C:\WINDOWS C:\io.sys C:' 0 error
+
+ ${WordFind2X} 'C:\WINDOWS C:\io.sys C:\logo.sys' '\' '.' '-1{}' $OUT
+ StrCmp $OUT 'C:\WINDOWS C:\io.sys C:sys' 0 error
+
+ ${WordFind2X} 'C:\WINDOWS C:\io.sys C:\logo.sys' '\' '.' '-1{*' $OUT
+ StrCmp $OUT 'C:\WINDOWS C:\io.sys C:\logo.' 0 error
+
+ ${WordFind2X} 'C:\WINDOWS C:\io.sys C:\logo.sys' '\' '.' '/logo' $OUT
+ StrCmp $OUT '2' 0 error
+
+ ${WordFind2X} '||a||b||c' '||' '||' 'E+1' $OUT
+ StrCmp $OUT 'a' 0 error
+
+ ${WordFind2X} '[io.sys];[C:\logo.sys]' '\' '];' 'E+1' $OUT
+ IfErrors 0 error
+ StrCmp $OUT 1 0 error
+
+ ${WordFind2X} '[io.sys];[C:\logo.sys]' '[' '];' 'E+2' $OUT
+ IfErrors 0 error
+ StrCmp $OUT 2 0 error
+
+ ${WordFind2X} '[io.sys];[C:\logo.sys]' '\' '];' 'E2' $OUT
+ IfErrors 0 error
+ StrCmp $OUT 3 0 error
+
+ goto +2
+ error:
+ SetErrors
+
+ ${StackVerificationEnd}
+SectionEnd
+
+
+Section WordFind3X
+ ${StackVerificationStart} WordFind3X
+
+ ${WordFind3X} '[1.AAB];[2.BAA];[3.BBB];' '[' 'AA' '];' '+1' $OUT
+ StrCmp $OUT '1.AAB' 0 error
+
+ ${WordFind3X} '[1.AAB];[2.BAA];[3.BBB];' '[' 'AA' '];' '-1' $OUT
+ StrCmp $OUT '2.BAA' 0 error
+
+ ${WordFind3X} '[1.AAB];[2.BAA];[3.BBB];' '[' 'AA' '];' '-1{{' $OUT
+ StrCmp $OUT '[1.AAB];' 0 error
+
+ ${WordFind3X} '[1.AAB];[2.BAA];[3.BBB];' '[' 'AA' '];' '-1{}' $OUT
+ StrCmp $OUT '[1.AAB];[3.BBB];' 0 error
+
+ ${WordFind3X} '[1.AAB];[2.BAA];[3.BBB];' '[' 'AA' '];' '-1{*' $OUT
+ StrCmp $OUT '[1.AAB];[2.BAA];' 0 error
+
+ ${WordFind3X} '[1.AAB];[2.BAA];[3.BBB];' '[' 'AA' '];' '/2.BAA' $OUT
+ StrCmp $OUT '2' 0 error
+
+ ${WordFind3X} '[1.AAB];[2.BAA];[3.BBB];' '[' 'XX' '];' 'E+1' $OUT
+ IfErrors 0 error
+ StrCmp $OUT '1' 0 error
+
+ ${WordFind3X} '[1.AAB];[2.BAA];[3.BBB];' '[' 'AA' '];' 'E+3' $OUT
+ IfErrors 0 error
+ StrCmp $OUT '2' 0 error
+
+ ${WordFind3X} '[1.AAB];[2.BAA];[3.BBB];' '[' 'AA' '];' 'E3' $OUT
+ IfErrors 0 error
+ StrCmp $OUT '3' 0 error
+
+ goto +2
+ error:
+ SetErrors
+
+ ${StackVerificationEnd}
+SectionEnd
+
+
+Section WordReplace
+ ${StackVerificationStart} WordReplace
+
+ ${WordReplace} 'C:\io.sys C:\logo.sys C:\WINDOWS' 'SYS' 'bmp' '+2' $OUT
+ StrCmp $OUT 'C:\io.sys C:\logo.bmp C:\WINDOWS' 0 error
+
+ ${WordReplace} 'C:\io.sys C:\logo.sys C:\WINDOWS' 'SYS' '' '+' $OUT
+ StrCmp $OUT 'C:\io. C:\logo. C:\WINDOWS' 0 error
+
+ ${WordReplace} 'C:\io.sys C:\logo.sys C:\WINDOWS' ' ' ' ' '+1*' $OUT
+ StrCmp $OUT 'C:\io.sys C:\logo.sys C:\WINDOWS' 0 error
+
+ ${WordReplace} 'C:\io.sys C:\logo.sysSYSsys C:\WINDOWS' 'sys' 'bmp' '+*' $OUT
+ StrCmp $OUT 'C:\io.bmp C:\logo.bmp C:\WINDOWS' 0 error
+
+ ${WordReplace} 'sysSYSsysC:\io.sys C:\logo.sys C:\WINDOWSsysSYSsys' 'sys' '|' '{}*' $OUT
+ StrCmp $OUT '|C:\io.sys C:\logo.sys C:\WINDOWS|' 0 error
+
+ ${WordReplace} 'C:\io.sys C:\logo.sys' '#sys' '|sys|' 'E+1' $OUT
+ IfErrors 0 error
+ StrCmp $OUT '1' 0 error
+
+ ${WordReplace} 'C:\io.sys C:\logo.sys' '.sys' '|sys|' 'E+3' $OUT
+ IfErrors 0 error
+ StrCmp $OUT '2' 0 error
+
+ ${WordReplace} 'C:\io.sys C:\logo.sys' '.sys' '|sys|' 'E3' $OUT
+ IfErrors 0 error
+ StrCmp $OUT '3' 0 error
+
+ goto +2
+ error:
+ SetErrors
+
+ ${StackVerificationEnd}
+SectionEnd
+
+
+Section WordAdd
+ ${StackVerificationStart} WordAdd
+
+ ${WordAdd} 'C:\io.sys C:\WINDOWS' ' ' '+C:\WINDOWS C:\config.sys' $OUT
+ StrCmp $OUT 'C:\io.sys C:\WINDOWS C:\config.sys' 0 error
+
+ ${WordAdd} 'C:\io.sys C:\logo.sys C:\WINDOWS' ' ' '-C:\WINDOWS C:\config.sys C:\IO.SYS' $OUT
+ StrCmp $OUT 'C:\logo.sys' 0 error
+
+ ${WordAdd} 'C:\io.sys' ' ' '+C:\WINDOWS C:\config.sys C:\IO.SYS' $OUT
+ StrCmp $OUT 'C:\io.sys C:\WINDOWS C:\config.sys' 0 error
+
+ ${WordAdd} 'C:\io.sys C:\logo.sys C:\WINDOWS' ' ' '-C:\WINDOWS' $OUT
+ StrCmp $OUT 'C:\io.sys C:\logo.sys' 0 error
+
+ ${WordAdd} 'C:\io.sys C:\logo.sys' ' ' '+C:\logo.sys' $OUT
+ StrCmp $OUT 'C:\io.sys C:\logo.sys' 0 error
+
+ ${WordAdd} 'C:\io.sys C:\logo.sys' ' ' 'E-' $OUT
+ StrCmp $OUT 'C:\io.sys C:\logo.sys' 0 error
+ IfErrors error
+
+ ${WordAdd} 'C:\io.sys C:\logo.sys' '' 'E-C:\logo.sys' $OUT
+ IfErrors 0 error
+ StrCmp $OUT '1' 0 error
+
+ ${WordAdd} 'C:\io.sys C:\logo.sys' '' 'EC:\logo.sys' $OUT
+ IfErrors 0 error
+ StrCmp $OUT '3' 0 error
+
+ goto +2
+ error:
+ SetErrors
+
+ ${StackVerificationEnd}
+SectionEnd
+
+
+Section WordInsert
+ ${StackVerificationStart} WordInsert
+
+ ${WordInsert} 'C:\io.sys C:\WINDOWS' ' ' 'C:\logo.sys' '-2' $OUT
+ StrCmp $OUT 'C:\io.sys C:\logo.sys C:\WINDOWS' 0 error
+
+ ${WordInsert} 'C:\io.sys' ' ' 'C:\WINDOWS' '+2' $OUT
+ StrCmp $OUT 'C:\io.sys C:\WINDOWS' 0 error
+
+ ${WordInsert} '' ' ' 'C:\WINDOWS' '+1' $OUT
+ StrCmp $OUT 'C:\WINDOWS ' 0 error
+
+ ${WordInsert} 'C:\io.sys C:\logo.sys' '' 'C:\logo.sys' 'E+1' $OUT
+ IfErrors 0 error
+ StrCmp $OUT '1' 0 error
+
+ ${WordInsert} 'C:\io.sys C:\logo.sys' ' ' 'C:\logo.sys' 'E+4' $OUT
+ IfErrors 0 error
+ StrCmp $OUT '2' 0 error
+
+ ${WordInsert} 'C:\io.sys C:\logo.sys' '' 'C:\logo.sys' 'E1' $OUT
+ IfErrors 0 error
+ StrCmp $OUT '3' 0 error
+
+ goto +2
+ error:
+ SetErrors
+
+ ${StackVerificationEnd}
+SectionEnd
+
+
+Section StrFilter
+ ${StackVerificationStart} StrFilter
+
+ ${StrFilter} '123abc 456DEF 7890|%#' '+' '' '' $OUT
+ IfErrors error
+ StrCmp $OUT '123ABC 456DEF 7890|%#' 0 error
+
+ ${StrFilter} '123abc 456DEF 7890|%#' '-' 'ef' '' $OUT
+ IfErrors error
+ StrCmp $OUT '123abc 456dEF 7890|%#' 0 error
+
+ ${StrFilter} '123abc 456DEF 7890|%#' '2' '|%' '' $OUT
+ IfErrors error
+ StrCmp $OUT 'abcDEF|%' 0 error
+
+ ${StrFilter} '123abc 456DEF 7890|%#' '13' 'af' '4590' $OUT
+ IfErrors error
+ StrCmp $OUT '123a 6F 78|%#' 0 error
+
+ ${StrFilter} '123abc 456DEF 7890|%#' '+12' 'b' 'def' $OUT
+ IfErrors error
+ StrCmp $OUT '123AbC4567890' 0 error
+
+ ${StrFilter} '123abc 456DEF 7890|%#' '+12' 'b' 'def' $OUT
+ IfErrors error
+ StrCmp $OUT '123AbC4567890' 0 error
+
+ ${StrFilter} '123abc 456DEF 7890|%#' '123' 'b' 'def' $OUT
+ IfErrors 0 error
+
+ goto +2
+ error:
+ SetErrors
+
+ ${StackVerificationEnd}
+SectionEnd
+
+
+Section VersionCompare
+ ${StackVerificationStart} VersionCompare
+
+ ${VersionCompare} '1.1.1.9' '1.1.1.01' $OUT
+ StrCmp $OUT '1' 0 error
+
+ ${VersionCompare} '1.1.1.1' '1.1.1.10' $OUT
+ StrCmp $OUT '2' 0 error
+
+ ${VersionCompare} '91.1.1.1' '101.1.1.9' $OUT
+ StrCmp $OUT '2' 0 error
+
+ ${VersionCompare} '1.1.1.1' '1.1.1.1' $OUT
+ StrCmp $OUT '0' 0 error
+
+ ${VersionCompare} '1.1.1.9' '1.1.1.10' $OUT
+ StrCmp $OUT '2' 0 error
+
+ ${VersionCompare} '1.1.1.0' '1.1.1' $OUT
+ StrCmp $OUT '0' 0 error
+
+ ${VersionCompare} '1.1.0.0' '1.1' $OUT
+ StrCmp $OUT '0' 0 error
+
+ goto +2
+ error:
+ SetErrors
+
+ ${StackVerificationEnd}
+SectionEnd
+
+
+Section VersionConvert
+ ${StackVerificationStart} VersionConvert
+
+ ${VersionConvert} '9.0a' '' $OUT
+ StrCmp $OUT '9.0.01' 0 error
+
+ ${VersionConvert} '9.0c' '' $OUT
+ StrCmp $OUT '9.0.03' 0 error
+
+ ${VersionConvert} '0.15c-9m' '' $OUT
+ StrCmp $OUT '0.15.03.9.13' 0 error
+
+ ${VersionConvert} '0.15c+' 'abcdefghijklmnopqrstuvwxyz+' $OUT
+ StrCmp $OUT '0.15.0327' 0 error
+
+ ${VersionConvert} '0.0xa12.x.ax|.|.|x|a|.3|a.4.||5.|' '' $OUT
+ StrCmp $OUT '0.0.2401.12.24.0124.24.01.3.01.4.5' 0 error
+
+ goto +2
+ error:
+ SetErrors
+
+ ${StackVerificationEnd}
+SectionEnd
+
+
+Section WriteUninstaller
+ goto +2
+ WriteUninstaller '$EXEDIR\un.WordFuncTest.exe'
+SectionEnd
+
+
+
+;############### UNINSTALL ###############
+
+Section un.Uninstall
+ ${un.WordFind} 'C:\io.sys C:\Program Files C:\WINDOWS' ' C:\' '-02' $OUT
+ ${un.WordFind2X} '[C:\io.sys];[C:\logo.sys];[C:\WINDOWS]' '[C:\' '];' '+2' $OUT
+ ${un.WordFind3X} '[1.AAB];[2.BAA];[3.BBB];' '[' 'AA' '];' '+1' $OUT
+ ${un.WordReplace} 'C:\io.sys C:\logo.sys C:\WINDOWS' 'SYS' 'bmp' '+2' $OUT
+ ${un.WordAdd} 'C:\io.sys C:\WINDOWS' ' ' '+C:\WINDOWS C:\config.sys' $OUT
+ ${un.WordInsert} 'C:\io.sys C:\WINDOWS' ' ' 'C:\logo.sys' '-2' $OUT
+ ${un.StrFilter} '123abc 456DEF 7890|%#' '+' '' '' $OUT
+ ${un.VersionCompare} '1.1.1.9' '1.1.1.01' $OUT
+ ${un.VersionConvert} '9.0a' '' $OUT
+SectionEnd
\ No newline at end of file
diff --git a/Include/FileFunc.nsh b/Include/FileFunc.nsh
new file mode 100644
index 00000000..f35f697d
--- /dev/null
+++ b/Include/FileFunc.nsh
@@ -0,0 +1,2345 @@
+/*
+_____________________________________________________________________________
+
+ File Functions Header v2.4
+_____________________________________________________________________________
+
+ 2005 Shengalts Aleksander aka Instructor (Shengalts@mail.ru)
+
+ See documentation for more information about the following functions.
+
+ Usage in script:
+ 1. !include "FileFunc.nsh"
+ 2. !insertmacro FileFunction
+ 3. [Section|Function]
+ ${FileFunction} "Param1" "Param2" "..." $var
+ [SectionEnd|FunctionEnd]
+
+
+ FileFunction=[Locate|GetSize|DriveSpace|GetDrives|GetTime|GetFileAttributes|
+ GetFileVersion|GetExeName|GetExePath|GetParameters|GetOptions|
+ GetRoot|GetParent|GetFileName|GetBaseName|GetFileExt|
+ BannerTrimPath|DirState|RefreshShellIcons]
+
+ un.FileFunction=[un.Locate|un.GetSize|un.DriveSpace|un.GetDrives|un.GetTime|
+ un.GetFileAttributes|un.GetFileVersion|un.GetExeName|
+ un.GetExePath|un.GetParameters|un.GetOptions|un.GetRoot|
+ un.GetParent|un.GetFileName|un.GetBaseName|un.GetFileExt|
+ un.BannerTrimPath|un.DirState|un.RefreshShellIcons]
+
+_____________________________________________________________________________
+
+ Thanks to:
+_____________________________________________________________________________
+
+GetSize
+ KiCHiK (Function "FindFiles")
+DriveSpace
+ sunjammer (Function "CheckSpaceFree")
+GetDrives
+ deguix (Based on his idea of Function "DetectDrives")
+GetTime
+ Takhir (Script "StatTest") and deguix (Function "FileModifiedDate")
+GetFileVersion
+ KiCHiK (Based on his example for command "GetDLLVersion")
+GetParameters
+ sunjammer (Based on his Function "GetParameters")
+GetRoot
+ KiCHiK (Based on his Function "GetRoot")
+GetParent
+ sunjammer (Based on his Function "GetParent")
+GetFileName
+ KiCHiK (Based on his Function "GetFileName")
+GetBaseName
+ comperio (Based on his idea of Function "GetBaseName")
+GetFileExt
+ opher (author)
+RefreshShellIcons
+ jerome tremblay (author)
+*/
+
+
+;_____________________________________________________________________________
+;
+; Macros
+;_____________________________________________________________________________
+;
+; Change log window verbosity (default: 3=no script)
+;
+; Example:
+; !include "FileFunc.nsh"
+; !insertmacro Locate
+; ${FILEFUNC_VERBOSE} 4 # all verbosity
+; !insertmacro VersionCompare
+; ${FILEFUNC_VERBOSE} 3 # no script
+
+!verbose push
+!verbose 3
+!ifndef _FILEFUNC_VERBOSE
+ !define _FILEFUNC_VERBOSE 3
+!endif
+!verbose ${_FILEFUNC_VERBOSE}
+!define FILEFUNC_VERBOSE `!insertmacro FILEFUNC_VERBOSE`
+!define _FILEFUNC_UN
+!verbose pop
+
+!macro FILEFUNC_VERBOSE _VERBOSE
+ !verbose push
+ !verbose 3
+ !undef _FILEFUNC_VERBOSE
+ !define _FILEFUNC_VERBOSE ${_VERBOSE}
+ !verbose 4
+ !echo `"verbosity=${_VERBOSE}"`
+ !verbose pop
+!macroend
+
+
+!macro LocateCall _PATH _OPTIONS _FUNC
+ !verbose push
+ !verbose ${_FILEFUNC_VERBOSE}
+ Push $0
+ Push `${_PATH}`
+ Push `${_OPTIONS}`
+ GetFunctionAddress $0 `${_FUNC}`
+ Push `$0`
+ Call Locate
+ Pop $0
+ !verbose pop
+!macroend
+
+!macro GetSizeCall _PATH _OPTIONS _RESULT1 _RESULT2 _RESULT3
+ !verbose push
+ !verbose ${_FILEFUNC_VERBOSE}
+ Push `${_PATH}`
+ Push `${_OPTIONS}`
+ Call GetSize
+ Pop ${_RESULT1}
+ Pop ${_RESULT2}
+ Pop ${_RESULT3}
+ !verbose pop
+!macroend
+
+!macro DriveSpaceCall _DRIVE _OPTIONS _RESULT
+ !verbose push
+ !verbose ${_FILEFUNC_VERBOSE}
+ Push `${_DRIVE}`
+ Push `${_OPTIONS}`
+ Call DriveSpace
+ Pop ${_RESULT}
+ !verbose pop
+!macroend
+
+!macro GetDrivesCall _DRV _FUNC
+ !verbose push
+ !verbose ${_FILEFUNC_VERBOSE}
+ Push $0
+ Push `${_DRV}`
+ GetFunctionAddress $0 `${_FUNC}`
+ Push `$0`
+ Call GetDrives
+ Pop $0
+ !verbose pop
+!macroend
+
+!macro GetTimeCall _FILE _OPTION _RESULT1 _RESULT2 _RESULT3 _RESULT4 _RESULT5 _RESULT6 _RESULT7
+ !verbose push
+ !verbose ${_FILEFUNC_VERBOSE}
+ Push `${_FILE}`
+ Push `${_OPTION}`
+ Call GetTime
+ Pop ${_RESULT1}
+ Pop ${_RESULT2}
+ Pop ${_RESULT3}
+ Pop ${_RESULT4}
+ Pop ${_RESULT5}
+ Pop ${_RESULT6}
+ Pop ${_RESULT7}
+ !verbose pop
+!macroend
+
+!macro GetFileAttributesCall _PATH _ATTR _RESULT
+ !verbose push
+ !verbose ${_FILEFUNC_VERBOSE}
+ Push `${_PATH}`
+ Push `${_ATTR}`
+ Call GetFileAttributes
+ Pop ${_RESULT}
+ !verbose pop
+!macroend
+
+!macro GetFileVersionCall _FILE _RESULT
+ !verbose push
+ !verbose ${_FILEFUNC_VERBOSE}
+ Push `${_FILE}`
+ Call GetFileVersion
+ Pop ${_RESULT}
+ !verbose pop
+!macroend
+
+!macro GetExeNameCall _RESULT
+ !verbose push
+ !verbose ${_FILEFUNC_VERBOSE}
+ Call GetExeName
+ Pop ${_RESULT}
+ !verbose pop
+!macroend
+
+!macro GetExePathCall _RESULT
+ !verbose push
+ !verbose ${_FILEFUNC_VERBOSE}
+ Call GetExePath
+ Pop ${_RESULT}
+ !verbose pop
+!macroend
+
+!macro GetParametersCall _RESULT
+ !verbose push
+ !verbose ${_FILEFUNC_VERBOSE}
+ Call GetParameters
+ Pop ${_RESULT}
+ !verbose pop
+!macroend
+
+!macro GetOptionsCall _PARAMETERS _OPTION _RESULT
+ !verbose push
+ !verbose ${_FILEFUNC_VERBOSE}
+ Push `${_PARAMETERS}`
+ Push `${_OPTION}`
+ Call GetOptions
+ Pop ${_RESULT}
+ !verbose pop
+!macroend
+
+!macro GetRootCall _FULLPATH _RESULT
+ !verbose push
+ !verbose ${_FILEFUNC_VERBOSE}
+ Push `${_FULLPATH}`
+ Call GetRoot
+ Pop ${_RESULT}
+ !verbose pop
+!macroend
+
+!macro GetParentCall _PATHSTRING _RESULT
+ !verbose push
+ !verbose ${_FILEFUNC_VERBOSE}
+ Push `${_PATHSTRING}`
+ Call GetParent
+ Pop ${_RESULT}
+ !verbose pop
+!macroend
+
+!macro GetFileNameCall _PATHSTRING _RESULT
+ !verbose push
+ !verbose ${_FILEFUNC_VERBOSE}
+ Push `${_PATHSTRING}`
+ Call GetFileName
+ Pop ${_RESULT}
+ !verbose pop
+!macroend
+
+!macro GetBaseNameCall _FILESTRING _RESULT
+ !verbose push
+ !verbose ${_FILEFUNC_VERBOSE}
+ Push `${_FILESTRING}`
+ Call GetBaseName
+ Pop ${_RESULT}
+ !verbose pop
+!macroend
+
+!macro GetFileExtCall _FILESTRING _RESULT
+ !verbose push
+ !verbose ${_FILEFUNC_VERBOSE}
+ Push `${_FILESTRING}`
+ Call GetFileExt
+ Pop ${_RESULT}
+ !verbose pop
+!macroend
+
+!macro BannerTrimPathCall _PATH _LENGHT _RESULT
+ !verbose push
+ !verbose ${_FILEFUNC_VERBOSE}
+ Push `${_PATH}`
+ Push `${_LENGHT}`
+ Call BannerTrimPath
+ Pop ${_RESULT}
+ !verbose pop
+!macroend
+
+!macro DirStateCall _PATH _RESULT
+ !verbose push
+ !verbose ${_FILEFUNC_VERBOSE}
+ Push `${_PATH}`
+ Call DirState
+ Pop ${_RESULT}
+ !verbose pop
+!macroend
+
+!macro RefreshShellIconsCall
+ !verbose push
+ !verbose ${_FILEFUNC_VERBOSE}
+ Call RefreshShellIcons
+ !verbose pop
+!macroend
+
+!macro Locate
+ !ifndef ${_FILEFUNC_UN}Locate
+ !verbose push
+ !verbose ${_FILEFUNC_VERBOSE}
+ !define ${_FILEFUNC_UN}Locate `!insertmacro ${_FILEFUNC_UN}LocateCall`
+
+ Function ${_FILEFUNC_UN}Locate
+ Exch $2
+ Exch
+ Exch $1
+ Exch
+ Exch 2
+ Exch $0
+ Exch 2
+ Push $3
+ Push $4
+ Push $5
+ Push $6
+ Push $7
+ Push $8
+ Push $9
+ Push $R6
+ Push $R7
+ Push $R8
+ Push $R9
+ ClearErrors
+
+ StrCpy $3 ''
+ StrCpy $4 ''
+ StrCpy $5 ''
+ StrCpy $6 ''
+ StrCpy $7 ''
+ StrCpy $8 0
+ StrCpy $R7 ''
+
+ StrCpy $R9 $0 1 -1
+ StrCmp $R9 '\' 0 +3
+ StrCpy $0 $0 -1
+ goto -3
+ IfFileExists '$0\*.*' 0 error
+
+ option:
+ StrCpy $R9 $1 1
+ StrCpy $1 $1 '' 1
+ StrCmp $R9 ' ' -2
+ StrCmp $R9 '' sizeset
+ StrCmp $R9 '/' 0 -4
+ StrCpy $9 -1
+ IntOp $9 $9 + 1
+ StrCpy $R9 $1 1 $9
+ StrCmp $R9 '' +2
+ StrCmp $R9 '/' 0 -3
+ StrCpy $R8 $1 $9
+ StrCpy $R8 $R8 '' 2
+ StrCpy $R9 $R8 '' -1
+ StrCmp $R9 ' ' 0 +3
+ StrCpy $R8 $R8 -1
+ goto -3
+ StrCpy $R9 $1 2
+ StrCpy $1 $1 '' $9
+
+ StrCmp $R9 'L=' 0 mask
+ StrCpy $3 $R8
+ StrCmp $3 '' +6
+ StrCmp $3 'FD' +5
+ StrCmp $3 'F' +4
+ StrCmp $3 'D' +3
+ StrCmp $3 'DE' +2
+ StrCmp $3 'FDE' 0 error
+ goto option
+
+ mask:
+ StrCmp $R9 'M=' 0 size
+ StrCpy $4 $R8
+ goto option
+
+ size:
+ StrCmp $R9 'S=' 0 gotosubdir
+ StrCpy $6 $R8
+ goto option
+
+ gotosubdir:
+ StrCmp $R9 'G=' 0 banner
+ StrCpy $7 $R8
+ StrCmp $7 '' +3
+ StrCmp $7 '1' +2
+ StrCmp $7 '0' 0 error
+ goto option
+
+ banner:
+ StrCmp $R9 'B=' 0 error
+ StrCpy $R7 $R8
+ StrCmp $R7 '' +3
+ StrCmp $R7 '1' +2
+ StrCmp $R7 '0' 0 error
+ goto option
+
+ sizeset:
+ StrCmp $6 '' default
+ StrCpy $9 0
+ StrCpy $R9 $6 1 $9
+ StrCmp $R9 '' +4
+ StrCmp $R9 ':' +3
+ IntOp $9 $9 + 1
+ goto -4
+ StrCpy $5 $6 $9
+ IntOp $9 $9 + 1
+ StrCpy $1 $6 1 -1
+ StrCpy $6 $6 -1 $9
+ StrCmp $5 '' +2
+ IntOp $5 $5 + 0
+ StrCmp $6 '' +2
+ IntOp $6 $6 + 0
+
+ StrCmp $1 'B' 0 +3
+ StrCpy $1 1
+ goto default
+ StrCmp $1 'K' 0 +3
+ StrCpy $1 1024
+ goto default
+ StrCmp $1 'M' 0 +3
+ StrCpy $1 1048576
+ goto default
+ StrCmp $1 'G' 0 error
+ StrCpy $1 1073741824
+
+ default:
+ StrCmp $3 '' 0 +2
+ StrCpy $3 'FD'
+ StrCmp $4 '' 0 +2
+ StrCpy $4 '*.*'
+ StrCmp $7 '' 0 +2
+ StrCpy $7 '1'
+ StrCmp $R7 '' 0 +2
+ StrCpy $R7 '0'
+ StrCpy $7 'G$7B$R7'
+
+ StrCpy $8 1
+ Push $0
+ SetDetailsPrint textonly
+
+ nextdir:
+ IntOp $8 $8 - 1
+ Pop $R8
+
+ StrCpy $9 $7 2 2
+ StrCmp $9 'B0' +3
+ GetLabelAddress $9 findfirst
+ goto call
+ DetailPrint 'Search in: $R8'
+
+ findfirst:
+ FindFirst $0 $R7 '$R8\$4'
+ IfErrors subdir
+ StrCmp $R7 '.' 0 +5
+ FindNext $0 $R7
+ StrCmp $R7 '..' 0 +3
+ FindNext $0 $R7
+ IfErrors subdir
+
+ dir:
+ IfFileExists '$R8\$R7\*.*' 0 file
+ StrCpy $R6 ''
+ StrCmp $3 'DE' +4
+ StrCmp $3 'FDE' +3
+ StrCmp $3 'FD' precall
+ StrCmp $3 'F' findnext precall
+ FindFirst $9 $R9 '$R8\$R7\*.*'
+ StrCmp $R9 '.' 0 +4
+ FindNext $9 $R9
+ StrCmp $R9 '..' 0 +2
+ FindNext $9 $R9
+ FindClose $9
+ IfErrors precall findnext
+
+ file:
+ StrCmp $3 'FDE' +3
+ StrCmp $3 'FD' +2
+ StrCmp $3 'F' 0 findnext
+ StrCpy $R6 0
+ StrCmp $5$6 '' precall
+ FileOpen $9 '$R8\$R7' r
+ IfErrors +3
+ FileSeek $9 0 END $R6
+ FileClose $9
+ System::Int64Op $R6 / $1
+ Pop $R6
+ StrCmp $5 '' +2
+ IntCmp $R6 $5 0 findnext
+ StrCmp $6 '' +2
+ IntCmp $R6 $6 0 0 findnext
+
+ precall:
+ StrCpy $9 0
+ StrCpy $R9 '$R8\$R7'
+
+ call:
+ Push $0
+ Push $1
+ Push $2
+ Push $3
+ Push $4
+ Push $5
+ Push $6
+ Push $7
+ Push $8
+ Push $9
+ Push $R7
+ Push $R8
+ StrCmp $9 0 +4
+ StrCpy $R6 ''
+ StrCpy $R7 ''
+ StrCpy $R9 ''
+ Call $2
+ Pop $R9
+ Pop $R8
+ Pop $R7
+ Pop $9
+ Pop $8
+ Pop $7
+ Pop $6
+ Pop $5
+ Pop $4
+ Pop $3
+ Pop $2
+ Pop $1
+ Pop $0
+ IfErrors error
+
+ StrCmp $R9 'StopLocate' clearstack
+ goto $9
+
+ findnext:
+ FindNext $0 $R7
+ IfErrors 0 dir
+ FindClose $0
+
+ subdir:
+ StrCpy $9 $7 2
+ StrCmp $9 'G0' end
+ FindFirst $0 $R7 '$R8\*.*'
+ StrCmp $R7 '.' 0 +5
+ FindNext $0 $R7
+ StrCmp $R7 '..' 0 +3
+ FindNext $0 $R7
+ IfErrors +7
+
+ IfFileExists '$R8\$R7\*.*' 0 +3
+ Push '$R8\$R7'
+ IntOp $8 $8 + 1
+ FindNext $0 $R7
+ IfErrors 0 -4
+ FindClose $0
+ StrCmp $8 0 end nextdir
+
+ error:
+ SetErrors
+
+ clearstack:
+ StrCmp $8 0 end
+ IntOp $8 $8 - 1
+ Pop $R8
+ goto clearstack
+
+ end:
+ SetDetailsPrint both
+ Pop $R9
+ Pop $R8
+ Pop $R7
+ Pop $R6
+ Pop $9
+ Pop $8
+ Pop $7
+ Pop $6
+ Pop $5
+ Pop $4
+ Pop $3
+ Pop $2
+ Pop $1
+ Pop $0
+ FunctionEnd
+
+ !undef _FILEFUNC_UN
+ !define _FILEFUNC_UN
+ !verbose pop
+ !endif
+!macroend
+
+!macro GetSize
+ !ifndef ${_FILEFUNC_UN}GetSize
+ !verbose push
+ !verbose ${_FILEFUNC_VERBOSE}
+ !define ${_FILEFUNC_UN}GetSize `!insertmacro ${_FILEFUNC_UN}GetSizeCall`
+
+ Function ${_FILEFUNC_UN}GetSize
+ Exch $1
+ Exch
+ Exch $0
+ Exch
+ Push $2
+ Push $3
+ Push $4
+ Push $5
+ Push $6
+ Push $7
+ Push $8
+ Push $9
+ Push $R3
+ Push $R4
+ Push $R5
+ Push $R6
+ Push $R7
+ Push $R8
+ Push $R9
+ ClearErrors
+
+ StrCpy $R9 $0 1 -1
+ StrCmp $R9 '\' 0 +3
+ StrCpy $0 $0 -1
+ goto -3
+ IfFileExists '$0\*.*' 0 error
+
+ StrCpy $3 ''
+ StrCpy $4 ''
+ StrCpy $5 ''
+ StrCpy $6 ''
+ StrCpy $8 0
+ StrCpy $R3 ''
+ StrCpy $R4 ''
+ StrCpy $R5 ''
+
+ option:
+ StrCpy $R9 $1 1
+ StrCpy $1 $1 '' 1
+ StrCmp $R9 ' ' -2
+ StrCmp $R9 '' sizeset
+ StrCmp $R9 '/' 0 -4
+
+ StrCpy $9 -1
+ IntOp $9 $9 + 1
+ StrCpy $R9 $1 1 $9
+ StrCmp $R9 '' +2
+ StrCmp $R9 '/' 0 -3
+ StrCpy $8 $1 $9
+ StrCpy $8 $8 '' 2
+ StrCpy $R9 $8 '' -1
+ StrCmp $R9 ' ' 0 +3
+ StrCpy $8 $8 -1
+ goto -3
+ StrCpy $R9 $1 2
+ StrCpy $1 $1 '' $9
+
+ StrCmp $R9 'M=' 0 size
+ StrCpy $4 $8
+ goto option
+
+ size:
+ StrCmp $R9 'S=' 0 gotosubdir
+ StrCpy $6 $8
+ goto option
+
+ gotosubdir:
+ StrCmp $R9 'G=' 0 error
+ StrCpy $7 $8
+ StrCmp $7 '' +3
+ StrCmp $7 '1' +2
+ StrCmp $7 '0' 0 error
+ goto option
+
+ sizeset:
+ StrCmp $6 '' default
+ StrCpy $9 0
+ StrCpy $R9 $6 1 $9
+ StrCmp $R9 '' +4
+ StrCmp $R9 ':' +3
+ IntOp $9 $9 + 1
+ goto -4
+ StrCpy $5 $6 $9
+ IntOp $9 $9 + 1
+ StrCpy $1 $6 1 -1
+ StrCpy $6 $6 -1 $9
+ StrCmp $5 '' +2
+ IntOp $5 $5 + 0
+ StrCmp $6 '' +2
+ IntOp $6 $6 + 0
+
+ StrCmp $1 'B' 0 +4
+ StrCpy $1 1
+ StrCpy $2 bytes
+ goto default
+ StrCmp $1 'K' 0 +4
+ StrCpy $1 1024
+ StrCpy $2 Kb
+ goto default
+ StrCmp $1 'M' 0 +4
+ StrCpy $1 1048576
+ StrCpy $2 Mb
+ goto default
+ StrCmp $1 'G' 0 error
+ StrCpy $1 1073741824
+ StrCpy $2 Gb
+
+ default:
+ StrCmp $4 '' 0 +2
+ StrCpy $4 '*.*'
+ StrCmp $7 '' 0 +2
+ StrCpy $7 '1'
+
+ StrCpy $8 1
+ Push $0
+ SetDetailsPrint textonly
+
+ nextdir:
+ IntOp $8 $8 - 1
+ Pop $R8
+ FindFirst $0 $R7 '$R8\$4'
+ IfErrors show
+ StrCmp $R7 '.' 0 +5
+ FindNext $0 $R7
+ StrCmp $R7 '..' 0 +3
+ FindNext $0 $R7
+ IfErrors show
+
+ dir:
+ IfFileExists '$R8\$R7\*.*' 0 file
+ IntOp $R5 $R5 + 1
+ goto findnext
+
+ file:
+ StrCpy $R6 0
+ StrCmp $5$6 '' 0 +3
+ IntOp $R4 $R4 + 1
+ goto findnext
+ FileOpen $9 '$R8\$R7' r
+ IfErrors +3
+ FileSeek $9 0 END $R6
+ FileClose $9
+ StrCmp $5 '' +2
+ IntCmp $R6 $5 0 findnext
+ StrCmp $6 '' +2
+ IntCmp $R6 $6 0 0 findnext
+ IntOp $R4 $R4 + 1
+ System::Int64Op $R3 + $R6
+ Pop $R3
+
+ findnext:
+ FindNext $0 $R7
+ IfErrors 0 dir
+ FindClose $0
+
+ show:
+ StrCmp $5$6 '' nosize
+ System::Int64Op $R3 / $1
+ Pop $9
+ DetailPrint 'Size:$9 $2 Files:$R4 Folders:$R5'
+ goto subdir
+ nosize:
+ DetailPrint 'Files:$R4 Folders:$R5'
+
+ subdir:
+ StrCmp $7 0 preend
+ FindFirst $0 $R7 '$R8\*.*'
+ StrCmp $R7 '.' 0 +5
+ FindNext $0 $R7
+ StrCmp $R7 '..' 0 +3
+ FindNext $0 $R7
+ IfErrors +7
+
+ IfFileExists '$R8\$R7\*.*' 0 +3
+ Push '$R8\$R7'
+ IntOp $8 $8 + 1
+ FindNext $0 $R7
+ IfErrors 0 -4
+ FindClose $0
+ StrCmp $8 0 0 nextdir
+
+ preend:
+ StrCmp $R3 '' nosizeend
+ System::Int64Op $R3 / $1
+ Pop $R3
+ nosizeend:
+ StrCpy $2 $R4
+ StrCpy $1 $R5
+ StrCpy $0 $R3
+ goto end
+
+ error:
+ SetErrors
+ StrCpy $0 ''
+ StrCpy $1 ''
+ StrCpy $2 ''
+
+ end:
+ SetDetailsPrint both
+ Pop $R9
+ Pop $R8
+ Pop $R7
+ Pop $R6
+ Pop $R5
+ Pop $R4
+ Pop $R3
+ Pop $9
+ Pop $8
+ Pop $7
+ Pop $6
+ Pop $5
+ Pop $4
+ Pop $3
+ Exch $2
+ Exch
+ Exch $1
+ Exch 2
+ Exch $0
+ FunctionEnd
+
+ !undef _FILEFUNC_UN
+ !define _FILEFUNC_UN
+ !verbose pop
+ !endif
+!macroend
+
+!macro DriveSpace
+ !ifndef ${_FILEFUNC_UN}DriveSpace
+ !verbose push
+ !verbose ${_FILEFUNC_VERBOSE}
+ !define ${_FILEFUNC_UN}DriveSpace `!insertmacro ${_FILEFUNC_UN}DriveSpaceCall`
+
+ Function ${_FILEFUNC_UN}DriveSpace
+ Exch $1
+ Exch
+ Exch $0
+ Exch
+ Push $2
+ Push $3
+ Push $4
+ Push $5
+ Push $6
+ ClearErrors
+
+ StrCpy $2 $0 1 -1
+ StrCmp $2 '\' 0 +3
+ StrCpy $0 $0 -1
+ goto -3
+ IfFileExists '$0\NUL' 0 error
+
+ StrCpy $5 ''
+ StrCpy $6 ''
+
+ option:
+ StrCpy $2 $1 1
+ StrCpy $1 $1 '' 1
+ StrCmp $2 ' ' -2
+ StrCmp $2 '' default
+ StrCmp $2 '/' 0 -4
+ StrCpy $3 -1
+ IntOp $3 $3 + 1
+ StrCpy $2 $1 1 $3
+ StrCmp $2 '' +2
+ StrCmp $2 '/' 0 -3
+ StrCpy $4 $1 $3
+ StrCpy $4 $4 '' 2
+ StrCpy $2 $4 1 -1
+ StrCmp $2 ' ' 0 +3
+ StrCpy $4 $4 -1
+ goto -3
+ StrCpy $2 $1 2
+ StrCpy $1 $1 '' $3
+
+ StrCmp $2 'D=' 0 unit
+ StrCpy $5 $4
+ StrCmp $5 '' +4
+ StrCmp $5 'T' +3
+ StrCmp $5 'O' +2
+ StrCmp $5 'F' 0 error
+ goto option
+
+ unit:
+ StrCmp $2 'S=' 0 error
+ StrCpy $6 $4
+ goto option
+
+ default:
+ StrCmp $5 '' 0 +2
+ StrCpy $5 'T'
+ StrCmp $6 '' 0 +3
+ StrCpy $6 '1'
+ goto getspace
+
+ StrCmp $6 'B' 0 +3
+ StrCpy $6 1
+ goto getspace
+ StrCmp $6 'K' 0 +3
+ StrCpy $6 1024
+ goto getspace
+ StrCmp $6 'M' 0 +3
+ StrCpy $6 1048576
+ goto getspace
+ StrCmp $6 'G' 0 error
+ StrCpy $6 1073741824
+
+ getspace:
+ System::Call 'kernel32::GetDiskFreeSpaceExA(t, *l, *l, *l)i(r0,.r2,.r3,.)'
+
+ StrCmp $5 T 0 +3
+ StrCpy $0 $3
+ goto getsize
+ StrCmp $5 O 0 +4
+ System::Int64Op $3 - $2
+ Pop $0
+ goto getsize
+ StrCmp $5 F 0 +2
+ StrCpy $0 $2
+
+ getsize:
+ System::Int64Op $0 / $6
+ Pop $0
+ goto end
+
+ error:
+ SetErrors
+ StrCpy $0 ''
+
+ end:
+ Pop $6
+ Pop $5
+ Pop $4
+ Pop $3
+ Pop $2
+ Pop $1
+ Exch $0
+ FunctionEnd
+
+ !undef _FILEFUNC_UN
+ !define _FILEFUNC_UN
+ !verbose pop
+ !endif
+!macroend
+
+
+!macro GetDrives
+ !ifndef ${_FILEFUNC_UN}GetDrives
+ !verbose push
+ !verbose ${_FILEFUNC_VERBOSE}
+ !define ${_FILEFUNC_UN}GetDrives `!insertmacro ${_FILEFUNC_UN}GetDrivesCall`
+
+ Function ${_FILEFUNC_UN}GetDrives
+ Exch $1
+ Exch
+ Exch $0
+ Exch
+ Push $2
+ Push $3
+ Push $4
+ Push $5
+ Push $8
+ Push $9
+
+ System::Alloc 1024
+ Pop $2
+
+ StrCmp $0 ALL drivestring
+ StrCmp $0 '' 0 typeset
+ StrCpy $0 ALL
+ goto drivestring
+
+ typeset:
+ StrCpy $5 -1
+ IntOp $5 $5 + 1
+ StrCpy $8 $0 1 $5
+ StrCmp $8$0 '' enumex
+ StrCmp $8 '' +2
+ StrCmp $8 '+' 0 -4
+ StrCpy $8 $0 $5
+ IntOp $5 $5 + 1
+ StrCpy $0 $0 '' $5
+
+ StrCmp $8 'FDD' 0 +3
+ StrCpy $5 2
+ goto drivestring
+ StrCmp $8 'HDD' 0 +3
+ StrCpy $5 3
+ goto drivestring
+ StrCmp $8 'NET' 0 +3
+ StrCpy $5 4
+ goto drivestring
+ StrCmp $8 'CDROM' 0 +3
+ StrCpy $5 5
+ goto drivestring
+ StrCmp $8 'RAM' 0 typeset
+ StrCpy $5 6
+
+ drivestring:
+ System::Call 'kernel32::GetLogicalDriveStringsA(i,i) i(1024,r2)'
+
+ enumok:
+ System::Call 'kernel32::lstrlenA(t) i(i r2) .r3'
+ StrCmp $3$0 '0ALL' enumex
+ StrCmp $3 0 typeset
+ System::Call 'kernel32::GetDriveTypeA(t) i (i r2) .r4'
+
+ StrCmp $0 ALL +2
+ StrCmp $4 $5 letter enumnext
+ StrCmp $4 2 0 +3
+ StrCpy $8 FDD
+ goto letter
+ StrCmp $4 3 0 +3
+ StrCpy $8 HDD
+ goto letter
+ StrCmp $4 4 0 +3
+ StrCpy $8 NET
+ goto letter
+ StrCmp $4 5 0 +3
+ StrCpy $8 CDROM
+ goto letter
+ StrCmp $4 6 0 enumex
+ StrCpy $8 RAM
+
+ letter:
+ System::Call '*$2(&t1024 .r9)'
+
+ Push $0
+ Push $1
+ Push $2
+ Push $3
+ Push $4
+ Push $5
+ Push $8
+ Call $1
+ Pop $9
+ Pop $8
+ Pop $5
+ Pop $4
+ Pop $3
+ Pop $2
+ Pop $1
+ Pop $0
+ StrCmp $9 'StopGetDrives' enumex
+
+ enumnext:
+ IntOp $2 $2 + $3
+ IntOp $2 $2 + 1
+ goto enumok
+
+ enumex:
+ System::Free $2
+
+ Pop $9
+ Pop $8
+ Pop $5
+ Pop $4
+ Pop $3
+ Pop $2
+ Pop $1
+ Pop $0
+ FunctionEnd
+
+ !undef _FILEFUNC_UN
+ !define _FILEFUNC_UN
+ !verbose pop
+ !endif
+!macroend
+
+!macro GetTime
+ !ifndef ${_FILEFUNC_UN}GetTime
+ !verbose push
+ !verbose ${_FILEFUNC_VERBOSE}
+ !define ${_FILEFUNC_UN}GetTime `!insertmacro ${_FILEFUNC_UN}GetTimeCall`
+
+ Function ${_FILEFUNC_UN}GetTime
+ Exch $1
+ Exch
+ Exch $0
+ Exch
+ Push $2
+ Push $3
+ Push $4
+ Push $5
+ Push $6
+ ClearErrors
+
+ StrCmp $1 'L' gettime
+ System::Call '*(i,l,l,l,i,i,i,i,&t260,&t14) i .r2'
+ System::Call 'kernel32::FindFirstFileA(t,i)i(r0,r2) .r3'
+ IntCmp $3 -1 error
+ System::Call 'kernel32::FindClose(i)i(r3)'
+
+ gettime:
+ System::Call '*(&i2,&i2,&i2,&i2,&i2,&i2,&i2,&i2) i .r0'
+ StrCmp $1 'L' 0 filetime
+ System::Call 'kernel32::GetLocalTime(i)i(r0)'
+ goto convert
+
+ filetime:
+ System::Call '*$2(i,l,l,l,i,i,i,i,&t260,&t14)i(,.r6,.r5,.r4)'
+ StrCmp $1 'A' 0 +3
+ StrCpy $4 $5
+ goto +5
+ StrCmp $1 'C' 0 +3
+ StrCpy $4 $6
+ goto +2
+ StrCmp $1 'M' 0 error
+ System::Call 'kernel32::FileTimeToLocalFileTime(*l,*l)i(r4,.r3)'
+ System::Call 'kernel32::FileTimeToSystemTime(*l,i)i(r3,r0)'
+
+ convert:
+ System::Call '*$0(&i2,&i2,&i2,&i2,&i2,&i2,&i2,&i2)i(.r5,.r6,.r4,.r0,.r3,.r2,.r1,)'
+
+ IntCmp $0 9 0 0 +2
+ StrCpy $0 '0$0'
+ IntCmp $1 9 0 0 +2
+ StrCpy $1 '0$1'
+ IntCmp $2 9 0 0 +2
+ StrCpy $2 '0$2'
+ IntCmp $6 9 0 0 +2
+ StrCpy $6 '0$6'
+
+ StrCmp $4 0 0 +3
+ StrCpy $4 Sunday
+ goto end
+ StrCmp $4 1 0 +3
+ StrCpy $4 Monday
+ goto end
+ StrCmp $4 2 0 +3
+ StrCpy $4 Tuesday
+ goto end
+ StrCmp $4 3 0 +3
+ StrCpy $4 Wednesday
+ goto end
+ StrCmp $4 4 0 +3
+ StrCpy $4 Thursday
+ goto end
+ StrCmp $4 5 0 +3
+ StrCpy $4 Friday
+ goto end
+ StrCmp $4 6 0 error
+ StrCpy $4 Saturday
+ goto end
+
+ error:
+ SetErrors
+ StrCpy $0 ''
+ StrCpy $1 ''
+ StrCpy $2 ''
+ StrCpy $3 ''
+ StrCpy $4 ''
+ StrCpy $5 ''
+ StrCpy $6 ''
+
+ end:
+ Exch $6
+ Exch
+ Exch $5
+ Exch 2
+ Exch $4
+ Exch 3
+ Exch $3
+ Exch 4
+ Exch $2
+ Exch 5
+ Exch $1
+ Exch 6
+ Exch $0
+ FunctionEnd
+
+ !undef _FILEFUNC_UN
+ !define _FILEFUNC_UN
+ !verbose pop
+ !endif
+!macroend
+
+!macro GetFileAttributes
+ !ifndef ${_FILEFUNC_UN}GetFileAttributes
+ !verbose push
+ !verbose ${_FILEFUNC_VERBOSE}
+ !define ${_FILEFUNC_UN}GetFileAttributes `!insertmacro ${_FILEFUNC_UN}GetFileAttributesCall`
+
+ Function ${_FILEFUNC_UN}GetFileAttributes
+ Exch $1
+ Exch
+ Exch $0
+ Exch
+ Push $2
+ Push $3
+ Push $4
+ Push $5
+
+ System::Call 'kernel32::GetFileAttributes(t r0)i .r2'
+
+ StrCmp $2 -1 error
+ StrCpy $3 ''
+
+ IntOp $0 $2 - 16384
+ IntCmp $0 0 0 +4
+ StrCpy $3 'ENCRYPTED|'
+ StrCpy $2 $0
+ StrCmp $2 0 all
+
+ IntOp $0 $2 - 8192
+ IntCmp $0 0 0 +4
+ StrCpy $3 'NOT_CONTENT_INDEXED|$3'
+ StrCpy $2 $0
+ StrCmp $2 0 all
+
+ IntOp $0 $2 - 4096
+ IntCmp $0 0 0 +4
+ StrCpy $3 'OFFLINE|$3'
+ StrCpy $2 $0
+ StrCmp $2 0 all
+
+ IntOp $0 $2 - 2048
+ IntCmp $0 0 0 +4
+ StrCpy $3 'COMPRESSED|$3'
+ StrCpy $2 $0
+ StrCmp $2 0 all
+
+ IntOp $0 $2 - 1024
+ IntCmp $0 0 0 +4
+ StrCpy $3 'REPARSE_POINT|$3'
+ StrCpy $2 $0
+ StrCmp $2 0 all
+
+ IntOp $0 $2 - 512
+ IntCmp $0 0 0 +4
+ StrCpy $3 'SPARSE_FILE|$3'
+ StrCpy $2 $0
+ StrCmp $2 0 all
+
+ IntOp $0 $2 - 256
+ IntCmp $0 0 0 +4
+ StrCpy $3 'TEMPORARY|$3'
+ StrCpy $2 $0
+ StrCmp $2 0 all
+
+ IntOp $0 $2 - 128
+ IntCmp $0 0 0 +4
+ StrCpy $3 'NORMAL|$3'
+ StrCpy $2 $0
+ StrCmp $2 0 all
+
+ IntOp $0 $2 - 64
+ IntCmp $0 0 0 +4
+ StrCpy $3 'DEVICE|$3'
+ StrCpy $2 $0
+ StrCmp $2 0 all
+
+ IntOp $0 $2 - 32
+ IntCmp $0 0 0 +4
+ StrCpy $3 'ARCHIVE|$3'
+ StrCpy $2 $0
+ StrCmp $2 0 all
+
+ IntOp $0 $2 - 16
+ IntCmp $0 0 0 +4
+ StrCpy $3 'DIRECTORY|$3'
+ StrCpy $2 $0
+ StrCmp $2 0 all
+
+ IntOp $0 $2 - 4
+ IntCmp $0 0 0 +4
+ StrCpy $3 'SYSTEM|$3'
+ StrCpy $2 $0
+ StrCmp $2 0 all
+
+ IntOp $0 $2 - 2
+ IntCmp $0 0 0 +4
+ StrCpy $3 'HIDDEN|$3'
+ StrCpy $2 $0
+ StrCmp $2 0 all
+
+ IntOp $0 $2 - 1
+ StrCpy $3 'READONLY|$3'
+
+ all:
+ StrCpy $0 $3 -1
+ StrCmp $1 '' end
+ StrCmp $1 'ALL' end
+
+ attrcmp:
+ StrCpy $5 0
+ IntOp $5 $5 + 1
+ StrCpy $4 $1 1 $5
+ StrCmp $4 '' +2
+ StrCmp $4 '|' 0 -3
+ StrCpy $2 $1 $5
+ IntOp $5 $5 + 1
+ StrCpy $1 $1 '' $5
+ StrLen $3 $2
+ StrCpy $5 -1
+ IntOp $5 $5 + 1
+ StrCpy $4 $0 $3 $5
+ StrCmp $4 '' notfound
+ StrCmp $4 $2 0 -3
+ StrCmp $1 '' 0 attrcmp
+ StrCpy $0 1
+ goto end
+
+ notfound:
+ StrCpy $0 0
+ goto end
+
+ error:
+ SetErrors
+ StrCpy $0 ''
+
+ end:
+ Pop $5
+ Pop $4
+ Pop $3
+ Pop $2
+ Pop $1
+ Exch $0
+ FunctionEnd
+
+ !undef _FILEFUNC_UN
+ !define _FILEFUNC_UN
+ !verbose pop
+ !endif
+!macroend
+
+!macro GetFileVersion
+ !ifndef ${_FILEFUNC_UN}GetFileVersion
+ !verbose push
+ !verbose ${_FILEFUNC_VERBOSE}
+ !define ${_FILEFUNC_UN}GetFileVersion `!insertmacro ${_FILEFUNC_UN}GetFileVersionCall`
+
+ Function ${_FILEFUNC_UN}GetFileVersion
+ Exch $0
+ Push $1
+ Push $2
+ Push $3
+ Push $4
+ Push $5
+ Push $6
+ ClearErrors
+
+ GetDllVersion '$0' $1 $2
+ IfErrors error
+ IntOp $3 $1 / 0x00010000
+ IntOp $4 $1 & 0x0000FFFF
+ IntOp $5 $2 / 0x00010000
+ IntOp $6 $2 & 0x0000FFFF
+ StrCpy $0 '$3.$4.$5.$6'
+ goto end
+
+ error:
+ SetErrors
+ StrCpy $0 ''
+
+ end:
+ Pop $6
+ Pop $5
+ Pop $4
+ Pop $3
+ Pop $2
+ Pop $1
+ Exch $0
+ FunctionEnd
+
+ !undef _FILEFUNC_UN
+ !define _FILEFUNC_UN
+ !verbose pop
+ !endif
+!macroend
+
+!macro GetExeName
+ !ifndef ${_FILEFUNC_UN}GetExeName
+ !verbose push
+ !verbose ${_FILEFUNC_VERBOSE}
+ !define ${_FILEFUNC_UN}GetExeName `!insertmacro ${_FILEFUNC_UN}GetExeNameCall`
+
+ Function ${_FILEFUNC_UN}GetExeName
+ Push $0
+ Push $1
+
+ StrCpy $1 $CMDLINE 1
+ StrCmp $1 '"' 0 kernel
+ StrCpy $1 0
+ IntOp $1 $1 + 1
+ StrCpy $0 $CMDLINE 1 $1
+ StrCmp $0 '"' 0 -2
+ IntOp $1 $1 - 1
+ StrCpy $0 $CMDLINE $1 1
+ goto end
+
+ kernel:
+ System::Call 'kernel32::GetModuleFileNameA(i 0, t .r0, i 1024) i r1'
+
+ end:
+ Pop $1
+ Exch $0
+ FunctionEnd
+
+ !undef _FILEFUNC_UN
+ !define _FILEFUNC_UN
+ !verbose pop
+ !endif
+!macroend
+
+!macro GetExePath
+ !ifndef ${_FILEFUNC_UN}GetExePath
+ !verbose push
+ !verbose ${_FILEFUNC_VERBOSE}
+ !define ${_FILEFUNC_UN}GetExePath `!insertmacro ${_FILEFUNC_UN}GetExePathCall`
+
+ Function ${_FILEFUNC_UN}GetExePath
+ Push $0
+ Push $1
+ Push $2
+
+ StrCpy $1 $CMDLINE 1
+ StrCmp $1 '"' 0 exedir
+ StrCpy $1 0
+ IntOp $1 $1 + 1
+ StrCpy $0 $CMDLINE 1 $1
+ StrCmp $0 '"' 0 -2
+ IntOp $1 $1 - 1
+ StrCpy $0 $CMDLINE $1 1
+
+ StrCpy $1 0
+ IntOp $1 $1 - 1
+ StrCpy $2 $0 1 $1
+ StrCmp $2 '\' 0 -2
+ StrCpy $0 $0 $1
+ goto end
+
+ exedir:
+ StrCpy $0 $EXEDIR
+
+ end:
+ Pop $2
+ Pop $1
+ Exch $0
+ FunctionEnd
+
+ !undef _FILEFUNC_UN
+ !define _FILEFUNC_UN
+ !verbose pop
+ !endif
+!macroend
+
+!macro GetParameters
+ !ifndef ${_FILEFUNC_UN}GetParameters
+ !verbose push
+ !verbose ${_FILEFUNC_VERBOSE}
+ !define ${_FILEFUNC_UN}GetParameters `!insertmacro ${_FILEFUNC_UN}GetParametersCall`
+
+ Function ${_FILEFUNC_UN}GetParameters
+ Push $0
+ Push $1
+ Push $2
+
+ StrCpy $1 1
+ StrCpy $0 $CMDLINE 1
+ StrCmp $0 '"' 0 +3
+ StrCpy $2 '"'
+ goto +2
+ StrCpy $2 ' '
+
+ IntOp $1 $1 + 1
+ StrCpy $0 $CMDLINE 1 $1
+ StrCmp $0 $2 +2
+ StrCmp $0 '' end -3
+
+ IntOp $1 $1 + 1
+ StrCpy $0 $CMDLINE 1 $1
+ StrCmp $0 ' ' -2
+ StrCpy $0 $CMDLINE '' $1
+
+ StrCpy $1 $0 1 -1
+ StrCmp $1 ' ' 0 +3
+ StrCpy $0 $0 -1
+ goto -3
+
+ end:
+ Pop $2
+ Pop $1
+ Exch $0
+ FunctionEnd
+
+ !undef _FILEFUNC_UN
+ !define _FILEFUNC_UN
+ !verbose pop
+ !endif
+!macroend
+
+!macro GetOptions
+ !ifndef ${_FILEFUNC_UN}GetOptions
+ !verbose push
+ !verbose ${_FILEFUNC_VERBOSE}
+ !define ${_FILEFUNC_UN}GetOptions `!insertmacro ${_FILEFUNC_UN}GetOptionsCall`
+
+ Function ${_FILEFUNC_UN}GetOptions
+ Exch $1
+ Exch
+ Exch $0
+ Exch
+ Push $2
+ Push $3
+ Push $4
+ Push $5
+
+ StrCpy $2 $1 '' 1
+ StrCpy $1 $1 1
+ StrLen $3 '$1$2'
+ StrCpy $4 -1
+
+ trimleft:
+ IntOp $4 $4 + 1
+ StrCpy $5 $0 $3 $4
+ StrCmp $5 '' notfound
+ StrCmp $5 '$1$2' 0 trimleft
+ IntOp $4 $4 + $3
+ StrCpy $0 $0 '' $4
+ StrCpy $4 $0 1
+ StrCmp $4 ' ' 0 +3
+ StrCpy $0 $0 '' 1
+ goto -3
+
+ StrCpy $3 ''
+ StrCpy $4 -1
+
+ trimright:
+ IntOp $4 $4 + 1
+ StrCpy $5 $0 1 $4
+ StrCmp $5 '' found
+ StrCmp $5 '"' 0 +7
+ StrCmp $3 '' 0 +3
+ StrCpy $3 '"'
+ goto trimright
+ StrCmp $3 '"' 0 +3
+ StrCpy $3 ''
+ goto trimright
+ StrCmp $5 `'` 0 +7
+ StrCmp $3 `` 0 +3
+ StrCpy $3 `'`
+ goto trimright
+ StrCmp $3 `'` 0 +3
+ StrCpy $3 ``
+ goto trimright
+ StrCmp $5 '`' 0 +7
+ StrCmp $3 '' 0 +3
+ StrCpy $3 '`'
+ goto trimright
+ StrCmp $3 '`' 0 +3
+ StrCpy $3 ''
+ goto trimright
+ StrCmp $3 '"' trimright
+ StrCmp $3 `'` trimright
+ StrCmp $3 '`' trimright
+ StrCmp $5 $1 0 trimright
+
+ found:
+ StrCpy $0 $0 $4
+ StrCpy $4 $0 1 -1
+ StrCmp $4 ' ' 0 +3
+ StrCpy $0 $0 -1
+ goto -3
+ StrCpy $3 $0 1
+ StrCpy $4 $0 1 -1
+ StrCmp $3 $4 0 end
+ StrCmp $3 '"' +3
+ StrCmp $3 `'` +2
+ StrCmp $3 '`' 0 end
+ StrCpy $0 $0 -1 1
+ goto end
+
+ notfound:
+ StrCpy $0 ''
+
+ end:
+ Pop $5
+ Pop $4
+ Pop $3
+ Pop $2
+ Pop $1
+ Exch $0
+ FunctionEnd
+
+ !undef _FILEFUNC_UN
+ !define _FILEFUNC_UN
+ !verbose pop
+ !endif
+!macroend
+
+
+!macro GetRoot
+ !ifndef ${_FILEFUNC_UN}GetRoot
+ !verbose push
+ !verbose ${_FILEFUNC_VERBOSE}
+ !define ${_FILEFUNC_UN}GetRoot `!insertmacro ${_FILEFUNC_UN}GetRootCall`
+
+ Function ${_FILEFUNC_UN}GetRoot
+ Exch $0
+ Push $1
+ Push $2
+ Push $3
+
+ StrCpy $1 $0 2
+ StrCmp $1 '\\' UNC
+ StrCpy $2 $1 1 1
+ StrCmp $2 ':' 0 empty
+ StrCpy $0 $1
+ goto end
+
+ UNC:
+ StrCpy $2 1
+ StrCpy $3 ''
+
+ loop:
+ IntOp $2 $2 + 1
+ StrCpy $1 $0 1 $2
+ StrCmp $1$3 '' empty
+ StrCmp $1 '' +5
+ StrCmp $1 '\' 0 loop
+ StrCmp $3 '1' +3
+ StrCpy $3 '1'
+ goto loop
+ StrCpy $0 $0 $2
+ StrCpy $2 $0 1 -1
+ StrCmp $2 '\' 0 end
+
+ empty:
+ StrCpy $0 ''
+
+ end:
+ Pop $3
+ Pop $2
+ Pop $1
+ Exch $0
+ FunctionEnd
+
+ !undef _FILEFUNC_UN
+ !define _FILEFUNC_UN
+ !verbose pop
+ !endif
+!macroend
+
+!macro GetParent
+ !ifndef ${_FILEFUNC_UN}GetParent
+ !verbose push
+ !verbose ${_FILEFUNC_VERBOSE}
+ !define ${_FILEFUNC_UN}GetParent `!insertmacro ${_FILEFUNC_UN}GetParentCall`
+
+ Function ${_FILEFUNC_UN}GetParent
+ Exch $0
+ Push $1
+ Push $2
+
+ StrCpy $2 $0 1 -1
+ StrCmp $2 '\' 0 +3
+ StrCpy $0 $0 -1
+ goto -3
+
+ StrCpy $1 0
+ IntOp $1 $1 - 1
+ StrCpy $2 $0 1 $1
+ StrCmp $2 '\' +2
+ StrCmp $2 '' 0 -3
+ StrCpy $0 $0 $1
+
+ Pop $2
+ Pop $1
+ Exch $0
+ FunctionEnd
+
+ !undef _FILEFUNC_UN
+ !define _FILEFUNC_UN
+ !verbose pop
+ !endif
+!macroend
+
+!macro GetFileName
+ !ifndef ${_FILEFUNC_UN}GetFileName
+ !verbose push
+ !verbose ${_FILEFUNC_VERBOSE}
+ !define ${_FILEFUNC_UN}GetFileName `!insertmacro ${_FILEFUNC_UN}GetFileNameCall`
+
+ Function ${_FILEFUNC_UN}GetFileName
+ Exch $0
+ Push $1
+ Push $2
+
+ StrCpy $2 $0 1 -1
+ StrCmp $2 '\' 0 +3
+ StrCpy $0 $0 -1
+ goto -3
+
+ StrCpy $1 0
+ IntOp $1 $1 - 1
+ StrCpy $2 $0 1 $1
+ StrCmp $2 '' end
+ StrCmp $2 '\' 0 -3
+ IntOp $1 $1 + 1
+ StrCpy $0 $0 '' $1
+
+ end:
+ Pop $2
+ Pop $1
+ Exch $0
+ FunctionEnd
+
+ !undef _FILEFUNC_UN
+ !define _FILEFUNC_UN
+ !verbose pop
+ !endif
+!macroend
+
+!macro GetBaseName
+ !ifndef ${_FILEFUNC_UN}GetBaseName
+ !verbose push
+ !verbose ${_FILEFUNC_VERBOSE}
+ !define ${_FILEFUNC_UN}GetBaseName `!insertmacro ${_FILEFUNC_UN}GetBaseNameCall`
+
+ Function ${_FILEFUNC_UN}GetBaseName
+ Exch $0
+ Push $1
+ Push $2
+ Push $3
+
+ StrCpy $1 0
+ StrCpy $3 ''
+
+ loop:
+ IntOp $1 $1 - 1
+ StrCpy $2 $0 1 $1
+ StrCmp $2 '' trimpath
+ StrCmp $2 '\' trimpath
+ StrCmp $3 'noext' loop
+ StrCmp $2 '.' 0 loop
+ StrCpy $0 $0 $1
+ StrCpy $3 'noext'
+ StrCpy $1 0
+ goto loop
+
+ trimpath:
+ StrCmp $1 -1 empty
+ IntOp $1 $1 + 1
+ StrCpy $0 $0 '' $1
+ goto end
+
+ empty:
+ StrCpy $0 ''
+
+ end:
+ Pop $3
+ Pop $2
+ Pop $1
+ Exch $0
+ FunctionEnd
+
+ !undef _FILEFUNC_UN
+ !define _FILEFUNC_UN
+ !verbose pop
+ !endif
+!macroend
+
+!macro GetFileExt
+ !ifndef ${_FILEFUNC_UN}GetFileExt
+ !verbose push
+ !verbose ${_FILEFUNC_VERBOSE}
+ !define ${_FILEFUNC_UN}GetFileExt `!insertmacro ${_FILEFUNC_UN}GetFileExtCall`
+
+ Function ${_FILEFUNC_UN}GetFileExt
+ Exch $0
+ Push $1
+ Push $2
+
+ StrCpy $1 0
+
+ loop:
+ IntOp $1 $1 - 1
+ StrCpy $2 $0 1 $1
+ StrCmp $2 '' empty
+ StrCmp $2 '\' empty
+ StrCmp $2 '.' 0 loop
+
+ StrCmp $1 -1 empty
+ IntOp $1 $1 + 1
+ StrCpy $0 $0 '' $1
+ goto end
+
+ empty:
+ StrCpy $0 ''
+
+ end:
+ Pop $2
+ Pop $1
+ Exch $0
+ FunctionEnd
+
+ !undef _FILEFUNC_UN
+ !define _FILEFUNC_UN
+ !verbose pop
+ !endif
+!macroend
+
+!macro BannerTrimPath
+ !ifndef ${_FILEFUNC_UN}BannerTrimPath
+ !verbose push
+ !verbose ${_FILEFUNC_VERBOSE}
+ !define ${_FILEFUNC_UN}BannerTrimPath `!insertmacro ${_FILEFUNC_UN}BannerTrimPathCall`
+
+ Function ${_FILEFUNC_UN}BannerTrimPath
+ Exch $1
+ Exch
+ Exch $0
+ Exch
+ Push $2
+ Push $3
+ Push $4
+
+ StrCpy $3 $1 1 -1
+ IntOp $1 $1 + 0
+ StrLen $2 $0
+ IntCmp $2 $1 end end
+ IntOp $1 $1 - 3
+ IntCmp $1 0 empty empty
+ StrCmp $3 'A' A-trim
+ StrCmp $3 'B' B-trim
+ StrCmp $3 'C' C-trim
+
+ A-trim:
+ StrCpy $3 $0 1 1
+ StrCpy $2 0
+ StrCmp $3 ':' 0 +2
+ IntOp $2 $2 + 2
+
+ loopleft:
+ IntOp $2 $2 + 1
+ StrCpy $3 $0 1 $2
+ StrCmp $2 $1 C-trim
+ StrCmp $3 '\' 0 loopleft
+ StrCpy $3 $0 $2
+ IntOp $2 $2 - $1
+ IntCmp $2 0 B-trim 0 B-trim
+
+ loopright:
+ IntOp $2 $2 + 1
+ StrCpy $4 $0 1 $2
+ StrCmp $2 0 B-trim
+ StrCmp $4 '\' 0 loopright
+ StrCpy $4 $0 '' $2
+ StrCpy $0 '$3\...$4'
+ goto end
+
+ B-trim:
+ StrCpy $2 $1
+ IntOp $2 $2 - 1
+ StrCmp $2 -1 C-trim
+ StrCpy $3 $0 1 $2
+ StrCmp $3 '\' 0 -3
+ StrCpy $0 $0 $2
+ StrCpy $0 '$0\...'
+ goto end
+
+ C-trim:
+ StrCpy $0 $0 $1
+ StrCpy $0 '$0...'
+ goto end
+
+ empty:
+ StrCpy $0 ''
+
+ end:
+ Pop $4
+ Pop $3
+ Pop $2
+ Pop $1
+ Exch $0
+ FunctionEnd
+
+ !undef _FILEFUNC_UN
+ !define _FILEFUNC_UN
+ !verbose pop
+ !endif
+!macroend
+
+!macro DirState
+ !ifndef ${_FILEFUNC_UN}DirState
+ !verbose push
+ !verbose ${_FILEFUNC_VERBOSE}
+ !define ${_FILEFUNC_UN}DirState `!insertmacro ${_FILEFUNC_UN}DirStateCall`
+
+ Function ${_FILEFUNC_UN}DirState
+ Exch $0
+ Push $1
+ ClearErrors
+
+ FindFirst $1 $0 '$0\*.*'
+ IfErrors 0 +3
+ StrCpy $0 -1
+ goto end
+ StrCmp $0 '.' 0 +4
+ FindNext $1 $0
+ StrCmp $0 '..' 0 +2
+ FindNext $1 $0
+ FindClose $1
+ IfErrors 0 +3
+ StrCpy $0 0
+ goto end
+ StrCpy $0 1
+
+ end:
+ Pop $1
+ Exch $0
+ FunctionEnd
+
+ !undef _FILEFUNC_UN
+ !define _FILEFUNC_UN
+ !verbose pop
+ !endif
+!macroend
+
+!macro RefreshShellIcons
+ !ifndef ${_FILEFUNC_UN}RefreshShellIcons
+ !verbose push
+ !verbose ${_FILEFUNC_VERBOSE}
+ !define ${_FILEFUNC_UN}RefreshShellIcons `!insertmacro ${_FILEFUNC_UN}RefreshShellIconsCall`
+
+ Function ${_FILEFUNC_UN}RefreshShellIcons
+ System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)'
+ FunctionEnd
+
+ !undef _FILEFUNC_UN
+ !define _FILEFUNC_UN
+ !verbose pop
+ !endif
+!macroend
+
+!macro un.LocateCall _PATH _OPTIONS _FUNC
+ !verbose push
+ !verbose ${_FILEFUNC_VERBOSE}
+ Push $0
+ Push `${_PATH}`
+ Push `${_OPTIONS}`
+ GetFunctionAddress $0 `${_FUNC}`
+ Push `$0`
+ Call un.Locate
+ Pop $0
+ !verbose pop
+!macroend
+
+!macro un.GetSizeCall _PATH _OPTIONS _RESULT1 _RESULT2 _RESULT3
+ !verbose push
+ !verbose ${_FILEFUNC_VERBOSE}
+ Push `${_PATH}`
+ Push `${_OPTIONS}`
+ Call un.GetSize
+ Pop ${_RESULT1}
+ Pop ${_RESULT2}
+ Pop ${_RESULT3}
+ !verbose pop
+!macroend
+
+!macro un.DriveSpaceCall _DRIVE _OPTIONS _RESULT
+ !verbose push
+ !verbose ${_FILEFUNC_VERBOSE}
+ Push `${_DRIVE}`
+ Push `${_OPTIONS}`
+ Call un.DriveSpace
+ Pop ${_RESULT}
+ !verbose pop
+!macroend
+
+!macro un.GetDrivesCall _DRV _FUNC
+ !verbose push
+ !verbose ${_FILEFUNC_VERBOSE}
+ Push $0
+ Push `${_DRV}`
+ GetFunctionAddress $0 `${_FUNC}`
+ Push `$0`
+ Call un.GetDrives
+ Pop $0
+ !verbose pop
+!macroend
+
+!macro un.GetTimeCall _FILE _OPTION _RESULT1 _RESULT2 _RESULT3 _RESULT4 _RESULT5 _RESULT6 _RESULT7
+ !verbose push
+ !verbose ${_FILEFUNC_VERBOSE}
+ Push `${_FILE}`
+ Push `${_OPTION}`
+ Call un.GetTime
+ Pop ${_RESULT1}
+ Pop ${_RESULT2}
+ Pop ${_RESULT3}
+ Pop ${_RESULT4}
+ Pop ${_RESULT5}
+ Pop ${_RESULT6}
+ Pop ${_RESULT7}
+ !verbose pop
+!macroend
+
+!macro un.GetFileAttributesCall _PATH _ATTR _RESULT
+ !verbose push
+ !verbose ${_FILEFUNC_VERBOSE}
+ Push `${_PATH}`
+ Push `${_ATTR}`
+ Call un.GetFileAttributes
+ Pop ${_RESULT}
+ !verbose pop
+!macroend
+
+!macro un.GetFileVersionCall _FILE _RESULT
+ !verbose push
+ !verbose ${_FILEFUNC_VERBOSE}
+ Push `${_FILE}`
+ Call un.GetFileVersion
+ Pop ${_RESULT}
+ !verbose pop
+!macroend
+
+!macro un.GetExeNameCall _RESULT
+ !verbose push
+ !verbose ${_FILEFUNC_VERBOSE}
+ Call un.GetExeName
+ Pop ${_RESULT}
+ !verbose pop
+!macroend
+
+!macro un.GetExePathCall _RESULT
+ !verbose push
+ !verbose ${_FILEFUNC_VERBOSE}
+ Call un.GetExePath
+ Pop ${_RESULT}
+ !verbose pop
+!macroend
+
+!macro un.GetParametersCall _RESULT
+ !verbose push
+ !verbose ${_FILEFUNC_VERBOSE}
+ Call un.GetParameters
+ Pop ${_RESULT}
+ !verbose pop
+!macroend
+
+!macro un.GetOptionsCall _PARAMETERS _OPTION _RESULT
+ !verbose push
+ !verbose ${_FILEFUNC_VERBOSE}
+ Push `${_PARAMETERS}`
+ Push `${_OPTION}`
+ Call un.GetOptions
+ Pop ${_RESULT}
+ !verbose pop
+!macroend
+
+!macro un.GetRootCall _FULLPATH _RESULT
+ !verbose push
+ !verbose ${_FILEFUNC_VERBOSE}
+ Push `${_FULLPATH}`
+ Call un.GetRoot
+ Pop ${_RESULT}
+ !verbose pop
+!macroend
+
+!macro un.GetParentCall _PATHSTRING _RESULT
+ !verbose push
+ !verbose ${_FILEFUNC_VERBOSE}
+ Push `${_PATHSTRING}`
+ Call un.GetParent
+ Pop ${_RESULT}
+ !verbose pop
+!macroend
+
+!macro un.GetFileNameCall _PATHSTRING _RESULT
+ !verbose push
+ !verbose ${_FILEFUNC_VERBOSE}
+ Push `${_PATHSTRING}`
+ Call un.GetFileName
+ Pop ${_RESULT}
+ !verbose pop
+!macroend
+
+!macro un.GetBaseNameCall _FILESTRING _RESULT
+ !verbose push
+ !verbose ${_FILEFUNC_VERBOSE}
+ Push `${_FILESTRING}`
+ Call un.GetBaseName
+ Pop ${_RESULT}
+ !verbose pop
+!macroend
+
+!macro un.GetFileExtCall _FILESTRING _RESULT
+ !verbose push
+ !verbose ${_FILEFUNC_VERBOSE}
+ Push `${_FILESTRING}`
+ Call un.GetFileExt
+ Pop ${_RESULT}
+ !verbose pop
+!macroend
+
+!macro un.BannerTrimPathCall _PATH _LENGHT _RESULT
+ !verbose push
+ !verbose ${_FILEFUNC_VERBOSE}
+ Push `${_PATH}`
+ Push `${_LENGHT}`
+ Call un.BannerTrimPath
+ Pop ${_RESULT}
+ !verbose pop
+!macroend
+
+!macro un.DirStateCall _PATH _RESULT
+ !verbose push
+ !verbose ${_FILEFUNC_VERBOSE}
+ Push `${_PATH}`
+ Call un.DirState
+ Pop ${_RESULT}
+ !verbose pop
+!macroend
+
+!macro un.RefreshShellIconsCall
+ !verbose push
+ !verbose ${_FILEFUNC_VERBOSE}
+ Call un.RefreshShellIcons
+ !verbose pop
+!macroend
+
+!macro un.Locate
+ !ifndef un.Locate
+ !verbose push
+ !verbose ${_FILEFUNC_VERBOSE}
+ !undef _FILEFUNC_UN
+ !define _FILEFUNC_UN `un.`
+
+ !insertmacro Locate
+
+ !verbose pop
+ !endif
+!macroend
+
+!macro un.GetSize
+ !ifndef un.GetSize
+ !verbose push
+ !verbose ${_FILEFUNC_VERBOSE}
+ !undef _FILEFUNC_UN
+ !define _FILEFUNC_UN `un.`
+
+ !insertmacro GetSize
+
+ !verbose pop
+ !endif
+!macroend
+
+!macro un.DriveSpace
+ !ifndef un.DriveSpace
+ !verbose push
+ !verbose ${_FILEFUNC_VERBOSE}
+ !undef _FILEFUNC_UN
+ !define _FILEFUNC_UN `un.`
+
+ !insertmacro DriveSpace
+
+ !verbose pop
+ !endif
+!macroend
+
+!macro un.GetDrives
+ !ifndef un.GetDrives
+ !verbose push
+ !verbose ${_FILEFUNC_VERBOSE}
+ !undef _FILEFUNC_UN
+ !define _FILEFUNC_UN `un.`
+
+ !insertmacro GetDrives
+
+ !verbose pop
+ !endif
+!macroend
+
+!macro un.GetTime
+ !ifndef un.GetTime
+ !verbose push
+ !verbose ${_FILEFUNC_VERBOSE}
+ !undef _FILEFUNC_UN
+ !define _FILEFUNC_UN `un.`
+
+ !insertmacro GetTime
+
+ !verbose pop
+ !endif
+!macroend
+
+!macro un.GetFileAttributes
+ !ifndef un.GetFileAttributes
+ !verbose push
+ !verbose ${_FILEFUNC_VERBOSE}
+ !undef _FILEFUNC_UN
+ !define _FILEFUNC_UN `un.`
+
+ !insertmacro GetFileAttributes
+
+ !verbose pop
+ !endif
+!macroend
+
+!macro un.GetFileVersion
+ !ifndef un.GetFileVersion
+ !verbose push
+ !verbose ${_FILEFUNC_VERBOSE}
+ !undef _FILEFUNC_UN
+ !define _FILEFUNC_UN `un.`
+
+ !insertmacro GetFileVersion
+
+ !verbose pop
+ !endif
+!macroend
+
+!macro un.GetExeName
+ !ifndef un.GetExeName
+ !verbose push
+ !verbose ${_FILEFUNC_VERBOSE}
+ !undef _FILEFUNC_UN
+ !define _FILEFUNC_UN `un.`
+
+ !insertmacro GetExeName
+
+ !verbose pop
+ !endif
+!macroend
+
+!macro un.GetExePath
+ !ifndef un.GetExePath
+ !verbose push
+ !verbose ${_FILEFUNC_VERBOSE}
+ !undef _FILEFUNC_UN
+ !define _FILEFUNC_UN `un.`
+
+ !insertmacro GetExePath
+
+ !verbose pop
+ !endif
+!macroend
+
+!macro un.GetParameters
+ !ifndef un.GetParameters
+ !verbose push
+ !verbose ${_FILEFUNC_VERBOSE}
+ !undef _FILEFUNC_UN
+ !define _FILEFUNC_UN `un.`
+
+ !insertmacro GetParameters
+
+ !verbose pop
+ !endif
+!macroend
+
+!macro un.GetOptions
+ !ifndef un.GetOptions
+ !verbose push
+ !verbose ${_FILEFUNC_VERBOSE}
+ !undef _FILEFUNC_UN
+ !define _FILEFUNC_UN `un.`
+
+ !insertmacro GetOptions
+
+ !verbose pop
+ !endif
+!macroend
+
+!macro un.GetRoot
+ !ifndef un.GetRoot
+ !verbose push
+ !verbose ${_FILEFUNC_VERBOSE}
+ !undef _FILEFUNC_UN
+ !define _FILEFUNC_UN `un.`
+
+ !insertmacro GetRoot
+
+ !verbose pop
+ !endif
+!macroend
+
+!macro un.GetParent
+ !ifndef un.GetParent
+ !verbose push
+ !verbose ${_FILEFUNC_VERBOSE}
+ !undef _FILEFUNC_UN
+ !define _FILEFUNC_UN `un.`
+
+ !insertmacro GetParent
+
+ !verbose pop
+ !endif
+!macroend
+
+!macro un.GetFileName
+ !ifndef un.GetFileName
+ !verbose push
+ !verbose ${_FILEFUNC_VERBOSE}
+ !undef _FILEFUNC_UN
+ !define _FILEFUNC_UN `un.`
+
+ !insertmacro GetFileName
+
+ !verbose pop
+ !endif
+!macroend
+
+!macro un.GetBaseName
+ !ifndef un.GetBaseName
+ !verbose push
+ !verbose ${_FILEFUNC_VERBOSE}
+ !undef _FILEFUNC_UN
+ !define _FILEFUNC_UN `un.`
+
+ !insertmacro GetBaseName
+
+ !verbose pop
+ !endif
+!macroend
+
+!macro un.GetFileExt
+ !ifndef un.GetFileExt
+ !verbose push
+ !verbose ${_FILEFUNC_VERBOSE}
+ !undef _FILEFUNC_UN
+ !define _FILEFUNC_UN `un.`
+
+ !insertmacro GetFileExt
+
+ !verbose pop
+ !endif
+!macroend
+
+!macro un.BannerTrimPath
+ !ifndef un.BannerTrimPath
+ !verbose push
+ !verbose ${_FILEFUNC_VERBOSE}
+ !undef _FILEFUNC_UN
+ !define _FILEFUNC_UN `un.`
+
+ !insertmacro BannerTrimPath
+
+ !verbose pop
+ !endif
+!macroend
+
+!macro un.DirState
+ !ifndef un.DirState
+ !verbose push
+ !verbose ${_FILEFUNC_VERBOSE}
+ !undef _FILEFUNC_UN
+ !define _FILEFUNC_UN `un.`
+
+ !insertmacro DirState
+
+ !verbose pop
+ !endif
+!macroend
+
+!macro un.RefreshShellIcons
+ !ifndef un.RefreshShellIcons
+ !verbose push
+ !verbose ${_FILEFUNC_VERBOSE}
+ !undef _FILEFUNC_UN
+ !define _FILEFUNC_UN `un.`
+
+ !insertmacro RefreshShellIcons
+
+ !verbose pop
+ !endif
+!macroend
diff --git a/Include/TextFunc.nsh b/Include/TextFunc.nsh
new file mode 100644
index 00000000..befbbf93
--- /dev/null
+++ b/Include/TextFunc.nsh
@@ -0,0 +1,1298 @@
+/*
+_____________________________________________________________________________
+
+ Text Functions Header v2.1
+_____________________________________________________________________________
+
+ 2005 Shengalts Aleksander aka Instructor (Shengalts@mail.ru)
+
+ See documentation for more information about the following functions.
+
+ Usage in script:
+ 1. !include "TextFunc.nsh"
+ 2. !insertmacro TextFunction
+ 3. [Section|Function]
+ ${TextFunction} "File" "..." $var
+ [SectionEnd|FunctionEnd]
+
+
+ TextFunction=[LineFind|LineRead|FileReadFromEnd|LineSum|FileJoin|
+ TextCompare|ConfigRead|ConfigWrite|FileRecode|TrimNewLines]
+
+ un.TextFunction=[un.LineFind|un.LineRead|un.FileReadFromEnd|un.LineSum|
+ un.FileJoin|un.TextCompare|un.ConfigRead|un.ConfigWrite|
+ un.FileRecode|un.TrimNewLines]
+
+
+_____________________________________________________________________________
+
+ Thanks to:
+_____________________________________________________________________________
+
+LineRead
+ Afrow UK (Based on his idea of Function "ReadFileLine")
+LineSum
+ Afrow UK (Based on his idea of Function "LineCount")
+FileJoin
+ Afrow UK (Based on his idea of Function "JoinFiles")
+TrimNewLines
+ sunjammer (Based on his Function "TrimNewLines")
+*/
+
+
+;_____________________________________________________________________________
+;
+; Macros
+;_____________________________________________________________________________
+;
+; Change log window verbosity (default: 3=no script)
+;
+; Example:
+; !include "TextFunc.nsh"
+; !insertmacro LineFind
+; ${TEXTFUNC_VERBOSE} 4 # all verbosity
+; !insertmacro LineSum
+; ${TEXTFUNC_VERBOSE} 3 # no script
+
+!verbose push
+!verbose 3
+!ifndef _TEXTFUNC_VERBOSE
+ !define _TEXTFUNC_VERBOSE 3
+!endif
+!verbose ${_TEXTFUNC_VERBOSE}
+!define TEXTFUNC_VERBOSE `!insertmacro TEXTFUNC_VERBOSE`
+!define _TEXTFUNC_UN
+!verbose pop
+
+!macro TEXTFUNC_VERBOSE _VERBOSE
+ !verbose push
+ !verbose 3
+ !undef _TEXTFUNC_VERBOSE
+ !define _TEXTFUNC_VERBOSE ${_VERBOSE}
+ !verbose 4
+ !echo `"verbosity=${_VERBOSE}"`
+ !verbose pop
+!macroend
+
+
+!macro LineFindCall _INPUT _OUTPUT _RANGE _FUNC
+ !verbose push
+ !verbose ${_TEXTFUNC_VERBOSE}
+ Push $0
+ Push `${_INPUT}`
+ Push `${_OUTPUT}`
+ Push `${_RANGE}`
+ GetFunctionAddress $0 `${_FUNC}`
+ Push `$0`
+ Call LineFind
+ Pop $0
+ !verbose pop
+!macroend
+
+!macro LineReadCall _FILE _NUMBER _RESULT
+ !verbose push
+ !verbose ${_TEXTFUNC_VERBOSE}
+ Push `${_FILE}`
+ Push `${_NUMBER}`
+ Call LineRead
+ Pop ${_RESULT}
+ !verbose pop
+!macroend
+
+!macro FileReadFromEndCall _FILE _FUNC
+ !verbose push
+ !verbose ${_TEXTFUNC_VERBOSE}
+ Push $0
+ Push `${_FILE}`
+ GetFunctionAddress $0 `${_FUNC}`
+ Push `$0`
+ Call FileReadFromEnd
+ Pop $0
+ !verbose pop
+!macroend
+
+!macro LineSumCall _FILE _RESULT
+ !verbose push
+ !verbose ${_TEXTFUNC_VERBOSE}
+ Push `${_FILE}`
+ Call LineSum
+ Pop ${_RESULT}
+ !verbose pop
+!macroend
+
+!macro FileJoinCall _FILE1 _FILE2 _FILE3
+ !verbose push
+ !verbose ${_TEXTFUNC_VERBOSE}
+ Push `${_FILE1}`
+ Push `${_FILE2}`
+ Push `${_FILE3}`
+ Call FileJoin
+ !verbose pop
+!macroend
+
+!macro TextCompareCall _FILE1 _FILE2 _OPTION _FUNC
+ !verbose push
+ !verbose ${_TEXTFUNC_VERBOSE}
+ Push $0
+ Push `${_FILE1}`
+ Push `${_FILE2}`
+ Push `${_OPTION}`
+ GetFunctionAddress $0 `${_FUNC}`
+ Push `$0`
+ Call TextCompare
+ Pop $0
+ !verbose pop
+!macroend
+
+!macro ConfigReadCall _FILE _ENTRY _RESULT
+ !verbose push
+ !verbose ${_TEXTFUNC_VERBOSE}
+ Push `${_FILE}`
+ Push `${_ENTRY}`
+ Call ConfigRead
+ Pop ${_RESULT}
+ !verbose pop
+!macroend
+
+!macro ConfigWriteCall _FILE _ENTRY _VALUE _RESULT
+ !verbose push
+ !verbose ${_TEXTFUNC_VERBOSE}
+ Push `${_FILE}`
+ Push `${_ENTRY}`
+ Push `${_VALUE}`
+ Call ConfigWrite
+ Pop ${_RESULT}
+ !verbose pop
+!macroend
+
+!macro FileRecodeCall _FILE _FORMAT
+ !verbose push
+ !verbose ${_TEXTFUNC_VERBOSE}
+ Push `${_FILE}`
+ Push `${_FORMAT}`
+ Call FileRecode
+ !verbose pop
+!macroend
+
+!macro TrimNewLinesCall _FILE _RESULT
+ !verbose push
+ !verbose ${_TEXTFUNC_VERBOSE}
+ Push `${_FILE}`
+ Call TrimNewLines
+ Pop ${_RESULT}
+ !verbose pop
+!macroend
+
+!macro LineFind
+ !ifndef ${_TEXTFUNC_UN}LineFind
+ !verbose push
+ !verbose ${_TEXTFUNC_VERBOSE}
+ !define ${_TEXTFUNC_UN}LineFind `!insertmacro ${_TEXTFUNC_UN}LineFindCall`
+
+ Function ${_TEXTFUNC_UN}LineFind
+ Exch $3
+ Exch
+ Exch $2
+ Exch
+ Exch 2
+ Exch $1
+ Exch 2
+ Exch 3
+ Exch $0
+ Exch 3
+ Push $4
+ Push $5
+ Push $6
+ Push $7
+ Push $8
+ Push $9
+ Push $R4
+ Push $R5
+ Push $R6
+ Push $R7
+ Push $R8
+ Push $R9
+ ClearErrors
+
+ IfFileExists '$0' 0 error
+ StrCmp $1 '/NUL' begin
+ StrCpy $8 0
+ IntOp $8 $8 - 1
+ StrCpy $9 $1 1 $8
+ StrCmp $9 \ +2
+ StrCmp $9 '' +3 -3
+ StrCpy $9 $1 $8
+ IfFileExists '$9\*.*' 0 error
+
+ begin:
+ StrCpy $4 1
+ StrCpy $5 -1
+ StrCpy $6 0
+ StrCpy $7 0
+ StrCpy $R4 ''
+ StrCpy $R6 ''
+ StrCpy $R7 ''
+ StrCpy $R8 0
+
+ StrCpy $8 $2 1
+ StrCmp $8 '{' 0 delspaces
+ StrCpy $2 $2 '' 1
+ StrCpy $8 $2 1 -1
+ StrCmp $8 '}' 0 delspaces
+ StrCpy $2 $2 -1
+ StrCpy $R6 cut
+
+ delspaces:
+ StrCpy $8 $2 1
+ StrCmp $8 ' ' 0 +3
+ StrCpy $2 $2 '' 1
+ goto -3
+ StrCmp $2$7 '0' file
+ StrCpy $4 ''
+ StrCpy $5 ''
+ StrCmp $2 '' writechk
+
+ range:
+ StrCpy $8 0
+ StrCpy $9 $2 1 $8
+ StrCmp $9 '' +5
+ StrCmp $9 ' ' +4
+ StrCmp $9 ':' +3
+ IntOp $8 $8 + 1
+ goto -5
+ StrCpy $5 $2 $8
+ IntOp $5 $5 + 0
+ IntOp $8 $8 + 1
+ StrCpy $2 $2 '' $8
+ StrCmp $4 '' 0 +2
+ StrCpy $4 $5
+ StrCmp $9 ':' range
+
+ IntCmp $4 0 0 +2
+ IntCmp $5 -1 goto 0 growthcmp
+ StrCmp $R7 '' 0 minus2plus
+ StrCpy $R7 0
+ FileOpen $8 $0 r
+ FileRead $8 $9
+ IfErrors +3
+ IntOp $R7 $R7 + 1
+ Goto -3
+ FileClose $8
+
+ minus2plus:
+ IntCmp $4 0 +5 0 +5
+ IntOp $4 $R7 + $4
+ IntOp $4 $4 + 1
+ IntCmp $4 0 +2 0 +2
+ StrCpy $4 0
+ IntCmp $5 -1 goto 0 growthcmp
+ IntOp $5 $R7 + $5
+ IntOp $5 $5 + 1
+ growthcmp:
+ IntCmp $4 $5 goto goto
+ StrCpy $5 $4
+ goto:
+ goto $7
+
+ file:
+ StrCmp $1 '/NUL' +4
+ GetTempFileName $R4
+ Push $R4
+ FileOpen $R4 $R4 w
+ FileOpen $R5 $0 r
+ IfErrors preerror
+
+ loop:
+ IntOp $R8 $R8 + 1
+ FileRead $R5 $R9
+ IfErrors handleclose
+
+ cmp:
+ StrCmp $2$4$5 '' writechk
+ IntCmp $4 $R8 call 0 writechk
+ StrCmp $5 -1 call
+ IntCmp $5 $R8 call 0 call
+
+ GetLabelAddress $7 cmp
+ goto delspaces
+
+ call:
+ StrCpy $7 $R9
+ Push $0
+ Push $1
+ Push $2
+ Push $3
+ Push $4
+ Push $5
+ Push $6
+ Push $7
+ Push $R4
+ Push $R5
+ Push $R6
+ Push $R7
+ Push $R8
+ StrCpy $R6 '$4:$5'
+ StrCmp $R7 '' +3
+ IntOp $R7 $R8 - $R7
+ IntOp $R7 $R7 - 1
+ Call $3
+ Pop $9
+ Pop $R8
+ Pop $R7
+ Pop $R6
+ Pop $R5
+ Pop $R4
+ Pop $7
+ Pop $6
+ Pop $5
+ Pop $4
+ Pop $3
+ Pop $2
+ Pop $1
+ Pop $0
+ IfErrors preerror
+ StrCmp $9 'StopLineFind' 0 +3
+ IntOp $6 $6 + 1
+ goto handleclose
+ StrCmp $1 '/NUL' loop
+ StrCmp $9 'SkipWrite' 0 +3
+ IntOp $6 $6 + 1
+ goto loop
+ StrCmp $7 $R9 write
+ IntOp $6 $6 + 1
+ goto write
+
+ writechk:
+ StrCmp $1 '/NUL' loop
+ StrCmp $R6 cut 0 write
+ IntOp $6 $6 + 1
+ goto loop
+
+ write:
+ FileWrite $R4 $R9
+ goto loop
+
+ preerror:
+ SetErrors
+
+ handleclose:
+ StrCmp $1 '/NUL' +3
+ FileClose $R4
+ Pop $R4
+ FileClose $R5
+ IfErrors error
+
+ StrCmp $1 '/NUL' end
+ StrCmp $1 '' 0 +2
+ StrCpy $1 $0
+ StrCmp $6 0 0 rename
+ FileOpen $7 $0 r
+ FileSeek $7 0 END $8
+ FileClose $7
+ FileOpen $7 $R4 r
+ FileSeek $7 0 END $9
+ FileClose $7
+ IntCmp $8 $9 0 rename
+ Delete $R4
+ StrCmp $1 $0 end
+ CopyFiles /SILENT $0 $1
+ goto end
+
+ rename:
+ Delete '$EXEDIR\$1'
+ Rename $R4 '$EXEDIR\$1'
+ IfErrors 0 end
+ Delete $1
+ Rename $R4 $1
+ IfErrors 0 end
+
+ error:
+ SetErrors
+
+ end:
+ Pop $R9
+ Pop $R8
+ Pop $R7
+ Pop $R6
+ Pop $R5
+ Pop $R4
+ Pop $9
+ Pop $8
+ Pop $7
+ Pop $6
+ Pop $5
+ Pop $4
+ Pop $3
+ Pop $2
+ Pop $1
+ Pop $0
+ FunctionEnd
+
+ !undef _TEXTFUNC_UN
+ !define _TEXTFUNC_UN
+ !verbose pop
+ !endif
+!macroend
+
+!macro LineRead
+ !ifndef ${_TEXTFUNC_UN}LineRead
+ !verbose push
+ !verbose ${_TEXTFUNC_VERBOSE}
+ !define ${_TEXTFUNC_UN}LineRead `!insertmacro ${_TEXTFUNC_UN}LineReadCall`
+
+ Function ${_TEXTFUNC_UN}LineRead
+ Exch $1
+ Exch
+ Exch $0
+ Exch
+ Push $2
+ Push $3
+ Push $4
+ ClearErrors
+
+ IfFileExists $0 0 error
+ IntOp $1 $1 + 0
+ IntCmp $1 0 error 0 plus
+ StrCpy $4 0
+ FileOpen $2 $0 r
+ IfErrors error
+ FileRead $2 $3
+ IfErrors +3
+ IntOp $4 $4 + 1
+ Goto -3
+ FileClose $2
+ IntOp $1 $4 + $1
+ IntOp $1 $1 + 1
+ IntCmp $1 0 error error
+
+ plus:
+ FileOpen $2 $0 r
+ IfErrors error
+ StrCpy $3 0
+ IntOp $3 $3 + 1
+ FileRead $2 $0
+ IfErrors +4
+ StrCmp $3 $1 0 -3
+ FileClose $2
+ goto end
+ FileClose $2
+
+ error:
+ SetErrors
+ StrCpy $0 ''
+
+ end:
+ Pop $4
+ Pop $3
+ Pop $2
+ Pop $1
+ Exch $0
+ FunctionEnd
+
+ !undef _TEXTFUNC_UN
+ !define _TEXTFUNC_UN
+ !verbose pop
+ !endif
+!macroend
+
+!macro FileReadFromEnd
+ !ifndef ${_TEXTFUNC_UN}FileReadFromEnd
+ !verbose push
+ !verbose ${_TEXTFUNC_VERBOSE}
+ !define ${_TEXTFUNC_UN}FileReadFromEnd `!insertmacro ${_TEXTFUNC_UN}FileReadFromEndCall`
+
+ Function ${_TEXTFUNC_UN}FileReadFromEnd
+ Exch $1
+ Exch
+ Exch $0
+ Exch
+ Push $7
+ Push $8
+ Push $9
+ ClearErrors
+
+ StrCpy $7 -1
+ StrCpy $8 0
+ IfFileExists $0 0 error
+ FileOpen $0 $0 r
+ IfErrors error
+ FileRead $0 $9
+ IfErrors +4
+ Push $9
+ IntOp $8 $8 + 1
+ goto -4
+ FileClose $0
+
+ nextline:
+ StrCmp $8 0 end
+ Pop $9
+ Push $1
+ Push $7
+ Push $8
+ Call $1
+ Pop $0
+ Pop $8
+ Pop $7
+ Pop $1
+ IntOp $7 $7 - 1
+ IntOp $8 $8 - 1
+ IfErrors error
+ StrCmp $0 'StopFileReadFromEnd' clearstack nextline
+
+ error:
+ SetErrors
+
+ clearstack:
+ StrCmp $8 0 end
+ Pop $9
+ IntOp $8 $8 - 1
+ goto clearstack
+
+ end:
+ Pop $9
+ Pop $8
+ Pop $7
+ Pop $1
+ Pop $0
+ FunctionEnd
+
+ !undef _TEXTFUNC_UN
+ !define _TEXTFUNC_UN
+ !verbose pop
+ !endif
+!macroend
+
+!macro LineSum
+ !ifndef ${_TEXTFUNC_UN}LineSum
+ !verbose push
+ !verbose ${_TEXTFUNC_VERBOSE}
+ !define ${_TEXTFUNC_UN}LineSum `!insertmacro ${_TEXTFUNC_UN}LineSumCall`
+
+ Function ${_TEXTFUNC_UN}LineSum
+ Exch $0
+ Push $1
+ Push $2
+ ClearErrors
+
+ IfFileExists $0 0 error
+ StrCpy $2 0
+ FileOpen $0 $0 r
+ IfErrors error
+ FileRead $0 $1
+ IfErrors +3
+ IntOp $2 $2 + 1
+ Goto -3
+ FileClose $0
+ StrCpy $0 $2
+ goto end
+
+ error:
+ SetErrors
+ StrCpy $0 ''
+
+ end:
+ Pop $2
+ Pop $1
+ Exch $0
+ FunctionEnd
+
+ !undef _TEXTFUNC_UN
+ !define _TEXTFUNC_UN
+ !verbose pop
+ !endif
+!macroend
+
+!macro FileJoin
+ !ifndef ${_TEXTFUNC_UN}FileJoin
+ !verbose push
+ !verbose ${_TEXTFUNC_VERBOSE}
+ !define ${_TEXTFUNC_UN}FileJoin `!insertmacro ${_TEXTFUNC_UN}FileJoinCall`
+
+ Function ${_TEXTFUNC_UN}FileJoin
+ Exch $2
+ Exch
+ Exch $1
+ Exch
+ Exch 2
+ Exch $0
+ Exch 2
+ Push $3
+ Push $4
+ Push $5
+ ClearErrors
+
+ IfFileExists $0 0 error
+ IfFileExists $1 0 error
+ StrCpy $3 0
+ IntOp $3 $3 - 1
+ StrCpy $4 $2 1 $3
+ StrCmp $4 \ +2
+ StrCmp $4 '' +3 -3
+ StrCpy $4 $2 $3
+ IfFileExists '$4\*.*' 0 error
+
+ StrCmp $2 $0 0 +2
+ StrCpy $2 ''
+ StrCmp $2 '' 0 +3
+ StrCpy $4 $0
+ goto +3
+ GetTempFileName $4
+ CopyFiles /SILENT $0 $4
+ FileOpen $3 $4 a
+ IfErrors error
+ FileSeek $3 -1 END
+ FileRead $3 $5
+ StrCmp $5 '$\r' +3
+ StrCmp $5 '$\n' +2
+ FileWrite $3 '$\r$\n'
+
+ ;FileWrite $3 '$\r$\n--Divider--$\r$\n'
+
+ FileOpen $0 $1 r
+ IfErrors error
+ FileRead $0 $5
+ IfErrors +3
+ FileWrite $3 $5
+ goto -3
+ FileClose $0
+ FileClose $3
+ StrCmp $2 '' end
+ Delete '$EXEDIR\$2'
+ Rename $4 '$EXEDIR\$2'
+ IfErrors 0 end
+ Delete $2
+ Rename $4 $2
+ IfErrors 0 end
+
+ error:
+ SetErrors
+
+ end:
+ Pop $5
+ Pop $4
+ Pop $3
+ Pop $2
+ Pop $1
+ Pop $0
+ FunctionEnd
+
+ !undef _TEXTFUNC_UN
+ !define _TEXTFUNC_UN
+ !verbose pop
+ !endif
+!macroend
+
+!macro TextCompare
+ !ifndef ${_TEXTFUNC_UN}TextCompare
+ !verbose push
+ !verbose ${_TEXTFUNC_VERBOSE}
+ !define ${_TEXTFUNC_UN}TextCompare `!insertmacro ${_TEXTFUNC_UN}TextCompareCall`
+
+ Function ${_TEXTFUNC_UN}TextCompare
+ Exch $3
+ Exch
+ Exch $2
+ Exch
+ Exch 2
+ Exch $1
+ Exch 2
+ Exch 3
+ Exch $0
+ Exch 3
+ Push $4
+ Push $5
+ Push $6
+ Push $7
+ Push $8
+ Push $9
+ ClearErrors
+
+ IfFileExists $0 0 error
+ IfFileExists $1 0 error
+ StrCmp $2 'FastDiff' +5
+ StrCmp $2 'FastEqual' +4
+ StrCmp $2 'SlowDiff' +3
+ StrCmp $2 'SlowEqual' +2
+ goto error
+
+ FileOpen $4 $0 r
+ IfErrors error
+ FileOpen $5 $1 r
+ IfErrors error
+ SetDetailsPrint textonly
+
+ StrCpy $6 0
+ StrCpy $8 0
+
+ nextline:
+ StrCmp $4 '' fast
+ IntOp $8 $8 + 1
+ FileRead $4 $9
+ IfErrors 0 +4
+ FileClose $4
+ StrCpy $4 ''
+ StrCmp $5 '' end
+ StrCmp $2 'FastDiff' fast
+ StrCmp $2 'FastEqual' fast slow
+
+ fast:
+ StrCmp $5 '' call
+ IntOp $6 $6 + 1
+ FileRead $5 $7
+ IfErrors 0 +5
+ FileClose $5
+ StrCpy $5 ''
+ StrCmp $4 '' end
+ StrCmp $2 'FastDiff' call close
+ StrCmp $2 'FastDiff' 0 +2
+ StrCmp $7 $9 nextline call
+ StrCmp $7 $9 call nextline
+
+ slow:
+ StrCmp $4 '' close
+ StrCpy $6 ''
+ DetailPrint '$8. $9'
+ FileSeek $5 0
+
+ slownext:
+ FileRead $5 $7
+ IfErrors 0 +2
+ StrCmp $2 'SlowDiff' call nextline
+ StrCmp $2 'SlowDiff' 0 +2
+ StrCmp $7 $9 nextline slownext
+ IntOp $6 $6 + 1
+ StrCmp $7 $9 0 slownext
+
+ call:
+ Push $2
+ Push $3
+ Push $4
+ Push $5
+ Push $6
+ Push $7
+ Push $8
+ Push $9
+ Call $3
+ Pop $0
+ Pop $9
+ Pop $8
+ Pop $7
+ Pop $6
+ Pop $5
+ Pop $4
+ Pop $3
+ Pop $2
+ StrCmp $0 'StopTextCompare' 0 nextline
+
+ close:
+ FileClose $4
+ FileClose $5
+ goto end
+
+ error:
+ SetErrors
+
+ end:
+ SetDetailsPrint both
+ Pop $9
+ Pop $8
+ Pop $7
+ Pop $6
+ Pop $5
+ Pop $4
+ Pop $3
+ Pop $2
+ Pop $1
+ Pop $0
+ FunctionEnd
+
+ !undef _TEXTFUNC_UN
+ !define _TEXTFUNC_UN
+ !verbose pop
+ !endif
+!macroend
+
+!macro ConfigRead
+ !ifndef ${_TEXTFUNC_UN}ConfigRead
+ !verbose push
+ !verbose ${_TEXTFUNC_VERBOSE}
+ !define ${_TEXTFUNC_UN}ConfigRead `!insertmacro ${_TEXTFUNC_UN}ConfigReadCall`
+
+ Function ${_TEXTFUNC_UN}ConfigRead
+ Exch $1
+ Exch
+ Exch $0
+ Exch
+ Push $2
+ Push $3
+ Push $4
+ ClearErrors
+
+ FileOpen $2 $0 r
+ IfErrors error
+ StrLen $0 $1
+ StrCmp $0 0 error
+
+ readnext:
+ FileRead $2 $3
+ IfErrors empty
+ StrCpy $4 $3 $0
+ StrCmp $4 $1 0 readnext
+ StrCpy $0 $3 '' $0
+ StrCpy $4 $0 1 -1
+ StrCmp $4 '$\r' +2
+ StrCmp $4 '$\n' 0 close
+ StrCpy $0 $0 -1
+ goto -4
+
+ error:
+ SetErrors
+
+ empty:
+ StrCpy $0 ''
+
+ close:
+ FileClose $2
+
+ Pop $4
+ Pop $3
+ Pop $2
+ Pop $1
+ Exch $0
+ FunctionEnd
+
+ !undef _TEXTFUNC_UN
+ !define _TEXTFUNC_UN
+ !verbose pop
+ !endif
+!macroend
+
+!macro ConfigWrite
+ !ifndef ${_TEXTFUNC_UN}ConfigWrite
+ !verbose push
+ !verbose ${_TEXTFUNC_VERBOSE}
+ !define ${_TEXTFUNC_UN}ConfigWrite `!insertmacro ${_TEXTFUNC_UN}ConfigWriteCall`
+
+ Function ${_TEXTFUNC_UN}ConfigWrite
+ Exch $2
+ Exch
+ Exch $1
+ Exch
+ Exch 2
+ Exch $0
+ Exch 2
+ Push $3
+ Push $4
+ Push $5
+ Push $6
+ ClearErrors
+
+ IfFileExists $0 0 error
+ FileOpen $3 $0 a
+ IfErrors error
+
+ StrLen $0 $1
+ StrCmp $0 0 0 readnext
+ StrCpy $0 ''
+ goto close
+
+ readnext:
+ FileRead $3 $4
+ IfErrors add
+ StrCpy $5 $4 $0
+ StrCmp $5 $1 0 readnext
+
+ StrCpy $5 0
+ IntOp $5 $5 - 1
+ StrCpy $6 $4 1 $5
+ StrCmp $6 '$\r' -2
+ StrCmp $6 '$\n' -3
+ StrCpy $6 $4
+ StrCmp $5 -1 +3
+ IntOp $5 $5 + 1
+ StrCpy $6 $4 $5
+
+ StrCmp $2 '' change
+ StrCmp $6 '$1$2' 0 change
+ StrCpy $0 SAME
+ goto close
+
+ change:
+ FileSeek $3 0 CUR $5
+ StrLen $4 $4
+ IntOp $4 $5 - $4
+ FileSeek $3 0 END $6
+ IntOp $6 $6 - $5
+
+ System::Alloc $6
+ Pop $0
+ FileSeek $3 $5 SET
+ System::Call 'kernel32::ReadFile(i r3, i r0, i $6, t.,)'
+ FileSeek $3 $4 SET
+ StrCmp $2 '' +2
+ FileWrite $3 '$1$2$\r$\n'
+ System::Call 'kernel32::WriteFile(i r3, i r0, i $6, t.,)'
+ System::Call 'kernel32::SetEndOfFile(i r3)'
+ System::Free $0
+ StrCmp $2 '' +3
+ StrCpy $0 CHANGED
+ goto close
+ StrCpy $0 DELETED
+ goto close
+
+ add:
+ StrCmp $2 '' 0 +3
+ StrCpy $0 SAME
+ goto close
+ FileSeek $3 -1 END
+ FileRead $3 $4
+ IfErrors +4
+ StrCmp $4 '$\r' +3
+ StrCmp $4 '$\n' +2
+ FileWrite $3 '$\r$\n'
+ FileWrite $3 '$1$2$\r$\n'
+ StrCpy $0 ADDED
+
+ close:
+ FileClose $3
+ goto end
+
+ error:
+ SetErrors
+ StrCpy $0 ''
+
+ end:
+ Pop $6
+ Pop $5
+ Pop $4
+ Pop $3
+ Pop $2
+ Pop $1
+ Exch $0
+ FunctionEnd
+
+ !undef _TEXTFUNC_UN
+ !define _TEXTFUNC_UN
+ !verbose pop
+ !endif
+!macroend
+
+!macro FileRecode
+ !ifndef ${_TEXTFUNC_UN}FileRecode
+ !verbose push
+ !verbose ${_TEXTFUNC_VERBOSE}
+ !define ${_TEXTFUNC_UN}FileRecode `!insertmacro ${_TEXTFUNC_UN}FileRecodeCall`
+
+ Function ${_TEXTFUNC_UN}FileRecode
+ Exch $1
+ Exch
+ Exch $0
+ Exch
+ Push $2
+ Push $3
+ Push $4
+
+ IfFileExists $0 0 error
+ StrCmp $1 OemToChar +2
+ StrCmp $1 CharToOem 0 error
+
+ FileOpen $2 $0 a
+ FileSeek $2 0 END $3
+ System::Alloc $3
+ Pop $4
+
+ FileSeek $2 0 SET
+ System::Call 'kernel32::ReadFile(i r2, i r4, i $3, t.,)'
+ System::Call 'user32::$1Buff(i r4, i r4, i $3)'
+ FileSeek $2 0 SET
+ System::Call 'kernel32::WriteFile(i r2, i r4, i $3, t.,)'
+
+ System::Free $4
+ FileClose $2
+ goto end
+
+ error:
+ SetErrors
+
+ end:
+ Pop $4
+ Pop $3
+ Pop $2
+ Pop $1
+ Pop $0
+ FunctionEnd
+
+ !undef _TEXTFUNC_UN
+ !define _TEXTFUNC_UN
+ !verbose pop
+ !endif
+!macroend
+
+!macro TrimNewLines
+ !ifndef ${_TEXTFUNC_UN}TrimNewLines
+ !verbose push
+ !verbose ${_TEXTFUNC_VERBOSE}
+ !define ${_TEXTFUNC_UN}TrimNewLines `!insertmacro ${_TEXTFUNC_UN}TrimNewLinesCall`
+
+ Function ${_TEXTFUNC_UN}TrimNewLines
+ Exch $0
+ Push $1
+ Push $2
+
+ StrCpy $1 0
+ IntOp $1 $1 - 1
+ StrCpy $2 $0 1 $1
+ StrCmp $2 '$\r' -2
+ StrCmp $2 '$\n' -3
+ StrCmp $1 -1 +3
+ IntOp $1 $1 + 1
+ StrCpy $0 $0 $1
+
+ Pop $2
+ Pop $1
+ Exch $0
+ FunctionEnd
+
+ !undef _TEXTFUNC_UN
+ !define _TEXTFUNC_UN
+ !verbose pop
+ !endif
+!macroend
+
+!macro un.LineFindCall _INPUT _OUTPUT _RANGE _FUNC
+ !verbose push
+ !verbose ${_TEXTFUNC_VERBOSE}
+ Push $0
+ Push `${_INPUT}`
+ Push `${_OUTPUT}`
+ Push `${_RANGE}`
+ GetFunctionAddress $0 `${_FUNC}`
+ Push `$0`
+ Call un.LineFind
+ Pop $0
+ !verbose pop
+!macroend
+
+!macro un.LineReadCall _FILE _NUMBER _RESULT
+ !verbose push
+ !verbose ${_TEXTFUNC_VERBOSE}
+ Push `${_FILE}`
+ Push `${_NUMBER}`
+ Call un.LineRead
+ Pop ${_RESULT}
+ !verbose pop
+!macroend
+
+!macro un.FileReadFromEndCall _FILE _FUNC
+ !verbose push
+ !verbose ${_TEXTFUNC_VERBOSE}
+ Push $0
+ Push `${_FILE}`
+ GetFunctionAddress $0 `${_FUNC}`
+ Push `$0`
+ Call un.FileReadFromEnd
+ Pop $0
+ !verbose pop
+!macroend
+
+!macro un.LineSumCall _FILE _RESULT
+ !verbose push
+ !verbose ${_TEXTFUNC_VERBOSE}
+ Push `${_FILE}`
+ Call un.LineSum
+ Pop ${_RESULT}
+ !verbose pop
+!macroend
+
+!macro un.FileJoinCall _FILE1 _FILE2 _FILE3
+ !verbose push
+ !verbose ${_TEXTFUNC_VERBOSE}
+ Push `${_FILE1}`
+ Push `${_FILE2}`
+ Push `${_FILE3}`
+ Call un.FileJoin
+ !verbose pop
+!macroend
+
+!macro un.TextCompareCall _FILE1 _FILE2 _OPTION _FUNC
+ !verbose push
+ !verbose ${_TEXTFUNC_VERBOSE}
+ Push $0
+ Push `${_FILE1}`
+ Push `${_FILE2}`
+ Push `${_OPTION}`
+ GetFunctionAddress $0 `${_FUNC}`
+ Push `$0`
+ Call un.TextCompare
+ Pop $0
+ !verbose pop
+!macroend
+
+!macro un.ConfigReadCall _FILE _ENTRY _RESULT
+ !verbose push
+ !verbose ${_TEXTFUNC_VERBOSE}
+ Push `${_FILE}`
+ Push `${_ENTRY}`
+ Call un.ConfigRead
+ Pop ${_RESULT}
+ !verbose pop
+!macroend
+
+!macro un.ConfigWriteCall _FILE _ENTRY _VALUE _RESULT
+ !verbose push
+ !verbose ${_TEXTFUNC_VERBOSE}
+ Push `${_FILE}`
+ Push `${_ENTRY}`
+ Push `${_VALUE}`
+ Call un.ConfigWrite
+ Pop ${_RESULT}
+ !verbose pop
+!macroend
+
+!macro un.FileRecodeCall _FILE _FORMAT
+ !verbose push
+ !verbose ${_TEXTFUNC_VERBOSE}
+ Push `${_FILE}`
+ Push `${_FORMAT}`
+ Call un.FileRecode
+ !verbose pop
+!macroend
+
+!macro un.TrimNewLinesCall _FILE _RESULT
+ !verbose push
+ !verbose ${_TEXTFUNC_VERBOSE}
+ Push `${_FILE}`
+ Call un.TrimNewLines
+ Pop ${_RESULT}
+ !verbose pop
+!macroend
+
+!macro un.LineFind
+ !ifndef un.LineFind
+ !verbose push
+ !verbose ${_TEXTFUNC_VERBOSE}
+ !undef _TEXTFUNC_UN
+ !define _TEXTFUNC_UN `un.`
+
+ !insertmacro LineFind
+
+ !verbose pop
+ !endif
+!macroend
+
+!macro un.LineRead
+ !ifndef un.LineRead
+ !verbose push
+ !verbose ${_TEXTFUNC_VERBOSE}
+ !undef _TEXTFUNC_UN
+ !define _TEXTFUNC_UN `un.`
+
+ !insertmacro LineRead
+
+ !verbose pop
+ !endif
+!macroend
+
+!macro un.FileReadFromEnd
+ !ifndef un.FileReadFromEnd
+ !verbose push
+ !verbose ${_TEXTFUNC_VERBOSE}
+ !undef _TEXTFUNC_UN
+ !define _TEXTFUNC_UN `un.`
+
+ !insertmacro FileReadFromEnd
+
+ !verbose pop
+ !endif
+!macroend
+
+!macro un.LineSum
+ !ifndef un.LineSum
+ !verbose push
+ !verbose ${_TEXTFUNC_VERBOSE}
+ !undef _TEXTFUNC_UN
+ !define _TEXTFUNC_UN `un.`
+
+ !insertmacro LineSum
+
+ !verbose pop
+ !endif
+!macroend
+
+!macro un.FileJoin
+ !ifndef un.FileJoin
+ !verbose push
+ !verbose ${_TEXTFUNC_VERBOSE}
+ !undef _TEXTFUNC_UN
+ !define _TEXTFUNC_UN `un.`
+
+ !insertmacro FileJoin
+
+ !verbose pop
+ !endif
+!macroend
+
+!macro un.TextCompare
+ !ifndef un.TextCompare
+ !verbose push
+ !verbose ${_TEXTFUNC_VERBOSE}
+ !undef _TEXTFUNC_UN
+ !define _TEXTFUNC_UN `un.`
+
+ !insertmacro TextCompare
+
+ !verbose pop
+ !endif
+!macroend
+
+!macro un.ConfigRead
+ !ifndef un.ConfigRead
+ !verbose push
+ !verbose ${_TEXTFUNC_VERBOSE}
+ !undef _TEXTFUNC_UN
+ !define _TEXTFUNC_UN `un.`
+
+ !insertmacro ConfigRead
+
+ !verbose pop
+ !endif
+!macroend
+
+!macro un.ConfigWrite
+ !ifndef un.ConfigWrite
+ !verbose push
+ !verbose ${_TEXTFUNC_VERBOSE}
+ !undef _TEXTFUNC_UN
+ !define _TEXTFUNC_UN `un.`
+
+ !insertmacro ConfigWrite
+
+ !verbose pop
+ !endif
+!macroend
+
+!macro un.FileRecode
+ !ifndef un.FileRecode
+ !verbose push
+ !verbose ${_TEXTFUNC_VERBOSE}
+ !undef _TEXTFUNC_UN
+ !define _TEXTFUNC_UN `un.`
+
+ !insertmacro FileRecode
+
+ !verbose pop
+ !endif
+!macroend
+
+!macro un.TrimNewLines
+ !ifndef un.TrimNewLines
+ !verbose push
+ !verbose ${_TEXTFUNC_VERBOSE}
+ !undef _TEXTFUNC_UN
+ !define _TEXTFUNC_UN `un.`
+
+ !insertmacro TrimNewLines
+
+ !verbose pop
+ !endif
+!macroend
diff --git a/Include/WordFunc.nsh b/Include/WordFunc.nsh
new file mode 100644
index 00000000..19a95c32
--- /dev/null
+++ b/Include/WordFunc.nsh
@@ -0,0 +1,1788 @@
+/*
+_____________________________________________________________________________
+
+ Word Functions Header v3.0
+_____________________________________________________________________________
+
+ 2005 Shengalts Aleksander aka Instructor (Shengalts@mail.ru)
+
+ See documentation for more information about the following functions.
+
+ Usage in script:
+ 1. !include "WordFunc.nsh"
+ 2. !insertmacro WordFunction
+ 3. [Section|Function]
+ ${WordFunction} "Param1" "Param2" "..." $var
+ [SectionEnd|FunctionEnd]
+
+
+ WordFunction=[WordFind|WordFind2X|WordFind3X|WordReplace|WordAdd|WordInsert|
+ StrFilter|VersionCompare|VersionConvert]
+
+ un.WordFunction=[un.WordFind|un.WordFind2X|un.WordFind3X|un.WordReplace|
+ un.WordAdd|un.WordInsert|un.StrFilter|un.VersionCompare|
+ un.VersionConvert]
+
+
+_____________________________________________________________________________
+
+ Thanks to:
+_____________________________________________________________________________
+
+WordFind3X
+ Afrow UK (Based on his idea of Function "StrSortLR")
+StrFilter
+ sunjammer (Function "StrUpper")
+VersionCompare
+ Afrow UK (Based on his Function "VersionCheckNew2")
+VersionConvert
+ Afrow UK (Based on his idea of Function "CharIndexReplace")
+*/
+
+
+;_____________________________________________________________________________
+;
+; Macros
+;_____________________________________________________________________________
+;
+; Change log window verbosity (default: 3=no script)
+;
+; Example:
+; !include "WordFunc.nsh"
+; !insertmacro WordFind
+; ${WORDFUNC_VERBOSE} 4 # all verbosity
+; !insertmacro WordReplace
+; ${WORDFUNC_VERBOSE} 3 # no script
+
+!verbose push
+!verbose 3
+!ifndef _WORDFUNC_VERBOSE
+ !define _WORDFUNC_VERBOSE 3
+!endif
+!verbose ${_WORDFUNC_VERBOSE}
+!define WORDFUNC_VERBOSE `!insertmacro WORDFUNC_VERBOSE`
+!define _WORDFUNC_UN1
+!define _WORDFUNC_UN2
+!verbose pop
+
+!macro WORDFUNC_VERBOSE _VERBOSE
+ !verbose push
+ !verbose 3
+ !undef _WORDFUNC_VERBOSE
+ !define _WORDFUNC_VERBOSE ${_VERBOSE}
+ !verbose 4
+ !echo `"verbosity=${_VERBOSE}"`
+ !verbose pop
+!macroend
+
+
+!macro WordFindCall _STRING _DELIMITER _OPTION _RESULT
+ !verbose push
+ !verbose ${_WORDFUNC_VERBOSE}
+ Push `${_STRING}`
+ Push `${_DELIMITER}`
+ Push `${_OPTION}`
+ Call WordFind
+ Pop ${_RESULT}
+ !verbose pop
+!macroend
+
+!macro WordFind2XCall _STRING _DELIMITER1 _DELIMITER2 _NUMBER _RESULT
+ !verbose push
+ !verbose ${_WORDFUNC_VERBOSE}
+ Push `${_STRING}`
+ Push `${_DELIMITER1}`
+ Push `${_DELIMITER2}`
+ Push `${_NUMBER}`
+ Call WordFind2X
+ Pop ${_RESULT}
+ !verbose pop
+!macroend
+
+!macro WordFind3XCall _STRING _DELIMITER1 _CENTER _DELIMITER2 _NUMBER _RESULT
+ !verbose push
+ !verbose ${_WORDFUNC_VERBOSE}
+ Push `${_STRING}`
+ Push `${_DELIMITER1}`
+ Push `${_CENTER}`
+ Push `${_DELIMITER2}`
+ Push `${_NUMBER}`
+ Call WordFind3X
+ Pop ${_RESULT}
+ !verbose pop
+!macroend
+
+!macro WordReplaceCall _STRING _WORD1 _WORD2 _NUMBER _RESULT
+ !verbose push
+ !verbose ${_WORDFUNC_VERBOSE}
+ Push `${_STRING}`
+ Push `${_WORD1}`
+ Push `${_WORD2}`
+ Push `${_NUMBER}`
+ Call WordReplace
+ Pop ${_RESULT}
+ !verbose pop
+!macroend
+
+!macro WordAddCall _STRING1 _DELIMITER _STRING2 _RESULT
+ !verbose push
+ !verbose ${_WORDFUNC_VERBOSE}
+ Push `${_STRING1}`
+ Push `${_DELIMITER}`
+ Push `${_STRING2}`
+ Call WordAdd
+ Pop ${_RESULT}
+ !verbose pop
+!macroend
+
+!macro WordInsertCall _STRING _DELIMITER _WORD _NUMBER _RESULT
+ !verbose push
+ !verbose ${_WORDFUNC_VERBOSE}
+ Push `${_STRING}`
+ Push `${_DELIMITER}`
+ Push `${_WORD}`
+ Push `${_NUMBER}`
+ Call WordInsert
+ Pop ${_RESULT}
+ !verbose pop
+!macroend
+
+!macro StrFilterCall _STRING _FILTER _INCLUDE _EXCLUDE _RESULT
+ !verbose push
+ !verbose ${_WORDFUNC_VERBOSE}
+ Push `${_STRING}`
+ Push `${_FILTER}`
+ Push `${_INCLUDE}`
+ Push `${_EXCLUDE}`
+ Call StrFilter
+ Pop ${_RESULT}
+ !verbose pop
+!macroend
+
+!macro VersionCompareCall _VER1 _VER2 _RESULT
+ !verbose push
+ !verbose ${_WORDFUNC_VERBOSE}
+ Push `${_VER1}`
+ Push `${_VER2}`
+ Call VersionCompare
+ Pop ${_RESULT}
+ !verbose pop
+!macroend
+
+!macro VersionConvertCall _VERSION _CHARLIST _RESULT
+ !verbose push
+ !verbose ${_WORDFUNC_VERBOSE}
+ Push `${_VERSION}`
+ Push `${_CHARLIST}`
+ Call VersionConvert
+ Pop ${_RESULT}
+ !verbose pop
+!macroend
+
+!macro WordFind
+ !ifndef ${_WORDFUNC_UN1}WordFind
+ !verbose push
+ !verbose ${_WORDFUNC_VERBOSE}
+ !define ${_WORDFUNC_UN1}WordFind `!insertmacro ${_WORDFUNC_UN1}WordFindCall`
+
+ Function ${_WORDFUNC_UN1}WordFind
+ Exch $1
+ Exch
+ Exch $0
+ Exch
+ Exch 2
+ Exch $R0
+ Exch 2
+ Push $2
+ Push $3
+ Push $4
+ Push $5
+ Push $6
+ Push $7
+ Push $8
+ Push $9
+ Push $R1
+ ClearErrors
+
+ StrCpy $9 ''
+ StrCpy $2 $1 1
+ StrCpy $1 $1 '' 1
+ StrCmp $2 'E' 0 +3
+ StrCpy $9 E
+ goto -4
+
+ StrCpy $3 ''
+ StrCmp $2 '+' +6
+ StrCmp $2 '-' +5
+ StrCmp $2 '/' restart
+ StrCmp $2 '#' restart
+ StrCmp $2 '*' restart
+ goto error3
+
+ StrCpy $4 $1 1 -1
+ StrCmp $4 '*' +4
+ StrCmp $4 '}' +3
+ StrCmp $4 '{' +2
+ goto +4
+ StrCpy $1 $1 -1
+ StrCpy $3 '$4$3'
+ goto -7
+ StrCmp $3 '*' error3
+ StrCmp $3 '**' error3
+ StrCmp $3 '}{' error3
+ IntOp $1 $1 + 0
+ StrCmp $1 0 error2
+
+ restart:
+ StrCmp $R0 '' error1
+ StrCpy $4 0
+ StrCpy $5 0
+ StrCpy $6 0
+ StrLen $7 $0
+ goto loop
+
+ preloop:
+ IntOp $6 $6 + 1
+
+ loop:
+ StrCpy $8 $R0 $7 $6
+ StrCmp $8$5 0 error1
+ StrCmp $8 '' +2
+ StrCmp $8 $0 +5 preloop
+ StrCmp $3 '{' minus
+ StrCmp $3 '}' minus
+ StrCmp $2 '*' minus
+ StrCmp $5 $6 minus +5
+ StrCmp $3 '{' +4
+ StrCmp $3 '}' +3
+ StrCmp $2 '*' +2
+ StrCmp $5 $6 nextword
+ IntOp $4 $4 + 1
+ StrCmp $2$4 +$1 plus
+ StrCmp $2 '/' 0 nextword
+ IntOp $8 $6 - $5
+ StrCpy $8 $R0 $8 $5
+ StrCmp $1 $8 0 nextword
+ StrCpy $R1 $4
+ goto end
+ nextword:
+ IntOp $6 $6 + $7
+ StrCpy $5 $6
+ goto loop
+
+ minus:
+ StrCmp $2 '-' 0 sum
+ StrCpy $2 '+'
+ IntOp $1 $4 - $1
+ IntOp $1 $1 + 1
+ IntCmp $1 0 error2 error2 restart
+ sum:
+ StrCmp $2 '#' 0 sumdelim
+ StrCpy $R1 $4
+ goto end
+ sumdelim:
+ StrCmp $2 '*' 0 error2
+ StrCpy $R1 $4
+ goto end
+
+ plus:
+ StrCmp $3 '' 0 +4
+ IntOp $6 $6 - $5
+ StrCpy $R1 $R0 $6 $5
+ goto end
+ StrCmp $3 '{' 0 +3
+ StrCpy $R1 $R0 $6
+ goto end
+ StrCmp $3 '}' 0 +4
+ IntOp $6 $6 + $7
+ StrCpy $R1 $R0 '' $6
+ goto end
+ StrCmp $3 '{*' +2
+ StrCmp $3 '*{' 0 +3
+ StrCpy $R1 $R0 $6
+ goto end
+ StrCmp $3 '*}' +2
+ StrCmp $3 '}*' 0 +3
+ StrCpy $R1 $R0 '' $5
+ goto end
+ StrCmp $3 '}}' 0 +3
+ StrCpy $R1 $R0 '' $6
+ goto end
+ StrCmp $3 '{{' 0 +3
+ StrCpy $R1 $R0 $5
+ goto end
+ StrCmp $3 '{}' 0 error3
+ StrLen $3 $R0
+ StrCmp $3 $6 0 +3
+ StrCpy $0 ''
+ goto +2
+ IntOp $6 $6 + $7
+ StrCpy $8 $R0 '' $6
+ StrCmp $4$8 1 +6
+ StrCmp $4 1 +2 +7
+ IntOp $6 $6 + $7
+ StrCpy $3 $R0 $7 $6
+ StrCmp $3 '' +2
+ StrCmp $3 $0 -3 +3
+ StrCpy $R1 ''
+ goto end
+ StrCmp $5 0 0 +3
+ StrCpy $0 ''
+ goto +2
+ IntOp $5 $5 - $7
+ StrCpy $3 $R0 $5
+ StrCpy $R1 '$3$0$8'
+ goto end
+
+ error3:
+ StrCpy $R1 3
+ goto error
+ error2:
+ StrCpy $R1 2
+ goto error
+ error1:
+ StrCpy $R1 1
+ error:
+ StrCmp $9 'E' 0 +3
+ SetErrors
+
+ end:
+ StrCpy $R0 $R1
+
+ Pop $R1
+ Pop $9
+ Pop $8
+ Pop $7
+ Pop $6
+ Pop $5
+ Pop $4
+ Pop $3
+ Pop $2
+ Pop $1
+ Pop $0
+ Exch $R0
+ FunctionEnd
+
+
+ !ifndef _WORDFUNC_UN2
+ !undef _WORDFUNC_UN1
+ !define _WORDFUNC_UN1
+ !endif
+ !verbose pop
+ !endif
+!macroend
+
+!macro WordFind2X
+ !ifndef ${_WORDFUNC_UN1}WordFind2X
+ !verbose push
+ !verbose ${_WORDFUNC_VERBOSE}
+ !define ${_WORDFUNC_UN1}WordFind2X `!insertmacro ${_WORDFUNC_UN1}WordFind2XCall`
+
+ Function ${_WORDFUNC_UN1}WordFind2X
+ Exch $2
+ Exch
+ Exch $1
+ Exch
+ Exch 2
+ Exch $0
+ Exch 2
+ Exch 3
+ Exch $R0
+ Exch 3
+ Push $3
+ Push $4
+ Push $5
+ Push $6
+ Push $7
+ Push $8
+ Push $9
+ Push $R1
+ Push $R2
+ ClearErrors
+
+ StrCpy $R2 ''
+ StrCpy $3 $2 1
+ StrCpy $2 $2 '' 1
+ StrCmp $3 'E' 0 +3
+ StrCpy $R2 E
+ goto -4
+
+ StrCmp $3 '+' +5
+ StrCmp $3 '-' +4
+ StrCmp $3 '#' restart
+ StrCmp $3 '/' restart
+ goto error3
+
+ StrCpy $4 $2 2 -2
+ StrCmp $4 '{{' +9
+ StrCmp $4 '}}' +8
+ StrCmp $4 '{*' +7
+ StrCmp $4 '*{' +6
+ StrCmp $4 '*}' +5
+ StrCmp $4 '}*' +4
+ StrCmp $4 '{}' +3
+ StrCpy $4 ''
+ goto +2
+ StrCpy $2 $2 -2
+ IntOp $2 $2 + 0
+ StrCmp $2 0 error2
+
+ restart:
+ StrCmp $R0 '' error1
+ StrCpy $5 -1
+ StrCpy $6 0
+ StrCpy $7 ''
+ StrLen $8 $0
+ StrLen $9 $1
+
+ loop:
+ IntOp $5 $5 + 1
+
+ delim1:
+ StrCpy $R1 $R0 $8 $5
+ StrCmp $R1$6 0 error1
+ StrCmp $R1 '' minus
+ StrCmp $R1 $0 +2
+ StrCmp $7 '' loop delim2
+ StrCmp $0 $1 0 +2
+ StrCmp $7 '' 0 delim2
+ IntOp $7 $5 + $8
+ StrCpy $5 $7
+ goto delim1
+
+ delim2:
+ StrCpy $R1 $R0 $9 $5
+ StrCmp $R1 $1 0 loop
+ IntOp $6 $6 + 1
+ StrCmp $3$6 '+$2' plus
+ StrCmp $3 '/' 0 nextword
+ IntOp $R1 $5 - $7
+ StrCpy $R1 $R0 $R1 $7
+ StrCmp $R1 $2 0 +3
+ StrCpy $R1 $6
+ goto end
+ nextword:
+ IntOp $5 $5 + $9
+ StrCpy $7 ''
+ goto delim1
+
+ minus:
+ StrCmp $3 '-' 0 sum
+ StrCpy $3 +
+ IntOp $2 $6 - $2
+ IntOp $2 $2 + 1
+ IntCmp $2 0 error2 error2 restart
+ sum:
+ StrCmp $3 '#' 0 error2
+ StrCpy $R1 $6
+ goto end
+
+ plus:
+ StrCmp $4 '' 0 +4
+ IntOp $R1 $5 - $7
+ StrCpy $R1 $R0 $R1 $7
+ goto end
+ IntOp $5 $5 + $9
+ IntOp $7 $7 - $8
+ StrCmp $4 '{*' +2
+ StrCmp $4 '*{' 0 +3
+ StrCpy $R1 $R0 $5
+ goto end
+ StrCmp $4 '*}' +2
+ StrCmp $4 '}*' 0 +3
+ StrCpy $R1 $R0 '' $7
+ goto end
+ StrCmp $4 '}}' 0 +3
+ StrCpy $R1 $R0 '' $5
+ goto end
+ StrCmp $4 '{{' 0 +3
+ StrCpy $R1 $R0 $7
+ goto end
+ StrCmp $4 '{}' 0 error3
+ StrCpy $5 $R0 '' $5
+ StrCpy $7 $R0 $7
+ StrCpy $R1 '$7$5'
+ goto end
+
+ error3:
+ StrCpy $R1 3
+ goto error
+ error2:
+ StrCpy $R1 2
+ goto error
+ error1:
+ StrCpy $R1 1
+ error:
+ StrCmp $R2 'E' 0 +3
+ SetErrors
+
+ end:
+ StrCpy $R0 $R1
+
+ Pop $R2
+ Pop $R1
+ Pop $9
+ Pop $8
+ Pop $7
+ Pop $6
+ Pop $5
+ Pop $4
+ Pop $3
+ Pop $2
+ Pop $1
+ Pop $0
+ Exch $R0
+ FunctionEnd
+
+ !undef _WORDFUNC_UN1
+ !define _WORDFUNC_UN1
+ !verbose pop
+ !endif
+!macroend
+
+!macro WordFind3X
+ !ifndef ${_WORDFUNC_UN1}WordFind3X
+ !verbose push
+ !verbose ${_WORDFUNC_VERBOSE}
+ !define ${_WORDFUNC_UN1}WordFind3X `!insertmacro ${_WORDFUNC_UN1}WordFind3XCall`
+
+ Function ${_WORDFUNC_UN1}WordFind3X
+ Exch $3
+ Exch
+ Exch $2
+ Exch
+ Exch 2
+ Exch $1
+ Exch 2
+ Exch 3
+ Exch $0
+ Exch 3
+ Exch 4
+ Exch $R0
+ Exch 4
+ Push $4
+ Push $5
+ Push $6
+ Push $7
+ Push $8
+ Push $9
+ Push $R1
+ Push $R2
+ Push $R3
+ Push $R4
+ Push $R5
+ ClearErrors
+
+ StrCpy $R5 ''
+ StrCpy $4 $3 1
+ StrCpy $3 $3 '' 1
+ StrCmp $4 'E' 0 +3
+ StrCpy $R5 E
+ goto -4
+
+ StrCmp $4 '+' +5
+ StrCmp $4 '-' +4
+ StrCmp $4 '#' restart
+ StrCmp $4 '/' restart
+ goto error3
+
+ StrCpy $5 $3 2 -2
+ StrCmp $5 '{{' +9
+ StrCmp $5 '}}' +8
+ StrCmp $5 '{*' +7
+ StrCmp $5 '*{' +6
+ StrCmp $5 '*}' +5
+ StrCmp $5 '}*' +4
+ StrCmp $5 '{}' +3
+ StrCpy $5 ''
+ goto +2
+ StrCpy $3 $3 -2
+ IntOp $3 $3 + 0
+ StrCmp $3 0 error2
+
+ restart:
+ StrCmp $R0 '' error1
+ StrCpy $6 -1
+ StrCpy $7 0
+ StrCpy $8 ''
+ StrCpy $9 ''
+ StrLen $R1 $0
+ StrLen $R2 $1
+ StrLen $R3 $2
+
+ loop:
+ IntOp $6 $6 + 1
+
+ delim1:
+ StrCpy $R4 $R0 $R1 $6
+ StrCmp $R4$7 0 error1
+ StrCmp $R4 '' minus
+ StrCmp $R4 $0 +2
+ StrCmp $8 '' loop center
+ StrCmp $0 $1 +2
+ StrCmp $0 $2 0 +2
+ StrCmp $8 '' 0 center
+ IntOp $8 $6 + $R1
+ StrCpy $6 $8
+ goto delim1
+
+ center:
+ StrCmp $9 '' 0 delim2
+ StrCpy $R4 $R0 $R2 $6
+ StrCmp $R4 $1 0 loop
+ IntOp $9 $6 + $R2
+ StrCpy $6 $9
+ goto delim1
+
+ delim2:
+ StrCpy $R4 $R0 $R3 $6
+ StrCmp $R4 $2 0 loop
+ IntOp $7 $7 + 1
+ StrCmp $4$7 '+$3' plus
+ StrCmp $4 '/' 0 nextword
+ IntOp $R4 $6 - $8
+ StrCpy $R4 $R0 $R4 $8
+ StrCmp $R4 $3 0 +3
+ StrCpy $R4 $7
+ goto end
+ nextword:
+ IntOp $6 $6 + $R3
+ StrCpy $8 ''
+ StrCpy $9 ''
+ goto delim1
+
+ minus:
+ StrCmp $4 '-' 0 sum
+ StrCpy $4 +
+ IntOp $3 $7 - $3
+ IntOp $3 $3 + 1
+ IntCmp $3 0 error2 error2 restart
+ sum:
+ StrCmp $4 '#' 0 error2
+ StrCpy $R4 $7
+ goto end
+
+ plus:
+ StrCmp $5 '' 0 +4
+ IntOp $R4 $6 - $8
+ StrCpy $R4 $R0 $R4 $8
+ goto end
+ IntOp $6 $6 + $R3
+ IntOp $8 $8 - $R1
+ StrCmp $5 '{*' +2
+ StrCmp $5 '*{' 0 +3
+ StrCpy $R4 $R0 $6
+ goto end
+ StrCmp $5 '*}' +2
+ StrCmp $5 '}*' 0 +3
+ StrCpy $R4 $R0 '' $8
+ goto end
+ StrCmp $5 '}}' 0 +3
+ StrCpy $R4 $R0 '' $6
+ goto end
+ StrCmp $5 '{{' 0 +3
+ StrCpy $R4 $R0 $8
+ goto end
+ StrCmp $5 '{}' 0 error3
+ StrCpy $6 $R0 '' $6
+ StrCpy $8 $R0 $8
+ StrCpy $R4 '$8$6'
+ goto end
+
+ error3:
+ StrCpy $R4 3
+ goto error
+ error2:
+ StrCpy $R4 2
+ goto error
+ error1:
+ StrCpy $R4 1
+ error:
+ StrCmp $R5 'E' 0 +3
+ SetErrors
+
+ end:
+ StrCpy $R0 $R4
+ Pop $R5
+ Pop $R4
+ Pop $R3
+ Pop $R2
+ Pop $R1
+ Pop $9
+ Pop $8
+ Pop $7
+ Pop $6
+ Pop $5
+ Pop $4
+ Pop $3
+ Pop $2
+ Pop $1
+ Pop $0
+ Exch $R0
+ FunctionEnd
+
+ !undef _WORDFUNC_UN1
+ !define _WORDFUNC_UN1
+ !verbose pop
+ !endif
+!macroend
+
+!macro WordReplace
+ !ifndef ${_WORDFUNC_UN1}WordReplace
+ !verbose push
+ !verbose ${_WORDFUNC_VERBOSE}
+ !define ${_WORDFUNC_UN1}WordReplace `!insertmacro ${_WORDFUNC_UN1}WordReplaceCall`
+
+ Function ${_WORDFUNC_UN1}WordReplace
+ Exch $2
+ Exch
+ Exch $1
+ Exch
+ Exch 2
+ Exch $0
+ Exch 2
+ Exch 3
+ Exch $R0
+ Exch 3
+ Push $3
+ Push $4
+ Push $5
+ Push $6
+ Push $7
+ Push $8
+ Push $9
+ Push $R1
+ ClearErrors
+
+ StrCpy $R1 $R0
+ StrCpy $9 ''
+ StrCpy $3 $2 1
+ StrCmp $3 'E' 0 +4
+ StrCpy $9 E
+ StrCpy $2 $2 '' 1
+ goto -4
+
+ StrLen $7 $0
+
+ StrCpy $4 $2 3
+ StrCpy $5 $2 2
+ StrCmp $4 '{}*' +3
+ StrCmp $5 '{}' +2
+ goto errorchk
+ StrCmp $7 0 end
+ StrCpy $5 ''
+ StrCpy $6 ''
+ StrCpy $3 $R0 $7
+ StrCmp $3 $0 0 +4
+ StrCpy $R0 $R0 '' $7
+ StrCpy $5 '$1$5'
+ goto -4
+ StrCpy $3 $R0 '' -$7
+ StrCmp $3 $0 0 +4
+ StrCpy $R0 $R0 -$7
+ StrCpy $6 '$6$1'
+ goto -4
+ StrCmp $4 '{}*' 0 +5
+ StrCmp $5 '' +2
+ StrCpy $5 $1
+ StrCmp $6 '' +2
+ StrCpy $6 $1
+ StrCpy $R0 '$5$R0$6'
+ goto end
+
+ errorchk:
+ StrCpy $3 $2 1
+ StrCpy $2 $2 '' 1
+ StrCmp $3 '+' +2
+ StrCmp $3 '-' 0 error3
+ StrCmp $R0 '' error1
+ StrCmp $7 0 error1
+
+ StrCpy $4 $2 1 -1
+ StrCpy $5 $2 1
+ IntOp $2 $2 + 0
+ StrCmp $2 0 0 one
+ StrCmp $5 0 error2
+ StrCpy $3 ''
+
+ all:
+ StrCpy $5 0
+ StrCpy $2 $R0 $7 $5
+ StrCmp $2$3 '' error1
+ StrCmp $2 '' +4
+ StrCmp $2 $0 +5
+ IntOp $5 $5 + 1
+ goto -5
+ StrCpy $R0 '$3$R0'
+ goto end
+ StrCpy $2 $R0 $5
+ IntOp $5 $5 + $7
+ StrCmp $4 '*' 0 +3
+ StrCpy $6 $R0 $7 $5
+ StrCmp $6 $0 -3
+ StrCpy $R0 $R0 '' $5
+ StrCpy $3 '$3$2$1'
+ goto all
+
+ one:
+ StrCpy $5 0
+ StrCpy $8 0
+ goto loop
+
+ preloop:
+ IntOp $5 $5 + 1
+
+ loop:
+ StrCpy $6 $R0 $7 $5
+ StrCmp $6$8 0 error1
+ StrCmp $6 '' minus
+ StrCmp $6 $0 0 preloop
+ IntOp $8 $8 + 1
+ StrCmp $3$8 +$2 found
+ IntOp $5 $5 + $7
+ goto loop
+
+ minus:
+ StrCmp $3 '-' 0 error2
+ StrCpy $3 +
+ IntOp $2 $8 - $2
+ IntOp $2 $2 + 1
+ IntCmp $2 0 error2 error2 one
+
+ found:
+ StrCpy $3 $R0 $5
+ StrCmp $4 '*' 0 +5
+ StrCpy $6 $3 '' -$7
+ StrCmp $6 $0 0 +3
+ StrCpy $3 $3 -$7
+ goto -3
+ IntOp $5 $5 + $7
+ StrCmp $4 '*' 0 +3
+ StrCpy $6 $R0 $7 $5
+ StrCmp $6 $0 -3
+ StrCpy $R0 $R0 '' $5
+ StrCpy $R0 '$3$1$R0'
+ goto end
+
+ error3:
+ StrCpy $R0 3
+ goto error
+ error2:
+ StrCpy $R0 2
+ goto error
+ error1:
+ StrCpy $R0 1
+ error:
+ StrCmp $9 'E' +3
+ StrCpy $R0 $R1
+ goto +2
+ SetErrors
+
+ end:
+ Pop $R1
+ Pop $9
+ Pop $8
+ Pop $7
+ Pop $6
+ Pop $5
+ Pop $4
+ Pop $3
+ Pop $2
+ Pop $1
+ Pop $0
+ Exch $R0
+ FunctionEnd
+
+ !undef _WORDFUNC_UN1
+ !define _WORDFUNC_UN1
+ !verbose pop
+ !endif
+!macroend
+
+!macro WordAdd
+ !ifndef ${_WORDFUNC_UN1}WordAdd
+ !verbose push
+ !verbose ${_WORDFUNC_VERBOSE}
+ !insertmacro WordFind
+
+ !define ${_WORDFUNC_UN1}WordAdd `!insertmacro ${_WORDFUNC_UN1}WordAddCall`
+
+ Function ${_WORDFUNC_UN1}WordAdd
+ Exch $1
+ Exch
+ Exch $0
+ Exch
+ Exch 2
+ Exch $R0
+ Exch 2
+ Push $2
+ Push $3
+ Push $4
+ Push $5
+ Push $6
+ Push $7
+ Push $R1
+ ClearErrors
+
+ StrCpy $7 ''
+ StrCpy $2 $1 1
+ StrCmp $2 'E' 0 +4
+ StrCpy $7 E
+ StrCpy $1 $1 '' 1
+ goto -4
+
+ StrCpy $5 0
+ StrCpy $R1 $R0
+ StrCpy $2 $1 '' 1
+ StrCpy $1 $1 1
+ StrCmp $1 '+' +2
+ StrCmp $1 '-' 0 error3
+
+ StrCmp $0 '' error1
+ StrCmp $2 '' end
+ StrCmp $R0 '' 0 +5
+ StrCmp $1 '-' end
+ StrCmp $1 '+' 0 +3
+ StrCpy $R0 $2
+ goto end
+
+ loop:
+ IntOp $5 $5 + 1
+ Push `$2`
+ Push `$0`
+ Push `E+$5`
+ Call ${_WORDFUNC_UN1}WordFind
+ Pop $3
+ IfErrors 0 /word
+ StrCmp $3 2 +4
+ StrCmp $3$5 11 0 +3
+ StrCpy $3 $2
+ goto /word
+ StrCmp $1 '-' end preend
+
+ /word:
+ Push `$R0`
+ Push `$0`
+ Push `E/$3`
+ Call ${_WORDFUNC_UN1}WordFind
+ Pop $4
+ IfErrors +2
+ StrCmp $1 '-' delete loop
+ StrCmp $1$4 '-1' +2
+ StrCmp $1 '-' loop +4
+ StrCmp $R0 $3 0 loop
+ StrCpy $R0 ''
+ goto end
+ StrCmp $1$4 '+1' 0 +2
+ StrCmp $R0 $3 loop
+ StrCmp $R0 $R1 +3
+ StrCpy $R1 '$R1$0$3'
+ goto loop
+ StrLen $6 $0
+ StrCpy $6 $R0 '' -$6
+ StrCmp $6 $0 0 -4
+ StrCpy $R1 '$R1$3'
+ goto loop
+
+ delete:
+ Push `$R0`
+ Push `$0`
+ Push `E+$4{}`
+ Call ${_WORDFUNC_UN1}WordFind
+ Pop $R0
+ goto /word
+
+ error3:
+ StrCpy $R1 3
+ goto error
+ error1:
+ StrCpy $R1 1
+ error:
+ StrCmp $7 'E' 0 end
+ SetErrors
+
+ preend:
+ StrCpy $R0 $R1
+
+ end:
+ Pop $R1
+ Pop $7
+ Pop $6
+ Pop $5
+ Pop $4
+ Pop $3
+ Pop $2
+ Pop $1
+ Pop $0
+ Exch $R0
+ FunctionEnd
+
+ !undef _WORDFUNC_UN1
+ !define _WORDFUNC_UN1
+ !verbose pop
+ !endif
+!macroend
+
+!macro WordInsert
+ !ifndef ${_WORDFUNC_UN1}WordInsert
+ !verbose push
+ !verbose ${_WORDFUNC_VERBOSE}
+ !insertmacro WordFind
+
+ !define ${_WORDFUNC_UN1}WordInsert `!insertmacro ${_WORDFUNC_UN1}WordInsertCall`
+
+ Function ${_WORDFUNC_UN1}WordInsert
+ Exch $2
+ Exch
+ Exch $1
+ Exch
+ Exch 2
+ Exch $0
+ Exch 2
+ Exch 3
+ Exch $R0
+ Exch 3
+ Push $3
+ Push $4
+ Push $5
+ Push $6
+ Push $7
+ Push $8
+ Push $9
+ Push $R1
+ ClearErrors
+
+ StrCpy $5 ''
+ StrCpy $6 $0
+ StrCpy $7 }
+
+ StrCpy $9 ''
+ StrCpy $R1 $R0
+ StrCpy $3 $2 1
+ StrCpy $2 $2 '' 1
+ StrCmp $3 'E' 0 +3
+ StrCpy $9 'E'
+ goto -4
+
+ StrCmp $3 '+' +2
+ StrCmp $3 '-' 0 error3
+ IntOp $2 $2 + 0
+ StrCmp $2 0 error2
+ StrCmp $0 '' error1
+
+ StrCmp $2 1 0 two
+ GetLabelAddress $8 oneback
+ StrCmp $3 '+' call
+ StrCpy $7 {
+ goto call
+ oneback:
+ IfErrors 0 +2
+ StrCpy $4 $R0
+ StrCmp $3 '+' 0 +3
+ StrCpy $R0 '$1$0$4'
+ goto end
+ StrCpy $R0 '$4$0$1'
+ goto end
+
+ two:
+ IntOp $2 $2 - 1
+ GetLabelAddress $8 twoback
+ StrCmp $3 '+' 0 call
+ StrCpy $7 {
+ goto call
+ twoback:
+ IfErrors 0 tree
+ StrCmp $2$4 11 0 error2
+ StrCmp $3 '+' 0 +3
+ StrCpy $R0 '$R0$0$1'
+ goto end
+ StrCpy $R0 '$1$0$R0'
+ goto end
+
+ tree:
+ StrCpy $7 }
+ StrCpy $5 $4
+ IntOp $2 $2 + 1
+ GetLabelAddress $8 treeback
+ StrCmp $3 '+' call
+ StrCpy $7 {
+ goto call
+ treeback:
+ IfErrors 0 +3
+ StrCpy $4 ''
+ StrCpy $6 ''
+ StrCmp $3 '+' 0 +3
+ StrCpy $R0 '$5$0$1$6$4'
+ goto end
+ StrCpy $R0 '$4$6$1$0$5'
+ goto end
+
+ call:
+ Push '$R0'
+ Push '$0'
+ Push 'E$3$2*$7'
+ Call ${_WORDFUNC_UN1}WordFind
+ Pop $4
+ goto $8
+
+ error3:
+ StrCpy $R0 3
+ goto error
+ error2:
+ StrCpy $R0 2
+ goto error
+ error1:
+ StrCpy $R0 1
+ error:
+ StrCmp $9 'E' +3
+ StrCpy $R0 $R1
+ goto +2
+ SetErrors
+
+ end:
+ Pop $R1
+ Pop $9
+ Pop $8
+ Pop $7
+ Pop $6
+ Pop $5
+ Pop $4
+ Pop $3
+ Pop $2
+ Pop $1
+ Pop $0
+ Exch $R0
+ FunctionEnd
+
+ !undef _WORDFUNC_UN1
+ !define _WORDFUNC_UN1
+ !verbose pop
+ !endif
+!macroend
+
+!macro StrFilter
+ !ifndef ${_WORDFUNC_UN1}StrFilter
+ !verbose push
+ !verbose ${_WORDFUNC_VERBOSE}
+ !define ${_WORDFUNC_UN1}StrFilter `!insertmacro ${_WORDFUNC_UN1}StrFilterCall`
+
+ Function ${_WORDFUNC_UN1}StrFilter
+ Exch $2
+ Exch
+ Exch $1
+ Exch
+ Exch 2
+ Exch $0
+ Exch 2
+ Exch 3
+ Exch $R0
+ Exch 3
+ Push $3
+ Push $4
+ Push $5
+ Push $6
+ Push $7
+ Push $R1
+ Push $R2
+ Push $R3
+ Push $R4
+ Push $R5
+ Push $R6
+ Push $R7
+ Push $R8
+ ClearErrors
+
+ StrCpy $R2 $0 '' -3
+ StrCmp $R2 eng eng
+ StrCmp $R2 rus rus
+ eng:
+ StrCpy $4 65
+ StrCpy $5 90
+ StrCpy $6 97
+ StrCpy $7 122
+ goto langend
+ rus:
+ StrCpy $4 192
+ StrCpy $5 223
+ StrCpy $6 224
+ StrCpy $7 255
+ goto langend
+ ;...
+
+ langend:
+ StrCpy $R7 ''
+ StrCpy $R8 ''
+
+ StrCmp $2 '' 0 begin
+
+ restart1:
+ StrCpy $2 ''
+ StrCpy $3 $0 1
+ StrCmp $3 '+' +2
+ StrCmp $3 '-' 0 +3
+ StrCpy $0 $0 '' 1
+ goto +2
+ StrCpy $3 ''
+
+ IntOp $0 $0 + 0
+ StrCmp $0 0 +5
+ StrCpy $R7 $0 1 0
+ StrCpy $R8 $0 1 1
+ StrCpy $R2 $0 1 2
+ StrCmp $R2 '' filter error
+
+ restart2:
+ StrCmp $3 '' end
+ StrCpy $R7 ''
+ StrCpy $R8 '+-'
+ goto begin
+
+ filter:
+ StrCmp $R7 '1' +3
+ StrCmp $R7 '2' +2
+ StrCmp $R7 '3' 0 error
+
+ StrCmp $R8 '' begin
+ StrCmp $R7$R8 '23' +2
+ StrCmp $R7$R8 '32' 0 +3
+ StrCpy $R7 -1
+ goto begin
+ StrCmp $R7$R8 '13' +2
+ StrCmp $R7$R8 '31' 0 +3
+ StrCpy $R7 -2
+ goto begin
+ StrCmp $R7$R8 '12' +2
+ StrCmp $R7$R8 '21' 0 error
+ StrCpy $R7 -3
+
+ begin:
+ StrCpy $R6 0
+ StrCpy $R1 ''
+
+ loop:
+ StrCpy $R2 $R0 1 $R6
+ StrCmp $R2 '' restartchk
+
+ StrCmp $2 '' +7
+ StrCpy $R4 0
+ StrCpy $R5 $2 1 $R4
+ StrCmp $R5 '' addsymbol
+ StrCmp $R5 $R2 skipsymbol
+ IntOp $R4 $R4 + 1
+ goto -4
+
+ StrCmp $1 '' +7
+ StrCpy $R4 0
+ StrCpy $R5 $1 1 $R4
+ StrCmp $R5 '' +4
+ StrCmp $R5 $R2 addsymbol
+ IntOp $R4 $R4 + 1
+ goto -4
+
+ StrCmp $R7 '1' +2
+ StrCmp $R7 '-1' 0 +4
+ StrCpy $R4 48
+ StrCpy $R5 57
+ goto loop2
+ StrCmp $R8 '+-' 0 +2
+ StrCmp $3 '+' 0 +4
+ StrCpy $R4 $4
+ StrCpy $R5 $5
+ goto loop2
+ StrCpy $R4 $6
+ StrCpy $R5 $7
+
+ loop2:
+ IntFmt $R3 '%c' $R4
+ StrCmp $R2 $R3 found
+ StrCmp $R4 $R5 notfound
+ IntOp $R4 $R4 + 1
+ goto loop2
+
+ found:
+ StrCmp $R8 '+-' setcase
+ StrCmp $R7 '3' skipsymbol
+ StrCmp $R7 '-3' addsymbol
+ StrCmp $R8 '' addsymbol skipsymbol
+
+ notfound:
+ StrCmp $R8 '+-' addsymbol
+ StrCmp $R7 '3' 0 +2
+ StrCmp $R5 57 addsymbol +3
+ StrCmp $R7 '-3' 0 +5
+ StrCmp $R5 57 skipsymbol
+ StrCpy $R4 48
+ StrCpy $R5 57
+ goto loop2
+ StrCmp $R8 '' skipsymbol addsymbol
+
+ setcase:
+ StrCpy $R2 $R3
+ addsymbol:
+ StrCpy $R1 $R1$R2
+ skipsymbol:
+ IntOp $R6 $R6 + 1
+ goto loop
+
+ error:
+ SetErrors
+ StrCpy $R0 ''
+ goto end
+
+ restartchk:
+ StrCpy $R0 $R1
+ StrCmp $2 '' 0 restart1
+ StrCmp $R8 '+-' 0 restart2
+
+ end:
+ Pop $R8
+ Pop $R7
+ Pop $R6
+ Pop $R5
+ Pop $R4
+ Pop $R3
+ Pop $R2
+ Pop $R1
+ Pop $7
+ Pop $6
+ Pop $5
+ Pop $4
+ Pop $3
+ Pop $2
+ Pop $1
+ Pop $0
+ Exch $R0
+ FunctionEnd
+
+ !undef _WORDFUNC_UN1
+ !define _WORDFUNC_UN1
+ !verbose pop
+ !endif
+!macroend
+
+!macro VersionCompare
+ !ifndef ${_WORDFUNC_UN1}VersionCompare
+ !verbose push
+ !verbose ${_WORDFUNC_VERBOSE}
+ !define ${_WORDFUNC_UN1}VersionCompare `!insertmacro ${_WORDFUNC_UN1}VersionCompareCall`
+
+ Function ${_WORDFUNC_UN1}VersionCompare
+ Exch $1
+ Exch
+ Exch $0
+ Exch
+ Push $2
+ Push $3
+ Push $4
+ Push $5
+ Push $6
+ Push $7
+
+ begin:
+ StrCpy $2 -1
+ IntOp $2 $2 + 1
+ StrCpy $3 $0 1 $2
+ StrCmp $3 '' +2
+ StrCmp $3 '.' 0 -3
+ StrCpy $4 $0 $2
+ IntOp $2 $2 + 1
+ StrCpy $0 $0 '' $2
+
+ StrCpy $2 -1
+ IntOp $2 $2 + 1
+ StrCpy $3 $1 1 $2
+ StrCmp $3 '' +2
+ StrCmp $3 '.' 0 -3
+ StrCpy $5 $1 $2
+ IntOp $2 $2 + 1
+ StrCpy $1 $1 '' $2
+
+ StrCmp $4$5 '' equal
+
+ StrCpy $6 -1
+ IntOp $6 $6 + 1
+ StrCpy $3 $4 1 $6
+ StrCmp $3 '0' -2
+ StrCmp $3 '' 0 +2
+ StrCpy $4 0
+
+ StrCpy $7 -1
+ IntOp $7 $7 + 1
+ StrCpy $3 $5 1 $7
+ StrCmp $3 '0' -2
+ StrCmp $3 '' 0 +2
+ StrCpy $5 0
+
+ StrCmp $4 0 0 +2
+ StrCmp $5 0 begin newer2
+ StrCmp $5 0 newer1
+ IntCmp $6 $7 0 newer1 newer2
+
+ StrCpy $4 '1$4'
+ StrCpy $5 '1$5'
+ IntCmp $4 $5 begin newer2 newer1
+
+ equal:
+ StrCpy $0 0
+ goto end
+ newer1:
+ StrCpy $0 1
+ goto end
+ newer2:
+ StrCpy $0 2
+
+ end:
+ Pop $7
+ Pop $6
+ Pop $5
+ Pop $4
+ Pop $3
+ Pop $2
+ Pop $1
+ Exch $0
+ FunctionEnd
+
+ !undef _WORDFUNC_UN1
+ !define _WORDFUNC_UN1
+ !verbose pop
+ !endif
+!macroend
+
+!macro VersionConvert
+ !ifndef ${_WORDFUNC_UN1}VersionConvert
+ !verbose push
+ !verbose ${_WORDFUNC_VERBOSE}
+ !define ${_WORDFUNC_UN1}VersionConvert `!insertmacro ${_WORDFUNC_UN1}VersionConvertCall`
+
+ Function ${_WORDFUNC_UN1}VersionConvert
+ Exch $1
+ Exch
+ Exch $0
+ Exch
+ Push $2
+ Push $3
+ Push $4
+ Push $5
+ Push $6
+ Push $7
+
+ StrCmp $1 '' 0 +2
+ StrCpy $1 'abcdefghijklmnopqrstuvwxyz'
+ StrCpy $1 $1 99
+
+ StrCpy $2 0
+ StrCpy $7 'dot'
+ goto loop
+
+ preloop:
+ IntOp $2 $2 + 1
+
+ loop:
+ StrCpy $3 $0 1 $2
+ StrCmp $3 '' endcheck
+ StrCmp $3 '.' dot
+ StrCmp $3 '0' digit
+ IntCmp $3 '0' letter letter digit
+
+ dot:
+ StrCmp $7 'dot' replacespecial
+ StrCpy $7 'dot'
+ goto preloop
+
+ digit:
+ StrCmp $7 'letter' insertdot
+ StrCpy $7 'digit'
+ goto preloop
+
+ letter:
+ StrCpy $5 0
+ StrCpy $4 $1 1 $5
+ IntOp $5 $5 + 1
+ StrCmp $4 '' replacespecial
+ StrCmp $4 $3 0 -3
+ IntCmp $5 9 0 0 +2
+ StrCpy $5 '0$5'
+
+ StrCmp $7 'letter' +2
+ StrCmp $7 'dot' 0 +3
+ StrCpy $6 ''
+ goto +2
+ StrCpy $6 '.'
+
+ StrCpy $4 $0 $2
+ IntOp $2 $2 + 1
+ StrCpy $0 $0 '' $2
+ StrCpy $0 '$4$6$5$0'
+ StrLen $4 '$6$5'
+ IntOp $2 $2 + $4
+ IntOp $2 $2 - 1
+ StrCpy $7 'letter'
+ goto loop
+
+ replacespecial:
+ StrCmp $7 'dot' 0 +3
+ StrCpy $6 ''
+ goto +2
+ StrCpy $6 '.'
+
+ StrCpy $4 $0 $2
+ IntOp $2 $2 + 1
+ StrCpy $0 $0 '' $2
+ StrCpy $0 '$4$6$0'
+ StrLen $4 $6
+ IntOp $2 $2 + $4
+ IntOp $2 $2 - 1
+ StrCpy $7 'dot'
+ goto loop
+
+ insertdot:
+ StrCpy $4 $0 $2
+ StrCpy $0 $0 '' $2
+ StrCpy $0 '$4.$0'
+ StrCpy $7 'dot'
+ goto preloop
+
+ endcheck:
+ StrCpy $4 $0 1 -1
+ StrCmp $4 '.' 0 end
+ StrCpy $0 $0 -1
+ goto -3
+
+ end:
+ Pop $7
+ Pop $6
+ Pop $5
+ Pop $4
+ Pop $3
+ Pop $2
+ Pop $1
+ Exch $0
+ FunctionEnd
+
+ !undef _WORDFUNC_UN1
+ !define _WORDFUNC_UN1
+ !verbose pop
+ !endif
+!macroend
+
+!macro un.WordFindCall _STRING _DELIMITER _OPTION _RESULT
+ !verbose push
+ !verbose ${_WORDFUNC_VERBOSE}
+ Push `${_STRING}`
+ Push `${_DELIMITER}`
+ Push `${_OPTION}`
+ Call un.WordFind
+ Pop ${_RESULT}
+ !verbose pop
+!macroend
+
+!macro un.WordFind2XCall _STRING _DELIMITER1 _DELIMITER2 _NUMBER _RESULT
+ !verbose push
+ !verbose ${_WORDFUNC_VERBOSE}
+ Push `${_STRING}`
+ Push `${_DELIMITER1}`
+ Push `${_DELIMITER2}`
+ Push `${_NUMBER}`
+ Call un.WordFind2X
+ Pop ${_RESULT}
+ !verbose pop
+!macroend
+
+!macro un.WordFind3XCall _STRING _DELIMITER1 _CENTER _DELIMITER2 _NUMBER _RESULT
+ !verbose push
+ !verbose ${_WORDFUNC_VERBOSE}
+ Push `${_STRING}`
+ Push `${_DELIMITER1}`
+ Push `${_CENTER}`
+ Push `${_DELIMITER2}`
+ Push `${_NUMBER}`
+ Call un.WordFind3X
+ Pop ${_RESULT}
+ !verbose pop
+!macroend
+
+!macro un.WordReplaceCall _STRING _WORD1 _WORD2 _NUMBER _RESULT
+ !verbose push
+ !verbose ${_WORDFUNC_VERBOSE}
+ Push `${_STRING}`
+ Push `${_WORD1}`
+ Push `${_WORD2}`
+ Push `${_NUMBER}`
+ Call un.WordReplace
+ Pop ${_RESULT}
+ !verbose pop
+!macroend
+
+!macro un.WordAddCall _STRING1 _DELIMITER _STRING2 _RESULT
+ !verbose push
+ !verbose ${_WORDFUNC_VERBOSE}
+ Push `${_STRING1}`
+ Push `${_DELIMITER}`
+ Push `${_STRING2}`
+ Call un.WordAdd
+ Pop ${_RESULT}
+ !verbose pop
+!macroend
+
+!macro un.WordInsertCall _STRING _DELIMITER _WORD _NUMBER _RESULT
+ !verbose push
+ !verbose ${_WORDFUNC_VERBOSE}
+ Push `${_STRING}`
+ Push `${_DELIMITER}`
+ Push `${_WORD}`
+ Push `${_NUMBER}`
+ Call un.WordInsert
+ Pop ${_RESULT}
+ !verbose pop
+!macroend
+
+!macro un.StrFilterCall _STRING _FILTER _INCLUDE _EXCLUDE _RESULT
+ !verbose push
+ !verbose ${_WORDFUNC_VERBOSE}
+ Push `${_STRING}`
+ Push `${_FILTER}`
+ Push `${_INCLUDE}`
+ Push `${_EXCLUDE}`
+ Call un.StrFilter
+ Pop ${_RESULT}
+ !verbose pop
+!macroend
+
+!macro un.VersionCompareCall _VER1 _VER2 _RESULT
+ !verbose push
+ !verbose ${_WORDFUNC_VERBOSE}
+ Push `${_VER1}`
+ Push `${_VER2}`
+ Call un.VersionCompare
+ Pop ${_RESULT}
+ !verbose pop
+!macroend
+
+!macro un.VersionConvertCall _VERSION _CHARLIST _RESULT
+ !verbose push
+ !verbose ${_WORDFUNC_VERBOSE}
+ Push `${_VERSION}`
+ Push `${_CHARLIST}`
+ Call un.VersionConvert
+ Pop ${_RESULT}
+ !verbose pop
+!macroend
+
+!macro un.WordFind
+ !ifndef un.WordFind
+ !verbose push
+ !verbose ${_WORDFUNC_VERBOSE}
+ !undef _WORDFUNC_UN1
+ !define _WORDFUNC_UN1 `un.`
+
+ !undef _WORDFUNC_UN2
+ !insertmacro WordFind
+ !define _WORDFUNC_UN2
+
+ !verbose pop
+ !endif
+!macroend
+
+!macro un.WordFind2X
+ !ifndef un.WordFind2X
+ !verbose push
+ !verbose ${_WORDFUNC_VERBOSE}
+ !undef _WORDFUNC_UN1
+ !define _WORDFUNC_UN1 `un.`
+
+ !insertmacro WordFind2X
+
+ !verbose pop
+ !endif
+!macroend
+
+!macro un.WordFind3X
+ !ifndef un.WordFind3X
+ !verbose push
+ !verbose ${_WORDFUNC_VERBOSE}
+ !undef _WORDFUNC_UN1
+ !define _WORDFUNC_UN1 `un.`
+
+ !insertmacro WordFind3X
+
+ !verbose pop
+ !endif
+!macroend
+
+!macro un.WordReplace
+ !ifndef un.WordReplace
+ !verbose push
+ !verbose ${_WORDFUNC_VERBOSE}
+ !undef _WORDFUNC_UN1
+ !define _WORDFUNC_UN1 `un.`
+
+ !insertmacro WordReplace
+
+ !verbose pop
+ !endif
+!macroend
+
+!macro un.WordAdd
+ !ifndef un.WordAdd
+ !verbose push
+ !verbose ${_WORDFUNC_VERBOSE}
+ !undef _WORDFUNC_UN1
+ !define _WORDFUNC_UN1 `un.`
+
+ !insertmacro WordAdd
+
+ !verbose pop
+ !endif
+!macroend
+
+!macro un.WordInsert
+ !ifndef un.WordInsert
+ !verbose push
+ !verbose ${_WORDFUNC_VERBOSE}
+ !undef _WORDFUNC_UN1
+ !define _WORDFUNC_UN1 `un.`
+
+ !insertmacro WordInsert
+
+ !verbose pop
+ !endif
+!macroend
+
+!macro un.StrFilter
+ !ifndef un.StrFilter
+ !verbose push
+ !verbose ${_WORDFUNC_VERBOSE}
+ !undef _WORDFUNC_UN1
+ !define _WORDFUNC_UN1 `un.`
+
+ !insertmacro StrFilter
+
+ !verbose pop
+ !endif
+!macroend
+
+!macro un.VersionCompare
+ !ifndef un.VersionCompare
+ !verbose push
+ !verbose ${_WORDFUNC_VERBOSE}
+ !undef _WORDFUNC_UN1
+ !define _WORDFUNC_UN1 `un.`
+
+ !insertmacro VersionCompare
+
+ !verbose pop
+ !endif
+!macroend
+
+!macro un.VersionConvert
+ !ifndef un.VersionConvert
+ !verbose push
+ !verbose ${_WORDFUNC_VERBOSE}
+ !undef _WORDFUNC_UN1
+ !define _WORDFUNC_UN1 `un.`
+
+ !insertmacro VersionConvert
+
+ !verbose pop
+ !endif
+!macroend