deprecate SetPluginUnload and /NOUNLOAD
plug-ins are now responsible to keeping themselves loaded using the new api git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@5855 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
d04cece9be
commit
5ac5b3f95b
24 changed files with 72 additions and 110 deletions
|
@ -158,7 +158,7 @@ Macros and conversion functions for InstallOptions
|
|||
|
||||
!macro INSTALLOPTIONS_INITDIALOG FILE
|
||||
|
||||
InstallOptions::initDialog /NOUNLOAD "$PLUGINSDIR\${FILE}"
|
||||
InstallOptions::initDialog "$PLUGINSDIR\${FILE}"
|
||||
|
||||
!macroend
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ Function ShowCustom
|
|||
; Initialise the dialog but don't show it yet
|
||||
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Test the right-to-left version?" IDNO +2
|
||||
WriteINIStr "$PLUGINSDIR\test.ini" "Settings" "RTL" "1"
|
||||
InstallOptions::initDialog /NOUNLOAD "$PLUGINSDIR\test.ini"
|
||||
InstallOptions::initDialog "$PLUGINSDIR\test.ini"
|
||||
; In this mode InstallOptions returns the window handle so we can use it
|
||||
Pop $0
|
||||
; Now show the dialog and wait for it to finish
|
||||
|
|
|
@ -90,7 +90,7 @@ FunctionEnd
|
|||
|
||||
Function GetLine
|
||||
push $TEMP1
|
||||
Math::Script /NOUNLOAD "mtsDL()"
|
||||
Math::Script "mtsDL()"
|
||||
pop $TEMP2
|
||||
pop $TEMP1
|
||||
FunctionEnd
|
||||
|
@ -98,13 +98,13 @@ FunctionEnd
|
|||
Function ExecuteScript
|
||||
!insertmacro MUI_INSTALLOPTIONS_READ $TEMP1 "MathTest.ini" "Field 2" "State"
|
||||
|
||||
Math::Script /NOUNLOAD "mtsTQ(s) (s = s(NS); #[s[0]=='$\"',s=s[1,]]; #[s[-1]=='$\"',s=s[,-2]]; NS = s)"
|
||||
Math::Script /NOUNLOAD "mtsP(s,e, p,i) (p=-1;i=0; #{(i<l(s))&&(p<0), #[s[i,i+l(e)-1]==e, p=i]; i++}; p)"
|
||||
Math::Script /NOUNLOAD "mtsDL(s) (s=s(NS); p=mtsP(s,'\r\n'); #[p>=0, (NS=s[p+4,]; NS=#[p>0,s[,p-1],'']), (NS='';NS=s)])"
|
||||
Math::Script "mtsTQ(s) (s = s(NS); #[s[0]=='$\"',s=s[1,]]; #[s[-1]=='$\"',s=s[,-2]]; NS = s)"
|
||||
Math::Script "mtsP(s,e, p,i) (p=-1;i=0; #{(i<l(s))&&(p<0), #[s[i,i+l(e)-1]==e, p=i]; i++}; p)"
|
||||
Math::Script "mtsDL(s) (s=s(NS); p=mtsP(s,'\r\n'); #[p>=0, (NS=s[p+4,]; NS=#[p>0,s[,p-1],'']), (NS='';NS=s)])"
|
||||
|
||||
push $TEMP1
|
||||
; remove ""
|
||||
Math::Script /NOUNLOAD "mtsTQ()"
|
||||
Math::Script "mtsTQ()"
|
||||
pop $TEMP1
|
||||
|
||||
; script at $TEMP1
|
||||
|
@ -114,7 +114,7 @@ Go:
|
|||
; get single line to $TEMP2
|
||||
Call GetLine
|
||||
; MessageBox MB_OK "'$TEMP2' '$TEMP1'"
|
||||
Math::Script /NOUNLOAD "$TEMP2"
|
||||
Math::Script "$TEMP2"
|
||||
goto Go
|
||||
End:
|
||||
Math::Script ""
|
||||
|
|
|
@ -256,9 +256,9 @@ Finish page (implemented using nsDialogs)
|
|||
!endif
|
||||
|
||||
;Create dialog
|
||||
nsDialogs::Create /NOUNLOAD 1044
|
||||
nsDialogs::Create 1044
|
||||
Pop $mui.FinishPage
|
||||
nsDialogs::SetRTL /NOUNLOAD $(^RTL)
|
||||
nsDialogs::SetRTL $(^RTL)
|
||||
SetCtlColors $mui.FinishPage "" "${MUI_BGCOLOR}"
|
||||
|
||||
;Image control
|
||||
|
|
|
@ -117,15 +117,15 @@ Start Menu folder page
|
|||
|
||||
${if} $(^RTL) == "0"
|
||||
!ifndef MUI_STARTMENUPAGE_NODISABLE
|
||||
StartMenu::Init /NOUNLOAD /noicon /autoadd /text "${MUI_STARTMENUPAGE_TEXT_TOP}" /lastused "${MUI_STARTMENUPAGE_VARIABLE}" /checknoshortcuts "${MUI_STARTMENUPAGE_TEXT_CHECKBOX}" "${MUI_STARTMENUPAGE_DEFAULTFOLDER}"
|
||||
StartMenu::Init /noicon /autoadd /text "${MUI_STARTMENUPAGE_TEXT_TOP}" /lastused "${MUI_STARTMENUPAGE_VARIABLE}" /checknoshortcuts "${MUI_STARTMENUPAGE_TEXT_CHECKBOX}" "${MUI_STARTMENUPAGE_DEFAULTFOLDER}"
|
||||
!else
|
||||
StartMenu::Init /NOUNLOAD /noicon /autoadd /text "${MUI_STARTMENUPAGE_TEXT_TOP}" /lastused "${MUI_STARTMENUPAGE_VARIABLE}" "${MUI_STARTMENUPAGE_DEFAULTFOLDER}"
|
||||
StartMenu::Init /noicon /autoadd /text "${MUI_STARTMENUPAGE_TEXT_TOP}" /lastused "${MUI_STARTMENUPAGE_VARIABLE}" "${MUI_STARTMENUPAGE_DEFAULTFOLDER}"
|
||||
!endif
|
||||
${else}
|
||||
!ifndef MUI_STARTMENUPAGE_NODISABLE
|
||||
StartMenu::Init /NOUNLOAD /rtl /noicon /autoadd /text "${MUI_STARTMENUPAGE_TEXT_TOP}" /lastused "${MUI_STARTMENUPAGE_VARIABLE}" /checknoshortcuts "${MUI_STARTMENUPAGE_TEXT_CHECKBOX}" "${MUI_STARTMENUPAGE_DEFAULTFOLDER}"
|
||||
StartMenu::Init /rtl /noicon /autoadd /text "${MUI_STARTMENUPAGE_TEXT_TOP}" /lastused "${MUI_STARTMENUPAGE_VARIABLE}" /checknoshortcuts "${MUI_STARTMENUPAGE_TEXT_CHECKBOX}" "${MUI_STARTMENUPAGE_DEFAULTFOLDER}"
|
||||
!else
|
||||
StartMenu::Init /NOUNLOAD /rtl /noicon /autoadd /text "${MUI_STARTMENUPAGE_TEXT_TOP}" /lastused "${MUI_STARTMENUPAGE_VARIABLE}" "${MUI_STARTMENUPAGE_DEFAULTFOLDER}"
|
||||
StartMenu::Init /rtl /noicon /autoadd /text "${MUI_STARTMENUPAGE_TEXT_TOP}" /lastused "${MUI_STARTMENUPAGE_VARIABLE}" "${MUI_STARTMENUPAGE_DEFAULTFOLDER}"
|
||||
!endif
|
||||
${endif}
|
||||
|
||||
|
|
|
@ -118,9 +118,9 @@ Welcome page (implemented using nsDialogs)
|
|||
!insertmacro MUI_PAGE_FUNCTION_CUSTOM PRE
|
||||
|
||||
;Create dialog
|
||||
nsDialogs::Create /NOUNLOAD 1044
|
||||
nsDialogs::Create 1044
|
||||
Pop $mui.WelcomePage
|
||||
nsDialogs::SetRTL /NOUNLOAD $(^RTL)
|
||||
nsDialogs::SetRTL $(^RTL)
|
||||
SetCtlColors $mui.WelcomePage "" "${MUI_BGCOLOR}"
|
||||
|
||||
;Image control
|
||||
|
|
|
@ -1405,16 +1405,16 @@ Var MUI_TEMP2
|
|||
|
||||
StrCmp $(^RTL) 0 mui.startmenu_nortl
|
||||
!ifndef MUI_STARTMENUPAGE_NODISABLE
|
||||
StartMenu::Init /NOUNLOAD /rtl /noicon /autoadd /text "${MUI_STARTMENUPAGE_TEXT_TOP}" /lastused "${MUI_STARTMENUPAGE_VARIABLE}" /checknoshortcuts "${MUI_STARTMENUPAGE_TEXT_CHECKBOX}" "${MUI_STARTMENUPAGE_DEFAULTFOLDER}"
|
||||
StartMenu::Init /rtl /noicon /autoadd /text "${MUI_STARTMENUPAGE_TEXT_TOP}" /lastused "${MUI_STARTMENUPAGE_VARIABLE}" /checknoshortcuts "${MUI_STARTMENUPAGE_TEXT_CHECKBOX}" "${MUI_STARTMENUPAGE_DEFAULTFOLDER}"
|
||||
!else
|
||||
StartMenu::Init /NOUNLOAD /rtl /noicon /autoadd /text "${MUI_STARTMENUPAGE_TEXT_TOP}" /lastused "${MUI_STARTMENUPAGE_VARIABLE}" "${MUI_STARTMENUPAGE_DEFAULTFOLDER}"
|
||||
StartMenu::Init /rtl /noicon /autoadd /text "${MUI_STARTMENUPAGE_TEXT_TOP}" /lastused "${MUI_STARTMENUPAGE_VARIABLE}" "${MUI_STARTMENUPAGE_DEFAULTFOLDER}"
|
||||
!endif
|
||||
Goto mui.startmenu_initdone
|
||||
mui.startmenu_nortl:
|
||||
!ifndef MUI_STARTMENUPAGE_NODISABLE
|
||||
StartMenu::Init /NOUNLOAD /noicon /autoadd /text "${MUI_STARTMENUPAGE_TEXT_TOP}" /lastused "${MUI_STARTMENUPAGE_VARIABLE}" /checknoshortcuts "${MUI_STARTMENUPAGE_TEXT_CHECKBOX}" "${MUI_STARTMENUPAGE_DEFAULTFOLDER}"
|
||||
StartMenu::Init /noicon /autoadd /text "${MUI_STARTMENUPAGE_TEXT_TOP}" /lastused "${MUI_STARTMENUPAGE_VARIABLE}" /checknoshortcuts "${MUI_STARTMENUPAGE_TEXT_CHECKBOX}" "${MUI_STARTMENUPAGE_DEFAULTFOLDER}"
|
||||
!else
|
||||
StartMenu::Init /NOUNLOAD /noicon /autoadd /text "${MUI_STARTMENUPAGE_TEXT_TOP}" /lastused "${MUI_STARTMENUPAGE_VARIABLE}" "${MUI_STARTMENUPAGE_DEFAULTFOLDER}"
|
||||
StartMenu::Init /noicon /autoadd /text "${MUI_STARTMENUPAGE_TEXT_TOP}" /lastused "${MUI_STARTMENUPAGE_VARIABLE}" "${MUI_STARTMENUPAGE_DEFAULTFOLDER}"
|
||||
!endif
|
||||
mui.startmenu_initdone:
|
||||
|
||||
|
|
|
@ -426,7 +426,7 @@ Modern UI 2 page
|
|||
!insertmacro MUI_PAGE_FUNCTION_CUSTOM PRE
|
||||
!insertmacro MUI_HEADER_TEXT_PAGE $(MULTIUSER_TEXT_INSTALLMODE_TITLE) $(MULTIUSER_TEXT_INSTALLMODE_SUBTITLE)
|
||||
|
||||
nsDialogs::Create /NOUNLOAD 1018
|
||||
nsDialogs::Create 1018
|
||||
Pop $MultiUser.InstallModePage
|
||||
|
||||
${NSD_CreateLabel} 0u 0u 300u 20u "${MULTIUSER_INSTALLMODEPAGE_TEXT_TOP}"
|
||||
|
|
|
@ -128,7 +128,6 @@ System::<b>Free</b> $0
|
|||
<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>
|
||||
<p>Note that the System's private stack will be lost when the System plug-in is unloaded from NSIS. If you want to use it, you must keep the System plug-in loaded into NSIS. To do that, use SetPluginUnload or the /NOUNLOAD flag in the NSIS script.</p>
|
||||
<h4>Usage Examples</h4>
|
||||
<blockquote><pre>
|
||||
StrCpy $0 "test"
|
||||
|
@ -143,7 +142,7 @@ DetailPrint "$2 = $R2"
|
|||
</pre></blockquote>
|
||||
<blockquote><pre>
|
||||
StrCpy $3 "test"
|
||||
System::<b>Store</b> /NOUNLOAD "s"
|
||||
System::<b>Store</b> "s"
|
||||
StrCpy $3 "another test"
|
||||
System::<b>Store</b> "l"
|
||||
DetailPrint $3
|
||||
|
@ -380,8 +379,7 @@ DetailPrint "UseCallback passed ($0, $1) to the callback"
|
|||
|
||||
<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>SetPluginUnload alwaysoff
|
||||
System::Get "(i .r0, i .r1) isR0"
|
||||
<blockquote><pre>System::Get "(i .r0, i .r1) isR0"
|
||||
Pop $0
|
||||
System::Call "dll::UseCallback(k r0)"
|
||||
loop:
|
||||
|
@ -392,7 +390,6 @@ loop:
|
|||
System::Call $0 # tell system to return from the callback
|
||||
Goto loop
|
||||
done:
|
||||
SetPluginUnload manual
|
||||
System::Free $0
|
||||
</pre></blockquote>
|
||||
|
||||
|
@ -405,7 +402,6 @@ System::Free $0
|
|||
<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>Always remember to use NSIS's /NOUNLOAD switch or SetPluginUnload when working with callbacks. The System plug-in will not be able to process the callback calls right if it's unloaded.</li>
|
||||
<li>If a function can't be found, an `A' 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>
|
||||
|
@ -512,8 +508,7 @@ System::<b>Call</b> "MyDLL::MyFunc(i 5) ? u"
|
|||
Delete $PLUGINSDIR\MyDLL.dll
|
||||
</pre></blockquote>
|
||||
<blockquote><pre>
|
||||
<a name="callback"></a>SetPluginUnload alwaysoff
|
||||
System::<b>Get</b> "(i.r1, i) iss"
|
||||
<a name="callback"></a>System::<b>Get</b> "(i.r1, i) iss"
|
||||
Pop $R0
|
||||
System::<b>Call</b> "user32::EnumChildWindows(i $HWNDPARENT, k R0, i) i.s"
|
||||
loop:
|
||||
|
@ -527,7 +522,6 @@ loop:
|
|||
System::<b>Call</b> "$R0"
|
||||
Goto loop
|
||||
done:
|
||||
SetPluginUnload manual
|
||||
System::Free $R0
|
||||
</pre></blockquote>
|
||||
<blockquote><pre>
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
|
||||
Name "System Plugin Example"
|
||||
OutFile "System.exe"
|
||||
SetPluginUnload alwaysoff
|
||||
|
||||
!include "SysFunc.nsh"
|
||||
|
||||
|
@ -132,11 +131,6 @@ enumex: ; End of drives or user cancel
|
|||
pop $0
|
||||
MessageBox MB_OK "Splash (callbacks) demo result $R0"
|
||||
|
||||
; last plugin call must not have /NOUNLOAD so NSIS will be able to delete the temporary DLL
|
||||
SetPluginUnload manual
|
||||
; do nothing
|
||||
System::Free 0
|
||||
|
||||
SectionEnd
|
||||
|
||||
; eof
|
||||
|
|
|
@ -87,12 +87,6 @@ This command sets the overwrite flag which is used by the \R{file}{File} command
|
|||
\c File program.cfg # config file we don't want to overwrite
|
||||
\c SetOverwrite on
|
||||
|
||||
\S2{setpluginunload} SetPluginUnload
|
||||
|
||||
\c \\<b\\>manual\\</b\\>|alwaysoff
|
||||
|
||||
This command sets the unload plug-in flag which is by \R{callinstdll}{CallInstDLL} and \R{plugindlls}{plug-in calls}. Setting this to always off will behave as if you have added the /NOUNLOAD to every CallInstDLL and plug-in call. Setting this to manual will only not unload if you specifically use /NOUNLOAD.
|
||||
|
||||
\S1{versioninfo} Version Information
|
||||
|
||||
\S2{viaddversionkey} VIAddVersionKey
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
\S2{callinstdll} CallInstDLL
|
||||
|
||||
\c dllfile [/NOUNLOAD] function_name
|
||||
\c dllfile function_name
|
||||
|
||||
Calls a function named \e{function_name} inside a NSIS extension DLL, a plug-in. See the \L{../Examples/Plugin/}{example plugin} for how to make one. Extension DLLs can access the stack and variables. Use /NOUNLOAD to force the installer to leave the DLL loaded. Note: To automatically extract and call plug-in DLLs, use a plug-in command instead of CallInstDLL.
|
||||
Calls a function named \e{function_name} inside a NSIS extension DLL, a plug-in. See the \L{../Examples/Plugin/}{example plugin} for how to make one. Extension DLLs can access the stack and variables. Note: To automatically extract and call plug-in DLLs, use a plug-in command instead of CallInstDLL.
|
||||
|
||||
\c Push "a parameter"
|
||||
\c Push "another parameter"
|
||||
|
|
|
@ -863,8 +863,8 @@ Call functions:
|
|||
\c !include "FileFunc.nsh"
|
||||
\c
|
||||
\c Section
|
||||
\c Banner::show /NOUNLOAD "Starting..."
|
||||
\c Banner::getWindow /NOUNLOAD
|
||||
\c Banner::show "Starting..."
|
||||
\c Banner::getWindow
|
||||
\c Pop $R1
|
||||
\c ${Locate} "$WINDIR" "/L=F /M=*.* /B=1" "LocateCallback"
|
||||
\c Banner::destroy
|
||||
|
|
|
@ -2093,7 +2093,7 @@ Released on February 7th, 2004
|
|||
|
||||
\b New and improved utilities: \L{../Docs/makensisw/Readme.txt}{MakeNSISw}, NSIS Menu (NSIS.exe), NSIS Update (Bin\\NSIS Update.exe) and zip2exe (Bin\\zip2exe.exe)
|
||||
|
||||
\b New commands: \R{addplugindir}{!addplugindir}, \R{echo}{!echo}, \R{ifmacrodef}{!ifmacrodef}, \R{ifmacrondef}{!ifmacrondef}, \R{verbose}{!verbose}, \R{aaddbrandingimage}{AddBrandingImage}, \R{asetallowskipfiles}{AllowSkipFiles}, \R{achangeui}{ChangeUI}, \R{acheckbitmap}{CheckBitmap}, \R{createfont}{CreateFont}, \R{adirvar}{DirVar}, \R{adirverify}{DirVerify}, \R{enablewindow}{EnableWindow}, \R{afilebufsize}{FileBufSize}, \R{flushini}{FlushINI}, \R{sgetcurinsttype}{GetCurInstType}, \R{getdlgitem}{GetDlgItem}, \R{getinstdirerror}{GetInstDirError}, \R{ifabort}{IfAbort}, \R{ifsilent}{IfSilent}, \R{initpluginsdir}{InitPluginsDir}, \R{sinsttypegettext}{InstTypeGetText}, \R{sinsttypesettext}{InstTypeSetText}, \R{langstring}{LangString}, \R{alicensebkcolor}{LicenseBkColor}, \R{alicenseforceselection}{LicenseForceSelection}, \R{licenselangstring}{LicenseLangString}, \R{loadlanguagefile}{LoadLanguageFile}, LockWindow, \R{page}{Page}, \R{pageex}{PageEx}, \R{reservefile}{ReserveFile}, \R{sectiongetinsttypes}{SectionGetInstTypes}, \R{ssectiongetsize}{SectionGetSize}, \R{sectionsetinsttypes}{SectionSetInstTypes}, \R{ssectionsetsize}{SectionSetSize}, \R{setbrandingimage}{SetBrandingImage}, SetCompressionLevel, \R{asetcompressor}{SetCompressor}, \R{asetcompressordictsize}{SetCompressorDictSize}, \R{setctlcolors}{SetCtlColors}, \R{ssetcurinsttype}{SetCurInstType}, \R{setpluginunload}{SetPluginUnload}, \R{setsilent}{SetSilent}, \R{showwindow}{ShowWindow}, SubSection (replaced by \R{ssectiongroup}{SectionGroup}), SubSectionEnd (replaced by \R{ssectiongroupend}{SectionGroupEnd}), \R{var}{Var}, \R{viaddversionkey}{VIAddVersionKey}, \R{viproductversion}{VIProductVersion} and \R{axpstyle}{XPStyle}
|
||||
\b New commands: \R{addplugindir}{!addplugindir}, \R{echo}{!echo}, \R{ifmacrodef}{!ifmacrodef}, \R{ifmacrondef}{!ifmacrondef}, \R{verbose}{!verbose}, \R{aaddbrandingimage}{AddBrandingImage}, \R{asetallowskipfiles}{AllowSkipFiles}, \R{achangeui}{ChangeUI}, \R{acheckbitmap}{CheckBitmap}, \R{createfont}{CreateFont}, \R{adirvar}{DirVar}, \R{adirverify}{DirVerify}, \R{enablewindow}{EnableWindow}, \R{afilebufsize}{FileBufSize}, \R{flushini}{FlushINI}, \R{sgetcurinsttype}{GetCurInstType}, \R{getdlgitem}{GetDlgItem}, \R{getinstdirerror}{GetInstDirError}, \R{ifabort}{IfAbort}, \R{ifsilent}{IfSilent}, \R{initpluginsdir}{InitPluginsDir}, \R{sinsttypegettext}{InstTypeGetText}, \R{sinsttypesettext}{InstTypeSetText}, \R{langstring}{LangString}, \R{alicensebkcolor}{LicenseBkColor}, \R{alicenseforceselection}{LicenseForceSelection}, \R{licenselangstring}{LicenseLangString}, \R{loadlanguagefile}{LoadLanguageFile}, LockWindow, \R{page}{Page}, \R{pageex}{PageEx}, \R{reservefile}{ReserveFile}, \R{sectiongetinsttypes}{SectionGetInstTypes}, \R{ssectiongetsize}{SectionGetSize}, \R{sectionsetinsttypes}{SectionSetInstTypes}, \R{ssectionsetsize}{SectionSetSize}, \R{setbrandingimage}{SetBrandingImage}, SetCompressionLevel, \R{asetcompressor}{SetCompressor}, \R{asetcompressordictsize}{SetCompressorDictSize}, \R{setctlcolors}{SetCtlColors}, \R{ssetcurinsttype}{SetCurInstType}, SetPluginUnload, \R{setsilent}{SetSilent}, \R{showwindow}{ShowWindow}, SubSection (replaced by \R{ssectiongroup}{SectionGroup}), SubSectionEnd (replaced by \R{ssectiongroupend}{SectionGroupEnd}), \R{var}{Var}, \R{viaddversionkey}{VIAddVersionKey}, \R{viproductversion}{VIProductVersion} and \R{axpstyle}{XPStyle}
|
||||
|
||||
\b Removed commands: DirShow, DisabledBitmap, EnabledBitmap and SectionDivider
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ The abilities of the NSIS scripting language can be extended by utilising functi
|
|||
|
||||
When the NSIS compiler starts it scans the plug-ins directory for DLLs and makes a list of the plug-ins found and their exported functions. During compilation if a sequence such as fred::flintstone is encountered where the compiler expected to find a language keyword the compiler will look through this list. If a list entry specifies that fred.dll exports function flintstone NSIS will pack the fred.dll file into the created installer binary.
|
||||
|
||||
During execution of a plug-in command NSIS will unpack the necessary DLL to a temporary folder ($PLUGINSDIR), push all of the arguments specified (right-to-left order), and then execute the DLL function. If the /NOUNLOAD option is specified the DLL will not be unloaded until the installer exits or the next time you use the DLL without /NOUNLOAD. Please note that the last call to the plug-in must not have the /NOUNLOAD flag or the plug-in will not be deleted from $PLUGINSDIR, thus garbage will be left on the user's machine.
|
||||
During execution of a plug-in command NSIS will unpack the necessary DLL to a temporary folder ($PLUGINSDIR), push all of the arguments specified (right-to-left order), and then execute the DLL function.
|
||||
|
||||
\S1{usingplug} Using Plug-in Commands
|
||||
|
||||
|
@ -14,14 +14,6 @@ A plug-in call looks like this:
|
|||
|
||||
All parameters are pushed onto the stack (in this case, the plug-in function only needs one parameter). Some plug-in commands may not need any parameters on the stack, others might require more of them. To use a plug-in command you will need to read the documentation for the plug-in so that you know what parameters its functions require.
|
||||
|
||||
\S1{disablingplug} Disabling Plug-in Unloading
|
||||
|
||||
If you don't want to unload the DLL after calling a function, use /NOUNLOAD as the first parameter. For example:
|
||||
|
||||
\c dll::function /NOUNLOAD "param"
|
||||
|
||||
You can also use \R{setpluginunload}{SetPluginUnload} alwaysoff to avoid writing /NOUNLOAD each and every time you use the same plug-in.
|
||||
|
||||
\S1{calldiskplug} Calling plug-ins manually
|
||||
|
||||
If you want to call a plug-in that is stored on user's hard drive or somewhere else, use \R{callinstdll}{CallInstDLL}. Almost all plug-ins provide installer functionality, so using plug-in commands is way easier. Using \R{callinstdll}{CallInstDLL} can be useful when you have created plug-ins that should be linked to a certain version of your application and are being copied to the installation folder.
|
||||
|
|
|
@ -165,16 +165,12 @@ i.e. It takes a text variable, a pointer to int, and returns an int value.
|
|||
\\<u\\>Using the external dll function\\</u\\> \\<br\\>
|
||||
Now that we've sorted out what the function does, and how it maps to the System.dll format, we can use the function in a NSIS script.
|
||||
|
||||
First, it is recommended to turn 'PluginUnload' off before making multiple calls to System.dll. According to Brainsucker (and others), this will speed up execution of the installer package.
|
||||
First, you have to change the output directory to that where the DLL you want to use is. It may also work if the DLL is on the system path, but this hasn't been tested.
|
||||
|
||||
Second, you have to change the output directory to that where the DLL you want to use is. It may also work if the DLL is on the system path, but this hasn't been tested.
|
||||
|
||||
The following code fragment will install 'condmgr.dll' to a temporary directory, execute the CmGetHotSyncExecPath function, display returned data and finally unload the System.dll plug-in.
|
||||
The following code fragment will install 'condmgr.dll' to a temporary directory, execute the CmGetHotSyncExecPath function and display returned data.
|
||||
Save this script
|
||||
|
||||
\c ; **** snip ****
|
||||
\c SetPluginUnload alwaysoff
|
||||
\c
|
||||
\c Function loadDll
|
||||
\c
|
||||
\c SetOutPath $TEMP\eInspect ; create temp directory
|
||||
|
@ -185,12 +181,6 @@ Save this script
|
|||
\c DetailPrint "Path length: $1"
|
||||
\c DetailPrint "Return value: $2"
|
||||
\c
|
||||
\c ; last plug-in call must not have /NOUNLOAD so NSIS will be able to delete
|
||||
\c ; the temporary DLL
|
||||
\c
|
||||
\c SetPluginUnload manual
|
||||
\c ; do nothing (but let the installer unload the System dll)
|
||||
\c System::Free 0
|
||||
\c FunctionEnd
|
||||
\c ; **** snip ****
|
||||
|
||||
|
@ -326,7 +316,6 @@ I wrote this script to help rpetges in \W{http://forums.winamp.com/showthread.ph
|
|||
\c StrCpy $1 ""
|
||||
\c StrCpy $2 ""
|
||||
\c StrCpy $3 ""
|
||||
\c SetPluginUnload alwaysoff
|
||||
\c System::Call "${RegOpenKeyEx}(${ROOT_KEY}, '${SUB_KEY}', \
|
||||
\c 0, ${KEY_QUERY_VALUE}|${KEY_ENUMERATE_SUB_KEYS}, .r0) .r3"
|
||||
\c
|
||||
|
@ -392,8 +381,7 @@ I wrote this script to help rpetges in \W{http://forums.winamp.com/showthread.ph
|
|||
\c System::Call "${RegCloseKey}(r0)"
|
||||
\c
|
||||
\c noClose:
|
||||
\c
|
||||
\c SetPluginUnload manual
|
||||
\c
|
||||
\c SectionEnd
|
||||
|
||||
written by KiCHiK
|
||||
|
|
|
@ -48,7 +48,7 @@ Var DIRSTATE1
|
|||
Page Custom ShowCustom LeaveCustom
|
||||
|
||||
Function ShowCustom
|
||||
InstallOptions::initDialog /NOUNLOAD "$INI"
|
||||
InstallOptions::initDialog "$INI"
|
||||
Pop $hwnd
|
||||
GetDlgItem $1 $HWND 1201
|
||||
ShowWindow $1 0
|
||||
|
|
|
@ -45,7 +45,7 @@ Var FILERECODE2
|
|||
Page Custom ShowCustom LeaveCustom
|
||||
|
||||
Function ShowCustom
|
||||
InstallOptions::initDialog /NOUNLOAD "$INI"
|
||||
InstallOptions::initDialog "$INI"
|
||||
Pop $hwnd
|
||||
GetDlgItem $0 $HWND 1206
|
||||
ShowWindow $0 0
|
||||
|
|
|
@ -21,7 +21,7 @@ Var STATE
|
|||
Page Custom ShowCustom LeaveCustom
|
||||
|
||||
Function ShowCustom
|
||||
InstallOptions::initDialog /NOUNLOAD "$INI"
|
||||
InstallOptions::initDialog "$INI"
|
||||
Pop $hwnd
|
||||
InstallOptions::show
|
||||
Pop $0
|
||||
|
|
|
@ -883,7 +883,7 @@ Function PageReinstall
|
|||
Abort
|
||||
${EndIf}
|
||||
|
||||
nsDialogs::Create /NOUNLOAD 1018
|
||||
nsDialogs::Create 1018
|
||||
Pop $R4
|
||||
|
||||
${NSD_CreateLabel} 0 0 100% 24u $R1
|
||||
|
|
|
@ -746,7 +746,7 @@ RefreshShellIcons
|
|||
StrCmp $6 '' +2
|
||||
IntCmp $R6 $6 0 0 FileFunc_GetSize_findnext
|
||||
IntOp $R4 $R4 + 1
|
||||
System::Int64Op /NOUNLOAD $R3 + $R6
|
||||
System::Int64Op $R3 + $R6
|
||||
Pop $R3
|
||||
|
||||
FileFunc_GetSize_findnext:
|
||||
|
@ -756,7 +756,7 @@ RefreshShellIcons
|
|||
|
||||
FileFunc_GetSize_show:
|
||||
StrCmp $5$6 '' FileFunc_GetSize_nosize
|
||||
System::Int64Op /NOUNLOAD $R3 / $1
|
||||
System::Int64Op $R3 / $1
|
||||
Pop $9
|
||||
DetailPrint 'Size:$9 $2 Files:$R4 Folders:$R5'
|
||||
goto FileFunc_GetSize_subdir
|
||||
|
@ -910,13 +910,13 @@ RefreshShellIcons
|
|||
StrCpy $6 1073741824
|
||||
|
||||
FileFunc_DriveSpace_getspace:
|
||||
System::Call /NOUNLOAD 'kernel32::GetDiskFreeSpaceExA(t, *l, *l, *l)i(r0,.r2,.r3,.)'
|
||||
System::Call 'kernel32::GetDiskFreeSpaceExA(t, *l, *l, *l)i(r0,.r2,.r3,.)'
|
||||
|
||||
StrCmp $5 T 0 +3
|
||||
StrCpy $0 $3
|
||||
goto FileFunc_DriveSpace_getsize
|
||||
StrCmp $5 O 0 +4
|
||||
System::Int64Op /NOUNLOAD $3 - $2
|
||||
System::Int64Op $3 - $2
|
||||
Pop $0
|
||||
goto FileFunc_DriveSpace_getsize
|
||||
StrCmp $5 F 0 +2
|
||||
|
@ -968,9 +968,9 @@ RefreshShellIcons
|
|||
Push $8
|
||||
Push $9
|
||||
|
||||
System::Alloc /NOUNLOAD 1024
|
||||
System::Alloc 1024
|
||||
Pop $2
|
||||
System::Call /NOUNLOAD 'kernel32::GetLogicalDriveStringsA(i,i) i(1024, r2)'
|
||||
System::Call 'kernel32::GetLogicalDriveStringsA(i,i) i(1024, r2)'
|
||||
|
||||
StrCmp $0 ALL FileFunc_GetDrives_drivestring
|
||||
StrCmp $0 '' 0 FileFunc_GetDrives_typeset
|
||||
|
@ -1007,10 +1007,10 @@ RefreshShellIcons
|
|||
StrCpy $3 $2
|
||||
|
||||
FileFunc_GetDrives_enumok:
|
||||
System::Call /NOUNLOAD 'kernel32::lstrlenA(t) i(i r3) .r4'
|
||||
System::Call 'kernel32::lstrlenA(t) i(i r3) .r4'
|
||||
StrCmp $4$0 '0ALL' FileFunc_GetDrives_enumex
|
||||
StrCmp $4 0 FileFunc_GetDrives_typeset
|
||||
System::Call /NOUNLOAD 'kernel32::GetDriveTypeA(t) i(i r3) .r5'
|
||||
System::Call 'kernel32::GetDriveTypeA(t) i(i r3) .r5'
|
||||
|
||||
StrCmp $0 ALL +2
|
||||
StrCmp $5 $6 FileFunc_GetDrives_letter FileFunc_GetDrives_enumnext
|
||||
|
@ -1030,7 +1030,7 @@ RefreshShellIcons
|
|||
StrCpy $8 RAM
|
||||
|
||||
FileFunc_GetDrives_letter:
|
||||
System::Call /NOUNLOAD '*$3(&t1024 .r9)'
|
||||
System::Call '*$3(&t1024 .r9)'
|
||||
|
||||
Push $0
|
||||
Push $1
|
||||
|
@ -1110,23 +1110,23 @@ RefreshShellIcons
|
|||
|
||||
FileFunc_GetTime_getfile:
|
||||
IfFileExists $0 0 FileFunc_GetTime_error
|
||||
System::Call /NOUNLOAD '*(i,l,l,l,i,i,i,i,&t260,&t14) i .r6'
|
||||
System::Call /NOUNLOAD 'kernel32::FindFirstFileA(t,i)i(r0,r6) .r2'
|
||||
System::Call /NOUNLOAD 'kernel32::FindClose(i)i(r2)'
|
||||
System::Call '*(i,l,l,l,i,i,i,i,&t260,&t14) i .r6'
|
||||
System::Call 'kernel32::FindFirstFileA(t,i)i(r0,r6) .r2'
|
||||
System::Call 'kernel32::FindClose(i)i(r2)'
|
||||
|
||||
FileFunc_GetTime_gettime:
|
||||
System::Call /NOUNLOAD '*(&i2,&i2,&i2,&i2,&i2,&i2,&i2,&i2) i .r7'
|
||||
System::Call '*(&i2,&i2,&i2,&i2,&i2,&i2,&i2,&i2) i .r7'
|
||||
StrCmp $1 'L' 0 FileFunc_GetTime_systemtime
|
||||
System::Call /NOUNLOAD 'kernel32::GetLocalTime(i)i(r7)'
|
||||
System::Call 'kernel32::GetLocalTime(i)i(r7)'
|
||||
goto FileFunc_GetTime_convert
|
||||
FileFunc_GetTime_systemtime:
|
||||
StrCmp $1 'LS' 0 FileFunc_GetTime_filetime
|
||||
System::Call /NOUNLOAD 'kernel32::GetSystemTime(i)i(r7)'
|
||||
System::Call 'kernel32::GetSystemTime(i)i(r7)'
|
||||
goto FileFunc_GetTime_convert
|
||||
|
||||
FileFunc_GetTime_filetime:
|
||||
System::Call /NOUNLOAD '*$6(i,l,l,l,i,i,i,i,&t260,&t14)i(,.r4,.r3,.r2)'
|
||||
System::Free /NOUNLOAD $6
|
||||
System::Call '*$6(i,l,l,l,i,i,i,i,&t260,&t14)i(,.r4,.r3,.r2)'
|
||||
System::Free $6
|
||||
StrCmp $1 'A' 0 +3
|
||||
StrCpy $2 $3
|
||||
goto FileFunc_GetTime_tolocal
|
||||
|
@ -1144,12 +1144,12 @@ RefreshShellIcons
|
|||
goto FileFunc_GetTime_tosystem
|
||||
|
||||
FileFunc_GetTime_tolocal:
|
||||
System::Call /NOUNLOAD 'kernel32::FileTimeToLocalFileTime(*l,*l)i(r2,.r3)'
|
||||
System::Call 'kernel32::FileTimeToLocalFileTime(*l,*l)i(r2,.r3)'
|
||||
FileFunc_GetTime_tosystem:
|
||||
System::Call /NOUNLOAD 'kernel32::FileTimeToSystemTime(*l,i)i(r3,r7)'
|
||||
System::Call 'kernel32::FileTimeToSystemTime(*l,i)i(r3,r7)'
|
||||
|
||||
FileFunc_GetTime_convert:
|
||||
System::Call /NOUNLOAD '*$7(&i2,&i2,&i2,&i2,&i2,&i2,&i2,&i2)i(.r5,.r6,.r4,.r0,.r3,.r2,.r1,)'
|
||||
System::Call '*$7(&i2,&i2,&i2,&i2,&i2,&i2,&i2,&i2)i(.r5,.r6,.r4,.r0,.r3,.r2,.r1,)'
|
||||
System::Free $7
|
||||
|
||||
IntCmp $0 9 0 0 +2
|
||||
|
@ -1401,7 +1401,7 @@ RefreshShellIcons
|
|||
Push $0
|
||||
Push $1
|
||||
Push $2
|
||||
System::Call /NOUNLOAD 'kernel32::GetModuleFileNameA(i 0, t .r0, i 1024)'
|
||||
System::Call 'kernel32::GetModuleFileNameA(i 0, t .r0, i 1024)'
|
||||
System::Call 'kernel32::GetLongPathNameA(t r0, t .r1, i 1024)i .r2'
|
||||
StrCmp $2 error +2
|
||||
StrCpy $0 $1
|
||||
|
|
|
@ -1044,15 +1044,15 @@ TrimNewLines
|
|||
FileSeek $3 0 END $6
|
||||
IntOp $6 $6 - $5
|
||||
|
||||
System::Alloc /NOUNLOAD $6
|
||||
System::Alloc $6
|
||||
Pop $0
|
||||
FileSeek $3 $5 SET
|
||||
System::Call /NOUNLOAD 'kernel32::ReadFile(i r3, i r0, i $6, t.,)'
|
||||
System::Call 'kernel32::ReadFile(i r3, i r0, i $6, t.,)'
|
||||
FileSeek $3 $4 SET
|
||||
StrCmp${_TEXTFUNC_S} $2 '' +2
|
||||
FileWrite $3 '$1$2$\r$\n'
|
||||
System::Call /NOUNLOAD 'kernel32::WriteFile(i r3, i r0, i $6, t.,)'
|
||||
System::Call /NOUNLOAD 'kernel32::SetEndOfFile(i r3)'
|
||||
System::Call 'kernel32::WriteFile(i r3, i r0, i $6, t.,)'
|
||||
System::Call 'kernel32::SetEndOfFile(i r3)'
|
||||
System::Free $0
|
||||
StrCmp${_TEXTFUNC_S} $2 '' +3
|
||||
StrCpy $0 CHANGED
|
||||
|
@ -1154,13 +1154,13 @@ TrimNewLines
|
|||
|
||||
FileOpen $2 $0 a
|
||||
FileSeek $2 0 END $3
|
||||
System::Alloc /NOUNLOAD $3
|
||||
System::Alloc $3
|
||||
Pop $4
|
||||
FileSeek $2 0 SET
|
||||
System::Call /NOUNLOAD 'kernel32::ReadFile(i r2, i r4, i $3, t.,)'
|
||||
System::Call /NOUNLOAD 'user32::$1Buff(i r4, i r4, i $3)'
|
||||
System::Call 'kernel32::ReadFile(i r2, i r4, i $3, t.,)'
|
||||
System::Call 'user32::$1Buff(i r4, i r4, i $3)'
|
||||
FileSeek $2 0 SET
|
||||
System::Call /NOUNLOAD 'kernel32::WriteFile(i r2, i r4, i $3, t.,)'
|
||||
System::Call 'kernel32::WriteFile(i r2, i r4, i $3, t.,)'
|
||||
System::Free $4
|
||||
FileClose $2
|
||||
goto TextFunc_FileRecode_end
|
||||
|
|
|
@ -175,8 +175,8 @@
|
|||
|
||||
!macro __WinVer_Call_GetVersionEx STRUCT_SIZE
|
||||
|
||||
System::Call /NoUnload '*$0(i ${STRUCT_SIZE})'
|
||||
System::Call /NoUnload kernel32::GetVersionEx(ir0)i.r3
|
||||
System::Call '*$0(i ${STRUCT_SIZE})'
|
||||
System::Call kernel32::GetVersionEx(ir0)i.r3
|
||||
|
||||
!macroend
|
||||
|
||||
|
@ -199,7 +199,7 @@
|
|||
Push $R0 ;temp
|
||||
|
||||
# allocate memory
|
||||
System::Alloc /NoUnload ${OSVERSIONINFOEXA_SIZE}
|
||||
System::Alloc ${OSVERSIONINFOEXA_SIZE}
|
||||
Pop $0
|
||||
|
||||
# use OSVERSIONINFOEX
|
||||
|
@ -211,7 +211,7 @@
|
|||
_winver_ex:
|
||||
|
||||
# get results from struct
|
||||
System::Call /NoUnload '*$0(i.s,i.r1,i.r2,i.r3,i.s,&t128.s,&i2.s,&i2,&i2,&i1.s,&i1)'
|
||||
System::Call '*$0(i.s,i.r1,i.r2,i.r3,i.s,&t128.s,&i2.s,&i2,&i2,&i1.s,&i1)'
|
||||
|
||||
# free struct
|
||||
System::Free $0
|
||||
|
|
|
@ -43,7 +43,7 @@ static tokenType tokenlist[TOK__LAST] =
|
|||
{TOK_BRANDINGTEXT,"BrandingText",1,1,"[/TRIM(LEFT|RIGHT|CENTER)] installer_text",TP_GLOBAL},
|
||||
{TOK_BRINGTOFRONT,"BringToFront",0,0,"",TP_CODE},
|
||||
{TOK_CALL,"Call",1,0,"function_name | [:label_name]",TP_CODE},
|
||||
{TOK_CALLINSTDLL,"CallInstDLL",2,1,"dll_path_on_target.dll [/NOUNLOAD] function",TP_CODE},
|
||||
{TOK_CALLINSTDLL,"CallInstDLL",2,1,"dll_path_on_target.dll function",TP_CODE},
|
||||
{TOK_CAPTION,"Caption",1,0,"installer_caption",TP_GLOBAL|TP_PAGEEX},
|
||||
{TOK_CHANGEUI,"ChangeUI",2,0,"(all|dlg_id) ui_file.exe",TP_GLOBAL},
|
||||
{TOK_CLEARERRORS,"ClearErrors",0,0,"",TP_CODE},
|
||||
|
@ -192,7 +192,7 @@ static tokenType tokenlist[TOK__LAST] =
|
|||
{TOK_SETFONT,"SetFont",2,1,"[/LANG=lang_id] font_face_name font_size",TP_GLOBAL},
|
||||
{TOK_SETOUTPATH,"SetOutPath",1,0,"output_path",TP_CODE},
|
||||
{TOK_SETOVERWRITE,"SetOverwrite",1,0,"on|off|try|ifnewer|ifdiff",TP_ALL},
|
||||
{TOK_SETPLUGINUNLOAD,"SetPluginUnload",1,0,"(manual|alwaysoff)",TP_ALL},
|
||||
{TOK_SETPLUGINUNLOAD,"SetPluginUnload",1,0,"deprecated - plug-ins should handle this on their own",TP_ALL},
|
||||
{TOK_SETREBOOTFLAG,"SetRebootFlag",1,0,"true|false",TP_CODE},
|
||||
{TOK_SETREGVIEW,"SetRegView",1,0,"32|64|lastused",TP_CODE},
|
||||
{TOK_SETSHELLVARCONTEXT,"SetShellVarContext",1,0,"all|current",TP_CODE},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue