merged from work

This commit is contained in:
2019-12-20 20:02:14 +01:00
parent 202608651b
commit 11e3a02511
505 changed files with 65307 additions and 823 deletions

View File

@ -0,0 +1,51 @@
AdvSplash.dll - small (5.5k), simple plugin that lets you throw
up a splash screen in NSIS installers with cool
fading effects (Win2000+) and transparency.
To use:
Create a .BMP file of your splash screen.
Create a .WAV file to play while your splash screen shows. (optional)
Add the following lines to your .NSI file:
Function .onInit
InitPluginsDir
File "/oname=$PluginsDir\spltmp.bmp" "${NSISDIR}\Contrib\Graphics\Wizard\llama.bmp"
; optional
; File /oname=$PluginsDir\spltmp.wav "my_splashsound.wav"
advsplash::show 1000 600 400 -1 $PluginsDir\spltmp
Pop $0 ; $0 has '1' if the user closed the splash screen early,
; '0' if everything closed normally, and '-1' if some error occurred.
FunctionEnd
Calling format
advsplash::show Delay FadeIn FadeOut KeyColor FileName
Delay - length to show the screen for (in milliseconds)
FadeIn - length to show the fadein scene (in ms) (not included in Delay)
FadeOut - length to show the fadeout scene (in ms) (not included in Delay)
KeyColor - color used for transparency, could be any RGB value
(for ex. R=255 G=100 B=16 -> KeyColor=0xFF6410),
use KeyColor=-1 if there is no transparent color in your image.
FileName - splash bitmap filename (without the .bmp). The BMP file used will be
this parameter.bmp, and the wave file used (if present) will be this
parameter.wav.
(If you already have an .onInit function, put that in it)
Note 1: fadein/fadeout supported only on win2k/winxp systems, all other systems
will show simple splash screen with Delay = Delay + FadeIn + FadeOut. Also, I've
noted my winXP uses no transparent color at 16 bpp, so at bpps lower than 32
for images with transparent color no fading effect will occur.
Note 2: the return value of splash is 1 if the user closed the splash
screen early (pop it from the stack)
-Justin
Converted to a plugin DLL by Amir Szekely (kichik)
Fading and transparency by Nik Medved (brainsucker)

View File

@ -0,0 +1,47 @@
BANNER PLUG-IN
--------------
The Banner plug-in shows a banner with customizable text. It uses the IDD_VERIFY dialog of the UI.
There are three functions - show, getWindow and destroy.
Usage
-----
Banner::show "Text to show"
[optional] Banner::getWindow
Banner::destroy
See Example.nsi for an example.
Modern UI
---------
The Modern UI has two labels on the IDD_VERIFY dialog. To change all the texts, use:
Banner::show /set 76 "Text 1 (replaces Please wait while Setup is loading...)" "Normal text"
Custom UI
---------
If you have more labels on your IDD_VERIFY dialog, you can use multiple /set parameters to change the texts.
Example:
Banner::show /set 76 "bah #1" /set 54 "bah #2" "Normal text"
The second parameter for /set is the ID of the control.
Some More Tricks
----------------
If you use /set to set the main string (IDC_STR, 1030) you can specify a different string for the window's caption and for the main string.
If you use an empty string as the main string (Banner::show "") the banner window will not show on the taskbar.
Credits
-------
A joint effort of brainsucker and kichik in honor of the messages dropped during the battle

View File

@ -0,0 +1,92 @@
BgImage.DLL - NSIS extension DLL
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Displays an image or a gradient with user defined texts and/or images behind the NSIS window.
Can also play WAVs.
See Example.nsi for a usage example.
Usage
~~~~~
1) Call SetBg to set the background
2) Call AddText, or AddImage to add texts and images
3) Call Redraw to update the background window
4) Optional - repeat steps 2-3 to add more images
-or-
call Clear and repeat steps 1-3 for a completely new background.
5) Call Destroy when the background is no longer required (.onGUIEnd for example)
Notes
~~~~~
* This plugin requires NSIS 2.42 and above.
* Do not call SetBg (which creates the window) from a section or a function called by a section.
BgImge must be run from the GUI thread as the installation thread is not built to handle GUI.
Available functions
~~~~~~~~~~~~~~
SetBg [/FILLSCREEN|/TILED] path_to_bitmap
SetBg /GRADIENT R G B R G B
Sets the background and creates the window if necessary
Use /FILLSCREEN to make the image fill the screen
Use /TILED to set a tiled background
Use /GRADIENT to set a gradient background
If SetReturn on was called returns "success" on the stack
or an error string if there was an error
Do not use in .onInit!
AddImage [/TRANSPARENT R G B] path_to_bitmap X Y
Adds an image to the background window at (X,Y)
X and Y can be negative to specify distance from right/bottom
Use /TRANSPARENT to make BgImage draw the image transparently
Define the transparent color using R G B
If SetReturn on was called returns "success" on the stack
or an error string if there was an error
AddText text font_handle R G B X Y X Y
Adds text to the background window
Use NSIS's CreateFont to create a font and pass it as font_handle
Use R G B to set the text color
The first X Y is for the top left corner of the text box
The second X Y is for the bottom right corner of the text box
X and Y can be negative to specify distance from right/bottoms
If SetReturn on was called returns "success" on the stack
or an error string if there was an error
Clear
Clears all of the current background, images and texts
Destroy
Destroys the current background window
Destroy calls Clear automatically
Sound [/WAIT|/LOOP] path_to_wav
Sound /STOP
Plays a wave file
Use /WAIT to wait for the sound to finish playing
Use /LOOP to loop the sound
Use Sound /STOP to stop the loop
SetReturn on|off
Enable return values from SetBg, AddImage and AddText
Default value is off because all of the possible errors
are either things you should handle when debugging your script
such as "can't load bitmap" or errors you can do nothing about
such as "memory allocation error"
Credits
~~~~~~~
Coded by Amir Szekely, aka KiCHiK
Ximon Eighteen, aka Sunjammer - Fixed window title bar issues
iceman_k - Text idea and original implementation
Lajos Molnar, aka orfanik - Tile idea and original implementation
Jason Reis - Coding help

View File

@ -0,0 +1,121 @@
DIALER PLUGIN
-------------
Written by Amir Szekely aka KiCHiK
Readme by Joost Verburg
The Dialer plugin for NSIS provides five functions related to internet connections.
To download files from the internet, use the NSISdl plugin.
USAGE
-----
Example of usage:
ClearErrors ;Clear the error flag
Dialer::FunctionName ;Call Dialer function
IfErrors "" +3 ;Check for errors
MessageBox MB_OK "Function not available"
Quit
Pop $R0 ;Get the return value from the stack
MessageBox MB_OK $R0 ;Display the return value
EXAMPLE FUNCTION
----------------
; ConnectInternet (uses Dialer plugin)
; Written by Joost Verburg
;
; This function attempts to make a connection to the internet if there is no
; connection available. If you are not sure that a system using the installer
; has an active internet connection, call this function before downloading
; files with NSISdl.
;
; The function requires Internet Explorer 3, but asks to connect manually if
; IE3 is not installed.
Function ConnectInternet
Push $R0
ClearErrors
Dialer::AttemptConnect
IfErrors noie3
Pop $R0
StrCmp $R0 "online" connected
MessageBox MB_OK|MB_ICONSTOP "Cannot connect to the internet."
Quit ;Remove to make error not fatal
noie3:
; IE3 not installed
MessageBox MB_OK|MB_ICONINFORMATION "Please connect to the internet now."
connected:
Pop $R0
FunctionEnd
FUNCTIONS
---------
If a function is not available on the system, the error flag will be set.
* AttemptConnect
Attempts to make a connection to the Internet if the system is not connected.
online - already connected / connection successful
offline - connection failed
Requires Internet Explorer 3 or later
* AutodialOnline
Causes the modem to automatically dial the default Internet connection if the system
is not connected to the internet. If the system is not set up to automatically
connect, it will prompt the user.
Return values:
online - already connected / connection successful
offline - connection failed
Requires Internet Explorer 4 or later
* AutodialUnattended
Causes the modem to automatically dial the default Internet connection if the system
is not connected to the internet. The user will not be prompted.
Return values:
online - already connected / connection successful
offline - connection failed
Requires Internet Explorer 4 or later
* AutodialHangup
Disconnects an automatic dial-up connection.
Return values:
success - disconnection successful
failure - disconnection failed
Requires Internet Explorer 4 or later
* GetConnectedState
Checks whether the system is connected to the internet.
Return values:
online - system is online
offline - system is offline
Requires Internet Explorer 4 or later

View File

@ -0,0 +1,144 @@
DLL version 2.47 (4/27/2007)
* Line breaks support in Link control
* Added HLine and VLine controls
DLL version 2.46 (3/31/2007)
* Use installer's name for message boxes
DLL version 2.45 (1/23/2007)
* Added FOCUS flag for setting focus to a control other than the first
DLL version 2.44 (10/11/2005)
* Added HWND and HWND2 entries to the INI file to avoid messy calculations of the correct control id
DLL version 2.43 (10/4/2005)
* Fixed alteration of the working directory by FileRequest
* Added WS_EX_LEFTSCROLLBAR in RTL mode
DLL version 2.42 (1/21/2005)
* Added TRANSPARENT flag for BITMAP fields (funded by Chris Morgan)
DLL version 2.41 (8/5/2004)
* Bitmaps are now automatically centered
* Fixed a bug which prevented enabling the next button from the leave function of InstallOptions pages
* Fixed a rare freeze
DLL version 2.4 (1/4/2004)
* Initial focus is set in "initDialog" making it possible to override it from NSIS prior to calling "show"
* When initial focus is to a Text field InstallOptions now follows standard Windows behaviour by having the text selected
* Label and other static fields no longer have State= written to the INI file when leaving the dialog
* NOTIFY flag can now be used with Link fields (State should be omitted in this case)
* Likewise, State can now be used with Button fields (behaves the same as with Link fields)
* NOTIFY flag can also now be used with ListBox and DropList fields to have NSIS notified when the selection changes
* Meaning of RIGHT flag is now reversed in right-to-left language mode
* HSCROLL and VSCROLL flags are no longer restricted to Text fields
* Various Link field fixes
DLL version 2.3 (12/4/2003)
* Added new control type "Button"
* Added new flag "NOTIFY"
* Added new flag "NOWORDWRAP" for multi-line text boxes
* Reduced size down to 12K
* Better RTL support
DLL version 2.2 (6/10/2003)
* Added New control type LINK
* \r\n converts to newline in Multiline edit box
* Support for multiline edit box
* Better tab order in DirRequest and FileRequest
* Added READONLY option to text box
* Minor fixes
DLL version 2.1 (3/15/2003)
* \r\n converts to newline in both label Text and ValidateText
* New browse dialog style (modern)
* Word wrapping for check boxes and radio buttons
* No ugly border for edit fields under XP
* Scroll bar for list boxes
* Works with SetStaticBkColor
* DISABLED dir and file request fields now disable the browse button too
* No more STATE value for labels
* Minor fixes
DLL version 2.0 (1/4/2003)
* Supports custom font and DPI settings (by Joost Verburg)
* INI files should contain dialog units now, no pixels (by Joost Verburg)
* RESIZETOFIT flag for Bitmap control (by Amir Szekely)
* New documentation (by Joost Verburg)
* New GROUP/NOTABSTOP/DISABLED flags
DLL version 1.7 beta (11/2/2002)
* Added initDialog and show DLL functions
DLL version 1.6 beta (9/30/2002)
* CancelConfirmIcon becomes CancelConfirmFlags and can now take the other common MessageBox flags
DLL version 1.5 beta (9/26/2002)
* Made close [x] button behave like Cancel (thanks brainsucker)
DLL version 1.4 beta (9/4/2002)
* Added Icon and Bitmap controls (by Amir Szekely)
DLL version 1.3 beta (8/15/2002)
* Added CancelShow (by ORTIM)
* Added pixel transformation for widgets (by ORTIM)
DLL version 1.2 beta (7/31/2002)
* Added CancelEnabled (by ORTIM)
* Added CancelConfirmCaption and CancelConfirmIcon (by Amir Szekely)
DLL version 1.1 beta (7/22/2002)
* Font is now taken from the main NSIS window (by Amir Szekely)
DLL version 1.0 beta (12/16/2001)
* Moved to DLL, no longer need parentwnd ini writing
* Tons of changes - no longer fully compatible (see source for a big list)
* removed support for silent installers (it seems the old version would bring up it's own dialog)
version 1.4 (11/18/2001)
* Added Listbox controls.
* Added MULTISELECT flag.
* Made the HWND list for the parent window controls dynamically allocated. This prevents a crash if NSIS ever gets more than 150 controls on it's main window.
* The TEXT property of DirRequest control can be used to specify an initial directory. The current directory is automatically selected when clicking the browse button of the DirRequest control.
* Added ROOT property to DirRequest which can be used to set the root directory (mostly due to felfert)
* Edit controls will now auto scroll (thanks felfert)
* Fixed a problem where the window wouldn't draw properly on some systems (thanks felfert)
version 1.3 (11/03/2001)
* Got rid of the call to RedrawWindow() because it's no longer needed with the WS_CLIPCHILDREN flag for NSIS.
* Removed a few hardcoded limits of buffer sizes
* Added Checkbox and RadioButton controls
* Added RIGHT and CHECKED flags
version 1.2.2 (10/30/2001)
* Additional size reductions. Further reduced the size down to 8k.
* The text parameter to a combobox can now be used to specify the initial value
* Changed from InvalidateRect() to RedrawWindow() to force a redraw after a browse dialog
* On startup, set the flags of the NSIS window to include WS_CLIPCHILDREN. Otherwise, our controls don't get drawn right.
version 1.2.1 (10/28/2001)
* Bug fix. ControlID for the caption and the OK button were reused by the first two controls. (Thanks Schultz)
version 1.2j (10/28/2001)
* 8.5kb from 44kb. heh. (by Justin Frankel)
version 1.2 (10/28/2001)
* Still 44k
* Added the "FileRequest" and "DirRequest" control types (thanks Schultz)
* Added "MinLen", "MaxLen", and "ValidateText" properties to fields
* Added "Flags" as a way to specify additional parameters for controls
* Few more changes to the documentation
* Cleaned the code in a few places...still trying to make it smaller
version 1.1 (10/27/2001)
* Added the "Title" option (thanks Alex)
* Moved the OK button so it is in the same location as the buttons on the main NSIS window (thanks Alex)
* Pressing "ENTER" will now automatically select the OK button (thanks Alex)
* Slightly improved the documentation
version 1.01 (10/25/2001)
* Fixed the SetFocus loop so it exits after the first control like it was supposed to
* Added the license to the documentation
version 1.0 (10/25/2001)
* Barely qualifies as a distribution

View File

@ -0,0 +1,907 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>InstallOptions 2</title>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
<style type="text/css">
/*<![CDATA[*/body
{
padding: 10px;
background-color: #F0F0F0;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 13px;
font-weight: normal;
text-align: left;
}
p, li
{
font-size: 13px;
}
.center
{
text-align: center;
}
table
{
margin: auto;
font-size: 13px;
background-color: #FFFFFF;
}
.maintable
{
border: 2px solid #376EAB;
}
.parameter
{
font-weight: bold;
color: #6586AC;
}
h1
{
font-size: 30px;
color: #333333;
font-weight: normal;
text-align: center;
margin-top: 20px;
}
h2
{
font-size: 20px;
color: #7A7272;
font-weight: normal;
}
h3
{
font-size: 17px;
font-weight: bold;
color: #303030;
}
pre
{
font-size: 13px;
}
div
{
margin: 20px;
}
a:link, a:visited, a:active
{
color: #294F75;
text-decoration: none;
}
a:hover
{
color: #182634;
text-decoration: underline;
}
.subtable
{
border: 0px;
margin-left: 20px;
margin-right: 20px;
}
.lefttable
{
background-color: #CCCCCC;
vertical-align: top;
}
.righttable
{
background-color: #EEEEEE;
vertical-align: top;
}
/*]]>*/</style>
</head>
<body>
<table width="750" class="maintable" cellspacing="0" cellpadding="0" align="center">
<tr>
<td>
<h1>
InstallOptions 2</h1>
<div>
<p>
The InstallOptions plug-in is deprecated. For new scripts, it is recommended to
use the new nsDialogs plug-in instead.</p>
</div>
<div>
<h2 id="intro">
Introduction</h2>
<div>
<p>
InstallOptions is an NSIS plugin which allows you to create custom pages for NSIS
installers, to prompt the user for extra information.</p>
<p>
The dialogs created by InstallOptions are based on INI files which define the controls
on the dialog and their properties. These INI files can be modified from the script
to adjust the dialogs at runtime.</p>
<p>
The format of INI files is described in a <a href="http://en.wikipedia.org/wiki/Ini_file">
Wikipedia article</a>.</p>
</div>
<h2 id="ini">
INI file structure</h2>
<div>
<p>
The INI file has one required section. This section includes the number of controls
to be created as well as general window attributes. The INI file also includes a
variable number of Field sections which are used to create the controls to be displayed.</p>
<p>
The required section is named &quot;<em>Settings</em>&quot;. It can contain the
following values:</p>
<table class="subtable">
<tr>
<td class="lefttable">
<strong>NumFields</strong></td>
<td class="lefttable">
<em>(required)</em></td>
<td class="righttable">
The number of control elements to be displayed on the dialog window.</td>
</tr>
<tr>
<td class="lefttable">
<strong>Title</strong></td>
<td class="lefttable">
<em>(optional)</em></td>
<td class="righttable">
If specified, gives the text to set the titlebar to. Otherwise, the titlebar text
is not changed.</td>
</tr>
<tr>
<td class="lefttable">
<strong>CancelEnabled</strong></td>
<td class="lefttable">
<em>(optional)</em></td>
<td class="righttable">
If specified, overrides NSIS settings and enables or disables the cancel button.
If set to 1, the cancel button will be enabled. If set to 0, the cancel button will
be disabled.</td>
</tr>
<tr>
<td class="lefttable">
<strong>CancelShow</strong></td>
<td class="lefttable">
<em>(optional)</em></td>
<td class="righttable">
If specified, overrides NSIS settings and shows or hides the cancel button If set
to 1, the cancel button will be shown. If set to 0, the cancel button will be hidden.</td>
</tr>
<tr>
<td class="lefttable">
<strong>BackEnabled</strong></td>
<td class="lefttable">
<em>(optional)</em></td>
<td class="righttable">
If specified, overrides NSIS settings and enables or disables the back button. If
set to 1, the back button will be enabled. If set to 0, the back button will be
disabled.</td>
</tr>
<tr>
<td class="lefttable">
<strong>CancelButtonText</strong></td>
<td class="lefttable">
<em>(optional)</em></td>
<td class="righttable">
Overrides the text for the cancel button. If not specified, the cancel button text
will not be changed.</td>
</tr>
<tr>
<td class="lefttable">
<strong>NextButtonText</strong></td>
<td class="lefttable">
<em>(optional)</em></td>
<td class="righttable">
Overrides the text for the next button. If not specified, the next button text will
not be changed.</td>
</tr>
<tr>
<td class="lefttable">
<strong>BackButtonText</strong></td>
<td class="lefttable">
<em>(optional)</em></td>
<td class="righttable">
Overrides the text for the back button. If not specified, the back button text will
not be changed.</td>
</tr>
<tr>
<td class="lefttable">
<strong>Rect</strong></td>
<td class="lefttable">
<em>(optional)</em></td>
<td class="righttable">
Overrides the default rect ID to run over. This will make IO resize itself according
to a different rect than NSIS's dialogs rect.</td>
</tr>
<tr>
<td class="lefttable">
<strong>RTL</strong></td>
<td class="lefttable">
<em>(optional)</em></td>
<td class="righttable">
If 1 is specified the dialog will be mirrored and all texts will be aligned to the
right. The INSTALLOPTIONS_EXTRACT macros automatically set this field to the right
value for the current installer language as given by the NSIS string $(^RTL).</td>
</tr>
<tr>
<td class="lefttable">
<strong>State</strong></td>
<td class="lefttable">
<em>(output)</em></td>
<td class="righttable">
This is not something you have to supply yourself but is set by InstallOptions,
before calling your custom page validation function, to the field number of the
custom Button control (or other control having the Notify flag) the user pressed,
if any.</td>
</tr>
</table>
<p>
Each field section has the heading &quot;Field #&quot; where # must be sequential
numbers from 1 to NumFields. Each Field section can contain the following values:</p>
<table class="subtable">
<tr>
<td class="lefttable">
<strong>Type</strong></td>
<td class="lefttable">
<em>(required)</em></td>
<td class="righttable">
Type of control to be created. Valid values are &quot;<em>Label</em>&quot;, &quot;<em>Text</em>&quot;,
&quot;<em>Password</em>&quot;, &quot;<em>Combobox</em>&quot;, &quot;<em>DropList</em>&quot;,
&quot;<em>Listbox</em>&quot;, &quot;<em>CheckBox</em>&quot;, &quot;<em>RadioButton</em>&quot;,
&quot;<em>FileRequest</em>&quot;, &quot;<em>DirRequest</em>&quot; &quot;<em>Icon</em>&quot;,
&quot;<em>Bitmap</em>&quot;, &quot;<em>GroupBox</em>&quot;, &quot;<em>HLine</em>&quot;,
&quot;<em>VLine</em>&quot;, &quot;<em>Link</em>&quot; or &quot;<em>Button</em>&quot;.<br />
<br />
A &quot;<em>Label</em>&quot; is used to display static text. (i.e. a caption for
a textbox)<br />
A &quot;<em>Text</em>&quot; and &quot;<em>Password</em>&quot; accept text input
from the user. &quot;<em>Password</em>&quot; masks the input with * characters.<br />
A &quot;<em>Combobox</em>&quot; allows the user to type text not in the popup list,
a &quot;<em>Droplist</em>&quot; only allows selection of items in the list.<br />
A &quot;<em>Listbox</em>&quot; shows multiple items and can optionally allow the
user to select more than one item.<br />
A &quot;<em>CheckBox</em>&quot; control displays a check box with label.<br />
A &quot;<em>RadioButton</em>&quot; control displays a radio button with label.<br />
A &quot;<em>FileRequest</em>&quot; control displays a textbox and a browse button.
Clicking the browse button will display a file requester where the user can browse
for a file.<br />
A &quot;<em>DirRequest</em>&quot; control displays a textbox and a browse button.
Clicking the browse button will display a directory requester where the user can
browse for a directory.<br />
An &quot;<em>Icon</em>&quot; control displays an icon. Use no Text to use the installer
icon.<br />
A &quot;<em>Bitmap</em>&quot; control displays a bitmap.<br />
A &quot;<em>GroupBox</em>&quot; control displays a frame to group controls.<br />
A &quot;<em>HLine</em>&quot; control displays a horizontal line to separate controls.<br />
A &quot;<em>VLine</em>&quot; control displays a vertical line to separate controls.<br />
A &quot;<em>Link</em>&quot; control displays a static hot text. When the user clicks
the control the contents of <strong>State</strong> (e.g. http://...) will be executed
using ShellExecute. Alternatively <strong>State</strong> can be omitted and the
<em>NOTIFY</em> flag used to have your NSIS script called. See the &quot;<em>NOTIFY</em>&quot;
flag below for more information.<br />
A &quot;<em>Button</em>&quot; control displays a push button that can be used in
the same way as the &quot;<em>Link</em>&quot; control above.</td>
</tr>
<tr>
<td class="lefttable">
<strong>Text</strong></td>
<td class="lefttable">
<em>(optional)</em></td>
<td class="righttable">
Specifies the caption of a label, checkbox, or radio button control. For DirRequest
control this specifies the title of the browse dialog. For icon and bitmaps control
this specifies the path to the image.<br />
<br />
<strong>Note:</strong> For labels, \r\n will be converted to a newline. To use a
back-slash in your text you have to escape it using another back-slash - \\. Described
<a href="#escaping">below</a> are NSIS functions for converting text to/from this
format.</td>
</tr>
<tr>
<td class="lefttable">
<strong>State</strong></td>
<td class="lefttable">
<em>(optional)</em></td>
<td class="righttable">
Specifies the state of the control. This is updated when the user closes the window,
so you can read from it from NSIS. For edit texts and dir and file request boxes,
this is the string that is specified. For radio button and check boxes, this can
be '0' or '1' (for unchecked or checked). For list boxes, combo boxes and drop lists
this is the selected items separated by pipes ('|'). For Links and Buttons this
can specify something to be executed or opened (using ShellExecute).<br />
<br />
<strong>Note:</strong> For Text fields with the MULTILINE flag, \r\n will be converted
to a newline. To use a back-slash in your text you have to escape it using another
back-slash - \\. Described <a href="#escaping">below</a> are NSIS functions for
converting text to/from this format.</td>
</tr>
<tr>
<td class="lefttable">
<strong>ListItems</strong></td>
<td class="lefttable">
<em>(optional)</em></td>
<td class="righttable">
A list of items to display in a combobox, droplist, or listbox.<br />
This is a single line of text with each item separated by a pipe character '|'</td>
</tr>
<tr>
<td class="lefttable">
<strong>MaxLen</strong></td>
<td class="lefttable">
<em>(optional)</em></td>
<td class="righttable">
Causes validation on the selected control to limit the maximum length of text.<br />
If the user specifies more text than this, a message box will appear when they click
&quot;OK&quot; and the dialog will not be dismissed.<br />
You should not use this on a &quot;<em>combobox</em>&quot; since the user can not
control what is selected.<br />
This should be set to a maximum of 260 for &quot;<em>FileRequest</em>&quot; and
&quot;<em>DirRequest</em>&quot; controls.<br />
Ignored on &quot;<em>Label</em>&quot; controls.</td>
</tr>
<tr>
<td class="lefttable">
<strong>MinLen</strong></td>
<td class="lefttable">
<em>(optional)</em></td>
<td class="righttable">
Causes validation on the selected control to force the user to enter a minimum amount
of text.<br />
If the user specifies less text than this, a message box will appear when they click
&quot;OK&quot; and the dialog will not be dismissed.<br />
Unlike MaxLen, this is useful for &quot;<em>Combobox</em>&quot; controls. By setting
this to a value of &quot;1&quot; the program will force the user to select an item.<br />
Ignored on &quot;<em>Label</em>&quot; controls.</td>
</tr>
<tr>
<td class="lefttable">
<strong>ValidateText</strong></td>
<td class="lefttable">
<em>(optional)</em></td>
<td class="righttable">
If the field fails the test for &quot;<em>MinLen</em>&quot; or &quot;<em>MaxLen</em>&quot;,
a messagebox will be displayed with this text.<br />
<br />
<strong>Note:</strong> \r\n will be converted to a newline, two back-slashes will
be converted to one - \\. Described <a href="#escaping">below</a> are NSIS functions
for converting text to/from this format.</td>
</tr>
<tr>
<td class="lefttable">
<strong>Left<br />
Right<br />
Top<br />
Bottom</strong></td>
<td class="lefttable">
<em>(required)</em></td>
<td class="righttable">
The position on the dialog where this control appears. All sizes should be set in
dialog units. To get the right dimensions for your controls, design your dialog
using a resource editor and copy the dimensions to the INI file.<br />
<br />
<strong>Note:</strong> You can specify negative coordinates to specify the distance
from the right or bottom edge.<br />
<br />
<strong>Note (2):</strong> For combobox or droplist, the &quot;<em>bottom</em>&quot;
value is not used in the same way.<br />
In this case, the bottom value is the maximum size of the window when the pop-up
list is being displayed. All other times, the combobox is automatically sized to
be one element tall. If you have trouble where you can not see the combobox drop-down,
then check the bottom value and ensure it is large enough. A rough guide for the
height required is the number of items in the list multiplied by 8, plus 20.<br />
<br />
<strong>Note (3):</strong> FileRequest and DirRequest controls will allocate 15
dialog units to the browse button. Make this control wide enough the contents of
the textbox can be seen.</td>
</tr>
<tr>
<td class="lefttable">
<strong>Filter</strong></td>
<td class="lefttable">
<em>(optional)</em></td>
<td class="righttable">
Specifies the filter to be used in the &quot;<em>FileRequest</em>&quot; control.<br />
This is constructed by putting pairs of entries together, each item separated by
a | character.<br />
The first value in each pair is the text to display for the filter.<br />
The second value is the pattern to use to match files.<br />
For example, you might specify:<br />
Filter=Text Files|*.txt|Programs|*.exe;*.com|All Files|*.*<br />
If not specified, then the filter defaults to All Files|*.*<br />
<br />
<strong>Note:</strong> you should not put any extra spaces around the | characters.</td>
</tr>
<tr>
<td class="lefttable">
<strong>Root</strong></td>
<td class="lefttable">
<em>(optional)</em></td>
<td class="righttable">
Used by <strong>DirRequest</strong> controls to specify the root directory of the
search. By default, this allows the user to browse any directory on the computer.
This will limit the search to a particular directory on the system.</td>
</tr>
<tr>
<td class="lefttable">
<strong>Flags</strong></td>
<td class="lefttable">
<em>(optional)</em></td>
<td class="righttable">
This specifies additional flags for the display of different controls. Each value
should be separated by a | character, and you should be careful not to put any spaces
around the | character.<br />
<table class="righttable">
<tr>
<td class="righttable">
<strong>Value</strong></td>
<td class="righttable">
<strong>Meaning</strong></td>
</tr>
<tr>
<td class="righttable">
REQ_SAVE</td>
<td class="righttable">
This causes &quot;<em>FileRequest</em>&quot; controls to display a Save As dialog.
If not specified, an Open dialog is used.</td>
</tr>
<tr>
<td class="righttable">
FILE_MUST_EXIST</td>
<td class="righttable">
Used by &quot;<em>FileRequest</em>&quot; to determine if the selected file must
exist.<br />
This only applies if an &quot;Open&quot; dialog is being displayed.<br />
This currently does not force the file to exist other than through the browse button.</td>
</tr>
<tr>
<td class="righttable">
FILE_EXPLORER</td>
<td class="righttable">
Used by &quot;<em>FileRequest</em>&quot;, enables new file request look (recommended)</td>
</tr>
<tr>
<td class="righttable">
FILE_HIDEREADONLY</td>
<td class="righttable">
Used by &quot;<em>FileRequest</em>&quot;, hides &quot;open read only&quot; checkbox
in open dialog.</td>
</tr>
<tr>
<td class="righttable">
WARN_IF_EXIST</td>
<td class="righttable">
Used by &quot;<em>FileRequest</em>&quot; to display a warning message if the selected
file already exists.<br />
The warning message is only displayed for files selected with the browse button.</td>
</tr>
<tr>
<td class="righttable">
PATH_MUST_EXIST</td>
<td class="righttable">
Used by &quot;<em>FileRequest</em>&quot; to force the path to exist. Prevents the
user from typing a non-existent path into the browse dialog window.<br />
This only validates path's selected with the browse button.</td>
</tr>
<tr>
<td class="righttable">
PROMPT_CREATE</td>
<td class="righttable">
Used by &quot;<em>FileRequest</em>&quot; to display a warning if the selected file
does not exist. However, it still allows the user to select the file.<br />
This only displays the warning for files selected with the browse button.<br />
Doesn't work along with REQ_SAVE.</td>
</tr>
<tr>
<td class="righttable">
RIGHT</td>
<td class="righttable">
Used by &quot;<em>Checkbox</em>&quot; and &quot;<em>Radiobutton</em>&quot; controls
to specify you want the checkbox to the right of the text instead of the left as
is the default.</td>
</tr>
<tr>
<td class="righttable">
MULTISELECT</td>
<td class="righttable">
Used by &quot;<em>Listbox</em>&quot; controls. Turns string selection on or off
each time the user clicks or double-clicks a string in the list box. The user can
select any number of strings. If this flag and EXTENDEDSELCT are not specified,
only one item can be selected from the list.</td>
</tr>
<tr>
<td class="righttable">
EXTENDEDSELCT</td>
<td class="righttable">
Used by &quot;<em>Listbox</em>&quot; controls. Allows multiple items to be selected
by using the SHIFT key and the mouse or special key combinations. If this flag and
MULTISELECT are not specified, only one item can be selected from the list.</td>
</tr>
<tr>
<td class="righttable">
RESIZETOFIT</td>
<td class="righttable">
This causes &quot;<em>Bitmap</em>&quot; controls to resize the image to the size
of the control. Also useful to support custom DPI settings. Without this, the image
will be centered within the specified area.</td>
</tr>
<td class="righttable">
TRANSPARENT</td>
<td class="righttable">
Used by &quot;<em>Bitmap</em>&quot; controls. Hides every pixel with the same color
as of the top left pixel. This allows to see-through to controls behind it. This
flag doesn't work well with a combination of the RESIZETOFIT flag and bitmaps with
more than 256 colors.</td>
</tr>
<tr>
<td class="righttable">
GROUP</td>
<td class="righttable">
Add this flag to the first control of a group of controls to group them. Grouping
controls allows you to create multiple groups of radio button and makes keyboard
navigation using arrow keys easier.</td>
</tr>
<tr>
<td class="righttable">
FOCUS</td>
<td class="righttable">
Sets focus on the specified control, instead of the first focusable control. If
more than one field is specified with this flag, only the first one will receive
focus.</td>
</tr>
<tr>
<td class="righttable">
NOTABSTOP</td>
<td class="righttable">
Do not stop on the control when the user pressed the Tab key. Add NOTABSTOP to all
controls of a group except the first one to allow navigation between groups with
the Tab key.</td>
</tr>
<tr>
<td class="righttable">
DISABLED</td>
<td class="righttable">
Causes a control to be disabled.</td>
</tr>
<tr>
<td class="righttable">
ONLY_NUMBERS</td>
<td class="righttable">
Used by &quot;<em>Text</em>&quot; controls. Forces the user to enter only numbers
into the edit box.</td>
</tr>
<tr>
<td class="righttable">
MULTILINE</td>
<td class="righttable">
Used by &quot;<em>Text</em>&quot; controls. Causes the control to accept multiple-lines.</td>
</tr>
<tr>
<td class="righttable">
WANTRETURN</td>
<td class="righttable">
Used by &quot;<em>Text</em>&quot; controls with multiple-line. Specifies that a
carriage return be inserted when the user presses the ENTER key while entering text
into the text box.</td>
</tr>
<tr>
<td class="righttable">
NOWORDWRAP</td>
<td class="righttable">
Used by &quot;<em>Text</em>&quot; controls with multiple-line. Disables the word-wrap
that occurs when long lines are entered. Long lines instead scroll off to the side.
Specifying the HSCROLL flag also has this effect.</td>
</tr>
<tr>
<td class="righttable">
HSCROLL</td>
<td class="righttable">
Show a horizontal scrollbar. When used by &quot;<em>Text</em>&quot; controls with
multiple-lines this also disables word-wrap.</td>
</tr>
<tr>
<td class="righttable">
VSCROLL</td>
<td class="righttable">
Show a vertical scrollbar.</td>
</tr>
<tr>
<td class="righttable">
READONLY</td>
<td class="righttable">
Used by &quot;<em>Text</em>&quot; controls. Prevents the user from entering or editing
text in the edit control, but allow the user to select and copy the text.</td>
</tr>
<tr>
<td class="righttable">
NOTIFY</td>
<td class="righttable">
Used by &quot;<em>Button</em>&quot;, &quot;<em>Link</em>&quot;, &quot;<em>CheckBox</em>&quot;,
&quot;<em>RadioButton</em>&quot;, &quot;<em>ListBox</em>&quot; and &quot;<em>DropList</em>&quot;
controls. Causes InstallOptions to call your NSIS custom page validation/leave function
whenever the control's selection changes. Your validation/leave function can read
the &quot;<em>State</em>&quot; value from the &quot;<em>Settings</em>&quot; section
to determine which control caused the notification, if any, and perform some appropriate
action followed by an Abort instruction (to tell NSIS to return to the page). The
Examples\InstallOptions folder contains an example script showing how this might
be used.</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="lefttable">
<strong>TxtColor</strong></td>
<td class="lefttable">
<em>(optional)</em></td>
<td class="righttable">
Used by <strong>Link</strong> controls to specify the foreground color of the text.
Format: 0xBBGGRR (hexadecimal).</td>
</tr>
<tr>
<td class="lefttable">
<strong>HWND<br>
HWND2</strong></td>
<td class="lefttable">
<em>(output)</em></td>
<td class="righttable">
After initDialog returns, this will contain the HWND of the control created by this
field. It can be used instead of FindWindow and GetDlgItem. HWND2 contains the HWND
of an additional control, such as the browse button.</td>
</tr>
</table>
</div>
<h2 id="nsh">
Header file</h2>
<div>
<p>
The InstallOptions header files provides macros and functions to easily create custom
dialogs. You can include it on the top of your script as follows:
<pre>
!include InstallOptions.nsh
</pre>
</div>
<h2 id="dialog">
Creating dialogs</h2>
<div>
<h3 id="extract">
Extracting the INI file</h3>
<div>
<p>
First, you have to extract your InstallOptions INI files in the .onInit function
(or un.onInit for the uninstaller) using the INSTALLOPTIONS_EXTRACT macro. The files
will be extracted to a temporary folder (the NSIS plug-ins folder) that is automatically
created.</p>
<pre>
Function .onInit
!insertmacro INSTALLOPTIONS_EXTRACT &quot;ioFile.ini&quot;
FunctionEnd
</pre>
<p>
If the INI file is located in another directory, use INSTALLOPTIONS_EXTRACT_AS.
The second parameter is the filename in the temporary folder, which is the filename
that should be used as input for the other macros.</p>
<pre>
Function .onInit
!insertmacro INSTALLOPTIONS_EXTRACT_AS &quot;..\ioFile.ini&quot; &quot;ioFile.ini&quot;
FunctionEnd
</pre>
</div>
<h3 id="display">
Displaying the dialog</h3>
<div>
<p>
You can call InstallOptions in a page function defined with the Page or UninstPage
command. Check the NSIS documentation (Scripting Reference -&gt; Pages) for information
about the page system.</p>
<pre>
Page custom CustomPageFunction</pre>
<p>
To display the dialog, use the INSTALLOPTIONS_DISPLAY macro:<pre>
Function CustomPageFunction ;Function name defined with Page command
!insertmacro INSTALLOPTIONS_DISPLAY &quot;ioFile.ini&quot;
FunctionEnd
</pre>
</div>
</div>
<h2 id="input">
User input</h2>
<div>
<p>
To get the input of the user, read the State value of a Field using the INSTALLOPTIONS_READ
macro:</p>
<pre>
!insertmacro INSTALLOPTIONS_READ $VAR &quot;ioFile.ini&quot; &quot;Field #&quot; &quot;Name&quot;
</pre>
</div>
<h2 id="writing">
Writing to INI files</h2>
<div>
<p>
The INSTALLOPTIONS_WRITE macro allows you to write values to the INI file to change
texts or control settings at runtime:
<pre>
!insertmacro INSTALLOPTIONS_WRITE &quot;ioFile.ini&quot; &quot;Field #&quot; &quot;Name&quot; &quot;Value&quot;
</pre>
</div>
<h2 id="escape">
Escaped values</h2>
<div>
<p>
Some InstallOptions values are escaped (in a similar manner to &quot;C&quot; strings)
to allow characters to be used that are not normally valid in INI file values. The
affected values are:</p>
<ul>
<li>The ValidateText field</li>
<li>The Text value of Label fields</li>
<li>The State value of Text fields that have the MULTILINE flag</li>
</ul>
<p>
The escape character is the back-slash character (&quot;\&quot;) and the available
escape sequences are:</p>
<table class="subtable">
<tr>
<td class="lefttable">
&quot;\\&quot;</td>
<td class="righttable">
Back-slash</td>
</tr>
<tr>
<td class="lefttable">
&quot;\r&quot;</td>
<td class="righttable">
Carriage return (ASCII 13)</td>
</tr>
<tr>
<td class="lefttable">
&quot;\n&quot;</td>
<td class="righttable">
Line feed (ASCII 10)</td>
</tr>
<tr>
<td class="lefttable">
&quot;\t&quot;</td>
<td class="righttable">
Tab (ASCII 9)</td>
</tr>
</table>
<p>
The INSTALLOPTIONS_READ_CONVERT and INSTALLOPTIONS_WRITE_CONVERT macros automatically
convert these characters in installer code. In uninstaller code, use INSTALLOPTIONS_READ_UNCONVERT
and INSTALLOPTIONS_WRITE_UNCONVERT.</p>
<p>
To use these macros in your script, the conversion functions need to be included:</p>
<pre>
;For INSTALLOPTIONS_READ_CONVERT
!insertmacro INSTALLOPTIONS_FUNCTION_READ_CONVERT
;For INSTALLOPTIONS_WRITE_CONVERT
!insertmacro INSTALLOPTIONS_FUNCTION_WRITE_CONVERT
;For INSTALLOPTIONS_READ_UNCONVERT
!insertmacro INSTALLOPTIONS_UNFUNCTION_READ_CONVERT
;For INSTALLOPTIONS_WRITE_UNCONVERT
!insertmacro INSTALLOPTIONS_UNFUNCTION_WRITE_CONVERT
</pre>
</div>
<h2 id="validate">
Input validation</h2>
<div>
<p>
To validate the user input (for example, to check whether the user has filled in
a textbox) use the leave function of the Page command and Abort when the validation
has failed:</p>
<pre>
Function ValidateCustom
!insertmacro INSTALLOPTIONS_READ $R0 "test.ini" "Field 1" "State"
StrCmp $R0 "" 0 +3
MessageBox MB_ICONEXCLAMATION|MB_OK "Please enter your name."
Abort
FunctionEnd
</pre>
</div>
<h2 id="dialogreturn">
Return value</h2>
<div>
After a dialog is created (using display or show), a return value is available:</p>
<ul>
<li>success - The user has pressed the Next button</li>
<li>back - The user has pressed the Back button</li>
<li>cancel - The user has pressed the Cancel button</li>
<li>error - An error has occurred, the dialog cannot be displayed.</li>
</ul>
<p>
You only have to check this value if you need something really special, such as
doing something when the user pressed the Back button.</p>
<p>
If you need the return value, use the INSTALLOPTIONS_DISPLAY_RETURN or INSTALLOPTIONS_SHOW_RETURN
macro. The return value will be added to the stack, so you can use the Pop command
to get it.</p>
</div>
<h2 id="reserve">
Reserve files</h2>
<div>
<p>
When using solid compression, it's important that files which are being extracted
in user interface functions are located before other files in the data block. Otherwise
there may be a delay before a page can be displayed.</p>
<p>
To ensure that this is the case, add ReserveFile commands for InstallOptions and
the INI files before all sections and functions:</p>
<pre>
ReserveFile &quot;test.ini&quot;
ReserveFile /plugin InstallOptions.dll
</pre>
</div>
<h2>
Fonts and colors</h2>
<div>
<p>
To customize fonts or colors on InstallOptions dialogs, the INSTALLOPTIONS_INITDIALOG
and INSTALLOPTIONS_SHOW macro can be used.</p>
<p>
INSTALLOPTIONS_INITDIALOG creates the dialog in memory, but does not show it. After
inserting this macro, you can set the fonts and colors, and then insert INSTALLOPTIONS_SHOW
to show the dialog.</p>
<p>
The INSTALLOPTIONS_INITDIALOG macro also pushes the HWND of the custom dialog to
the stack. Control HWND's are available for each control in the HWND entry of the
corresponding field in the INI file.</p>
<p>
Example of using a custom font:</p>
<pre>
Var HWND
Var DLGITEM
Var FONT
Function FunctionName ;FunctionName defined with Page command
!insertmacro INSTALLOPTIONS_INITDIALOG &quot;ioFile.ini&quot;
Pop $HWND ;HWND of dialog
!insertmacro INSTALLOPTIONS_READ $DLGITEM &quot;ioFile.ini&quot; &quot;Field 1&quot; &quot;HWND&quot;
;$DLGITEM contains the HWND of the first field
CreateFont $FONT &quot;Tahoma&quot; 10 700
SendMessage $DLGITEM ${WM_SETFONT} $FONT 0
!insertmacro INSTALLOPTIONS_SHOW
FunctionEnd
</pre>
</div>
<h2 id="credits">
Credits</h2>
<div>
<p>
Original version by Michael Bishop<br />
DLL version by Nullsoft, Inc.<br />
DLL version 2 by Amir Szekely, ORTIM, Joost Verburg<br />
New documentation by Joost Verburg</p>
</div>
<h2 id="license">
License</h2>
<div>
<pre>
Original version Copyright &copy; 2001 Michael Bishop
DLL version 1 Copyright &copy; 2001-2002 Nullsoft, Inc., ORTIM
DLL version 2 Copyright &copy; 2003-2018 Amir Szekely, Joost Verburg, Dave Laundon
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute
it freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented;
you must not claim that you wrote the original software.
If you use this software in a product, an acknowledgment in the
product documentation would be appreciated but is not required.
2. Altered versions must be plainly marked as such,
and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any distribution.
</pre>
</div>
</div> </td> </tr> </table>
</body>
</html>

View File

@ -0,0 +1,197 @@
Math::Script NSIS plugin.
C-like style scripting (operators at least).
Tip1: plugin watches the case of the letters.
Tip2: plugin makes almost no error checks. So YOU should check your script
twice before run :)
New HOW TO USE: run the MathTest.Exe, and try yourself. After spending
some minutes your should be able to write your script by yourself.
To include it to your NSIS script just insert that:
Math::Script "YourScript1"
Math::Script "YourScript2"
Math::Script "YourScriptFinal"
How to use it? Simple:
Strcpy $0 "Brainsucker"
Math::Script "a = 'Math'; B = 'Script'; r0 += ' wants to use ' + a + '::' + b +'!'"
DetailPrint "$0"
That string will fill r0 with some stuff.
Here are some other samples:
10! (factorial, r0 will contain '10! = 362880'):
r0 = '10! = ' + (1*2*3*4*5*6*7*8*9)
the same:
a = b = 1; #{++a <= 10, b = b*a}; r0 = (a-1) + '! = ' + b
Some floating point:
Strcpy $R0 "1e1"
Math::Script "pi = 3.14159; R1 = 2*pi*R0; r0 = 'Length of circle with radius ' + R0 + ' is equal to ' + R1 + '.'"
Detailprint "$0"
Ok. Variables.
NSIS: r0-r9 -> $0-$9. R0-R9 -> $R0-$R9.
Also CL ($CMDLINE), ID ($INSTDIR), OD ($OUTDIR), LG ($LANG), ED ($EXEDIR).
User definable: name starting from character, up to 28 letters long.
Stacks. Two stacks are supported: NSIS stack and plugin's own stack. I see no
reasons for using plugin stack, but if you will, remember - the plugin stores
variables used at function to that stack before function execution, and restores
after execution. Even less I recommend you to use NSIS stack. You should use it
only for input/output.
How to use? It's variable styled. Plugins stack is associated with S variable,
and NSIS stack associated with NS variable. To push to stack just do "S=0" or
"NS=0", to pop from stack "a=S" or "b=NS". Combined operations supported too:
"S += 1.5" will increment value at the top of stack by 1.5.
Supported types: int (in fact that is __int64), float (double in fact),
string.
Int: just numbers, may include sign.
Float: -123.456, 123.456e-78, 123e-45
String: something in quotes ("", '', ``).
There is also an array type. It is actually a reference type, so if b is array
and you will perform "a=b", the a and b will reference a single array.
To create a copy of array, use ca func: dest = ca(source). Btw - you couldn't
control dimensions of arrays - they are autosized.
To declare array:
a = {};
To declare array and initialize some items with values:
{"Hello!", "Use", "mixed types", 1.01e23, "like that" ,1234};
To access array:
a[index] = "Cool";
Also [] operation could be used to strings. str[x] gives you a single char with
index x (zero-based) as new string. str[-x] - the same, but x counts from the
string end (so the last char is -1). str[x,y] gives you characters in range x-y
(inclusive), both x and y could be <0 - in this case they counted from the end
of the string.
The function could be useful - is conversion of arrays to strings and back.
Example:
a = a("Hello"); str = s(a);
After running such script array a will contain 6 integers (chars and last zero
- end of string), and str will contain your string back.
Operators (some binary, some unary):
>>= <<= -= += /= *= |= &= ^= %= -- ++ >> << && || <= =< >= => != ==
= + - * / % < > & | ^ ~ !
Only some are applicable to float (logic & arithmetic) and string (+ and logic)
of course.
Additional case: reference/de-reference operators (& and *). & will
give you the reference to argument which should be a variable (NSIS, user, array
item, stack), and * will convert it back to original variable. For example
(a=&b; *a=10) will set b to 10. Expression (*&a) is equal to simple (a).
Script is set of expressions (mathematical in general) delimited with ';'.
Processing is mathematically right (2+2*2 will give 6), operations are performed
in a C like order (precedence).
Flow control:
if-then-else like: #[if-expression, then-expr, else-expr]
example:
#[a==0, b=1; c=2, b *= (--c); c/=10]
C eq:
if (a==0) { b=1; c=2;} else { b*=(c++);c-=10; }
while (expr) do; like #{expr, do}
example:
#{(c<1.1e25)&&(b < 10), b++; c*=1.23}
C eq:
while ((c<1.1e25)&&(b<10)) { b++; c*=1.23; }
WATCH OUT! Comma (,) separates if-expr, then-expr, and else-expr from each
other. All sub-expressions separated by (;) are the part of one expression,
and the result of the last one of these sub-exprs gives you the result of
expression.
All the stuff (like variables and functions) will be saved between calls.
Functions:
type conversions:
l(string) returns the length of string or array argument
s(source) converts source to string type
i(source) converts source to int type
f(source) converts source to float type
c(source) if source is string, returns int value of first
char, if source is int, returns string which consists
of a single char (source) (+0 terminator).
a(source) converts source to array (only string supported)
ff(float, format) converts float to string, with format
options.
options = precision + flags.
Precision shows how many digits after decimal point
will be shown. Flags:
16 (or 0x10) - No Exponential View
(number will be shown as 123.123)
32 (or 0x20) - Only exponential view
(number will be shown as 123.12e123)
64 (or 0x40) - use 'E' character instead of 'e'
By default the plugin decides itself how to show your
number.
math (description of all these functions is available at MSDN, use the
second given name for search):
sin(x), sin Sine of argument
cos(x), cos Cosine of argument
cel(x), ceil Ceil of argument (no fract. part)
csh(x), cosh Hyperbolic Cosine of Argument
exp(x), exp Exponential
abs(x), abs Absolute value (warning: float)
flr(x), floor Floor of argument (no fract. part)
asn(x), asin ArcSine of argument
acs(x), acos ArcCosine of argument
atn(x), atan ArcTangent of argument
ln(x), log Exponential Logarithm
log(x), log10 Decimal logarithm
snh(x), sinh Hyperbolic Sine of Argument
sqt(x), sqrt Square root of argument
tan(x), tan Tangent of argument
tnh(x), tanh Hyperbolic tangent of argument
functions taking two arguments
at2(x, y) atan2 Arctangent of the value (y/x)
pow(x, y) pow power, x^y
fmd(x, y) fmod floating point remainder
fex(x, o) frexp Gets the mantissa (result = r)
and exponent (o) of floating-point
number (x): x = r*(2^o)
mdf(x, o) modf Splits a floating-point value into
fractional and integer parts.
User-defined functions.
It's very simple. Example:
test(a,b) (a+b);
After that test(1,2) will give you 3.
test2(a,b) (a=a+b; b *= a);
The result of function is always the result of last expression.
As said before it better not to use stack (S) in between function calls.
It will be better to develop variable-safe functions, i.e. functions which will
not corrupt variables. For this you should either push/pop them to stack, or
declare as additional arguments, which will never be used. Example:
test3(a,b,c) (c=10; #{--c > 0, a=sqrt(a*b)}; a)
No matter how many arguments will be passed to function, the values of all three
vars (a,b,c) will be saved.
Such variable-safe functions could be recursive:
Math::Script 'rec(a) (#[a > 0, rec(a-1), 0]+a);'
Math::Script 'R1 = rec(10)'
will set R1 to right result 55.
Sometimes functions will need to return more than one value, in this case you
could declare argument as referent (b at example):
test4(a, &b) (*b = a*a; a*a*a)
In this case test4 will return a^3, and if we will call it like that test4(a,c),
it will place a^2 to c. BUT! Note: you should use de-referencer (*) with variable,
at example *b. CAUTION: never use the same variable as function internal reference
variable and external argument variable (for example test4(a,b)). It will surely
fail. Also: if you declared argument as reference - you should never supply
a constant expression to it. It could be either array item (array[1]), NSIS
register R0, any of the user variables (beside the variable with the same name:),
but never the constant.
Another may-be-useful possibility is to redeclare the function (the usual
declaration at the time when function already defined will simply call that
function). For such task you could use "#name", like "func()(1); #func()(2);".
But beware, function declaration occurs at time of parsing, so it's not possible
to perform flow controlled declaration.
SUCH IS NOT POSSIBLE: "#[a<0, #func()(1), #func()(2)]"
IT WILL SIMPLY DEFINE #func as (2), as the latest variant.
(c) Nik Medved (brainsucker)

View File

@ -0,0 +1,10 @@
Copyright <20> 2002-2018 Joost Verburg
This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software.
If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
2. Altered versions must be plainly marked as such, and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any distribution.

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 203 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 138 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

View File

@ -0,0 +1,268 @@
NSIS Modern User Interface
Version History
1.81
* Added MUI_TEXTCOLOR (2018-09-09)
* Added MUI_PAGE_CUSTOMFUNCTION_DESTROYED (2017-04-03)
* Added support for MUI_UNCONFIRMPAGE_VARIABLE (RFE #511) (2016-12-30)
1.8 - August 9, 2007
* Uses the new language files
* Updated documentation
* Although MUI_DIRECTORYPAGE_BGCOLOR and MUI_STARTMENUPAGE_BGCOLOR are documented as interface
setttings that apply to every directory page or Start Menu folder page, they were actually
implemented as page specific settings. They have been changed to interface settings.
* MUI_LANGDLL_DISPLAY now also reads a previously saved language from the registry if the
installation is silent.
* InstallOptions macros have been moved to a separate header file (InstallOptions.nsh).
The MUI_INSTALLOPTIONS_* macros are still provided for backwards compatibility and insert the
equalivent INSTALLOPTIONS_* macros.
* Added MUI_CUSTOMFUNCTION_MOUSEOVERSECTION
1.78 - June 8, 2007
* Added MUI_STARTMENUPAGE_BGCOLOR
* Added MUI_DIRECTORYPAGE_BGCOLOR
* Added MUI_LANGDLL_ALLLANGUAGES
1.77 - April 27, 2007
* Added MUI_FINISHPAGE_CANCEL_ENABLED
* Added MUI_FINISHPAGE_REBOOTLATER_DEFAULT
* Block unsupported languages in the language selection dialog
* Cancel button no longer enabled by default on the finish page
* Reduced flicker caused by MUI_HEADER_TRANSPARENT_TEXT
1.76 - September 23, 2006
* Added MUI_ABORTWARNING_CANCEL_DEFAULT
1.75 - April 1, 2006
* Added show function for the start menu page
* Added MUI_HEADER_TRANSPARENT_TEXT for transparent header texts
1.74 - September 4, 2005
* Fixed compile error when checkboxes are used on multiple finish page pages
1.73 - August 6, 2005
* The checkboxes to run an application or show a Readme file can now also be used on an uninstaller
finish pages or multiple finish pages
1.72 - November 27, 2004
* Fixed state of Finish page Cancel button when both an installer and uninstaller page is included
1.71 - October 14, 2004
* The selected language is only stored in the registry when installation was successful
1.70 - February 6, 2004
* Improved documentation
* New Init custom function for Welcome and Finish page
1.69 - January 7, 2004
* All uninstaller pages work without installer pages
* Fixed top text on uninstaller license page
1.68 - November 24, 2003
* New settings for extra space for title and text on Welcome and Finish page.
* Improved handling of verbose settings. Define MUI_VERBOSE the set the Modern UI verbose level (1-4).
* Language file string for uninstaller reboot information
* Setting for folder validation in leave function
* Fixed finish page text settings for multiple pages
1.67 - November 18, 2003
* Support for uninstaller Welcome pages and Finish pages
* Improved and changed text settings
* ID for Start Menu Folder pages, easier to use multiple pages
* Renamed a few settings
* Default header image
* Support for uninstaller abort warning
* Setting for 3 line text on Welcome and Finish page
(NOTE: New settings have been introduced in version 1.68)
* Langauge file backwards compatibility: English for missing strings
* Support for different uninstaller header image
* Language selection dialog not displayed if installer is silent
* Cancel button on Finish page when there are options
* Full RTL support
1.66 - October 7, 2003
* New system for page settings and custom pages
* Support for uninstaller components page
* Support for multiple pages of the same type
* New position for interface settings
* Changed macro and setting names
* Updated langauge system, new language files and settings
* Removed MUI_BRANDINGTEXT. You can use the standard BrandingText instruction.
* Removed MUI_PRODUCT and MUI VERSION. You can use the standard Name instruction.
1.65 - July 16, 2003
* New page configuration system, no different system for installers with custom pages
* Default windows color for the license text background
* Example script updates (new format, user variables)
* Improved registry storage for Start Menu folder
* ReserveFile macro for StartMenu plug-in
* Option to always show the language selection dialog (even if a language has been stored in the registry)
* Checkboxes on Finish page can be used to call a function
* Support for custom leave functions for Start Menu Folder, Welcome and Finish pages
* Support for a link on the Finish page
* New macro to get Start Menu folder in uninstaller
* Options to disable bitmap stretching
* Components page description box info text: always displayed
when mouse is outside box, disabled style
1.64 - April 27, 2003
* Support for license page with checkbox or radiobuttons to let the user accept the agreement or not
* Macros for finish headers don't have to be inserted anymore
* Language preference stored when installation has completed, no problems anymore when the users selects the wrong language
* Header text for aborted installation
* New macros: get language for uninstaller, delete shortcuts
* Language specific fonts
* Welcome/Finish page INI files can be modified in pre functions
* More texts can be customized
1.63 - March 9, 2003
* Support for a bitmap in the wizard header
* New defines to change the components page interface
* MUI_SYSTEM inserted automatically
* Single macro for language selection dialog
* Removed page description in window title
* Easier to customize resource files
* New system for custom functions
* Start Menu folder registry key automatically written
* New InstallOptions macros that do not remove the return value from the stack
* Support for custom pages before the finish page
* Renamed Start Menu page defines
* 'Do not create shortcuts' checkbox can be removed
* 'MS Shell Dlg' font for header title
* RTL support
* Documentation updates
* Minor fixes
1.62 - February 2, 2003
* New language strings for Finish page
* Possibility to let a Modern UI Function call your own function
* No problems anymore when using both 'Run program' and 'Show Readme' on the Finish page
* Default state of checkboxes on the finish page can be changed
* Welcome / Finish page compatible with custom DPI settings
* Converted Install Options INI files to use dialog units
* More ReserveFile macros
(NOTE: Some of these macros have been removed in later versions)
* Background color can be changed with a define
* Support for multilingual branding texts
* Start Menu / Finish page window titles also work when using custom page commands
* Language files should be inserted after inserting the MUI_SYSTEM macro
(NOTE: The MUI_SYSTEM macro has been removed in version 1.63)
* Define MUI_MANUALVERBOSE if you don't want the Modern UI to change the verbose settings during compilation
(NOTE: This setting has been changed in version 1.68)
1.61 - December 5, 2002
* modern3.exe UI without description area
(NOTE: This setting has been changed in version 1.63)
* Added define to show uninstall confirm page
* Added language string for finish page title and continue to uninstall
* Define for parameters for the application to run on the finish page
* Minor fixes
1.6 - November 18, 2002
* Welcome / Finish page
* Automatic ask for reboot on finish page
* Create no shortcut option on the Start Menu Folder selection page
* Customizing GUIInit functions easier
* Minor font / UI changes
1.5 - November 11, 2002
* New language file format
* Language strings can be changed in the script without editing languagefiles
* Start Menu Folder selection page
* 'Click Next to continue' and 'Click Install to start the installation' texts automatically change to the page order
* Install Options macros updated. MUI_INSTALLOPTIONS_DISPLAY is the standard macro now.
Use MUI_INSTALLOPTIONS_INITDIALOG and MUI_INSTALLOPTIONS_SHOW if you want to customize dialog controls.
* No more writing window titles & abort warnings to Install Options INI Files
* Compatible with updated paging system
* Renamed macros and defines
* Minor fixes
1.4 - November 4, 2002
* Uses new NSIS Page command
* Macro System updates (smaller)
* Macro System a lot easier
* Modern UI Language Files load NLF language files
* Renamed macros and defines
1.3 - October 27, 2002
* Easier macro system for basic scripts
* New MultiLanguage system using Modern UI Language Files
* New directory structure (header/language files in Contrib\Modern UI)
* Small bugfixes & typo corrections
* SetPage function should be set using defines
* Different NextPage/PrevPage/FinishHeader macros for install/uninstall
(NOTE: These macros have been removed in version 1.4)
* Interface settings can be definend (for example, MUI_ICON), no parameters for MUI_INTERFACE anymore
* New Install Options macros to read/write IO INI file value
1.21 - September 30, 2002
* Temp vars set in Modern UI header
* Currentpage & Install Options vars should be set using
parameters of the MUI_INTERFACE and * MUI_INSTALLOPTIONS macros
(NOTE: The MUI_INTERFACE macro has been removed in version 1.3)
* MultiLanguage.nsi uses the new language strings
1.2 - September 22, 2002
(NOTE: All macros mentioned here have been removed in version 1.4)
* Lots of macro system updates & fixes
* InstallOptions support in macro system
* Added Modern UI + InstallOptions example (InstallOptions.nsi)
* MUI_NEXTPAGE_OUTER integrated in MUI_NEXTPAGE
* No hard-coded function names anymore (you should give
MUI_PREVPAGE a parameter with the set page function name
(for example, MUI_PREVPAGE SetPage)
* Examples use ReserveFile for faster startup
1.19 - Semtember 19, 2002
* Renamed some macros
* Custom code can be used between page start/stop macros
(NOTE: These macros have been removed in version 1.4)
1.18 - Semtember 13, 2002
* Uses the new Sendmessage string option
1.17 - Semtember 10, 2002
* Win9x font weight bug fixed (font of title in white rect)
1.16 - Semtember 6, 2002
* Change text 'Scroll down' on license page to 'Press Page Down',
because the RichEdit control has focus by default now
1.15 - Semtember 4, 2002
* Multilanguage example: changed LangDialog to LangDLL::LangDialog (using the DLL name is now required)
(NOTE: A new macro for the language selection dialog has been introduced in version 1.63)
1.14 - Semtember 3, 2002
* Small grammar fix (thanks eccles)
* UI files updated by Justin for better RichEdit usage
1.13 - Semtember 2, 2002
* Added 16 color icons
1.12 - August 30, 2002
* Verifying installer & Unpacking data dialog has no titlebar anymore
1.11 - August 29, 2002
* Finish header for uninstaller can also be set using MUI_FINISHHEADER
(NOTE: The MUI_FINISHHEADER macro has been removed in version 1.64)
1.1 - August 29, 2002
(NOTE: All settings mentioned here do not exist anymore)
* Header file with macros, it's now very easy to use the UI in your scripts
* Added the modern2.exe UI, with an other location of the Description frame, for installers with a lot of subsections (thanks rainwater)
* Updated example scripts
* Added Multilanguage.nsi example (Multilanguage & LangDLL)
* Fixed background color issue with some custom XP themes
* Removed WS_VISIBLE from black rect for inner dialog (fixes display issues)
* Changed size of description area
* Example script: Added instructions for the user on the Description frame
* Auto sizing branding text
* Used modern.bmp for the checks (thanks rainwater)
* Using the new NSIS version, descriptions work using the keyboard and you can give descriptions to subsections
* Correct font size using High-DPI fonts
1.0 - August 26, 2002
* Initial release

View File

@ -0,0 +1,10 @@
Copyright 2002-2018 Joost Verburg
This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software.
If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
2. Altered versions must be plainly marked as such, and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any distribution.

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 203 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 138 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

View File

@ -0,0 +1,412 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>Multi-User Header File (MultiUser.nsh)</title>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
<style type="text/css">
td
{
padding: 5px;
vertical-align: top;
border-bottom: 1px solid black;
}
</style>
</head>
<body>
<h1>
Multi-User Header File (MultiUser.nsh)</h1>
<p>
<i>Installer configuration for multi-user Windows environments</i></p>
<h2>
Table of Contents</h2>
<ul>
<li><a href="#introduction">Introduction</a></li>
<li><a href="#executionlevel">Initalization and Execution Level</a>
<li><a href="#installationmode">Installation Mode</a></ul>
<h2>
<a name="introduction"></a>Introduction</h2>
<p>
Modern Windows versions support multiple users accounts on a single computer, each
with different privileges. For security reasons, the privileges of applications
can also be limited. For an installer, the <i>execution level</i> and <i>installation
mode</i> are important. The execution level determines the privileges of the
installer application. For example, to install hardware drivers, administrator privileges
are required. Applications can also be installed for a single user or for all users
on a computer, which is determined by the installation mode. Installation for all
users requires a higher execution level as compared with a single user setup. The
MultiUser.nsh header files provides the features to automatically handle all these
aspects related to user accounts and installer privileges.</p>
<p>
Note that all settings need to be set before including the MultiUser.nsh header
file.</p>
<h2>
Initialization and <a name="executionlevel"></a>Execution Level&nbsp;</h2>
<p>
Before the MultiUser.nsh file is included, the MULTIUSER_EXECUTIONLEVEL define should
be set to one of the following values depending on the execution level that is required:</p>
<table>
<tr>
<td>
<b>Value </b>
</td>
<td>
<b>Description</b>
</td>
<td>
<b>Typical application</b>
</td>
</tr>
<tr>
<td>
Admin
</td>
<td>
Administrator privileges are required
</td>
<td>
Access data of all users accounts
</td>
</tr>
<tr>
<td>
Power
</td>
<td>
Power User privileges are required<br />
(Power Users no longer exist in Windows Vista. For Vista this is equivalent to Admin)
</td>
<td>
Installation for all users (writing to &quot;Program Files&quot; or HKLM registry
keys), driver installation
</td>
</tr>
<tr>
<td>
Highest
</td>
<td>
Request the highest possible execution level for the current user
</td>
<td>
Mixed-mode installer that can both be installed per-machine or per-user
</td>
</tr>
<tr>
<td>
Standard
</td>
<td>
No special rights required
</td>
<td>
Installation for current user only
</td>
</tr>
</table>
<p>
Insert the MULTIUSER_INIT and MULTIUSER_UNINT macros in the .onInit and un.onInit
function to verify these privileges. If no uninstaller is created in the script,
set MULTIUSER_NOUNINSTALL.</p>
<blockquote>
<pre>!define MULTIUSER_EXECUTIONLEVEL Highest
;!define MULTIUSER_NOUNINSTALL ;Uncomment if no uninstaller is created
!include MultiUser.nsh
...
Function .onInit
!insertmacro MULTIUSER_INIT
FunctionEnd
Function un.onInit
!insertmacro MULTIUSER_UNINIT
FunctionEnd</pre>
</blockquote>
<p>
Whether the required privileges can be obtained depends on the user that starts
the installer:</p>
<ul>
<li>Windows NT 4/2000/XP/2003 give the installer the same privileges as the user itself.
If the privileges of the user are not sufficient (e.g. Admin level is required is
set but the user has no administrator rights), the macros will display an error
message and quit the installer. If is however possible to manually run the installer
with an administrator account.</li>
<li>Windows Vista restricts the privileges of all applications by default. Depending
on requested execution level, MultiUser.nsh will set the RequestExecutionLevel flag
to request privileges. The user will be asked for confirmation and (if necessary)
for an administrator password.</li>
<li>Windows 95/98/98 do not set any restrictions on users or applications. Administrator
rights are always available.</li>
</ul>
<p>
It is recommended to insert these initialization macros before macros that require
user intervention. For example, it does not make sense to ask a user for an installer
language if the installer will quit afterwards because the user account does not
have the required privileges. After the macros are inserted, the variable $MultiUser.Privileges
will contain the current execution level (Admin, Power, User or Guest).</p>
<p>
The following additional settings are available to customize the initialization:</p>
<table>
<tr>
<td>
<b>Setting<td>
<b>Description</b>
</td>
</tr>
<tr>
<td>
MULTIUSER_INIT_TEXT_ADMINREQUIRED
</td>
<td>
Error message to be displayed when administrator rights are required but not available.
</td>
</tr>
<tr>
<td>
MULTIUSER_INIT_TEXT_POWERREQUIRED
</td>
<td>
Error message to be displayed when Power User rights are required but not available.
</td>
</tr>
<tr>
<td>
MULTIUSER_INIT_TEXT_ALLUSERSNOTPOSSIBLE
</td>
<td>
Error message to be displayed when administrator or Power User rights are required
because of an installation mode setting on the command line (see below) but are
not available.
</td>
</tr>
<tr>
<td>
MULTIUSER_USE_PROGRAMFILES64
</td>
<td>
Use $PROGRAMFILES64 instead of $PROGRAMFILES as the default all users directory.
</td>
</tr>
<tr>
<td>
MULTIUSER_INIT_FUNCTIONQUIT<br />
MULTIUSER_INIT_UNFUNCTIONQUIT
</td>
<td>
A custom function to be called when the installer is closed due to insufficient
privileges.
</td>
</tr>
</table>
<h2>
<a name="installationmode"></a>Installation Mode</h2>
<p>
As mentioned before, applications can both be installed for a single users or for
all users on a computer. Applications for all users are typically installed in the
Program Files folder and appear in the Start Menu of every user. On the contrary,
applications for a single user are usually installed in the local Application Data
folder and only a appear in the Start Menu of the user who installed the application.</p>
<p>
By default, MultiUser.nsh will set the installation mode for a per-machine installation
if Administrator or Power User rights are available (this is always the case if
the execution level is set to Admin or Power, if Highest is set it depends on the
user account). For the Standard execution level the installation will always be
for a single user. On Windows 95/98/Me installation for a single user is not possible.</p>
<p>
The following settings are available to change the default installation mode:
<table>
<tr>
<td>
<b>Setting</b>
</td>
<td>
<b>Description</b>
</td>
</td>
</tr>
<tr>
<td>
MULTIUSER_INSTALLMODE_DEFAULT_CURRENTUSER
</td>
<td>
Set default to a per-user installation, even if the rights for a per-machine installation
are available.
</td>
</tr>
<tr>
<td>
MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_KEY MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_VALUENAME
</td>
<td>
Non-empty registry key that is created during the installation in either HKCU or
HKLM. The default installation mode will automatically be set to the previously
selected mode depending on the location of the key.
</td>
</tr>
</table>
<p>
After initialization, the variable $MultiUser.InstallMode will contain the current
installation mode (AllUsers or CurrentUser).
</p>
<h3>
Mixed-Mode Installation</h3>
<p>
For the Admin and Power levels, both a per-machine as well as a per-user installation
is possible. If the Highest level is set and the user is an Administrator or Power
User, both options are also available.</p>
<p>
Usually it's a good thing to give the user to choice between these options. For
users of the Modern UI version 2, a page is provided that asks the user for the
installation mode. To use this page, define MULTIUSER_MUI before including User.nsh.
Then, the MULTIUSER_PAGE_INSTALLMODE macro can be used just like a normal Modern
UI page (this page will automatically be skipped when running Windows 95/98/Me):</p>
<pre>!define MULTIUSER_EXECUTIONLEVEL Highest
<b>!define MULTIUSER_MUI</b>
!define MULTIUSER_INSTALLMODE_COMMANDLINE
!include MultiUser.nsh
!include MUI2.nsh
<b>!insertmacro MULTIUSER_PAGE_INSTALLMODE</b>
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE English
...
Function .onInit
!insertmacro MULTIUSER_INIT
FunctionEnd
Function un.onInit
!insertmacro MULTIUSER_UNINIT
FunctionEnd
</pre>
<p>
The MULTIUSER_INSTALLMODE_COMMANDLINE setting that also appears in this example
enables the installation mode to be set using the /AllUsers or /CurrentUser command
line parameters. This is especially useful for silent setup.</p>
<p>
The following settings can be used to customize the texts on the page (in addition
to the general Modern UI page settings):</p>
<table>
<tr>
<td>
<b>Setting</b>
</td>
<td>
<b>Description</b>
</td>
</tr>
<tr>
<td>
MULTIUSER_INSTALLMODEPAGE_TEXT_TOP
</td>
<td>
Text to display on the top of the page.
</td>
</tr>
<tr>
<td>
MULTIUSER_INSTALLMODEPAGE_TEXT_ALLUSERS
</td>
<td>
Text to display on the combo button for a per-machine installation.
</td>
</tr>
<tr>
<td>
MULTIUSER_INSTALLMODEPAGE_TEXT_CURRENTUSER
</td>
<td>
Text to display on the combo button for a per-user installation.
</td>
</tr>
</table>
<h3>
Installation Mode Initalization</h3>
<p>
The SetShellVarContext flag (which determines the folders for e.g. shortcuts, like
$DESKTOP) is automatically set depending on the installation mode. In addition,
the following settings can be used to perform additional actions when the installation
mode is initialized:</p>
<table>
<tr>
<td>
<b>Setting</b>
</td>
<td>
<b>Description</b>
</td>
</td>
</tr>
<tr>
<td>
MULTIUSER_INSTALLMODE_INSTDIR
</td>
<td>
Name of the folder in which to install the application, without a path. This folder
will be located in Program Files for a per-machine installation and in the local
Application Data folder for a per-user installation (if supported).
</td>
</tr>
<tr>
<td>
MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_KEY MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_VALUENAME
</td>
<td>
Registry key from which to obtain a previously stored installation folder. It will
be retrieved from HKCU for per-user and HKLM for per-machine.
</td>
</tr>
<tr>
<td>
MULTIUSER_INSTALLMODE_FUNCTION<br />
MULTIUSER_INSTALLMODE_UNFUNCTION
</td>
<td>
A custom fuction to be called during the initialization of the installation mode
to set additional installer settings that depend on the mode
</td>
</table>
<p>
To set the installation mode manually, call one of these four functions:</p>
<table>
<tr>
<td>
<b>Function name</b>
</td>
<td>
<b>Installation mode</b>
</td>
</tr>
<tr>
<td>
MultiUser.InstallMode.AllUsers
</td>
<td>
Installer: Per-machine installation
</td>
</tr>
<tr>
<td>
MultiUser.InstallMode.CurrentUser
<td>
Installer: Per-user installation
</td>
</tr>
<tr>
<td>
un.MultiUser.InstallMode.AllUsers<td>
Uninstaller: Per-machine installation
</td>
</tr>
<tr>
<td>
un.MultiUser.InstallMode.CurrentUser<td>
Uninstaller: Per-user installation
</td>
</tr>
</table>
</body>
</html>

View File

@ -0,0 +1,18 @@
NSISdl 1.1 - HTTP downloading plugin for NSIS
Copyright (C) 2001-2002 Yaroslav Faybishenko & Justin Frankel
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.

View File

@ -0,0 +1,92 @@
NSISdl 1.3 - HTTP downloading plugin for NSIS
---------------------------------------------
Copyright (C) 2001-2002 Yaroslav Faybishenko & Justin Frankel
This plugin can be used from NSIS to download files via HTTP.
Note: HTTPS is not supported, only plain HTTP!
To connect to the internet, use the Dialer plugin.
USAGE
-----
NSISdl::download http://www.domain.com/file localfile.exe
You can also pass /TIMEOUT to set the timeout in milliseconds:
NSISdl::download /TIMEOUT=30000 http://www.domain.com/file localfile.exe
The return value is pushed to the stack:
"cancel" if cancelled
"success" if success
otherwise, an error string describing the error
If you don't want the progress window to appear, use NSISdl::download_quiet.
Example of usage:
NSISdl::download http://www.domain.com/file localfile.exe
Pop $R0 ;Get the return value
StrCmp $R0 "success" +3
MessageBox MB_OK "Download failed: $R0"
Quit
For another example, see waplugin.nsi in the examples directory.
PROXIES
-------
NSISdl supports only basic configurations of proxies. It doesn't support
proxies which require authentication, automatic configuration script, etc.
NSISdl reads the proxy configuration from Internet Explorer's registry key
under HKLM\Software\Microsoft\Windows\CurrentVersion\Internet Settings. It
reads and parses ProxyEnable and ProxyServer.
If you don't want NSISdl to use Internet Explorer's settings, use the
/NOIEPROXY flag. /NOIEPROXY should be used after /TRANSLATE and
/TIMEOUT. For example:
If you want to specify a proxy on your own, use the /PROXY flag.
NSISdl::download /NOIEPROXY http://www.domain.com/file localfile.exe
NSISdl::download /TIMEOUT=30000 /NOIEPROXY http://www.domain.com/file localfile.exe
NSISdl::download /PROXY proxy.whatever.com http://www.domain.com/file localfile.exe
NSISdl::download /PROXY proxy.whatever.com:8080 http://www.domain.com/file localfile.exe
TRANSLATE
---------
To translate NSISdl add the following values to the call line:
/TRANSLATE2 downloading connecting second minute hour seconds minutes hours progress
Default values are:
downloading - "Downloading %s"
connecting - "Connecting ..."
second - " (1 second remaining)"
minute - " (1 minute remaining)"
hour - " (1 hour remaining)"
seconds - " (%u seconds remaining)"
minutes - " (%u minutes remaining)"
hours - " (%u hours remaining)"
progress - "%skB (%d%%) of %skB @ %u.%01ukB/s"
The old /TRANSLATE method still works for backward compatibility.
/TRANSLATE downloading connecting second minute hour plural progress remianing
Default values are:
downloading - "Downloading %s"
connecting - "Connecting ..."
second - "second"
minute - "minute"
hour - "hour"
plural - "s"
progress - "%dkB (%d%%) of %ukB @ %d.%01dkB/s"
remaining - " (%d %s%s remaining)"
/TRANSLATE and /TRANSLATE2 must come before /TIMEOUT.

View File

@ -0,0 +1,41 @@
Splash.dll - small (4k), simple plugin that lets you throw
up a splash screen in NSIS installers.
--- UPDATED in 2.0b0 - will break old scripts ---
To use:
Create a .BMP file of your splash screen.
(optional) Create a .WAV file to play while your splash screen shows.
Add the following lines to your .NSI file:
Function .onInit
SetOutPath $TEMP
File /oname=spltmp.bmp "my_splash.bmp"
; optional
; File /oname=spltmp.wav "my_splashsound.wav"
splash::show 1000 $TEMP\spltmp
Pop $0 ; $0 has '1' if the user closed the splash screen early,
; '0' if everything closed normally, and '-1' if some error occurred.
Delete $TEMP\spltmp.bmp
; Delete $TEMP\spltmp.wav
FunctionEnd
Note that the first parameter to splash.exe is the length to show the
screen for (in milliseconds), and the second is the splash bitmap filename (without
the .bmp). The BMP file used will be this parameter.bmp, and the wave file used
(if present) will be this parameter.wav.
(If you already have an .onInit function, put that in it)
Note: the return value of splash is 1 if the user closed the splash
screen early (pop it from the stack)
-Justin
Converted to a plugin DLL by Amir Szekely (kichik)

View File

@ -0,0 +1,47 @@
StartMenu.dll shows a custom page that lets the user select a start menu program
folder to put shortcuts in.
To show the dialog use the Select function. This function has one required parameter
which is the program group default name, and some more optional switches:
/autoadd - automatically adds the program name to the selected folder
/noicon - doesn't show the icon in the top left corner
/text [please select...] - sets the top text to something else than
"Select the Start Menu folder in which..."
/lastused [folder] - sets the edit box to a specific value folder.
Use this to make this plug-in remember the last
folder selected by the user
/checknoshortcuts text - Shows a check box with the text "text". If
the user checks this box, the return value
will have > as its first character and you
should not create the program group.
/rtl - sets the direction of every control on the selection dialog
to RTL. This means every text shown on the page will be
justified to the right.
The order of the switches doesn't matter but the required parameter must come after
all of them. Every switch after the required parameter will be ignored and left
on the stack.
The function pushes "success", "cancel" or an error to the stack. If there was no
error and the user didn't press on cancel it will push the selected folder name
after "success". If the user checked the no shortcuts checkbox the result will be
prefixed with '>'. The function does not push the full path but only the selected
sub-folder. It's up to you to decide if to put it in the current user or all
users start menu.
To set properties of the controls on the page, such as colors and fonts use Init
and Show instead of Select. Init will push the HWND of the page on the stack,
or an error string. For example:
StartMenu::Init "Test"
Pop $0
IntCmp $0 0 failed
GetDlgItem $0 $0 1003
SetCtlColors $0 "" FF0000
StartMenu::Show
# continue as with Select here
failed:
Look at Example.nsi for a full example (without Init and Select).
Created by Amir Szekely (aka KiCHiK)

View File

@ -0,0 +1,707 @@
String Functions Header File Readme
-----------------------------------
String Functions Header File contains a set of good string manipulation
functions in a much simpler way to include and call in NSIS scripts.
How to use
----------
Basic Syntax
------------
Parameters are specified in this format:
required (required) (option1 | option2) [optional or add. options]
[option1 | option2]
The stars in command titles (*****) are the function usefulness in my
opinion. The more starts, the more useful it is. 5 stars (*****) is the
most useful.
Any time when is mentioned "Default is" means that you can use the value
mentioned or keep it blank, the result is the same.
If you want a certain value (e.g. a text) to be language-specific, set a
language string (using LangString) and define $(STRINGNAME) as value.
If you want to add ` to a string, you should always escape it using $\`
because the header file macro functions use ` to separate parameters.
1. Include Header file
----------------------
!include "StrFunc.nsh"
StrFunc.nsh has to be inside Include directory, so you don't have to
specify a path.
You have to put this command before any command used in this header file.
2. Defines
----------
This header file contains defines that automate the life of some who
fear a lot of changes sometimes imposed in this header file, or who have
applications that put it to work at maximum capacity. Before you try
these, take a look at the information below:
- Every item on a define value is separated by a "|", and every subitem
(items in an item) is separated by " ".
- Use ${StrTok} $var "${DefineName}" "|" "$counter" "0" to get every
item inside the define. For subitems, use ${StrTok} $var2 "$var" " "
"$counter2" "0" after getting the value for a desired item.
- ${StrFunc_List} is automatically made by the header file. The rest
is manually added to the header.
2.1 Defines List:
-----------------
StrFunc_List - Lists all function names currently available on StrFunc
header file.
*_List - Lists all parameter names currently available for "*"
function. (* = function name - i.e. StrTok_List).
*_TypeList - Lists the types of all parameters on "*" function.
(* = function name - i.e. StrTok_List). Possible types
for each parameter:
- Output - Needs a variable to output a function result.
- Text - Needs text or number to be input.
- Mixed - Needs text, number or option to be inputed.
Each subitem following the "Mixed" word is an
option. The first option is ever the default
one. Two following spaces " " means that
that subitem is empty.
- Option - Needs an option to be inputed. Each subitem
following the "Option" word is an option.
The first option is ever the default one. Two
following spaces " " means that that subitem
is empty.
3. Commands
-----------
Some commands have special specifications to work. Consult command's
documentation on "3.3 Commands" section.
3.1 How To Use Commands In Install Sections and Functions
---------------------------------------------------------
Every command used in install sections and functions have to be called
first before and out of any sections and functions, and without
parameters.
Example:
--------
${StrStr}
3.2 How To Use Commands In Uninstall Sections and Functions
-----------------------------------------------------------
Commands with Uninstall Sections and Functions support have "Un" before
the words inside curly brackets "{}".
Example:
--------
${UnStrStr}
A complete example with both Install and Uninstall Commands:
------------------------------------------------------------
!include "StrFunc.nsh"
${StrStr} # Supportable for Install Sections and Functions
${UnStrStr} # Supportable for Uninstall Sections and Functions
Section
${StrStr} $0 "OK! Now what?" "wh"
SectionEnd
Section Uninstall
${UnStrStr} $0 "OK! Now what?" "wh"
SectionEnd
3.3 Commands
------------
=========================================================================
** ${StrCase}
-------------------------------------------------------------------------
ResultVar String Type(|L|U|T|S|<>)
=========================================================================
Converts "String" to "Type" Case. Uses LogicLib.
Parameters:
ResultVar
Destination where result is returned.
String
String to convert to "Type" case.
Type
Type of string case to convert to:
- "" = Original Case (same as "String")
- L = Lower Case (this is just an example. a very simple one.)
- U = Upper Case (THIS IS JUST AN EXAMPLE. A VERY SIMPLE ONE.)
- T = Title Case (This Is Just An Example. A Very Simple One.)
- S = Sentence Case (This is just an example. A very simple one.)
- <> = Switch Case (This is just an example. A very simple one.)
Default value is "" (Original Case).
Result Value -> ResultVar:
"String" in "Type" case.
Example:
${StrCase} $0 '"Voc<6F>" is "You" in English.' "U"
[__(_)__()___()__()__(____)_]
$0 = '"VOC<4F>" IS "YOU" IN ENGLISH.'
=========================================================================
* ${StrClb}
-------------------------------------------------------------------------
ResultVar String Action(|>|<|<>)
=========================================================================
Makes an action with the clipboard depending on value of parameter
"Action". Uses LogicLib.
Parameters:
String
If "Action" = ">" or "<>" - String to put on the clipboard.
Action
Can be one of the following values:
- "" = Cleans the clipboard.
- ">" = Set string to clipboard.
- "<" = Get string from clipboard.
- "<>" = Swap string with clipboard's.
Result Value -> ResultVar:
If "Action" = "<" or "<>" - String found on the clipboard.
=========================================================================
*** ${StrIOToNSIS}
-------------------------------------------------------------------------
ResultVar String
=========================================================================
Convert "String" from Install Options plugin to be supported by NSIS.
Escape, back-slash, carriage return, line feed and tab characters are
converted.
Parameters:
ResultVar
Destination where result is returned.
String
String to convert to be supportable for NSIS.
Result Value -> ResultVar:
"String" supportable for NSIS.
Example:
${StrIOToNSIS} $0 "\r\n\t\\This is just an example\\"
[()()()()_______________________()]
$0 = "$\r$\n$\t\This is just an example\"
=========================================================================
* ${StrLoc}
-------------------------------------------------------------------------
ResultVar String StrToSearchFor CounterDirection(>|<)
=========================================================================
Searches for "StrToSearchFor" in "String" and returns its location,
according to "CounterDirection".
Parameters:
ResultVar
Destination where result is returned.
String
String where to search "StrToSearchFor".
StrToSearchFor
String to search in "String".
CounterDirection(>|<)
Direction where the counter increases to. Default is ">".
(> = increases from left to right, < = increases from right to left)
Result Value -> ResultVar:
Where "StrToSearchFor" is, according to "OffsetDirection".
Example:
${StrLoc} $0 "This is just an example" "just" "<"
(__)<<<<<<<<<<<
$0 = "11"
=========================================================================
*** ${StrNSISToIO}
-------------------------------------------------------------------------
ResultVar String
=========================================================================
Converts "String" from NSIS to be supported by Install Options plugin.
Escape, back-slash, carriage return, line feed and tab characters are
converted.
Parameters:
ResultVar
Destination where result is returned.
String
String to convert to be supportable for Install Options plugin.
Result Value -> ResultVar:
"String" supportable for Install Options plugin.
Example:
${StrNSISToIO} $0 "$\r$\n$\t\This is just an example\"
[(_)(_)(_)^_______________________^]
$0 = "\r\n\t\\This is just an example\\"
=========================================================================
***** ${StrRep}
-------------------------------------------------------------------------
ResultVar String StrToReplace ReplacementString
=========================================================================
Searches for all "StrToReplace" in "String" replacing those with
"ReplacementString".
Parameters:
ResultVar
Destination where result is returned.
String
String where to search "StrToReplace".
StrToReplaceFor
String to search in "String".
StringToBeReplacedWith
String to replace "StringToReplace" when it is found in "String".
Result Value -> ResultVar:
"String" with all occurrences of "StringToReplace" replaced with
"ReplacementString".
Example:
${StrRep} $0 "This is just an example" "an" "one"
[____________()_______]
$0 = "This is just one example"
=========================================================================
*** ${StrSort}
-------------------------------------------------------------------------
ResultVar String LeftStr CenterStr RightStr IncludeLeftStr(1|0)
IncludeCenterStr(1|0) IncludeRightStr(1|0)
=========================================================================
Searches for "CenterStr" in "String", and returns only the value
between "LeftStr" and "RightStr", including or not the "CenterStr" using
"IncludeCenterStr" and/or the "LeftStr" using "IncludeLeftStr" and
"RightStr" using "IncludeRightStr".
Parameters:
ResultVar
Destination where result is returned.
String
String where to search "CenterStr".
LeftStr
The first occurrence of "LeftStr" on the left of "CenterStr".
If it is an empty value, or was not found, will return
everything on the left of "CenterStr".
CenterStr
String to search in "String".
RightStr
The first occurrence of "RightStr" on the right of "CenterStr".
If it is an empty value, or was not found, will return
everything on the right of "CenterStr".
IncludeLeftStr(1|0)
Include or not the "LeftStr" in the result value. Default is 1
(True). (1 = True, 0 = False)
IncludeCenterStr(1|0)
Include or not the "CenterStr" in the result value. Default is 1
(True). (1 = True, 0 = False)
IncludeRightStr(1|0)
Include or not the "RightStr" in the result value. Default is 1
(True). (1 = True, 0 = False)
Result Value -> ResultVar:
String between "LeftStr" and "RightStr" of a found "CenterStr"
including or not the "LeftStr" and "RightStr" if
"IncludeLeftRightStr" is 1 and/or the "CenterStr" if
"IncludeCenterStr" is 1.
Example:
${StrSort} $0 "This is just an example" " just" "" "ple" "0" "0" "0"
[_______(___)_______]( )
C R
$0 = "This is an exam"
=========================================================================
***** ${StrStr}
-------------------------------------------------------------------------
ResultVar String StrToSearchFor
=========================================================================
Searches for "StrToSearchFor" in "String".
Parameters:
ResultVar
Destination where result is returned.
String
String where to search "StrToSearchFor".
StrToSearchFor
String to search in "String".
Result Value -> ResultVar:
"StrToSearchFor" + the string after where "StrToSearchFor" was found in
"String".
Example:
${StrStr} $0 "This is just an example" "just"
>>>>>>>>>{_)____________]
$0 = "just an example"
=========================================================================
***** ${StrStrAdv}
-------------------------------------------------------------------------
ResultVar String StrToSearchFor SearchDirection(>|<)
ResultStrDirection(>|<) DisplayStrToSearch(1|0) Loops CaseSensitive(0|1)
=========================================================================
Searches for "StrToSearchFor" in "String" in the direction specified by
"SearchDirection" and looping "Loops" times.
Parameters:
ResultVar
Destination where result is returned.
String
String where to search "StrToSearchFor".
StrToSearchFor
String to search in "String".
SearchDirection (>|<)
Where do you want to direct the search. Default is ">" (to right).
(< = To left, > = To right)
ResultStrDirection (>|<)
Where the result string will be based on in relation of
"StrToSearchFor"
position. Default is ">" (to right). (< = To left, > = To right)
DisplayStrToSearch (1|0)
Display "StrToSearchFor" in the result. Default is "1" (True).
(1 = True, 0 = False)
Loops
Number of times the code will search "StrToSearchFor" in "String" not
including the original execution. Default is "0" (1 code execution).
CaseSensitive(0|1)
If "1" the search will be case-sensitive (differentiates between cases).
If "0" it is case-insensitive (does not differentiate between cases).
Default is "0" (Case-Insensitive).
Result Value -> ResultVar:
"StrToSearchFor" if "DisplayStrToSearch" is 1 + the result string after
or before "StrToSearchFor", depending on "ResultStrDirection".
Result with Errors:
When "StrToSearchFor" was not found, will return an empty string.
When you put nothing in "StrToSearchFor", will return "String" and set
error flag.
When you put nothing in "String", will return an empty string and set
error flag.
Example:
${StrStrAdv} $0 "This IS really just an example" "IS " ">" ">" "0" "0" "1"
>>>>>( )[____________________]
$0 = "really just an example"
=========================================================================
**** ${StrTok}
-------------------------------------------------------------------------
ResultVar String Separators ResultPart[L] SkipEmptyParts(1|0)
=========================================================================
Returns the part "ResultPart" between two "Separators" inside
"String".
Parameters:
ResultVar
Destination where result is returned.
String
String where to search for "Separators".
Separators
Characters to find on "String".
ResultPart[L]
The part want to be found on "StrToTokenize" between two "Separators".
Can be any number, starting at 0, and "L" that is the last part.
Default is L (Last part).
SkipEmptyParts(1|0)
Skips empty string parts between two "Separators". Default is 1 (True).
(1 = True, 0 = False)
Result Value -> ResultVar:
"String" part number "Part" between two "Separators".
Examples:
1) ${StrTok} $0 "This is, or is not, just an example" " ," "4" "1"
( ) () () () [_] ( ) () ( )
0 1 2 3 4 5 6 7
$0 = "not"
2) ${StrTok} $0 "This is, or is not, just an example" " ," "4" "0"
( ) () ^() [] ( ) ^( ) () ( )
0 1 23 4 5 67 8 9
$0 = "is"
=========================================================================
* ${StrTrimNewLines}
-------------------------------------------------------------------------
ResultVar String
=========================================================================
Deletes unnecessary new lines at end of "String".
Parameters:
ResultVar
Destination where result is returned.
String
String where to search unnecessary new lines at end of "String".
Result Value -> ResultVar:
"String" with unnecessary end new lines removed.
Example:
${StrTrimNewLines} $0 "$\r$\nThis is just an example$\r$\n$\r$\n"
[_____________________________(_)(_)(_)(_)]
$0 = "$\r$\nThis is just an example"
Functions included and not included
--------------------------------------------------
11 functions have been included
They are not available on Archive
They are on LogicLib format
15 functions have not been included
12 were not included because of better functions
6 were not included because of AdvStrTok (called here as StrTok)
First String Part Function
Save on Variables Function
Sort Strings (1, 2 and 3) Functions
StrTok Function
2 were not included because of StrCase
StrLower Function
StrUpper Function
2 were not included because of StrClb
StrClbSet Function
StrClbGet Function
1 was not included because of NSISToIO and IOToNSIS
Convert / to // in Paths Function
1 was not included because of original String Replace Function (called
here as StrRep)
Another String Replace Function
2 were not included because they aren't useful anymore
Slash <-> Backslash Converter Function
Trim Function
1 was not included because of bugs
Number to String Converter Function
Version History
---------------
1.09 - 10/22/2004
- Fixed stack problems involving: StrCase, StrRep, StrSort, StrTok.
- Fixed StrClb: When "Action" = "<>", handle was wrongly outputed as
text.
- Fixed StrSort, StrStrAdv documentation examples.
- Fixed StrIOToNSIS, StrLoc, StrNSISToIO, StrRep, StrStr: sometimes
didn't find "StrToSearch" at all.
1.08 - 10/12/2004
- Converted all the functions to LogicLib.
- StrSort: Totally remade and it can break old scripts. See
documentation for details.
- StrTok: "ResultPart" has to start from 0 and it can break old scripts.
See documentation for details.
- Added defines: StrFunc_List, *_List and *_TypeList.
- Fixed StrStrAdv: Variables $R0-$R3 couldn't be used on scripts before
calling.
- StrRep: Cut down some variables.
- Arranged correctly the order of StrSort on the documentation.
1.07 - 09/21/2004
- Removed ${UnStrFunc} command. Now you can just include uninstall
functions commands like ${UnStrStr} to be supported by uninstall functions
and sections.
- Added case-sensitive comparation option for StrStrAdv.
- StrCase now uses System.dll which makes case conversions effective with
all latin letters (i.e. <20>).
- Added switch case and original case for StrCase.
- StrClbSet and StrClbGet removed, added StrClb.
- Made compact the most usual operations inside the header file. File size
reduced.
1.06 - 03/26/2004
- StrNumToStr removed due to complex number handling on some languages.
- Fixed the bug where the old string was attached to string returned by
StrCase when $R5 variable was used.
1.05 - 03/17/2004
- Fixed a bug with StrCase, Title Case wasn't working as should be.
- Fixed a bug with StrStrAdv, previous fix created another bug, string not
returned correctly when using backwards search with "DisplayStrToSearch" as
"0".
1.04 - 03/07/2004
- Added new StrCase, removed StrLower and StrUpper.
- Organized by name commands inside header and readme files.
1.03 - 02/12/2004
- Added commands support for uninstall sections and functions.
- Fixed variables switch in "StrLoc" and "StrTok" after using these.
1.02 - 02/07/2004
- Fixed StrLoc.
- Fixed Documentation about StrLoc. "Direction" is really "OffsetDirection".
- Added my new AdvStrSort, and removed the old one.
1.01 - 02/05/2004
- Fixed Documentation about StrSort and StrTok.
- Fixed StrTok default value for the string part. Now it's "L".
- Fixed StrStrAdv fixed wrong search when had a combination of same
substrings one after another in a string.
- Fixed StrLoc: when a string isn't found, don't return any value at all.
1.00 - 02/01/2004
- Added documentation.
- Renamed header file to "StrFunc.nsh".
- Added 1 function, StrLoc.
- Modified StrStrAdv, removed some lines.
- Fixed StrTok, 2 simple numbers made it loop everytime.
- Fixed some small issues on the header file.
0.02 - 01/24/2004
- Completed StrFunc.nsh file. Need some tests and the readme.
0.01 - 01/22/2004
- First version to test ideas...
Credits
-------
Made by Diego Pedroso (aka deguix).
Functions Credits
-----------------
- All functions are made by Diego Pedroso on LogicLib format. They
are based on functions by Amir Szekely, Dave Laundon, Hendri
Adriaens, Nik Medved, Joost Verburg, Stuart Welch, Ximon Eighteen,
"bigmac666" and "bluenet". "bluenet"'s version of StrIOToNSIS and
StrNSISToIO on LogicLib format were included.
License
-------
This header file is provided 'as-is', without any express or implied
warranty. In no event will the author be held liable for any damages
arising from the use of this header file.
Permission is granted to anyone to use this header file for any purpose,
including commercial applications, and to alter it and redistribute
it freely, subject to the following restrictions:
1. The origin of this header file must not be misrepresented;
you must not claim that you wrote the original header file.
If you use this header file in a product, an acknowledgment in the
product documentation would be appreciated but is not required.
2. Altered versions must be plainly marked as such,
and must not be misrepresented as being the original header file.
3. This notice may not be removed or altered from any distribution.

View File

@ -0,0 +1,880 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>NSIS System Plug-in</title>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
</head>
<body>
<h1>NSIS System Plug-in</h1>
<p>
<i>Copyright &copy; 2002 brainsucker (Nik Medved)</i><br><i>Copyright &copy; 2002-2018 NSIS Contributors</i>
</p>
<h2>Table of Contents</h2>
<ul>
<li><a href="#intro">Introduction</a></li>
<li>
<a href="#funcs">Available Functions</a>
<ul>
<li><a href="#memfuncs">Memory Related Functions</a></li>
<li><a href="#callfuncs">Calling Functions</a></li>
<li><a href="#64bitfuncs">64-bit Functions</a></li>
</ul>
</li>
<li><a href="#faq">FAQ</a></li>
</ul>
<h2><a name="intro"></a>Introduction</h2>
<p>The System plug-in gives developers the ability to call any exported function from any DLL. For example, you can use it to call <a href="https://msdn.microsoft.com/en-us/library/aa364975">GetLogicalDriveStrings</a> to get a list of available drives on the user's computer.</p>
<p>The System plug-in also allows the developer to allocate, free and copy memory; interact with COM objects and perform mathematical operations on 64-bit integers.</p>
<p>Programming knowledge is highly recommended for good understanding of the System plug-in.</p>
<h4>Usage Examples From The Wiki</h4>
<ul>
<li><a href="http://nsis.sourceforge.net/wiki/Get_Local_Time">Get local time</a></li>
<li><a href="http://nsis.sourceforge.net/wiki/Registering_a_Palm_Com_Conduit">Register conduits with Palm HotSync</a></li>
<li><a href="http://nsis.sourceforge.net/wiki/Determining_free_memory_using_the_System_plugin">Get free memory</a></li>
<li><a href="http://nsis.sourceforge.net/wiki/REG_MULTI_SZ_Reader">Read REG_MULTI_SZ</a></li>
<li><a href="http://nsis.sourceforge.net/wiki/Get_Disk_Volume_Serial_Number">Get disk serial number</a></li>
<li><i><a href="http://nsis.sourceforge.net/Special:Search?search=System%3A%3ACall">Search all...</a></i></li>
</ul>
<h2><a name="funcs"></a>Available Functions</h2>
<h3><a name="memfuncs"></a>Memory Related Functions</h3>
<div>
<ul>
<li>
<b>Alloc</b> <i>SIZE</i>
<blockquote>
<p>Allocates <i>SIZE</i> bytes and returns a memory address on the stack.</p>
<h4>Usage Example</h4>
<blockquote><pre>
System::<b>Alloc</b> 64
Pop $0
DetailPrint "64 bytes allocated at $0"
System::Free $0
</pre></blockquote>
</blockquote>
</li>
<li>
<b>StrAlloc</b> <i>SIZE</i>
<blockquote>
<p>Allocates a string buffer for <i>SIZE</i> <b>TCHARs</b> and returns a memory address on the stack. This is extremely useful if you want to write an NSI script that will work for both ANSI and Unicode NSIS.</p>
<h4>Usage Example</h4>
<blockquote><pre>
System::<b>StrAlloc</b> 64 ; String buffer for 63 characters and \0 termination.
Pop $0
DetailPrint "A string buffer for 64 characters allocated at $0"
System::Free $0
</pre></blockquote>
</blockquote>
</li>
<li>
<b>Copy</b> [/<i>SIZE</i>] <i>DESTINATION</i> <i>SOURCE</i>
<blockquote>
<p>Copies <i>SIZE</i> bytes from <i>SOURCE</i> to <i>DESTINATION</i>. If <i>SIZE</i> is not specified, <i>SOURCE</i>'s size will queried using GlobalSize. This means that if you don't allocate <i>SOURCE</i> using System::Alloc, System::Call or GlobalAlloc, you must specify <i>SIZE</i>. If <i>DESTINATION</i> is zero it will be allocated and its address will be pushed on the stack.</p>
<h4>Usage example</h4>
<blockquote><pre>
# allocate a buffer and put 'test string' and an int in it
System::Call "*(&amp;t1024 'test string', i 5) p .s"
Pop $0
# copy to an automatically created buffer
System::<b>Copy</b> 0 $0
Pop $1
# get string and int in $1 buffer
System::Call "*$1(&amp;t1024 .r2, i .r3)"
# free buffer
System::Free $1
# print result
DetailPrint $2
DetailPrint $3
# copy to our own buffer
System::Alloc 1028
Pop $1
System::<b>Copy</b> $1 $0
# get string and int in $1 buffer
System::Call "*$1(&amp;t1024 .r2, i .r3)"
# free
System::Free $0
System::Free $1
# print result
DetailPrint $2
DetailPrint $3
</pre></blockquote>
</blockquote>
</li>
<li>
<b>Free</b> <i>ADDRESS</i>
<blockquote>
<p>Frees <i>ADDRESS</i>.</p>
<h4>Usage Example</h4>
<blockquote><pre>
System::Alloc 64
Pop $0
DetailPrint "64 bytes allocated at $0"
System::<b>Free</b> $0
</pre></blockquote>
</blockquote>
</li>
<li>
<b>Store</b> "<i>OPERATION</i> [<i>OPERATION</i> [<i>OPERATION</i> ...]]"
<blockquote>
<p>Performs stack operations. An operation can be pushing or popping a single register from the NSIS stack or pushing or popping all of the registers ($0-$9 and $R0-$R9) from System's private stack. Operations can be separated by any character.</p>
<h4>Available Operations</h4>
<ul>
<li>To push $<i>#</i>, use p<i>#</i>, where <i>#</i> is a digit from 0 to 9.</li>
<li>To pop $<i>#</i>, use r<i>#</i>, where <i>#</i> is a digit from 0 to 9.</li>
<li>To push $R<i>#</i>, use P<i>#</i>, where <i>#</i> is a digit from 0 to 9.</li>
<li>To pop $R<i>#</i>, use R<i>#</i>, where <i>#</i> is a digit from 0 to 9.</li>
<li>To push $0-$9 and $R0-$R9 to System's private stack, use s or S.</li>
<li>To pop $0-$9 and $R0-$R9 from System's private stack, use l or L.</li>
</ul>
<h4>Usage Examples</h4>
<blockquote><pre>
StrCpy $0 "test"
System::<b>Store</b> "p0"
Pop $1
DetailPrint "$0 = $1"
</pre></blockquote>
<blockquote><pre>
StrCpy $2 "test"
System::<b>Store</b> "p2 R2"
DetailPrint "$2 = $R2"
</pre></blockquote>
<blockquote><pre>
StrCpy $3 "test"
System::<b>Store</b> "s"
StrCpy $3 "another test"
System::<b>Store</b> "l"
DetailPrint $3
</pre></blockquote>
<blockquote><pre>
System::<b>Store</b> "r4" "test"
DetailPrint $4
</pre></blockquote>
</blockquote>
</li>
</ul>
</div>
<h3><a name="callfuncs"></a>Calling Functions</h3>
<div>
<ul>
<li><b>Call</b> <i>PROC</i> [( <i>PARAMS</i> ) [<i>RETURN</i> [? <i>OPTIONS</i>]]]</li>
<li><b>Get</b> <i>PROC</i> [( <i>PARAMS</i> ) [<i>RETURN</i> [? <i>OPTIONS</i>]]]
<blockquote>
<p>Call and get both share a common syntax. As the names suggest, Call calls and Get gets. What does it call or get? It depends on <i>PROC</i>'s value.</p>
<p><i>PARAMS</i> is a list of parameters and what do to with them. You can pass data in the parameters and you can also get data from them. The parameters list is separated by commas. Each parameter is combined of three values: <i>type</i>, <i>source</i> and <i>destination</i>. <i>Type</i> can be an integer, a string, etc. <i>Source</i>, which is the source of the parameter value, can be a NSIS register ($0, $1, $INSTDIR), the NSIS stack, a concrete value (5, "test", etc.) or nothing (null). <i>Destination</i>, which is the destination of the parameter value after the call returns, can be a NSIS register, the NSIS stack or nothing which means no output is required. Either one of <i>source</i> or <i>destination</i> can also be a dot (`.') if it is not needed.</p>
<p><i>RETURN</i> is like a single parameter definition, but <i>source</i> is only used when creating callback functions. Normally <i>source</i> is a dot.</p>
<p><i>OPTIONS</i> is a list of options which control the way System plug-in behaves. Each option can be turned off by prefixing with an exclamation mark. For example: <b>?!e</b>.</p>
<p><i>PARAMS</i>, <i>RETURN</i> and <i>OPTIONS</i> can be repeated many times in one Get/Call line. When repeating, a lot can be omitted, and only what you wish to change can be used. <i>Type</i>, <i>source</i> and/or <i>destination</i> can be omitted for each parameter, even the return value. Options can be added or removed. This allows you to define function prototypes and save on some typing. The <a href="#repeat">last two examples</a> show this.</p>
<p><i>PROC</i> can also be repeated but must be prefixed with a hash sign (`#') except if the hash sign is preceded by a double colon (<code>shell32::#18</code>).</p>
<h4>Possible <i>PROC</i> Values and Meanings</h4>
<blockquote>
<table>
<tr>
<th>Value</th>
<th>Meaning</th>
<th>Example</th>
</tr>
<tr>
<th><i>DLL</i>::<i>FUNC</i></th>
<td><i>FUNC</i> exported from <i>DLL</i></td>
<td><a href="#func">user32::MessageBox</a></td>
</tr>
<tr>
<th>::<i>ADDR</i></th>
<td>Function located at <i>ADDR</i></td>
<td><a href="#funcaddr">see below</a></td>
</tr>
<tr>
<th>*<i>ADDR</i></th>
<td>Structure located at <i>ADDR</i></td>
<td><a href="#structaddr">see below</a></td>
</tr>
<tr>
<th>*</th>
<td>New structure</td>
<td><a href="#newstruct">see below</a></td>
</tr>
<tr>
<th><i>IPTR</i>-><i>IDX</i></th>
<td>Member indexed <i>IDX</i> from<br/>interface pointed by <i>IPTR</i></td>
<td><a href="#com">see below</a></td>
</tr>
<tr>
<th>&lt;nothing&gt;</th>
<td>New callback function</td>
<td><a href="#callback">see below</a></td>
</tr>
<tr>
<th><i>PROC</i></th>
<td><i>PROC</i> returned by Get</td>
<td><a href="#get">see below</a></td>
</tr>
</table>
</blockquote>
<h4>Available Parameter Types</h4>
<blockquote>
<table>
<tr>
<th>Type</th>
<th>Meaning</th>
</tr>
<tr>
<th>v</th>
<td>void (generally for return)</td>
<td></td>
</tr>
<tr>
<th>p</th>
<td>pointer (and other pointer sized types like handles and HWNDs)</td>
</tr>
<tr>
<th>b</th>
<td>int8, byte</td>
</tr>
<tr>
<th>h</th>
<td>int16, short</td>
</tr>
<tr>
<th>i</th>
<td>int32 (includes char, byte, short and so on when used as a pointer)</td>
</tr>
<tr>
<th>l</th>
<td>int64, large integer</td>
</tr>
<tr>
<th>m</th>
<td>ANSI text, string. (FYI: 'm' for multibyte string or 'w' flipped over.)</td>
</tr>
<tr>
<th>t</th>
<td>text, string (pointer to first character). <i>Like TCHAR*, it is a Unicode string in Unicode NSIS.</i></td>
</tr>
<tr>
<th>w</th>
<td>WCHAR text, Unicode string</td>
</tr>
<tr>
<th>g</th>
<td>GUID</td>
</tr>
<tr>
<th>k</th>
<td>callback</td>
</tr>
<th>@</th>
<td>Direct register memory access (Buffer is limited to <code>(NSIS_MAX_STRLEN - 24) * NSIS_CHAR_SIZE</code> bytes)</td>
</tr>
<tr>
<tr>
<th>&amp;v<i>N</i></th>
<td><i>N</i> bytes padding (structures only)</td>
</tr>
<tr>
<th>&amp;i<i>N</i></th>
<td>integer of <i>N</i> bytes (structures only)</td>
</tr>
<tr>
<th>&amp;l</th>
<td>structure size (structures only)</td>
</tr>
<tr>
<th>&amp;t<i>N</i></th>
<td>array of <i>N</i> TCHAR text characters (structures only)</td>
</tr>
<tr>
<th>&amp;m<i>N</i></th>
<td>array of <i>N</i> CHAR ANSI characters (structures only)</td>
</tr>
<tr>
<th>&amp;w<i>N</i></th>
<td>array of <i>N</i> WCHAR Unicode characters (structures only)</td>
</tr>
<tr>
<th>&amp;g<i>16</i></th>
<td><i>16</i> bytes of GUID (structures only)</td>
</tr>
</table>
<p>Additionally, each type (except <i>b</i>, <i>h</i>, <i>k</i> and <i>@</i>) can be prefixed with an asterisk to denote a pointer. When using an asterisk, the System plug-in still expects the value of the parameter, rather than the pointer's address. To pass a direct address, use `p' with no asterisk. A <a href="#pointer">usage example</a> is available. <a href="#memfuncs">Alloc</a> returns addresses and its return value should therefore be used with `p', without an asterisk.</p>
</blockquote>
<h4>Available Sources and Destinations</h4>
<blockquote>
<table>
<tr>
<th>Type</th>
<th>Meaning</th>
</tr>
<tr>
<th>.</th>
<td>ignored</td>
<td></td>
</tr>
<tr>
<th><i>number</i></th>
<td>concrete hex, decimal or octal integer value. several integers can be or'ed using the pipe symbol (`|')</td>
</tr>
<tr>
<th>'<i>string</i>'<br/>"<i>string</i>"<br/>`<i>string</i>`</th>
<td>concrete string value</td>
</tr>
<tr>
<th><i>r0</i> through <i>r9</i></th>
<td>$0 through $9 respectively</td>
</tr>
<tr>
<th><i>r10</i> through <i>r19</i><br/><i>R0</i> through <i>R9</i></th>
<td>$R0 through $R9 respectively</td>
</tr>
<tr>
<th>c</th>
<td>$CMDLINE</td>
</tr>
<tr>
<th>d</th>
<td>$INSTDIR</td>
</tr>
<tr>
<th>o</th>
<td>$OUTDIR</td>
</tr>
<tr>
<th>e</th>
<td>$EXEDIR</td>
</tr>
<tr>
<th>a</th>
<td>$LANGUAGE</td>
</tr>
<tr>
<th>s</th>
<td>NSIS stack</td>
</tr>
<tr>
<th>n</th>
<td>null for source, no output required for destination</td>
</tr>
</table>
<p>Source is required when using the @ type and must be a register. When the call returns the source register already contains the memory address in string form so using destination is usually <a href="#directvarmemparam">not necessary</a>.
</blockquote>
<h4>Callbacks</h4>
<blockquote>
<p>Callback functions are simply functions which are passed to a function and called back by it. They are frequently used to pass a possibly large set of data item by item. For example, <a href="https://msdn.microsoft.com/en-us/library/ms633494">EnumChildWindows</a> uses a <a href="https://msdn.microsoft.com/en-us/library/ms633493">callback function</a>. As NSIS functions are not quite regular functions, the System plug-in provides its own mechanism to support callback functions. It allows you to create callback functions and notifies you each time a callback function was called.</p>
<p>Creation of callback functions is done using <a href="#callfuncs">Get</a> and the callback creation syntax. As you will not call the callbacks yourself, the source of the parameters should be omitted using a dot. When the callback is called, the destination of the parameters will be filled with the values passed on to the callback. The value the callback will return is set by the source of the return "parameter". The destination of the return "parameter" should always be set as that's where System will notify you the callback was called.</p>
<blockquote><pre>System::Get "(i .r0, i .r1) iss"</pre></blockquote>
<p>To pass a callback to a function, use the k type.</p>
<blockquote><pre>System::Get "(i .r0, i .r1) isR0"
Pop $0
System::Call "dll::UseCallback(k r0)"</pre></blockquote>
<p>Each time the callback is called, the string callback#, where # is the number of the callback, will be placed in the destination of the return "parameter". The number of the first callback created is 1, the second's is 2, the third's is 3 and so on. As System is single threaded, a callback can only be called while calling another function. For example, EnumChildWindows's callback can only be called when EnumChildWindows is being called. You should therefore check for callback# after each function call that might call your callback.</p>
<blockquote><pre>System::Get "(i .r0, i .r1) isR0"
Pop $0
System::Call "dll::UseCallback(k r0)"
StrCmp $R0 "callback1" 0 +2
DetailPrint "UseCallback passed ($0, $1) to the callback"
</pre></blockquote>
<p>After you've processed the callback call, you should use <a href="#callfuncs">Call</a>, passing it the value returned by <a href="#callfuncs">Get</a> - the callback. This tells System to return from the callback. Destination of the return "parameter" must be cleared prior to calling a function, to avoid false detection of a callback call. If you've specified a source for the return "parameter" when the callback was created, you should fill that source with the appropriate return value. Callbacks are not automatically freed, don't forget to free it after you've finished using it.</p>
<blockquote><pre>System::Get "(i .r0, i .r1) isR0"
Pop $0
System::Call "dll::UseCallback(k r0)"
loop:
StrCmp $R0 "callback1" 0 done
DetailPrint "UseCallback passed ($0, $1) to the callback"
Push 1 # return value of the callback
StrCpy $R0 "" # clear $R0 in case there are no more callback calls
System::Call $0 # tell system to return from the callback
Goto loop
done:
System::Free $0
</pre></blockquote>
<p>A complete working <a href="#callback">example</a> is available in the usage examples section.</p>
</blockquote>
<h4>Notes</h4>
<blockquote>
<ul>
<li>To find out the index of a member in a COM interface, you need to search for the definition of this COM interface in the header files that come with Visual C/C++ or the Platform SDK. Remember the index is zero based.</li>
<li>If a function can't be found or the <code>t</code> parameter type was used, an `A' or `W' will be appended to its name and it will be looked up again. This is done because a lot of Windows API functions have two versions, one for ANSI strings and one for Unicode strings. The ANSI version of the function is marked with `A' and the Unicode version is marked with `W'. For example: lstrcpyA and lstrcpyW.</li>
</ul>
</blockquote>
<h4>Available Options</h4>
<blockquote>
<table>
<tr>
<th>Option</th>
<th>Meaning</th>
</tr>
<tr>
<th>c</th>
<td>cdecl calling convention (the stack restored by caller). By default stdcall calling convention is used on x86 (the stack restored by callee).</td>
<td></td>
</tr>
<tr>
<th>r</th>
<td>Always return (for GET means you should pop result and proc, for CALL means you should pop result (at least)). By default result is returned for errors only (for GET you will pop either error result or right proc, and for CALL you will get either your return or result at defined return place).</td>
</tr>
<tr>
<th>n</th>
<td>No redefine. Whenever this proc will be used it will never be redefined either by GET or CALL. This options is never inherited to children.</td>
</tr>
<tr>
<th>s</th>
<td>Use general Stack. Whenever the first callback defined the system starts using the temporary stacks for function calls.</td>
</tr>
<tr>
<th>e</th>
<td>Call GetLastError() after procedure end and push result on stack.</td>
</tr>
<tr>
<th>u</th>
<td>Unload DLL after call (using FreeLibrary, so you'll be able to delete it for example).</td>
</tr>
<tr>
<th>2</th>
<td>Experimental v2 syntax</td>
</tr>
</table>
</blockquote>
<h4>Experimental v2 syntax</h4>
<ul>
<li>Struct types in <a href="#v2typealign">uppercase are aligned</a> to their natural alignment. Lowercased types are packed without alignment.
<li><a href="#v2callback">Callback id</a> based on the allocated callback
</ul>
<h4>Usage Examples</h4>
<blockquote><pre>
<a name="func"></a>System::<b>Call</b> "user32::MessageBox(p $HWNDPARENT, t 'NSIS System Plug-in', t 'Test', i 0)"
</pre></blockquote>
<blockquote><pre>
<a name="funcaddr"></a>System::<b>Call</b> "kernel32::GetModuleHandle(t 'user32.dll') p .s"
System::<b>Call</b> "kernel32::GetProcAddress(p s, m 'MessageBoxA') p .r0"
System::<b>Call</b> "::$0(p $HWNDPARENT, t 'GetProcAddress test', t 'NSIS System Plug-in', i 0)"
</pre></blockquote>
<blockquote><pre>
<a name="get"></a>System::<b>Get</b> "user32::MessageBox(p $HWNDPARENT, t 'This is a default text', t 'Default', i 0)"
Pop $0
System::<b>Call</b> "$0"
</pre></blockquote>
<blockquote><pre>
System::<b>Get</b> "user32::MessageBox(p $HWNDPARENT, t 'This is a default text', \
t 'Default', i 0x1|0x10)"
Pop $0
System::<b>Call</b> "$0(, 'This is a System::Get test', 'NSIS System Plug-in',)"
</pre></blockquote>
<blockquote><pre>
<a name="pointer"></a>System::<b>Call</b> "advapi32::GetUserName(t .r0, *i ${NSIS_MAX_STRLEN} r1) i.r2"
DetailPrint "User name - $0"
DetailPrint "String length - $1"
DetailPrint "Return value - $2"
</pre></blockquote>
<blockquote><pre>
<a name="structaddr"></a>System::Alloc 4
Pop $0
System::<b>Call</b> "*$0(i 5)" ; Write
System::<b>Call</b> "*$0(i .r1)" ; Read
System::Free $0
DetailPrint $1
</pre></blockquote>
<blockquote><pre>
<a name="newstruct"></a>System::<b>Call</b> "*(i 5) p .r0"
System::<b>Call</b> "*$0(i .r1)"
System::Free $0
DetailPrint $1
</pre></blockquote>
<a name="structsize"></a><blockquote><pre>
System::Call '*0(p, <b>&amp;l.r2,</b> &amp;t2)' ; &amp;l. is not part of the struct
DetailPrint "Struct size=$2"
</pre></blockquote>
<a name="structsizemember"></a><blockquote><pre>
System::Call '*(<b>&amp;l4</b>,i,i,i,i,&amp;t128)p.r1' ; Fills dwOSVersionInfoSize with the struct size as a int32
${If} $1 Z&lt;&gt; 0
System::Call 'kernel32::GetVersionEx(pr1)i.r0'
System::Call '*$1(i,i.R1,i.R2,i.R3)'
System::Free $1
${IfThen} $0 &lt;&gt; 0 ${|} DetailPrint "v$R1.$R2.$R3" ${|}
${EndIf}
</pre></blockquote>
<blockquote><pre>
<a name="directvarmemparam"></a>System::<b>Call</b> "user32::GetClientRect(p $hwndparent, @ r0)"
System::<b>Call</b> "*$0(i,i,i.r1,i.r2)"
DetailPrint ClientRect=$1x$2
</pre></blockquote>
<blockquote><pre>
<a name="com"></a># defines
!define CLSCTX_INPROC_SERVER 1
!define CLSID_ActiveDesktop {75048700-EF1F-11D0-9888-006097DEACF9}
!define IID_IActiveDesktop {F490EB00-1240-11D1-9888-006097DEACF9}
# create IActiveDesktop interface
System::<b>Call</b> "ole32::CoCreateInstance( \
g '${CLSID_ActiveDesktop}', p 0, \
i ${CLSCTX_INPROC_SERVER}, \
g '${IID_IActiveDesktop}', *p .r0) i.r1"
StrCmp $1 0 0 end
# call IActiveDesktop->GetWallpaper
System::<b>Call</b> "$0->4(w .r2, i ${NSIS_MAX_STRLEN}, i 0)"
# call IActiveDesktop->Release
System::<b>Call</b> "$0->2()"
# print result
DetailPrint $2
end:
</pre></blockquote>
<blockquote><pre>
InitPluginsDir
File "/oname=$PLUGINSDIR\MyDLL.dll" MyDLL.dll
System::<b>Call</b> "MyDLL::MyFunc(i 5) ? u"
Delete $PLUGINSDIR\MyDLL.dll
</pre></blockquote>
<blockquote><pre>
<a name="callback"></a>System::<b>Get</b> "(p.r1, p) iss"
Pop $R0
System::<b>Call</b> "user32::EnumChildWindows(p $HWNDPARENT, k R0, p) i.s"
loop:
Pop $0
StrCmp $0 "callback1" 0 done
System::<b>Call</b> "user32::GetWindowText(pr1,t.r2,i${NSIS_MAX_STRLEN})"
System::<b>Call</b> "user32::GetClassName(pr1,t.r3,i${NSIS_MAX_STRLEN})"
IntFmt $1 "0x%X" $1
DetailPrint "$1 - [$3] $2"
Push 1 # callback's return value
System::<b>Call</b> "$R0"
Goto loop
done:
System::Free $R0
</pre></blockquote>
<a name="v2callback"></a><blockquote><pre>
System::Get '(m.r1)ir2r0 <b>?2</b>' ; v2 syntax
Pop $9
System::Call 'kernel32::EnumSystemLocalesA(k r9, i 0)'
loop:
StrCmp <b>$0 "callback$9"</b> 0 done
DetailPrint "Locale: $1"
StrCpy $2 1 ; EnumLocalesProc return value
System::Call $9 ; return from EnumLocalesProc
Goto loop
done:
System::Free $9
</pre></blockquote>
<a name="v2typealign"></a><blockquote><pre>
System::Call '*(&amp;t50 "!")p.r2' ; DecimalSep
System::Call '*(&amp;t50 "`")p.r3' ; ThousandSep
System::Call '*(i 2, i 0, i 3, <b>P r2, P r3</b>, i 1)p.r1 <b>?2</b>'
System::Call 'kernel32::GetNumberFormat(i 0, i 0, t "1337.666" r4, p r1, t.r5, i ${NSIS_MAX_STRLEN})'
DetailPrint "Custom formated $4: $5"
System::Free $3
System::Free $2
System::Free $1
</pre></blockquote>
<blockquote><pre>
<a name="repeat"></a>!define MB "user32::MessageBox(p$HWNDPARENT,t,t'NSIS System Plug-in',i0)"
System::<b>Call</b> "${MB}(,'my message',,)"
System::<b>Call</b> "${MB}(,'another message',,) i.r0"
MessageBox MB_OK "last call returned $0"
</pre></blockquote>
<blockquote><pre>
System::<b>Call</b> "user32::SendMessage(p $HWNDPARENT, t 'test', t 'test', p 0) p.s ? \
e (,t'test replacement',,) i.r0 ? !e #user32::MessageBox"
DetailPrint $0
ClearErrors
Pop $0
IfErrors good
MessageBox MB_OK "this message box will never be reached"
good:
</pre></blockquote>
</blockquote>
</li>
</ul>
</div>
<h3><a name="64bitfuncs"></a>64-bit Functions</h3>
<div>
<ul>
<li>
<b id="Int64Op">Int64Op</b> <i>ARG1</i> <i>OP</i> [<i>ARG2</i>]
<blockquote>
<p>Performs <i>OP</i> on <i>ARG1</i> and optionally <i>ARG2</i> and returns the result on the stack. Both <i>ARG1</i> and <i>ARG2</i> are 64-bit integers. This means they can range between -2^63 and 2^63 - 1.</p>
<h4>Available Operations</h4>
<ul>
<li>Addition -- <b>+</b></li>
<li>Subtraction -- <b>-</b></li>
<li>Multiplication -- <b>*</b></li>
<li>Division -- <b>/</b></li>
<li>Modulo -- <b>%</b></li>
<li>Shift left -- <b>&lt;&lt;</b></li>
<li>Arithmetic shift right -- <b>&gt;&gt;</b></li>
<li>Logical shift right -- <b>&gt;&gt;&gt;</b></li>
<li>Bitwise or -- <b>|</b></li>
<li>Bitwise and -- <b>&amp;</b></li>
<li>Bitwise xor -- <b>^</b></li>
<li>Bitwise not (one argument) -- <b>~</b></li>
<li>Logical not (one argument) -- <b>!</b></li>
<li>Logical or -- <b>||</b></li>
<li>Logical and -- <b>&amp;&amp;</b></li>
<li>Less than -- <b>&lt;</b></li>
<li>Equals -- <b>=</b></li>
<li>Greater than -- <b>&gt;</b></li>
</ul>
<h4>Usage Examples</h4>
<blockquote><pre>
System::<b>Int64Op</b> 5 + 5
Pop $0
DetailPrint "5 + 5 = $0" # 10
</pre></blockquote>
<blockquote><pre>
System::<b>Int64Op</b> 64 - 25
Pop $0
DetailPrint "64 - 25 = $0" # 39
</pre></blockquote>
<blockquote><pre>
System::<b>Int64Op</b> 526355 * 1565487
Pop $0
DetailPrint "526355 * 1565487 = $0" # 824001909885
</pre></blockquote>
<blockquote><pre>
System::<b>Int64Op</b> 5498449498849818 / 3
Pop $0
DetailPrint "5498449498849818 / 3 = $0" # 1832816499616606
</pre></blockquote>
<blockquote><pre>
System::<b>Int64Op</b> 0x89498A198E4566C % 157
Pop $0
DetailPrint "0x89498A198E4566C % 157 = $0" # 118
</pre></blockquote>
<blockquote><pre>
System::<b>Int64Op</b> 1 &lt;&lt; 62
Pop $0
DetailPrint "1 &lt;&lt; 62 = $0" # 4611686018427387904
</pre></blockquote>
<blockquote><pre>
System::<b>Int64Op</b> 0x4000000000000000 &gt;&gt; 62
Pop $0
DetailPrint "0x4000000000000000 &gt;&gt; 62 = $0" # 1
System::<b>Int64Op</b> 0x8000000000000000 &gt;&gt; 1
Pop $0
DetailPrint "0x8000000000000000 &gt;&gt; 1 = $0" # -4611686018427387904 (0xC000000000000000)
System::<b>Int64Op</b> 0x8000000000000000 &gt;&gt;&gt; 1
Pop $0
DetailPrint "0x8000000000000000 &gt;&gt;&gt; 1 = $0" # 4611686018427387904 (0x4000000000000000)
</pre></blockquote>
<blockquote><pre>
System::<b>Int64Op</b> 0xF0F0F0F | 0xF0F0FFF
Pop $0
# IntFmt is 32-bit, this is just for the example
IntFmt $0 "0x%X" $0
DetailPrint "0xF0F0F0F | 0xF0F0FFF = $0" # 0xF0F0FFF
</pre></blockquote>
<blockquote><pre>
System::<b>Int64Op</b> 0x12345678 &amp; 0xF0F0F0F0
Pop $0
# IntFmt is 32-bit, this is just for the example
IntFmt $0 "0x%X" $0
DetailPrint "0x12345678 &amp; 0xF0F0F0F0 = $0" # 0x10305070
</pre></blockquote>
<blockquote><pre>
System::<b>Int64Op</b> 1 ^ 0
Pop $0
DetailPrint "1 ^ 0 = $0" # 1
</pre></blockquote>
<blockquote><pre>
System::<b>Int64Op</b> 1 || 0
Pop $0
DetailPrint "1 || 0 = $0" # 1
</pre></blockquote>
<blockquote><pre>
System::<b>Int64Op</b> 1 &amp;&amp; 0
Pop $0
DetailPrint "1 &amp;&amp; 0 = $0" # 0
</pre></blockquote>
<blockquote><pre>
System::<b>Int64Op</b> 9302157012375 &lt; 570197509190760
Pop $0
DetailPrint "9302157012375 &lt; 570197509190760 = $0" # 1
</pre></blockquote>
<blockquote><pre>
System::<b>Int64Op</b> 5168 &gt; 89873
Pop $0
DetailPrint "5168 &gt; 89873 = $0" # 0
</pre></blockquote>
<blockquote><pre>
System::<b>Int64Op</b> 189189 = 189189
Pop $0
DetailPrint "189189 = 189189 = $0" # 1
</pre></blockquote>
<blockquote><pre>
System::<b>Int64Op</b> 156545668489 ~
Pop $0
DetailPrint "156545668489 ~ = $0" # -156545668490
</pre></blockquote>
<blockquote><pre>
System::<b>Int64Op</b> 1 !
Pop $0
DetailPrint "1 ! = $0" # 0
</pre></blockquote>
</blockquote>
</li>
</ul>
</div>
<h2><a name="faq"></a>FAQ</h2>
<div>
<ul>
<li>
<b>Q:</b> How can I pass structs to functions?
<blockquote>
<p><b>A:</b> First of all, you must allocate the struct. This can be done in two ways. You can either use <a href="#memfuncs">Alloc</a> or <a href="#callfuncs">Call</a> with the special struct allocation syntax. Next, if you need to pass data in the struct, you must fill it with data. Then you call the function with a pointer to the struct. Finally, if you want to read data from the struct which might have been written by the called function, you must use <a href="#callfuncs">Call</a> with the struct handling syntax. After all is done, it's important to remember to free the struct.</p>
<h4>Allocation</h4>
<blockquote><p>To allocate the struct using <a href="#memfuncs">Alloc</a>, you must know the size of the struct in bytes. Therefore, it would normally be easier to use <a href="#callfuncs">Call</a>. In this case it's easy to see the required size is 16 bytes, but other cases might not be that trivial. In both cases, the struct address will be located on the top of the stack and should be retrieved using Pop.</p>
<blockquote><pre>
System::Alloc 16
</pre></blockquote>
<blockquote><pre>
System::Call "*(i, i, i, t)p.s"
</pre></blockquote>
</blockquote>
<h4>Setting Data</h4>
<blockquote><p>Setting data can be done using <a href="#callfuncs">Call</a>. It can be done in the allocation stage, or in another stage using the struct handling syntax.</p>
<blockquote><pre>
System::Call "*(i 5, i 2, i 513, t 'test')p.s"
</pre></blockquote>
<blockquote><pre>
# assuming the struct's memory address is kept in $0
System::Call "*$0(i 5, i 2, i 513, t 'test')"
</pre></blockquote>
</blockquote>
<h4>Passing to the Function</h4>
<blockquote><p>As all allocation methods return an address, the type of the passed data should be an integer, an address in memory.</p>
<blockquote><pre>
# assuming the struct's memory address is kept in $0
System::Call "dll::func(p r0)"
</pre></blockquote>
</blockquote>
<h4>Reading Data</h4>
<blockquote><p>Reading data from the struct can be done using the same syntax as setting it. The only difference is that the destination part of the parameter will be set and the source part will be omitted using a dot.</p>
<blockquote><pre>
# assuming the struct's memory address is kept in $0
System::Call "*$0(i .r0, i .r1, i .r2, t .r3)"
DetailPrint "first int = $0"
DetailPrint "second int = $1"
DetailPrint "third int = $2"
DetailPrint "string = $3"
</pre></blockquote>
</blockquote>
<h4>Freeing Memory</h4>
<blockquote><p>Memory is freed using <a href="#memfuncs">Free</a>.</p>
<blockquote><pre>
# assuming the struct's memory address is kept in $0
System::Free $0
</pre></blockquote>
</blockquote>
<h4>A Complete Example</h4>
<blockquote><pre>
# allocate
System::Call "*(i,i,p,p,p,p,p,p)p.r1"
# call
System::Call "Kernel32::GlobalMemoryStatus(p r1)"
# get
System::Call "*$1(i.r2, i.r3, p.r4, p.r5, p.r6, p.r7, p.r8, p.r9)"
# free
System::Free $1
# print
DetailPrint "Structure size: $2 bytes"
DetailPrint "Memory load: $3%"
DetailPrint "Total physical memory: $4 bytes"
DetailPrint "Free physical memory: $5 bytes"
DetailPrint "Total page file: $6 bytes"
DetailPrint "Free page file: $7 bytes"
DetailPrint "Total virtual: $8 bytes"
DetailPrint "Free virtual: $9 bytes"
</pre></blockquote>
</blockquote>
</li>
</ul>
</div>
</body>
</html>

View File

@ -0,0 +1,46 @@
release 2.
1. Syntax, with inline input
2. Int64 full support (conversion/operations/comparison)
3. Structures support
4. Callbacks support, including multilevel callbacks
5. Some useful routines (Alloc, Free, Copy)
6. CDecl and StdCall calling conventions
release 3, 22 march 2003.
1. Custom Message Boxes (with icons etc) -> bug in case of GetModuleHandle and
call to FreeLibrary (sysfunc.nsh)
2. GetFileSysTime -> No SystemTimeToTzSpecificLocalTime at win9x bug,
changed to use FileTimeToLocalFileTime (sysfunc.nsh)
3. Incorrect automatic structure size (&l) bug, value actually never filled
into the structure (strange -> winxp takes no care of the structure size
members, such as cbSize, and win98 does...) (system.c)
4. Changed Secondary Stack Allocation behavior - now we just leave 65kb of the
stack NSIS give to us to the NSIS itself, and use the other part as the stack
for our calls. (system.c)
5. Secondary Stack Optimization - in case of no more pending callback procs -
"free" the secondary stack pointer. (system.c)
6. PlaySound("", 0, 0) plays the default windows sound at win9x, so changed to
PlaySound(NULL, 0, 0) for effective sound stopping after splash (sysfunc.nsh).
release 4, 3 september 2003.
1. Division by zero fatal error at Int64Op killed.
2. bool type removed (use int instead).
3. GUID (g) and LPWSTR (w) types added.
4. Memory cleanup after using t (string), g (guid) and w (unicode string) added.
5. Automatic A-letter at proc name discovery.
6. COM optimized: new proc specification "x->y", where x is interface ptr, and
y is vtable member index. For such procs Interface pointer passed as first arg
automatically.
release 5, 11 september 2003.
1. u flag - unload dll after procedure call.
2. some changes to asm to turn on Whole Program Optimization.
3. Dll shrunk by 1 kb.
bug-fix-release, 4.06.2004
1. System::Copy /SIZE fixed (Kichik).
2. System::Copy with destination auto-allocation now pushes destination
address on stack.
3. Callbacks fixed (Kichik's kick is awesome).
4. Bug with proc call parts redefinition, # for example (pointed by Kichik).
5. Bug with memory protection during callback processing (Kichik).

View File

@ -0,0 +1,334 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>VPatch 3</title>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
<style type="text/css">
/*<![CDATA[*/
body
{
padding: 10px;
background-color: #F0F0F0;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 13px;
font-weight: normal;
text-align: left;
}
p, li
{
font-size: 13px;
}
.center
{
text-align: center;
}
table
{
margin: auto;
font-size: 13px;
background-color: #FFFFFF;
}
.maintable
{
border: 2px solid #376EAB;
}
.parameter
{
font-weight: bold;
color: #6586AC;
}
h1
{
font-size: 30px;
color: #333333;
font-weight: normal;
text-align: center;
margin-top: 20px;
}
h2
{
font-size: 20px;
color: #7A7272;
font-weight: normal;
}
h3
{
font-size: 17px;
font-weight: bold;
color: #303030;
}
pre {
font-size: 13px;
}
div
{
margin: 20px;
}
a:link, a:visited, a:active
{
color: #294F75;
text-decoration: none;
}
a:hover
{
color: #182634;
text-decoration: underline;
}
/*]]>*/
</style>
</head>
<body>
<table width="750" class="maintable" cellspacing="0" cellpadding="0" align="center">
<tr>
<td>
<h1>VPatch 3.1</h1>
<div>
<h2>Introduction</h2>
<div>
<p>VPatch allows to create a patch file to update previous versions
of your software. The GenPat utility generates the patch file. The
plug-in can use the patch to update a file. Using a patch, you can
reduce the download size of your updates because only the differences
between the files are included in the patch file.</p>
</div>
<h2>How to use</h2>
<div>
<h3>Generate the patch file</h3>
<div>
<p>Make sure you have the source file (original version) and the target
file (version to update to). For example, DATA.DTA (currently on user
system) and DATA_20.DTA (version 2.0 of this data file). Now call
the command line tool GenPat.exe:</p>
<pre>
GENPAT oldfile.txt newfile.txt patch.pat
</pre>
<p>Now, the patch will be generated, this will take some time.</p>
<p>Using the /B=(BlockSize) parameter of the GenPat utility (put it
after the filenames), you can use a different block size. A smaller
block size may result in a smaller patch, but the generation will
take more time (the default blocksize is 64).</p>
<p>If you have trouble using this command-line utility, you can download
a GUI (graphical user interface) for VPatch from its own website:
<a href="http://www.tibed.net/vpatch">http://www.tibed.net/vpatch</a>.</p>
</div>
<h3>Update the file during installation</h3>
<div>
<p>Use the VPatch plug-in to update a file using a patch file:</p>
<pre>
vpatch::vpatchfile "patch.pat" "oldfile.txt" "temporary_newfile.txt"
</pre>
<p>The result of the patch operating will be added to the stack and
can be one of the following texts:</p>
<ul>
<li>OK</li>
<li>OK, new version already installed</li>
<li>An error occurred while patching</li>
<li>Patch data is invalid or corrupt</li>
<li>No suitable patches were found</li>
</ul>
<p>Check <a href="../../Examples/VPatch/example.nsi">example.nsi</a> for an example. You
should check whether the stack string starts with &quot;OK&quot;
because then the patch has succeeded and you can rename &quot;temporary_newfile.txt&quot;
to &quot;oldfile.txt&quot; to replace the original, if you want.</p>
</div>
<h3>Multiple patches in one file</h3>
<div>
<p>GenPat appends a patch to the file you specified. If there is already
a patch for the same original file, with the same CRC/MD5, in the patch file,
the patch will be replaced. For example, if you want to be able to upgrade
version 1 and 2 to version 3, you can put a 1 &gt; 3 and 2 &gt; 3 patch in
one file.</p>
<p>You can also put patches for different files in one patch file, for
example, a patch from file A version 1 to file A version 2 and a patch
from file B version 1 to file B version 2. Just call the plug-in multiple
times with the same patch file. It will automatically select the right
patch (based on the file CRC).</p>
</div>
<h3>Patch generator (GenPat) exit codes</h3>
<div>
<p>In version 3 the following exit codes (known as error levels in
the DOS period) can be returned by GenPat. GenPat will return an
exit code based on success of the patch generation. Here is a list
of the possible exit codes:</p>
<table width="547" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>Exit code</b></td>
<td><b>Description</b></td>
</tr>
<tr>
<td>0</td>
<td>Success</td>
</tr>
<tr>
<td>1</td>
<td>Arguments missing</td>
</tr>
<tr>
<td>2</td>
<td>Other error</td>
</tr>
<tr>
<td>3</td>
<td>Source file already has a patch in specified patch file (ERROR),
use /R switch to override</td>
</tr>
</table>
<p>These exit codes can be useful when you generate patch files through
a NSIS script.</p>
</div>
</div>
</div>
<div>
<h2>Source code</h2>
<div>
<p>Source code is available in the original package and in the SVN repository of NSIS.</p>
<h3>NSIS plug-in (C++)</h3>
<div>
<p>The source of the NSIS plug-in that applies patches can be found
in the Source\Plugin folder.</p>
</div>
<h3>Patch Generator (C++)</h3>
<div>
<p>The most interesting part of VPatch, the actual patch generation
algorithm, can be found in Source\GenPat\PatchGenerator.cpp. The
header of that file contains a brief explanation of the algorithm
as well.</p>
</div>
<h3>User interface (Delphi)</h3>
<div>
<p>A user interface is included as well, which you will have to build
yourself because the GUI executable was too large to include. Besides
Borland Delphi 6 or higher (you can use the freely available Personal
edition), you will also need to install the <a href=
"http://www.delphi-gems.com">VirtualTreeView</a> component by Mike Lischke.</p>
</div>
</div>
<h2>Version history</h2>
<div>
<ul>
<li>3.1
<ul>
<li>GenPat now compiles on POSIX platforms (MinGW/GCC), Visual
C++ 6 and Borland C++.</li>
<li>More test cases to verify functionality of GenPat.</li>
</ul>
</li>
<li>3.0
<ul>
<li><b>Final</b>: Updates to the GUI, installer</li>
<li><b>RC8</b>: GenPat will now flag replacement of a patch (e.g.
the source file has the same contents as a previous patch inside
a patch file) as an error. You can specifically allow it using
the /R switch. Added license to source files.</li>
<li><b>RC7</b>: Fixed critical bug in GenPat with multiple patches
in a single file. Fixed serious bug in stand-alone EXE runtime:
process kept on running forever. Included case testing through
a Python script to test common usage (and prevent bugs like
the one in GenPat in the future).</li>
<li><b>RC6</b>: Upgraded to non-beta compiler. Added /A switch
to change block match limit and /O to deactivate the limit.
Updated GUI to support the /O switch.</li>
<li><b>RC4a to RC5a</b>: input block size is now checked for power
of 2 and fixed if incorrect. When patch file does not yet exist,
no longer forgets to create the header. No longer tries to allocate
memory when there are no chunks. Fixed memory leaks.</li>
<li>Target file date is now preserved inside a patch and restored
on the user system.</li>
<li>MD5 checksums are now used instead of CRC32 checksums, unless
existing patches in a file already are in CRC32 mode.</li>
<li>The patch generator, GenPat, has been completely rewritten
in C++. It no longer needs to keep the entire files in memory,
instead memory usage is a certain percentage of the source file
size. The percentage is based on the block size, larger block
sizes will reduce memory usage.</li>
<li>All runtimes now share a common codebase, perform proper error
checking and don't leave behind files if the input file was
already up to date.</li>
<li>Bug Fix: The patch generator algorithm no longer reduces to
a quadratic runtime if there are many blocks with the same content
in the files to patch.</li>
<li>Bug Fix: The documentation of the command-line utilities was
incorrect and no warnings would be given by the runtimes, causing
the patch not to work (this does not apply to NSIS patches).</li>
</ul>
</li>
<li>2.1
<ul>
<li>Added argument checking and error handling to GenPat. Now
returns exit codes as well to indicate success/failure (and
the reason for failure). Only GenPat has changed in this version
compared to 2.0 final.</li>
<li>Bug Fix: GenPat no longer gives an Access Violation when attempting
to patch a file smaller than 64 bytes into a file larger than
64 bytes.</li>
</ul>
</li>
<li>2.0 final
<ul>
<li>Cleaned up source code for the patch generator, which is now
included (this code is written in Borland Delphi 6 and compiles
with the freely available Personal edition).</li>
</ul>
</li>
<li>2.0 beta 2
<ul>
<li>All new algorithm used in the patch generator: much faster
(up to 90%) while using smaller block sizes (higher compression)</li>
<li>Created a NSIS 2 plugin</li>
<li>Works with small files</li>
<li>Replaces existing patch in file if original file CRC is identical</li>
</ul>
</li>
</ul>
</div>
<h2>Credits</h2>
<div>
<p>Written by Koen van de Sande<br />
C plug-in initially by Edgewize, updated by Koen van de Sande<br />
New documentation and example by Joost Verburg and Koen van de Sande</p>
</div>
<h2>License</h2>
<div>
<pre>
Copyright (C) 2001-2005 Koen van de Sande / Van de Sande Productions
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute
it freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented;
you must not claim that you wrote the original software.
If you use this software in a product, an acknowledgment in the
product documentation would be appreciated but is not required.
2. Altered versions must be plainly marked as such,
and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any distribution.
</pre>
</div>
</div>
</td>
</tr>
</table>
</body>
</html>

View File

@ -0,0 +1,17 @@
Copyright (c) 2002 Robert Rainwater <rrainwater@yahoo.com>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.

View File

@ -0,0 +1,228 @@
----------------------------------------------------
MakeNSISW - MakeNSIS Windows Wrapper
----------------------------------------------------
About MakeNSISW
---------------
MakeNSISW is a wrapper for the MakeNSIS that is distributed with
NSIS (http://www.nullsoft.com/free/nsis/). MakeNSISW allows you
to compile NSIS scripts using a Windows GUI interface. To install
MakeNSISW, compile the source using Visual C++ or Mingw.
Requirements
------------
MakeNSISW requires NSIS be installed on your system. The default
directory for this installation is $PROGRAMFILES\NSIS\Contrib\MakeNSISW.
Usage:
------
If you installed the Shell Extensions option during the installation, then
all that is required is that you choose 'Compile NSI' from the right-
click menu on a NSIS script. This will invoke MakeNSISW.
The format of the parameters when calling MakeNSISW from the commandline is:
makensisw [options] [script.nsi | - [...]]
For the options, please see the MakeNSIS documentation.
Shortcut Keys
-------------
Ctrl+A: Select All text
Ctrl+B: Open Script Folder
Ctrl+C: Copy selected text
Ctrl+D: Opens the Define Symbols dialog
Ctrl+E: Edits the script
Ctrl+F: Find text
Ctrl+L: Load a script
Ctrl+R: Recompiles the script
Ctrl+T: Tests the installer
Ctrl+W: Clear Log Window
Alt+X: Exits the application
F1: View Documentation
Version History
---------------
0.1
- Initial Release
0.2
- Added ability to save output and copy output
0.3
- Added option to recompile script (F2 or File|Recompile)
- Added Help Menu
- Return code is now always set
- Added Accelerator key support for Exit and Recompile
- No longer uses NSIS's version string
- Made clearer status message in title bar
- Disabled menu/accelerator functions during compile
0.4
- Fixed Copy Selected bug
0.5
- Minor Makefile changes (mingw)
- Moved strings into global strings to make editing easier
- Added Clear Log Command under Edit menu
- Recompile no longer clears the log window (use F5)
- Close is now the default button when you hit enter
- added VC++ project, updated resources to work with VC++
- rearranged directory structure
- makefiles now target ../../makensisw.exe
- removed makensisw home link in help menu (hope this is ok,
doesn't really seem needed to me)
- made display use a fixed width font (Some people may not like
this, but I do)
- added 'test' button (peeks output for 'Output' line)
- made it so that the log shows the most recent 32k.
- made it so that the log always clears on a recompile.
- compiled with VC++ so no longer needs msvcrt.dll
- made the compiler name be a full path (for more flexibility)
0.6
- print correct usage if unable to execute compiler
- removed mingw warnings
- set title/branding before errors
- some docs changes
- Added Edit|Edit Script function
0.7
- Edit Script should now work for output>32k
- Added resize support (thanks to felfert)
- Added window position saving (thanks to felfert)
- Disable some items when exec of makensis failed
0.8
- Added window size constraints (thanks to bcheck)
- Cleaned up the resource file
0.9
- Removed global strings (moved into #defines)
- Some GUI changes
- No longer focused Close button (its default anyways)
- Fixed resize bug on minimize/restore (thanks to felfert)
- Made window placement stored in HKLM instead of HKCU, cause
I hate things that get littered in HKCU.
1.0
- Fixed bug with large output causing crash
1.1
- Crash may actually be fixed
1.2
- XP visual style support
1.3
- Added Documentation menu item
- Fix GUI problem with About dialog
1.4
- Edit Script command will now work with or without file associations
- Added default filename for save dialog
- Use standard fonts
- Documentation menuitem caused recompile
1.5
- Fixed Copy All function
1.6
- Reduced size from 44k to 12k (kichik)
- Editbox not limited to 32k (now using richedit control)
- Made the log window font-size smaller.
1.7
- Added check for warnings
- Added sound for sucessfull compilations
- Update home page and documentation menu items to Sourceforge page
1.8
- Contents of log window are now streamed in
- Empty log window check (to prevent random crashes)
1.9
- Text always scrolls to bottom (kichik)
- Updated link to new docs
- Makensisw now takes the same parameters as makensis.exe
- Fixed some random crashes
- Drag and Drop Support into the Makensisw window
- Updated icon to more sexy one
- Added Load Script option on File menu
- Added Search Dialog (Ctrl+F) (kichik)
- Added Select All (Ctrl+A), Copy (Ctrl+C), Exit (Alt+X) keys
- Branding text now reflects NSIS version
- Added some simple tool tips
- Added Context Menu in log window
- Added resize gripper
- Ctrl+L loads a script
- Added Clear Log (Ctrl+W)
- Browse Script (Ctrl+B) launches explorer in script directory
- Check for Update command
- Added link to the NSIS Forum under Help menu
- Bunch of other stuff not worth mentioning
- Define Symbols menu (Ctrl+D)
2.0
- Improved user interface
- Define Symbols is available even if a script is not loaded
- Defined Symbols are saved on exit and reloaded on start
- Added NSIS Update menu
- Added toolbar for commonly used menus
- Made the Toolbar style flat
- Added option for compile & run
- Added compressor setting option
- Added support for lzma compression
- Added named Symbols sets.
2.1
- Added "Cancel compilation" menu item
2.2
- Settings saved in HKCU instead of HKLM
- Added menu accelerators to MRU list
2.3
- Escape button closes MakeNSISw
2.3.1
- Fixed broken command line parameter handling
2.3.2
- The size gripper can be used to resize the window
2.3.3
- Update check switched from JNetLib to WinInet
- New file type icons
2.3.4
- Added Window Info/Spy feature
- System DPI aware
- New toolbar images
Copyright Information
---------------------
Copyright (c) 2002 Robert Rainwater
Contributors: Justin Frankel, Fritz Elfert, Amir Szekely,
Sunil Kamath, Joost Verburg, Anders Kjersem.
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.

View File

@ -0,0 +1,838 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>nsDialogs</title>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css">
body { color: #000000; background-color: #ffffff; }
b { color: red; }
code { margin-left: 1.2em; padding: 0.5em; background-color: #f0f0f0; }
span.inlcod i { padding: 0px 0.2em; color: #222222; font-family: monospace; font-style: normal; }
blockquote pre { background-color: #fcfcfc; font-family: monospace; }
abbr { font-variant: none; cursor: help; }
</style>
</head>
<body>
<h1>NSIS nsDialogs Plug-in</h1>
<p><i>Next generation of user interface design</i></p>
<h2>Table of Contents</h2>
<ul>
<li><a href="#intro">Introduction</a></li>
<li>
<a href="#step">Step-by-Step Tutorial</a>
<ul>
<li><a href="#step-page">Custom Page</a></li>
<li><a href="#step-add">Adding Controls</a></li>
<li><a href="#step-state">Control State</a></li>
<li><a href="#step-notify">Real-time Notification</a></li>
<li><a href="#step-memory">Memory</a></li>
</ul>
</li>
<li>
<a href="#ref">Function Reference</a>
<ul>
<li><a href="#ref-create">Create</a></li>
<li><a href="#ref-createcontrol">CreateControl</a></li>
<li><a href="#ref-show">Show</a></li>
<li><a href="#ref-selectfiledialog">SelectFileDialog</a></li>
<li><a href="#ref-selectfolderdialog">SelectFolderDialog</a></li>
<li><a href="#ref-setrtl">SetRTL</a></li>
<li><a href="#ref-getuserdata">GetUserData</a></li>
<li><a href="#ref-setuserdata">SetUserData</a></li>
<li><a href="#ref-onback">OnBack</a></li>
<li><a href="#ref-onchange">OnChange</a></li>
<li><a href="#ref-onclick">OnClick</a></li>
<li><a href="#ref-onnotify">OnNotify</a></li>
<li><a href="#ref-createtimer">CreateTimer</a></li>
<li><a href="#ref-killtimer">KillTimer</a></li>
</ul>
</li>
<li>
<a href="#mref">Macro Reference</a>
<ul>
<li><a href="#mref-create">NSD_Create*</a></li>
<li><a href="#mref-onback">NSD_OnBack</a>, <a href="#mref-onchange">NSD_OnChange</a>, <a href="#mref-onclick">NSD_OnClick</a>, <a href="#mref-onnotify">NSD_OnNotify</a></li>
<li><a href="#mref-setfocus">NSD_SetFocus</a></li>
<li><a href="#mref-createtimer">NSD_CreateTimer</a>, <a href="#mref-killtimer">NSD_KillTimer</a></li>
<li><a href="#mref-addstyle">NSD_AddStyle</a>, <a href="#mref-addexstyle">NSD_AddExStyle</a></li>
<li><a href="#mref-gettext">NSD_GetText</a>, <a href="#mref-settext">NSD_SetText</a></li>
<li>Text, Password &amp; Number:
<a href="#mref-settextlimit">NSD_Edit_SetTextLimit</a>,
<a href="#mref-edsetro">NSD_Edit_SetReadOnly</a>,
<a href="#mref-edsetcuebanner">NSD_Edit_SetCueBannerText</a>
</li>
<li>RichEdit:
<a href="#mref-richsettextlimit">NSD_RichEd_SetTextLimit</a>,
<a href="#mref-richseteventmask">NSD_RichEd_SetEventMask</a>,
<a href="#mref-richsetbkclr">NSD_RichEd_SetCustomBackgroundColor</a>
</li>
<li>CheckBox &amp; RadioButton:
<a href="#mref-getstate">NSD_GetState</a>,
<a href="#mref-setstate">NSD_SetState</a>,
<a href="#mref-check">NSD_Check</a>,
<a href="#mref-uncheck">NSD_Uncheck</a>
</li>
<li>ComboBox &amp; DropList:
<a href="#mref-cbaddstring">NSD_CB_AddString</a>,
<a href="#mref-cbinsstring">NSD_CB_PrependString, NSD_CB_AppendString, NSD_CB_InsertString</a>,
<a href="#mref-cbselectstring">NSD_CB_SelectString</a>,
<a href="#mref-cbgetcount">NSD_CB_GetCount</a>
</li>
<li>ListBox:
<a href="#mref-lbaddstring">NSD_LB_AddString</a>,
<a href="#mref-lbinsstring">NSD_LB_PrependString, NSD_LB_AppendString, NSD_LB_InsertString</a>,
<a href="#mref-lbdelstring">NSD_LB_DelString</a>,
<a href="#mref-lbdelitem">NSD_LB_DelItem</a>,
<a href="#mref-lbclear">NSD_LB_Clear</a>,
<a href="#mref-lbgetcount">NSD_LB_GetCount</a>,
<a href="#mref-lbselectstring">NSD_LB_SelectString</a>,
<a href="#mref-lbgetselection">NSD_LB_GetSelection</a>
</li>
<li>Animation:
<a href="#mref-animopenfile">NSD_Anim_OpenFile</a>,
<a href="#mref-animplay">NSD_Anim_Play</a>,
<a href="#mref-animstop">NSD_Anim_Stop</a>
</li>
<li>HTrackBar &amp; VTrackBar:
<a href="#mref-trackgetpos">NSD_TrackBar_GetPos</a>,
<a href="#mref-tracksetpos">NSD_TrackBar_SetPos</a>,
<a href="#mref-tracksetrmin">NSD_TrackBar_SetRangeMin</a>,
<a href="#mref-tracksetrmax">NSD_TrackBar_SetRangeMax</a>,
<a href="#mref-tracksetticfr">NSD_TrackBar_SetTicFreq</a>
</li>
<li>UpDown:
<a href="#mref-udsetbuddy">NSD_UD_SetBuddy</a>,
<a href="#mref-udgetpos">NSD_UD_GetPos</a>,
<a href="#mref-udsetpos">NSD_UD_SetPos</a>,
<a href="#mref-udsetpackedrange">NSD_UD_SetPackedRange</a>
</li>
<li>HotKey:
<a href="#mref-hkgethk">NSD_HK_GetHotKey</a>, <a href="#mref-hksethk">NSD_HK_SetHotKey</a>
</li>
<li>Bitmap:
<a href="#mref-setimage">NSD_SetImage</a>,
<a href="#mref-setsimage">NSD_SetStretchedImage</a>,
<a href="#mref-clearimage">NSD_ClearImage</a>,
<a href="#mref-freeimage">NSD_FreeImage</a>
</li>
<li>Icon:
<a href="#mref-seticon">NSD_SetIcon</a>,
<a href="#mref-seticonfrominstaller">NSD_SetIconFromInstaller</a>,
<a href="#mref-clearicon">NSD_ClearIcon</a>,
<a href="#mref-freeicon">NSD_FreeIcon</a>
</li>
</ul>
</li>
<li><a href="#faq">FAQ</a></li>
</ul>
<h2><a name="intro"></a>Introduction</h2>
<p>nsDialogs allows creation of custom pages in the installer. On top of the built-in pages, nsDialogs can create pages with any type of controls in any order and arrangement. It can create everything from a simple page with one label to form which reacts to user's actions. <a href="../Modern UI 2/Readme.html">Modern UI 2</a>, for example, uses nsDialogs to create the welcome and finish pages.</p>
<p>nsDialogs is a NSIS plug-in, introduced in version 2.29 as a replacement for <a href="../InstallOptions/Readme.html">InstallOptions</a>. nsDialogs doesn't use INI files, so it's way faster than InstallOptions. Integration with the script is tighter and more natural - creating controls is done using plug-in functions and notification is done by directly calling a function in the script. Unlike InstallOptions, there isn't a predefined set of available control type and by providing a lower level access to Windows API, every type of control can be created and pages can be more customizable.</p>
<p>The same thing that makes nsDialogs more flexible can also make it more complicated for users with no knowledge of Win32 API. This is solved by creating a library of predefined functions, defined in script, that allow creation and handling of controls. This way, novices get easy access to the flexibility, while advanced users still get access to the <a href="http://msdn.microsoft.com/en-us/library/bb773169">core functionality</a> by modifying the library or simply avoid using it.</p>
<h2><a name="step"></a>Step-by-Step Tutorial</h2>
<h3><a name="step-page"></a>Custom Page</h3>
<p>Before you can start adding controls you need to create a nsDialogs custom page. nsDialogs pages can only be created in a custom page's creator function, not in sections nor regular functions. Lets create a basic script with a empty nsDialogs page as our skeleton:</p>
<blockquote><pre><b>!include LogicLib.nsh</b>
Name nsDialogs
OutFile nsDialogs.exe
XPStyle on
<b>
Var Dialog
Page custom nsDialogsPage</b>
Page instfiles
<b>Function nsDialogsPage
nsDialogs::Create 1018
Pop $Dialog
${If} $Dialog == error
Abort
${EndIf}
nsDialogs::Show
FunctionEnd</b>
Section
SectionEnd</pre></blockquote>
<span class="inlcod">
<p>The first call must always be to <i>nsDialogs::Create</i>. It will create a new dialog in the page and return its <i>HWND</i> on the stack. The result must be popped from the stack to prevent stack corruption. If the result is <i>error</i>, the dialog couldn't be created and the page must be aborted!</p>
<p><i>nsDialogs::Create</i> accepts one parameter. It has a very specific function, but to keep things simple for this tutorial, it must always be 1018.</p>
<p><i>HWND</i> is a number that uniquely identifies the dialog and can be used with <i>SendMessage</i>, <i>SetCtlColors</i> and Win32 API functions.</p>
<p>The dialog is not fully constructed at this point and you can make modifications to it before it is displayed. To finalize and display the dialog you must call <i>nsDialogs::Show</i>. This function will not return until the user clicks Next, Back or Cancel.</p>
</span>
<h3><a name="step-add"></a>Adding Controls</h3>
<span class="inlcod">
<p>Compiling the last script and running it results in an empty page which is not very useful. So now we'll add some controls to it to. To do so, we'll use <a href="#mref-create">${NSD_Create*}</a> macros from nsDialogs.nsh. Each of those macros takes 5 parameters - x, y, width, height and text. Each macro also returns one value on the stack, which is the new control's <i>HWND</i>. Like the dialogs <i>HWND</i>, it must be popped from the stack and saved.</p>
<p>Each of the measurements that the macros take can use one of three unit types - pixels, dialog units or percentage of the dialog's size. It can also be negative to indicate it should be measured from the end. To use dialog units, the measurement must be suffixed with the letter <i>u</i>. To use percentage, the measurement must be suffixed with the percentage sign - <i>%</i>. Any other suffix, or no suffix, means pixels.</p>
<p>Dialog units allow creation of dialogs that scale well when different fonts or <abbr title="Dots per Inch">DPI</abbr> is used. Its size in pixels is determined at runtime based on the font and the DPI. For example, standard pages in the classic NSIS user interface are 266 dialog units wide and 130 dialog units high. Pages in Modern UI are 300 dialogs units wide and 140 dialog units high. In different resolutions, using different fonts or DPI settings, the dialogs will always have the same size in dialog units, but different size in pixels.</p>
</span>
<blockquote><pre><b>!include nsDialogs.nsh</b>
!include LogicLib.nsh
Name nsDialogs
OutFile nsDialogs.exe
XPStyle on
Var Dialog
<b>Var Label
Var Text</b>
Page custom nsDialogsPage
Page instfiles
Function nsDialogsPage
nsDialogs::Create 1018
Pop $Dialog
${If} $Dialog == error
Abort
${EndIf}
<b>
${NSD_CreateLabel} 0 0 100% 12u "Hello, welcome to nsDialogs!"
Pop $Label
${NSD_CreateText} 0 13u 100% -13u "Type something here..."
Pop $Text
</b>
nsDialogs::Show
FunctionEnd
Section
SectionEnd</pre></blockquote>
<p>Available control types that can be created with <a href="#mref-create">${NSD_Create*}</a> are:
HLine,
VLine,
Label,
Icon,
Bitmap,
BrowseButton,
Link,
Button,
GroupBox,
CheckBox,
RadioButton,
Text,
Password,
Number,
FileRequest,
DirRequest,
RichEdit,
ComboBox,
DropList,
ListBox,
SortedListBox,
ProgressBar,
Animation,
HTrackBar,
VTrackBar,
UpDown,
HotKey,
IPAddress.
</p>
<h3><a name="step-state"></a>Control State</h3>
<span class="inlcod">
<p>Now that we have some controls that the user can interact with, it's time to see what the user actually does with them. For that, we'll first add a "leave callback function" to our page. In that function, we'll query the state of the text control we've created and display it to the user. To do so, we'll use the <a href="#mref-gettext">${NSD_GetText}</a> macro. Use the <a href="#mref-getstate">${NSD_GetState}</a> macro for RadioButton and CheckBox controls.</p>
<p>Note that not all controls support <a href="#mref-gettext">${NSD_GetText}</a> and some require special handling with specific messages defined in WinMessages.nsh. For example, the ListBox control requires usage of <i>LB_GETCURSEL</i> and <i>LB_GETTEXT</i>. With time, the library of macros in nsDialogs.nsh will fill with more and more macros that'll handle more cases like this.</p>
</span>
<blockquote><pre>!include nsDialogs.nsh
!include LogicLib.nsh
Name nsDialogs
OutFile nsDialogs.exe
XPStyle on
Var Dialog
Var Label
Var Text
Page custom nsDialogsPage <b>nsDialogsPageLeave</b>
Page instfiles
Function nsDialogsPage
nsDialogs::Create 1018
Pop $Dialog
${If} $Dialog == error
Abort
${EndIf}
${NSD_CreateLabel} 0 0 100% 12u "Hello, welcome to nsDialogs!"
Pop $Label
${NSD_CreateText} 0 13u 100% -13u "Type something here..."
Pop $Text
nsDialogs::Show
FunctionEnd
<b>Function nsDialogsPageLeave
${NSD_GetText} $Text $0
MessageBox MB_OK "You typed:$\n$\n$0"
FunctionEnd</b>
Section
SectionEnd</pre></blockquote>
<h3><a name="step-notify"></a>Real-time Notification</h3>
<span class="inlcod">
<p>One of the more exciting new features of nsDialogs is callback function notification of changes to the dialog. nsDialogs can call a function defined in a script in response to a user action such as changing of a text field or click of a button. To make nsDialogs notify us of events, we'll use <a href="#mref-onclick">${NSD_OnClick}</a> and <a href="#mref-onchange">${NSD_OnChange}</a>. Not every control supports both of the events. For example, there is nothing to notify about label changes, only clicks.</p>
<p>When the callback function is called, the control's <i>HWND</i> will be waiting on the stack and must be popped to prevent stack corruption. In this simple example, this is not so useful. But in case of a bigger script where several controls are associated with the same callback function, the <i>HWND</i> can shed some light on which control originated the event.</p>
<p>The new example will respond to the user typing "hello" in the text box.</p>
</span>
<blockquote><pre>!include nsDialogs.nsh
!include LogicLib.nsh
Name nsDialogs
OutFile nsDialogs.exe
XPStyle on
Var Dialog
Var Label
Var Text
Page custom nsDialogsPage nsDialogsPageLeave
Page instfiles
Function nsDialogsPage
nsDialogs::Create 1018
Pop $Dialog
${If} $Dialog == error
Abort
${EndIf}
${NSD_CreateLabel} 0 0 100% 12u "Hello, welcome to nsDialogs!"
Pop $Label
${NSD_CreateText} 0 13u 100% -13u "Type something here..."
Pop $Text
<b>${NSD_OnChange} $Text nsDialogsPageTextChange</b>
nsDialogs::Show
FunctionEnd
Function nsDialogsPageLeave
${NSD_GetText} $Text $0
MessageBox MB_OK "You typed:$\n$\n$0"
FunctionEnd
<b>Function nsDialogsPageTextChange
Pop $1 # $1 == $ Text
${NSD_GetText} $Text $0
${If} $0 == "hello"
MessageBox MB_OK "right back at ya!"
${EndIf}
FunctionEnd</b>
Section
SectionEnd</pre></blockquote>
<h3><a name="step-memory"></a>Memory</h3>
<p>So far we have a page that has some basic input controls. But what happens when the user goes to the next page and comes back? With the current code, the user's input will not be remembered. To remember, we'll use the already present leave callback function to store the user's choice in variables and pass these values when creating the controls the next time. For a better example, we'll also add a checkbox to the page and use <a href="#mref-getstate">${NSD_GetState}</a> and <a href="#mref-setstate">${NSD_SetState}</a> to get and set its state.</p>
<p>For clarity, we'll remove some of the notifications from the previous step.</p>
<blockquote><pre>!include nsDialogs.nsh
!include LogicLib.nsh
Name nsDialogs
OutFile nsDialogs.exe
XPStyle on
Var Dialog
Var Label
Var Text
<b>Var Text_State
Var Checkbox
Var Checkbox_State</b>
Page custom nsDialogsPage nsDialogsPageLeave
<b>Page license</b>
Page instfiles
<b>Function .onInit
StrCpy $Text_State "Type something here..."
FunctionEnd</b>
Function nsDialogsPage
nsDialogs::Create 1018
Pop $Dialog
${If} $Dialog == error
Abort
${EndIf}
${NSD_CreateLabel} 0 0 100% 12u "Hello, welcome to nsDialogs!"
Pop $Label
${NSD_CreateText} 0 13u 100% <b>12u $Text_State</b>
Pop $Text
<b>${NSD_CreateCheckbox} 0 30u 100% 10u "&amp;Something"
Pop $Checkbox
${If} $Checkbox_State == ${BST_CHECKED}
${NSD_Check} $Checkbox
${EndIf}
# alternative for the above ${If}:
#${NSD_SetState} $Checkbox_State</b>
nsDialogs::Show
FunctionEnd
Function nsDialogsPageLeave
${NSD_GetText} $Text <b>$Text_State</b>
<b>${NSD_GetState} $Checkbox $Checkbox_State</b>
FunctionEnd
Section
SectionEnd</pre></blockquote>
<h2><a name="ref"></a>Function Reference</h2>
<h3><a name="ref-create"></a>Create</h3>
<p><code>nsDialogs::Create <i>rect</i></code></p>
<p>Creates a new dialog. <i>rect</i> specific the identifier of the control whose location will be mimiced. This should usually be 1018, which is control mimiced for creation of built-in pages. The Modern UI also has control 1044 for the welcome and the finish page.</p>
<p>Returns the new dialog's HWND on the stack or <i>error</i>.</p>
<h3><a name="ref-createcontrol"></a>CreateControl</h3>
<p><code>nsDialogs::CreateControl <i>class</i> <i>style</i> <i>extended_style</i> <i>x</i> <i>y</i> <i>width</i> <i>height</i> <i>text</i></code></p>
<p>Create a new control in the current dialog. A dialog must exist for this to work, so nsDialogs::Create must be called prior to this function.</p>
<p>Returns the new control's HWND on the stack or <i>error</i>.</p>
<h3><a name="ref-show"></a>Show</h3>
<p><code>nsDialogs::Show</code></p>
<p>Displays the page. Call this once finished with nsDialogs::Create, nsDialogs::CreateControl and the rest.</p>
<p>Returns nothing.</p>
<h3><a name="ref-selectfiledialog"></a>SelectFileDialog</h3>
<p><code>nsDialogs::SelectFileDialog <i>mode</i> <i>initial_selection</i> <i>filter</i></code></p>
<p>Displays a file selection dialog to the user. If <i>mode</i> is set to <i>save</i>, displays a file save dialog. If <i>mode</i> is set to <i>open</i>, displays a file open dialog. <i>filter</i> is a list of available file filters separated by pipes. If an empty string is passed, the default is used - <i>All Files|*.*</i>.</p>
<p><i>initial_selection</i> can be used to provide the user with a default file to look for and/or a default folder to look in. If <i>initial_selection</i> is empty no default filename will be provided for the user and the dialog will start in the current working directory. If <i>initial_selection</i> specifies just a filename, for example "test.exe", the dialog will be set up to look for a file called test.exe in the current working directory. If <i>initial_selection</i> specifies just a directory, for example "C:\Program Files", the dialog starts in the provided directory with no file name provided. If <i>initial_selection</i> specifies a directory and a filename, for example "C:\Windows\System32\calc.exe", the dialog will be set up to look for a file called calc.exe in the directory C:\Windows\System32.</p>
<p>Returns the selected file on the stack or an empty string if the user canceled the operation.</p>
<h3><a name="ref-selectfolderdialog"></a>SelectFolderDialog</h3>
<p><code>nsDialogs::SelectFolderDialog <i>title</i> <i>initial_selection</i></code></p>
<p>Displays a directory selection dialog to the user.</p>
<p>Returns the selected directory on the stack or "error" in case the user canceled the operation or an error occured.</p>
<h3><a name="ref-setrtl"></a>SetRTL</h3>
<p><code>nsDialogs::SetRTL <i>rtl_setting</i></code></p>
<p>Sets right-to-left mode on or off. If <i>rtl_setting</i> is 0, it's set to off. If <i>rtl_setting</i> is 1, it's set to on. This function must be called before any calls to nsDialogs::CreateControl.</p>
<p>Returns nothing.</p>
<h3><a name="ref-getuserdata"></a>GetUserData</h3>
<p><code>nsDialogs::GetUserData <i>control_HWND</i></code></p>
<p>Returns user data associated with the control on the stack. Use nsDialogs::SetUserData to set this data.</p>
<h3><a name="ref-setuserdata"></a>SetUserData</h3>
<p><code>nsDialogs::SetUserData <i>control_HWND</i> <i>data</i></code></p>
<p>Associates <i>data</i> with the control. Use nsDialogs::GetUserData to get this data.</p>
<p>Returns nothing.</p>
<h3><a name="ref-onback"></a>OnBack</h3>
<p><code>nsDialogs::OnBack <i>function_address</i></code></p>
<p>Sets the callback function for the Back button. This function will be called when the user clicks the back button. Call Abort in this function to prevent the user from going back to the last page.</p>
<p>Use GetFunctionAddress to get the address of the desired callback function.</p>
<p>Returns nothing.</p>
<h3><a name="ref-onchange"></a>OnChange</h3>
<p><code>nsDialogs::OnChange <i>control_HWND</i> <i>function_address</i></code></p>
<p>Sets a change notification callback function for the given control. Whenever the control changes, the function will be called and the control's HWND will be waiting on its stack.</p>
<p>Use GetFunctionAddress to get the address of the desired callback function.</p>
<p>Returns nothing.</p>
<h3><a name="ref-onclick"></a>OnClick</h3>
<p><code>nsDialogs::OnClick <i>control_HWND</i> <i>function_address</i></code></p>
<p>Sets a click notification callback function for the given control. Whenever the control is clicked, the function will be called and the control's HWND will be waiting on its stack.</p>
<p>Use GetFunctionAddress to get the address of the desired callback function.</p>
<p>Returns nothing.</p>
<h3><a name="ref-onnotify"></a>OnNotify</h3>
<p><code>nsDialogs::OnNotify <i>control_HWND</i> <i>function_address</i></code></p>
<p>Sets a notification callback function for the given control. Whenever the control receives the WM_NOTIFY message, the function will be called and the control's HWND, notification code and a pointer to the NMHDR structure will be waiting on its stack. Use ${NSD_Return} to return a value.</p>
<p>Use GetFunctionAddress to get the address of the desired callback function.</p>
<p>Returns nothing.</p>
<h3><a name="ref-createtimer"></a>CreateTimer</h3>
<p><code>nsDialogs::CreateTimer <i>function_address</i> <i>timer_interval</i></code></p>
<p>Sets a timer that'd call the callback function for the given control every in a constant interval. Interval times are specified in milliseconds.</p>
<p>Use GetFunctionAddress to get the address of the desired callback function.</p>
<p>Returns nothing.</p>
<h3><a name="ref-killtimer"></a>KillTimer</h3>
<p><code>nsDialogs::KillTimer <i>function_address</i></code></p>
<p>Kills a previously set timer.</p>
<p>Use GetFunctionAddress to get the address of the desired callback function.</p>
<p>Returns nothing.</p>
<h2><a name="mref"></a>Macro Reference</h2>
<p>nsDialogs.nsh contains a lot of macros that can make nsDialogs usage a lot easier. Below is a description of each of those macros including purpose, syntax, input and output.</p>
<h3><a name="mref-create"></a>NSD_Create*</h3>
<p><code>${NSD_Create*} <i>x</i> <i>y</i> <i>width</i> <i>height</i> <i>text</i></code></p>
<p>Create a new control in the current dialog. A dialog must exist for this to work, so nsDialogs::Create must be called prior to this function.</p>
<p>Available variants:</p>
<ul>
<li>${NSD_CreateHLine}</li>
<li>${NSD_CreateVLine}</li>
<li>${NSD_CreateLabel}</li>
<li>${NSD_CreateIcon}</li>
<li>${NSD_CreateBitmap}</li>
<li>${NSD_CreateBrowseButton}</li>
<li>${NSD_CreateLink}</li>
<li>${NSD_CreateButton}</li>
<li>${NSD_CreateGroupBox}</li>
<li>${NSD_CreateCheckBox}</li>
<li>${NSD_CreateRadioButton}</li>
<li>${NSD_CreateText}</li>
<li>${NSD_CreatePassword}</li>
<li>${NSD_CreateNumber}</li>
<li>${NSD_CreateFileRequest}</li>
<li>${NSD_CreateDirRequest}</li>
<li>${NSD_CreateRichEdit}</li>
<li>${NSD_CreateComboBox}</li>
<li>${NSD_CreateDropList}</li>
<li>${NSD_CreateListBox}</li>
<li>${NSD_CreateSortedListBox}</li>
<li>${NSD_CreateProgressBar}</li>
<li>${NSD_CreateAnimation}</li>
<li>${NSD_CreateHTrackBar}</li>
<li>${NSD_CreateVTrackBar}</li>
<li>${NSD_CreateUpDown}</li>
<li>${NSD_CreateHotKey}</li>
<li>${NSD_CreateIPAddress} <small>(Requires <abbr title="Internet Explorer">IE</abbr>4)</small></li>
</ul>
<p>Returns the new control's HWND on the stack or <i>error</i></p>
<h3><a name="mref-onback"></a>NSD_OnBack</h3>
<p><code>${NSD_OnBack} <i>function_name</i></code></p>
<p>See <a href="#ref-onback">OnBack</a> for more details.</p>
<h3><a name="mref-onchange"></a>NSD_OnChange</h3>
<p><code>${NSD_OnChange} <i>control_HWND</i> <i>function_name</i></code></p>
<p>See <a href="#ref-onchange">OnChange</a> for more details.</p>
<p>See <a href="#step-notify">Real-time Notification</a> for usage example.</p>
<h3><a name="mref-onclick"></a>NSD_OnClick</h3>
<p><code>${NSD_OnClick} <i>control_HWND</i> <i>function_name</i></code></p>
<p>See <a href="#ref-onclick">OnClick</a> for more details.</p>
<h3><a name="mref-onnotify"></a>NSD_OnNotify</h3>
<p><code>${NSD_OnNotify} <i>control_HWND</i> <i>function_name</i></code></p>
<p>See <a href="#ref-onnotify">OnNotify</a> for more details.</p>
<h3><a name="mref-return"></a>NSD_Return</h3>
<p><code>${NSD_Return} <i>value</i></code></p>
<p>Used to return a value back to Windows from a OnNotify callback.</p>
<h3><a name="mref-setfocus"></a>NSD_SetFocus</h3>
<p><code>${NSD_SetFocus} <i>control_HWND</i></code></p>
<p>Sets focus to a control.</p>
<h3><a name="mref-createtimer"></a>NSD_CreateTimer</h3>
<p><code>${NSD_CreateTimer} <i>function_name</i> <i>timer_interval</i></code></p>
<p>See <a href="#ref-createtimer">CreateTimer</a> for more details.</p>
<h3><a name="mref-killtimer"></a>NSD_KillTimer</h3>
<p><code>${NSD_KillTimer} <i>function_name</i></code></p>
<p>See <a href="#ref-killtimer">KillTimer</a> for more details.</p>
<h3><a name="mref-addstyle"></a>NSD_AddStyle</h3>
<p><code>${NSD_AddStyle} <i>control_HWND</i> <i>style</i></code></p>
<p>Adds one or more window styles to a control. Multiple styles should be separated with pipes `|'.</p>
<p>See MSDN for shared and per-control style descriptions.</p>
<h3><a name="mref-addexstyle"></a>NSD_AddExStyle</h3>
<p><code>${NSD_AddExStyle} <i>control_HWND</i> <i>style</i></code></p>
<p>Adds one or more extended window styles to a control. Multiple styles should be separated with pipes `|'.</p>
<p>See <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/ff700543">MSDN</a> for style descriptions.</p>
<h3><a name="mref-gettext"></a>NSD_GetText</h3>
<p><code>${NSD_GetText} <i>control_HWND</i> <i>$output_variable</i></code></p>
<p>Retrieves the text of a control and stores it into <i>output_variable</i>. Especially useful for textual controls.</p>
<p>See <a href="#step-state">Control State</a> for usage example.</p>
<h3><a name="mref-settext"></a>NSD_SetText</h3>
<p><code>${NSD_SetText} <i>control_HWND</i> <i>text</i></code></p>
<p>Sets the text of a control.</p>
<h3><a name="mref-settextlimit"></a>NSD_Edit_SetTextLimit</h3>
<p><code>${NSD_Edit_SetTextLimit} <i>control_HWND</i> <i>limit</i></code></p>
<p>Sets the input length limit for a text control.</p>
<h3><a name="mref-edsetro"></a>NSD_Edit_SetReadOnly</h3>
<p><code>${NSD_Edit_SetReadOnly} <i>control_HWND</i> <i>readonly</i></code></p>
<p>1 to make the text control read-only or 0 to allow the user to input data.</p>
<h3><a name="mref-edsetcuebanner"></a>NSD_Edit_SetCueBannerText</h3>
<p><code>${NSD_Edit_SetCueBannerText} <i>control_HWND</i> <i>displaywhenfocused</i> <i>text</i></code></p>
<p>Set a text hint displayed when the control is empty. The text is only visible on WinXP and later. Requires <i>XPStyle on</i>.</p>
<h3><a name="mref-richsettextlimit"></a>NSD_RichEd_SetTextLimit</h3>
<p><code>${NSD_RichEd_SetTextLimit} <i>control_HWND</i> <i>limit</i></code></p>
<p>Sets the input length limit.</p>
<h3><a name="mref-richseteventmask"></a>NSD_RichEd_SetEventMask</h3>
<p><code>${NSD_RichEd_SetEventMask} <i>control_HWND</i> <i>eventmask</i></code></p>
<h3><a name="mref-richsetbkclr"></a>NSD_RichEd_SetCustomBackgroundColor</h3>
<p><code>${NSD_RichEd_SetCustomBackgroundColor} <i>control_HWND</i> <i>COLORREF</i></code></p>
<h3><a name="mref-getstate"></a>NSD_GetState</h3>
<p><code>${NSD_GetState} <i>control_HWND</i> <i>$output_variable</i></code></p>
<p>Retrieves the state of a check box or a radio button control. Possible outputs are ${BST_CHECKED} and ${BST_UNCHECKED}.</p>
<p>See <a href="#step-memory">Memory</a> for usage example.</p>
<h3><a name="mref-setstate"></a>NSD_SetState</h3>
<p><code>${NSD_SetState} <i>control_HWND</i> <i>state</i></code></p>
<p>Sets the state of a check box or a radio button control. Possible values for <i>state</i> are ${BST_CHECKED} and ${BST_UNCHECKED}.</p>
<p>See <a href="#step-memory">Memory</a> for usage example.</p>
<h3><a name="mref-check"></a>NSD_Check</h3>
<p><code>${NSD_Check} <i>control_HWND</i></code></p>
<p>Checks a check box or a radio button control. Same as calling ${NSD_SetState} with ${BST_CHECKED}.</p>
<h3><a name="mref-uncheck"></a>NSD_Uncheck</h3>
<p><code>${NSD_Uncheck} <i>control_HWND</i></code></p>
<p>Unchecks a check box or a radio button control. Same as calling ${NSD_SetState} with ${BST_UNCHECKED}.</p>
<p>See <a href="#step-memory">Memory</a> for usage example.</p>
<h3><a name="mref-cbaddstring"></a>NSD_CB_AddString</h3>
<p><code>${NSD_CB_AddString} <i>combo_HWND</i> <i>string</i></code></p>
<p>Adds a string to a combo box.</p>
<h3><a name="mref-cbinsstring"></a>NSD_CB_InsertString</h3>
<p><code>${NSD_CB_InsertString} <i>combo_HWND</i> <i>index</i> <i>string</i></code></p>
<p><code>${NSD_CB_PrependString} <i>combo_HWND</i> <i>string</i></code></p>
<p><code>${NSD_CB_AppendString} <i>combo_HWND</i> <i>string</i></code></p>
<p>Insert a string in a specified position in a combo box.</p>
<h3><a name="mref-cbselectstring"></a>NSD_CB_SelectString</h3>
<p><code>${NSD_CB_SelectString} <i>combo_HWND</i> <i>string</i></code></p>
<p>Selects a string in a combo box.</p>
<h3><a name="mref-cbgetcount">NSD_CB_GetCount</a></h3>
<p><code>${NSD_CB_GetCount} <i>combo_HWND</i> <i>$output_variable</i></code></p>
<h3><a name="mref-lbaddstring"></a>NSD_LB_AddString</h3>
<p><code>${NSD_LB_AddString} <i>listbox_HWND</i> <i>string</i></code></p>
<p>Adds a string to a list box.</p>
<h3><a name="mref-lbinsstring"></a>NSD_LB_InsertString</h3>
<p><code>${NSD_LB_InsertString} <i>listbox_HWND</i> <i>index</i> <i>string</i></code></p>
<p><code>${NSD_LB_PrependString} <i>listbox_HWND</i> <i>string</i></code></p>
<p><code>${NSD_LB_AppendString} <i>listbox_HWND</i> <i>string</i></code></p>
<p>Insert a string in a specified position in a list box.</p>
<h3><a name="mref-lbdelstring"></a>NSD_LB_DelString</h3>
<p><code>${NSD_LB_DelString} <i>listbox_HWND</i> <i>string</i></code></p>
<p>Deletes a string from a list box.</p>
<h3><a name="mref-lbdelitem"></a>NSD_LB_DelItem</h3>
<p><code>${NSD_LB_DelItem} <i>listbox_HWND</i> <i>itemindex</i></code></p>
<p>Deletes a string from a list box.</p>
<h3><a name="mref-lbclear">NSD_LB_Clear</a></h3>
<p><code>${NSD_LB_Clear} <i>listbox_HWND</i></code></p>
<p>Deletes all strings from a list box.</p>
<h3><a name="mref-lbgetcount">NSD_LB_GetCount</a></h3>
<p><code>${NSD_LB_GetCount} <i>listbox_HWND</i> <i>$output_variable</i></code></p>
<p>Retrieves the number of strings from a list box.</p>
<h3><a name="mref-lbselectstring"></a>NSD_LB_SelectString</h3>
<p><code>${NSD_LB_SelectString} <i>listbox_HWND</i> <i>string</i></code></p>
<p>Selects a string in a list box.</p>
<h3><a name="mref-lbgetselection">NSD_LB_GetSelection</a></h3>
<p><code>${NSD_LB_GetSelection} <i>listbox_HWND</i> <i>$output_variable</i></code></p>
<p>Retrieves the selected string from a list box. Returns an empty string if no string is selected.</p>
<h3><a name="mref-animopenfile">NSD_Anim_OpenFile</a></h3>
<p><code>${NSD_Anim_OpenFile} <i>anim_HWND</i> <i>avi_path</i></code></p>
<p>Opens the specified (silent) .AVI movie clip.</p>
<h3><a name="mref-animplay">NSD_Anim_Play</a></h3>
<p><code>${NSD_Anim_Play} <i>anim_HWND</i></code></p>
<p>Plays the movie clip repeatedly.</p>
<h3><a name="mref-animstop">NSD_Anim_Stop</a></h3>
<p><code>${NSD_Anim_Stop} <i>anim_HWND</i></code></p>
<p>Stops playback.</p>
<h3><a name="mref-trackgetpos">NSD_TrackBar_GetPos</a></h3>
<p><code>${NSD_TrackBar_GetPos} <i>track_HWND</i> <i>$output</i></code></p>
<h3><a name="mref-tracksetpos">NSD_TrackBar_SetPos</a></h3>
<p><code>${NSD_TrackBar_SetPos} <i>track_HWND</i> <i>pos</i></code></p>
<h3><a name="mref-tracksetrmin">NSD_TrackBar_SetRangeMin</a></h3>
<p><code>${NSD_TrackBar_SetRangeMin} <i>track_HWND</i> <i>minpos</i></code></p>
<h3><a name="mref-tracksetrmax">NSD_TrackBar_SetRangeMax</a></h3>
<p><code>${NSD_TrackBar_SetRangeMax} <i>track_HWND</i> <i>maxpos</i></code></p>
<h3><a name="mref-tracksetticfr">NSD_TrackBar_SetTicFreq</a></h3>
<p><code>${NSD_TrackBar_SetTicFreq} <i>track_HWND</i> <i>frequency</i></code></p>
<p>Sets the interval frequency for tick marks.</p>
<h3><a name="mref-udsetbuddy">NSD_UD_SetBuddy</a></h3>
<p><code>${NSD_UD_SetBuddy} <i>ud_HWND</i> <i>buddy_HWND</i></code></p>
<h3><a name="mref-udgetpos">NSD_UD_GetPos</a></h3>
<p><code>${NSD_UD_GetPos} <i>ud_HWND</i> <i>$output</i></code></p>
<h3><a name="mref-udsetpos">NSD_UD_SetPos</a></h3>
<p><code>${NSD_UD_SetPos} <i>ud_HWND</i> <i>pos</i></code></p>
<h3><a name="mref-udsetpackedrange">NSD_UD_SetPackedRange</a></h3>
<p><code>${NSD_UD_SetPackedRange} <i>ud_HWND</i> <i>packedrange</i></code></p>
<p>Sets the min-max range. Two signed 16-bit numbers packed into 32-bits.</p>
<h3><a name="mref-hkgethk">NSD_HK_GetHotKey</a></h3>
<p><code>${NSD_HK_GetHotKey} <i>hk_HWND</i> <i>$output</i></code></p>
<p>Bits 0..7 specify the virtual key code and bits 8..15 specify the HOTKEYF modifier flags.</p>
<h3><a name="mref-hksethk">NSD_HK_SetHotKey</a></h3>
<p><code>${NSD_HK_SetHotKey} <i>hk_HWND</i> <i>packedhotkey</i></code></p>
<h3><a name="mref-setimage"></a>NSD_SetImage</h3>
<p><code>${NSD_SetImage} <i>control_HWND</i> <i>image_path</i> <i>$output_variable</i></code></p>
<p>Loads a bitmap from <i>image_path</i> and displays it on <i>control_HWND</i> created by <a href="#mref-create">${NSD_CreateBitmap}</a>. The image handle is stored in <i>output_variable</i> and should be freed using <a href="#mref-freeimage">${NSD_FreeImage}</a> once no longer necessary.</p>
<p>The image must be extracted to the user's computer prior to calling this macro. A good place to extract images is $PLUGINSDIR.</p>
<blockquote><pre>!include nsDialogs.nsh
Name nsDialogs
OutFile nsDialogs.exe
Page custom nsDialogsImage
Page instfiles
Var Dialog
Var Image
Var ImageHandle
Function .onInit
InitPluginsDir
File /oname=$PLUGINSDIR\image.bmp "${NSISDIR}\Contrib\Graphics\Header\nsis-r.bmp"
FunctionEnd
Function nsDialogsImage
nsDialogs::Create 1018
Pop $Dialog
${If} $Dialog == error
Abort
${EndIf}
${NSD_CreateBitmap} 0 0 100% 100% ""
Pop $Image
${NSD_SetImage} $Image $PLUGINSDIR\image.bmp $ImageHandle
nsDialogs::Show
${NSD_FreeImage} $ImageHandle
FunctionEnd
Section
SectionEnd</pre></blockquote>
<h3><a name="mref-setsimage"></a>NSD_SetStretchedImage</h3>
<p><code>${NSD_SetStretchedImage} <i>control_HWND</i> <i>image_path</i> <i>$output_variable</i></code></p>
<p>Loads and displays a bitmap just like <a href="#mref-setimage">${NSD_SetImage}</a>, but stretched the image to fit the control.</p>
<h3><a name="mref-clearimage"></a>NSD_ClearImage</h3>
<p><code>${NSD_ClearImage} <i>control_HWND</i></code></p>
<p>Clears an image from a control.</p>
<h3><a name="mref-freeimage"></a>NSD_FreeImage</h3>
<p><code>${NSD_FreeImage} <i>image_handle</i></code></p>
<p>Frees an image handle previously loaded with <a href="#mref-setimage">${NSD_SetImage}</a> or <a href="#mref-setsimage">${NSD_SetStretchedImage}</a>.</p>
<h3><a name="mref-seticon"></a>NSD_SetIcon</h3>
<p><code>${NSD_SetIcon} <i>control_HWND</i> <i>image_path</i> <i>$output_variable</i></code></p>
<p>Same as <a href="#mref-setimage">${NSD_SetImage}</a>, but used for loading and setting an icon in a control created by <a href="#mref-create">${NSD_CreateIcon}</a>. The image handle is stored in <i>output_variable</i> and should be freed using <a href="#mref-freeicon">${NSD_FreeIcon}</a> once no longer necessary.</p>
<h3><a name="mref-seticonfrominstaller"></a>NSD_SetIconFromInstaller</h3>
<p><code>${NSD_SetIconFromInstaller} <i>control_HWND</i> <i>$output_variable</i></code></p>
<p>Loads the icon used in the installer and displays it on <i>control_HWND</i> created by <a href="#mref-create">${NSD_CreateIcon}</a>. The image handle is stored in <i>output_variable</i> and should be freed using <a href="#mref-freeicon">${NSD_FreeIcon}</a> once no longer necessary.</p>
<h3><a name="mref-clearicon"></a>NSD_ClearIcon</h3>
<p><code>${NSD_ClearIcon} <i>control_HWND</i></code></p>
<p>Clears an icon from a control.</p>
<h3><a name="mref-freeicon"></a>NSD_FreeIcon</h3>
<p><code>${NSD_FreeIcon} <i>icon_handle</i></code></p>
<p>Frees an icon handle previously loaded with <a href="#mref-seticon">${NSD_SetIcon}</a> or <a href="#mref-seticonfrominstaller">${NSD_SetIconFromInstaller}</a>.</p>
<h2><a name="faq"></a>FAQ</h2>
<div>
<ul>
<li>
<b>Q:</b> Can nsDialogs handle InstallOptions INI files?
<blockquote>
<p><b>A:</b> nsDialogs.nsh contains a function called <i>CreateDialogFromINI</i> that can create nsDialogs' dialog from an INI file. It can handle every type of control InstallOptions supports, but doesn't handle the flags or notifications. <i>Examples\nsDialogs\InstallOptions.nsi</i> shows a usage example of this function.</p>
</blockquote>
</li>
</ul>
</div>
</body>
</html>

View File

@ -0,0 +1,53 @@
nsExec
------
nsExec will execute command-line based programs and capture the output
without opening a dos box.
Usage
-----
nsExec::Exec [/OEM] [/TIMEOUT=x] path
Pop $0
-or-
nsExec::ExecToLog [/OEM] [/TIMEOUT=x] path
Pop $0
-or-
nsExec::ExecToStack [/OEM] [/TIMEOUT=x] path
Pop $0 ; Return
Pop $1 ; Output
All functions are the same except ExecToLog will print the output
to the log window and ExecToStack will push up to ${NSIS_MAX_STRLEN}
characters of output onto the stack after the return value.
Use the /OEM switch to convert the output text from OEM to ANSI.
The timeout value is optional. The timeout is the time in
milliseconds nsExec will wait for output. If output from the
process is received, the timeout value is reset and it will
again wait for more output using the timeout value. See Return
Value for how to check if there was a timeout.
To ensure that command are executed without problems on all windows versions,
is recommended to use the following syntax:
nsExec::ExecToStack [OPTIONS] '"PATH" param1 param2 paramN'
This way the application path may contain non 8.3 paths (with spaces)
Return Value
------------
If nsExec is unable to execute the process, it will return "error"
on the top of the stack, if the process timed out it will return
"timeout", else it will return the return code from the
executed process.
Copyright Info
--------------
Copyright (c) 2002 Robert Rainwater
Thanks to Justin Frankel and Amir Szekely