Use a undocumented variable as the nsDialogs::OnNotify return value so we don't have to worry about restoring it

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@7055 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
anders_k 2018-11-27 22:36:58 +00:00
parent a523c05626
commit fa85ddb775
5 changed files with 7 additions and 7 deletions

View file

@ -7,6 +7,7 @@
#define NSDFUNC WINAPI
#define GetVar(vars, varlen, varid) ( (vars) + ((varid) * (varlen)) )
#define DlgRet(hDlg, val) ( SetWindowLongPtr((hDlg), DWLP_MSGRESULT, (val)) | TRUE )
#define StrToIntPtr nsishelper_str_to_ptr

View file

@ -1,3 +1,4 @@
!include nsDialogs.nsh
!include LogicLib.nsh
!include WinCore.nsh ; MAKELONG

View file

@ -19,7 +19,7 @@
HINSTANCE g_hInstance;
struct nsDialog g_dialog;
extra_parameters* g_pluginParms;
LPTSTR g_var0;
LPTSTR g_callbackRetVar;
static COLORREF GetLinkColor()
{
@ -165,7 +165,7 @@ INT_PTR CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
g_pluginParms->ExecuteCodeSegment(ctl->callbacks.onNotify - 1, 0);
ret = *pFlag, *pFlag = orgFlag;
if (ret)
return DlgRet(hwndDlg, StrToIntPtr(g_var0));
return DlgRet(hwndDlg, StrToIntPtr(g_callbackRetVar));
}
break;
@ -273,7 +273,7 @@ void __declspec(dllexport) Create(HWND hwndParent, int string_size, TCHAR *varia
g_dialog.hwParent = hwndParent;
g_pluginParms = extra;
g_var0 = variables;
g_callbackRetVar = GetVar(variables, string_size, 31); // The undocumented $_OUTDIR variable
hwPlacementRect = GetDlgItem(hwndParent, popint());
GetWindowRect(hwPlacementRect, &rcPlacement);

View file

@ -415,9 +415,7 @@ Header file for creating custom installer pages with nsDialogs
!define NSD_Return "!insertmacro NSD_Return "
!macro NSD_Return val
!if "${val}" != "$0"
StrCpy $0 ${val}
!endif
StrCpy $_OUTDIR ${val}
SetSilent silent
Return
!macroend

View file

@ -344,7 +344,7 @@ CEXEBuild::CEXEBuild(signed char pponly, bool warnaserror) :
m_UserVarNames.add(_T("EXEFILE"),-1); // 28
m_UserVarNames.add(_T("HWNDPARENT"),-1); // 29
m_UserVarNames.add(_T("_CLICK"),-1); // 30
m_UserVarNames.add(_T("_OUTDIR"),1); // 31
m_UserVarNames.add(_T("_OUTDIR"),1); // 31 Note: nsDialogs also uses this
m_iBaseVarsNum = m_UserVarNames.getnum();