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:
kichik 2008-12-20 08:17:15 +00:00
parent d04cece9be
commit 5ac5b3f95b
24 changed files with 72 additions and 110 deletions

View file

@ -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

View file

@ -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"

View file

@ -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

View file

@ -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

View file

@ -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.

View file

@ -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