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 NSDFUNC WINAPI
#define GetVar(vars, varlen, varid) ( (vars) + ((varid) * (varlen)) )
#define DlgRet(hDlg, val) ( SetWindowLongPtr((hDlg), DWLP_MSGRESULT, (val)) | TRUE ) #define DlgRet(hDlg, val) ( SetWindowLongPtr((hDlg), DWLP_MSGRESULT, (val)) | TRUE )
#define StrToIntPtr nsishelper_str_to_ptr #define StrToIntPtr nsishelper_str_to_ptr

View file

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

View file

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

View file

@ -415,9 +415,7 @@ Header file for creating custom installer pages with nsDialogs
!define NSD_Return "!insertmacro NSD_Return " !define NSD_Return "!insertmacro NSD_Return "
!macro NSD_Return val !macro NSD_Return val
!if "${val}" != "$0" StrCpy $_OUTDIR ${val}
StrCpy $0 ${val}
!endif
SetSilent silent SetSilent silent
Return Return
!macroend !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("EXEFILE"),-1); // 28
m_UserVarNames.add(_T("HWNDPARENT"),-1); // 29 m_UserVarNames.add(_T("HWNDPARENT"),-1); // 29
m_UserVarNames.add(_T("_CLICK"),-1); // 30 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(); m_iBaseVarsNum = m_UserVarNames.getnum();