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

@ -158,7 +158,7 @@ Macros and conversion functions for InstallOptions
!macro INSTALLOPTIONS_INITDIALOG FILE
InstallOptions::initDialog /NOUNLOAD "$PLUGINSDIR\${FILE}"
InstallOptions::initDialog "$PLUGINSDIR\${FILE}"
!macroend

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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