Updated documentation and file functions for Unicode support
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6119 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
954c0abe6c
commit
73501896d4
6 changed files with 179 additions and 4 deletions
|
@ -87,6 +87,23 @@ This command sets the overwrite flag which is used by the \R{file}{File} command
|
|||
\c File program.cfg # config file we don't want to overwrite
|
||||
\c SetOverwrite on
|
||||
|
||||
\S2{atargetminimalos} TargetMinimalOS
|
||||
|
||||
\c X.Y
|
||||
|
||||
This command sets the minimal OS version of the target Windows system required in order to run the installer. This will NOT make the installer test for OS compatibility, but it will indicate which Windows APIs will be available for use by the installer program. The installer will not be able to execute on older systems.
|
||||
|
||||
In particular, if you indicate a minimal OS of 5.0 or more, MakeNSIS will generate a \R{intro-unicode}{Unicode installer} (as Windows 2000 and more recent are Unicode fully-compatible OSes).
|
||||
|
||||
\c TargetMinimalOS 4.1 ; target Windows 9x or more recent
|
||||
\c TargetMinimalOS 4.2 ; target Windows NT4 or more recent
|
||||
\c TargetMinimalOS 5.0 ; target Windows 2000 or more recent / make a Unicode installer
|
||||
\c TargetMinimalOS 5.1 ; target Windows XP or more recent / make a Unicode installer
|
||||
\c TargetMinimalOS 6.0 ; target Windows Vista or more recent / make a Unicode installer
|
||||
\c TargetMinimalOS 6.1 ; target Windows Seven or more recent / make a Unicode installer
|
||||
|
||||
Check the various \W{http://msdn.microsoft.com/en-us/library/ms724833.aspx}{version numbers of Windows}.
|
||||
|
||||
\S1{versioninfo} Version Information
|
||||
|
||||
\S2{viaddversionkey} VIAddVersionKey
|
||||
|
|
|
@ -156,6 +156,8 @@ French - \e{veekee, Sebastien Delahaye, Jerome Charaoui}
|
|||
|
||||
Galician - \e{Ramon Flores}
|
||||
|
||||
Georgian - \e{David Huriev}
|
||||
|
||||
German - \e{L.King, K. Windszus, R. Bisswanger, M. Simmack, Tim Kosse}
|
||||
|
||||
Greek - \e{Makidis N. Michael}
|
||||
|
@ -172,6 +174,8 @@ Italian - \e{Orfanik, sanface, Alessandro Staltari, Lorenzo Bevilacqua}
|
|||
|
||||
Japanese - \e{Dnanako, Takahiro Yoshimura}
|
||||
|
||||
Khmer - \e{yi sophally}
|
||||
|
||||
Korean - \e{dTomoyo, linak, koder}
|
||||
|
||||
Kurdish - \e{Erdal Ronahi}
|
||||
|
@ -190,6 +194,8 @@ Norwegian - \e{Jonas Christoffer Lindstrom, Jan Ivar Beddari}
|
|||
|
||||
Norwegian Nynorsk - \e{Vebj\u00F8rn Sture}
|
||||
|
||||
Pashto - \e{Pakhtosoft}
|
||||
|
||||
Polish - \e{Piotr Murawski, Rafa³ Lampe, cube, SYSTEMsoft Group}
|
||||
|
||||
Portuguese - \e{DragonSoull, Dre', Ramon}
|
||||
|
@ -224,6 +230,8 @@ Uzbek - \e{Emil Garipov (emil.garipov@gmail.com)}
|
|||
|
||||
Valencian - \e{Bernardo Arlandis Ma\uF1\uF3}
|
||||
|
||||
Vietnamese - \e{Clytie Siddall}
|
||||
|
||||
Welsh - \e{Rhoslyn Prys, Meddal.com}
|
||||
|
||||
\H{writers} Writers
|
||||
|
|
|
@ -21,7 +21,9 @@ If no absolute path is specified the current folder will be used. The current fo
|
|||
|
||||
\c handle user_var(output) [maxlen]
|
||||
|
||||
Reads a string from a file opened with FileOpen. The string is read until either a newline (or carriage return newline pair) occurs, or until a null byte is read, or until maxlen is met (if specified). By default, strings are limited to 1024 characters (a special build with larger NSIS_MAX_STRLEN can be compiled or downloaded). If the end of file is read and no more data is available, the output string will be empty, and the error flag will be set.
|
||||
Reads a string (ANSI characters) from a file opened with FileOpen. The string is read until either a newline (or carriage return newline pair) occurs, or until a null byte is read, or until maxlen is met (if specified). By default, strings are limited to 1024 characters (a special build with larger NSIS_MAX_STRLEN can be compiled or downloaded). If the end of file is read and no more data is available, the output string will be empty, and the error flag will be set.
|
||||
|
||||
(If you are building a \R{intro-unicode}{Unicode installer}, the function reads an ANSI string and makes the adequate conversion)
|
||||
|
||||
\c ClearErrors
|
||||
\c FileOpen $0 $INSTDIR\file.dat r
|
||||
|
@ -31,6 +33,22 @@ Reads a string from a file opened with FileOpen. The string is read until either
|
|||
\c FileClose $0
|
||||
\c done:
|
||||
|
||||
\S2{FileReadUTF16LE} FileReadUTF16LE
|
||||
|
||||
\c handle user_var(output) [maxlen]
|
||||
|
||||
This function is only available when building a \R{intro-unicode}{Unicode installer}.
|
||||
|
||||
Reads a string (UTF-16LE characters) from a file opened with FileOpen. The string is read until either a newline (or carriage return newline pair) occurs, or until a null wide-character is read, or until maxlen is met (if specified). By default, strings are limited to 1024 characters (a special build with larger NSIS_MAX_STRLEN can be compiled or downloaded). If the end of file is read and no more data is available, the output string will be empty, and the error flag will be set.
|
||||
|
||||
\c ClearErrors
|
||||
\c FileOpen $0 $INSTDIR\file.dat r
|
||||
\c IfErrors done
|
||||
\c FileReadUTF16LE $0 $1
|
||||
\c DetailPrint $1
|
||||
\c FileClose $0
|
||||
\c done:
|
||||
|
||||
\S2{FileReadByte} FileReadByte
|
||||
|
||||
\c handle user_var(output)
|
||||
|
@ -46,6 +64,23 @@ Reads a byte from a file opened with FileOpen. The byte is stored in the output
|
|||
\c FileClose $0
|
||||
\c done:
|
||||
|
||||
\S2{FileReadWord} FileReadWord
|
||||
|
||||
\c handle user_var(output)
|
||||
|
||||
This function is only available when building a \R{intro-unicode}{Unicode installer}.
|
||||
|
||||
Reads a word (2-bytes) from a file opened with FileOpen. The word is stored in the output as an integer (0-65535). If the end of file is read and no more data is available, the output will be empty, and the error flag will be set.
|
||||
|
||||
\c ClearErrors
|
||||
\c FileOpen $0 $INSTDIR\file.dat r
|
||||
\c IfErrors done
|
||||
\c FileReadWord $0 $1
|
||||
\c FileReadWord $0 $2
|
||||
\c DetailPrint "$1 $2"
|
||||
\c FileClose $0
|
||||
\c done:
|
||||
|
||||
\S2{FileSeek} FileSeek
|
||||
|
||||
\c handle offset [mode] [user_var(new position)]
|
||||
|
@ -65,7 +100,9 @@ Seeks a file opened with FileOpen. If mode is omitted or specified as SET, the f
|
|||
|
||||
\c handle string
|
||||
|
||||
Writes a string to a file opened with FileOpen. If an error occurs writing, the error flag will be set.
|
||||
Writes an ANSI string to a file opened with FileOpen. If an error occurs writing, the error flag will be set.
|
||||
|
||||
(If you are building a \R{intro-unicode}{Unicode installer}, the function makes the adequate conversion and writes an ANSI string)
|
||||
|
||||
\c ClearErrors
|
||||
\c FileOpen $0 $INSTDIR\file.dat w
|
||||
|
@ -74,6 +111,21 @@ Writes a string to a file opened with FileOpen. If an error occurs writing, the
|
|||
\c FileClose $0
|
||||
\c done:
|
||||
|
||||
\S2{FileWriteUTF16LE} FileWriteUTF16LE
|
||||
|
||||
\c handle string
|
||||
|
||||
This function is only available when building a \R{intro-unicode}{Unicode installer}.
|
||||
|
||||
Writes a Unicode (UTF-16LE) string to a file opened with FileOpen. If an error occurs writing, the error flag will be set.
|
||||
|
||||
\c ClearErrors
|
||||
\c FileOpen $0 $INSTDIR\file.dat w
|
||||
\c IfErrors done
|
||||
\c FileWriteUTF16LE $0 "some text"
|
||||
\c FileClose $0
|
||||
\c done:
|
||||
|
||||
\S2{FileWriteByte} FileWriteByte
|
||||
|
||||
\c handle string
|
||||
|
@ -85,6 +137,19 @@ Writes the integer interpretation of 'string' to a file opened with FileOpen. Of
|
|||
|
||||
If an error occurs while writing, the error flag will be set. Note that the low byte of the integer is used, i.e. writing 256 is the same as writing 0, etc.
|
||||
|
||||
\S2{FileWriteWord} FileWriteWord
|
||||
|
||||
\c handle string
|
||||
|
||||
This function is only available when building a \R{intro-unicode}{Unicode installer}.
|
||||
|
||||
Writes the integer interpretation of 'string' as a WORD (2-bytes, range: 0-65535) to a file opened with FileOpen. Of course you can enter the integer value directly. The following code writes a "Carriage Return / Line Feed" - Enter to the file.
|
||||
|
||||
\c FileWriteWord file_handle "13"
|
||||
\c FileWriteWord file_handle "10"
|
||||
|
||||
If an error occurs while writing, the error flag will be set. Note that the low WORD of the integer is used, i.e. writing 65536 is the same as writing 0, etc.
|
||||
|
||||
\S2{FindClose} FindClose
|
||||
|
||||
\c handle
|
||||
|
|
|
@ -14,6 +14,8 @@ Because it's based on script files, you can fully control every part of your ins
|
|||
The script language supports variables, functions, string manipulation, just like a normal programming language - but designed for the creation of installers.
|
||||
Even with all these features, NSIS is still the smallest installer system available. With the default options, it has an overhead of only 34 KB.
|
||||
|
||||
Now you can also create \R{intro-unicode}{Unicode installers}, targeting all the languages supported by the OS without display issues.
|
||||
|
||||
\H{intro-features} Main Features
|
||||
|
||||
\\<b\\>Small overhead size\\</b\\>
|
||||
|
@ -34,7 +36,7 @@ Unlike other systems that can only generate installers based on a list of files
|
|||
|
||||
\\<b\\>Multiple languages in one installer\\</b\\>
|
||||
|
||||
One installer can support multiple interface languages. More than 40 translations are already included, but you can also create your own language files. RTL (right-to-left) languages such as Arabic and Hebrew are fully supported.
|
||||
One installer can support multiple interface languages. More than 60 translations are already included, but you can also create your own language files. RTL (right-to-left) languages such as Arabic and Hebrew are fully supported. Creating Unicode native installer is also possible for even more supported languages.
|
||||
|
||||
\\<b\\>Many features and checks for the target system\\</b\\>
|
||||
|
||||
|
@ -72,7 +74,7 @@ The NSIS script format and the format used for interface dialogs are easy, docum
|
|||
|
||||
\b Classic and Modern wizard interface
|
||||
|
||||
\b Fully multilingual, support for multiple languages in one installer. More than 40 translations are available, but you can also create your own
|
||||
\b Fully multilingual, support for multiple languages in one installer. More than 60 translations are available, but you can also create your own. Unicode support allowing even more languages.
|
||||
|
||||
\b Page system: You can add standard wizard pages or custom pages
|
||||
|
||||
|
@ -147,3 +149,11 @@ The NSIS script format and the format used for interface dialogs are easy, docum
|
|||
\b Completely free for any use. See \R{license}{license}.
|
||||
|
||||
\b More
|
||||
|
||||
\H{intro-unicode} Unicode installers
|
||||
|
||||
Starting with MakeNSIS v2.50, you can choose create Unicode installers by using \R{atargetminimalos}{TargetMinimalOS} with value greater than or equal to 5.0.
|
||||
These installers will work only under Windows 2000 or more recent (depending on the value you chose), but they will allow you to display your installer in any Unicode language supported by the OS.
|
||||
|
||||
When building a Unicode installer, NSIS variables can hold Unicode characters (0000-FFFF). There should be no need to modify your existing scripts.
|
||||
If you want to read/write Unicode files, specific instructions have been added to read/write UTF-16LE strings from/to disk.
|
||||
|
|
|
@ -262,6 +262,57 @@ Here is the function:
|
|||
|
||||
written by KiCHiK
|
||||
|
||||
Here's the function to generate a Unicode file if you're building a \R{intro-unicode}{Unicode installer}.
|
||||
|
||||
\c !define LVM_GETITEMCOUNT 0x1004
|
||||
\c !define LVM_GETITEMTEXT 0x1073
|
||||
\c
|
||||
\c Function DumpLog
|
||||
\c Exch $5
|
||||
\c Push $0
|
||||
\c Push $1
|
||||
\c Push $2
|
||||
\c Push $3
|
||||
\c Push $4
|
||||
\c Push $6
|
||||
\c
|
||||
\c FindWindow $0 "#32770" "" $HWNDPARENT
|
||||
\c GetDlgItem $0 $0 1016
|
||||
\c StrCmp $0 0 error
|
||||
\c FileOpen $5 $5 "w"
|
||||
\c FileWriteWord $5 0xfeff ; Write the BOM
|
||||
\c StrCmp $5 0 error
|
||||
\c SendMessage $0 ${LVM_GETITEMCOUNT} 0 0 $6
|
||||
\c System::StrAlloc ${NSIS_MAX_STRLEN}
|
||||
\c Pop $3
|
||||
\c StrCpy $2 0
|
||||
\c System::Call "*(i, i, i, i, i, i, i, i, i) i \
|
||||
\c (0, 0, 0, 0, 0, r3, ${NSIS_MAX_STRLEN}) .r1"
|
||||
\c loop: StrCmp $2 $6 done
|
||||
\c System::Call "User32::SendMessageW(i, i, i, i) i \
|
||||
\c ($0, ${LVM_GETITEMTEXT}, $2, r1)"
|
||||
\c System::Call "*$3(&t${NSIS_MAX_STRLEN} .r4)"
|
||||
\c FileWriteUTF16LE $5 "$4$\r$\n"
|
||||
\c IntOp $2 $2 + 1
|
||||
\c Goto loop
|
||||
\c done:
|
||||
\c FileClose $5
|
||||
\c System::Free $1
|
||||
\c System::Free $3
|
||||
\c Goto exit
|
||||
\c error:
|
||||
\c MessageBox MB_OK error
|
||||
\c exit:
|
||||
\c Pop $6
|
||||
\c Pop $4
|
||||
\c Pop $3
|
||||
\c Pop $2
|
||||
\c Pop $1
|
||||
\c Pop $0
|
||||
\c Exch $5
|
||||
\c FunctionEnd
|
||||
|
||||
Modified by Jim Park.
|
||||
|
||||
\H{readreg_multi_sz} How to Read REG_MULTI_SZ Values
|
||||
|
||||
|
@ -383,3 +434,7 @@ I wrote this script to help rpetges in \W{http://forums.winamp.com/showthread.ph
|
|||
\c SectionEnd
|
||||
|
||||
written by KiCHiK
|
||||
|
||||
\H{unicode_defines}Predefined Macros for Unicode support
|
||||
|
||||
There are two macros that can help you write scripts that work for both Unicode and ANSI installers. To figure out if the script is being compiled to generate a Unicode installer, use !ifdef check for $\{NSIS_UNICODE\}. To see what the size of the default character is, use $\{NSIS_CHAR_SIZE\}. It will be 1 for ANSI and 2 for Unicode installers.
|
||||
|
|
|
@ -5562,6 +5562,11 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
|
|||
return add_entry(&ent);
|
||||
#ifdef _UNICODE
|
||||
case TOK_FILEREADUTF16LE:
|
||||
if (!build_unicode)
|
||||
{
|
||||
ERROR_MSG(_T("Error: %s is only available when building a Unicode installer\n"), line.gettoken_str(0));
|
||||
return PS_ERROR;
|
||||
}
|
||||
ent.which=EW_FGETWS;
|
||||
ent.offsets[0]=GetUserVarIndex(line, 1); // file handle
|
||||
ent.offsets[1]=GetUserVarIndex(line, 2); // output string
|
||||
|
@ -5573,6 +5578,11 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
|
|||
SCRIPT_MSG(_T("FileReadUTF16LE: %s->%s (max:%s)\n"),line.gettoken_str(1),line.gettoken_str(2),line.gettoken_str(3));
|
||||
return add_entry(&ent);
|
||||
case TOK_FILEWRITEUTF16LE:
|
||||
if (!build_unicode)
|
||||
{
|
||||
ERROR_MSG(_T("Error: %s is only available when building a Unicode installer\n"), line.gettoken_str(0));
|
||||
return PS_ERROR;
|
||||
}
|
||||
ent.which=EW_FPUTWS;
|
||||
ent.offsets[0]=GetUserVarIndex(line, 1); // file handle
|
||||
ent.offsets[1]=add_string(line.gettoken_str(2));
|
||||
|
@ -5580,6 +5590,11 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
|
|||
SCRIPT_MSG(_T("FileWriteUTF16LE: %s->%s\n"),line.gettoken_str(2),line.gettoken_str(1));
|
||||
return add_entry(&ent);
|
||||
case TOK_FILEREADWORD:
|
||||
if (!build_unicode)
|
||||
{
|
||||
ERROR_MSG(_T("Error: %s is only available when building a Unicode installer\n"), line.gettoken_str(0));
|
||||
return PS_ERROR;
|
||||
}
|
||||
ent.which=EW_FGETWS;
|
||||
ent.offsets[0]=GetUserVarIndex(line, 1); // file handle
|
||||
ent.offsets[1]=GetUserVarIndex(line, 2); // output string
|
||||
|
@ -5589,6 +5604,11 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
|
|||
SCRIPT_MSG(_T("FileReadWord: %s->%s\n"),line.gettoken_str(1),line.gettoken_str(2));
|
||||
return add_entry(&ent);
|
||||
case TOK_FILEWRITEWORD:
|
||||
if (!build_unicode)
|
||||
{
|
||||
ERROR_MSG(_T("Error: %s is only available when building a Unicode installer\n"), line.gettoken_str(0));
|
||||
return PS_ERROR;
|
||||
}
|
||||
ent.which=EW_FPUTWS;
|
||||
ent.offsets[0]=GetUserVarIndex(line, 1); // file handle
|
||||
ent.offsets[1]=add_string(line.gettoken_str(2));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue