From d13fbec6dfba18f7f7354567c916eeb1620a3314 Mon Sep 17 00:00:00 2001 From: Anders Date: Wed, 16 Oct 2024 20:10:03 +0000 Subject: [PATCH 1/5] LicenseBkColor in the uninstaller (bug #1314) git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@7442 212acab6-be3b-0410-9dea-997c60f758d6 --- Docs/src/history.but | 2 ++ Source/script.cpp | 19 ++++++++++--------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/Docs/src/history.but b/Docs/src/history.but index 3a5b610945..a6e4e99b84 100644 --- a/Docs/src/history.but +++ b/Docs/src/history.but @@ -14,6 +14,8 @@ Workgroups party? The end of 16-bit? \b Support setting source file decoding charset with magic comment (\W{http://sf.net/p/nsis/patches/292}{patch #292}) +\b Fixed LicenseBkColor for uninstaller (\W{http://sf.net/p/nsis/bugs/1314}{bug #1314}) + \b Handle CHARSET command line parameter in MakeNSISW (\W{http://sf.net/p/nsis/patches/315}{patch #315}) \b Make System/Resource.dll reproducible (\W{http://sf.net/p/nsis/patches/312}{patch #312}) diff --git a/Source/script.cpp b/Source/script.cpp index 820babdfea..9de0e1e381 100644 --- a/Source/script.cpp +++ b/Source/script.cpp @@ -1573,25 +1573,26 @@ int CEXEBuild::doCommand(int which_token, LineParser &line) return PS_OK; case TOK_LICENSEBKCOLOR: { - const TCHAR *cmdname = _T("LicenseBkColor"); - TCHAR *p = line.gettoken_str(1); - if (!_tcsicmp(p,_T("/windows"))) + const TCHAR *cmdname = _T("LicenseBkColor"), *paramname; + TCHAR *p = line.gettoken_str(1), *p2; + if (!_tcsicmp(p,paramname = _T("/windows")) || !_tcsicmp(p,_T("/window"))) { build_header.license_bg=-COLOR_WINDOW; - SCRIPT_MSG(_T("%") NPRIs _T(": /windows\n"),cmdname); + SCRIPT_MSG(_T("%") NPRIs _T(": %") NPRIs _T("\n"),cmdname,paramname); } - else if (!_tcsicmp(p,_T("/grey")) || !_tcsicmp(p,_T("/gray"))) + else if (!_tcsicmp(p,paramname = _T("/grey")) || !_tcsicmp(p,_T("/gray"))) { - build_header.license_bg=-COLOR_BTNFACE; - SCRIPT_MSG(_T("%") NPRIs _T(": /grey\n"),cmdname); + build_header.license_bg=-COLOR_BTNFACE; /* Note: This might not actually be gray */ + SCRIPT_MSG(_T("%") NPRIs _T(": %") NPRIs _T("\n"),cmdname,paramname); } else { - const int v=_tcstoul(p,&p,16); + const int v=_tcstoul(p,&p2,16); + if (p2 == p) return PS_ERROR; build_header.license_bg=((v&0xff)<<16)|(v&0xff00)|((v&0xff0000)>>16); - build_uninst.license_bg=build_header.license_bg; SCRIPT_MSG(_T("%") NPRIs _T(": %06X\n"),cmdname,v); } + build_uninst.license_bg=build_header.license_bg; } return PS_OK; #else From 1f8ab68802910f4bebe77804592f79ca70ef4b7b Mon Sep 17 00:00:00 2001 From: Amir Szekely Date: Sun, 20 Oct 2024 19:28:11 +0000 Subject: [PATCH 2/5] fix github actions build git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@7443 212acab6-be3b-0410-9dea-997c60f758d6 --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e975841670..bd4620b6ec 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,7 +10,7 @@ jobs: strategy: matrix: python-version: ['3.x'] # 2.x is supported but EOL on GitHub Actions - os: [ubuntu-20.04, ubuntu-22.04, macos-11, macos-12, windows-2019] # TODO fails to find VC windows-2022 + os: [ubuntu-20.04, ubuntu-22.04, ubuntu-24.04, macos-12, macos-13, windows-2019, windows-2022] # TODO fails to find cppunit on macos-14/15 log: [yes, no] include: - nightly: nightly From 2255de14e6bc04e0ddf3360fda87319cc2b6ff6c Mon Sep 17 00:00:00 2001 From: Anders Date: Sun, 1 Dec 2024 18:06:43 +0000 Subject: [PATCH 3/5] Retry creating restricted $PLUGINSDIR (bug #1315) git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@7444 212acab6-be3b-0410-9dea-997c60f758d6 --- Docs/src/history.but | 2 ++ Source/build.cpp | 43 ++++++++++++++++++++++++++++++------------- Source/exehead/exec.c | 3 +++ 3 files changed, 35 insertions(+), 13 deletions(-) diff --git a/Docs/src/history.but b/Docs/src/history.but index a6e4e99b84..d491b798b0 100644 --- a/Docs/src/history.but +++ b/Docs/src/history.but @@ -12,6 +12,8 @@ Workgroups party? The end of 16-bit? \S2{} Minor Changes +\b Retry creating restricted $PLUGINSDIR (\W{http://sf.net/p/nsis/bugs/1315}{bug #1315}) + \b Support setting source file decoding charset with magic comment (\W{http://sf.net/p/nsis/patches/292}{patch #292}) \b Fixed LicenseBkColor for uninstaller (\W{http://sf.net/p/nsis/bugs/1314}{bug #1314}) diff --git a/Source/build.cpp b/Source/build.cpp index 6f0a986e88..3b375d35bb 100644 --- a/Source/build.cpp +++ b/Source/build.cpp @@ -3787,10 +3787,8 @@ int CEXEBuild::add_plugins_dir_initializer(void) bool uninstall = !plugin_used; int ret; - int zero_offset; - - int var_zero; - var_zero=m_UserVarNames.get(_T("0")); + int var_r0=m_UserVarNames.get(_T("0")), r0_offset; + int var_r1=m_UserVarNames.get(_T("1")), r1_offset; again: // Function [un.]Initialize_____Plugins @@ -3798,7 +3796,8 @@ int CEXEBuild::add_plugins_dir_initializer(void) if (ret != PS_OK) return ret; // don't move this, depends on [un.] - zero_offset=add_asciistring(_T("$0")); + r0_offset=add_asciistring(_T("$0")); + r1_offset=add_asciistring(_T("$1")); // SetDetailsPrint none (special) ret=add_entry_direct(EW_SETFLAG, FLAG_OFFSET(status_update), add_intstring(6), -1); @@ -3808,38 +3807,56 @@ int CEXEBuild::add_plugins_dir_initializer(void) ret=add_entry_direct(EW_STRCMP, add_asciistring(_T("$PLUGINSDIR")), 0, 0, ns_label.add(_T("Initialize_____Plugins_done"),0)); if (ret != PS_OK) return ret; // Push $0 - ret=add_entry_direct(EW_PUSHPOP, zero_offset); + ret=add_entry_direct(EW_PUSHPOP, r0_offset); + if (ret != PS_OK) return ret; + // Push $1 + ret=add_entry_direct(EW_PUSHPOP, r1_offset); if (ret != PS_OK) return ret; + // Copy "" to $1 + ret=add_entry_direct(EW_ASSIGNVAR, var_r1, r0_offset, 0, -1); + if (ret != PS_OK) return ret; + + // retry: + if (add_label(_T("Initialize_____Plugins_retry"))) return PS_ERROR; // ClearErrors ret=add_entry_direct(EW_SETFLAG, FLAG_OFFSET(exec_error)); if (ret != PS_OK) return ret; // GetTempFileName $0 - ret=add_entry_direct(EW_GETTEMPFILENAME, var_zero, add_asciistring(_T("$TEMP"))); + ret=add_entry_direct(EW_GETTEMPFILENAME, var_r0, add_asciistring(_T("$TEMP"))); if (ret != PS_OK) return ret; // Delete $0 [simple, nothing that could clash with special temp permissions] - ret=add_entry_direct(EW_DELETEFILE, zero_offset, DEL_SIMPLE); + ret=add_entry_direct(EW_DELETEFILE, r0_offset, DEL_SIMPLE); if (ret != PS_OK) return ret; // CreateDirectory $0 - a dir instead of that temp file - ret=add_entry_direct(EW_CREATEDIR, zero_offset, 0, 1); + ret=add_entry_direct(EW_CREATEDIR, r0_offset, 0, 1); if (ret != PS_OK) return ret; // IfErrors Initialize_____Plugins_error - detect errors ret=add_entry_direct(EW_IFFLAG, ns_label.add(_T("Initialize_____Plugins_error"),0), 0, FLAG_OFFSET(exec_error)); if (ret != PS_OK) return ret; // Copy $0 to $PLUGINSDIR - ret=add_entry_direct(EW_ASSIGNVAR, m_UserVarNames.get(_T("PLUGINSDIR")), zero_offset); + ret=add_entry_direct(EW_ASSIGNVAR, m_UserVarNames.get(_T("PLUGINSDIR")), r0_offset); + if (ret != PS_OK) return ret; + // Pop $1 + ret=add_entry_direct(EW_PUSHPOP, var_r1, 1); if (ret != PS_OK) return ret; // Pop $0 - ret=add_entry_direct(EW_PUSHPOP, var_zero, 1); + ret=add_entry_direct(EW_PUSHPOP, var_r0, 1); if (ret != PS_OK) return ret; - // done + // done: if (add_label(_T("Initialize_____Plugins_done"))) return PS_ERROR; // Return ret=add_entry_direct(EW_RET); if (ret != PS_OK) return ret; - // error + // error: if (add_label(_T("Initialize_____Plugins_error"))) return PS_ERROR; + // IntOp $1 $1 + 1 + ret=add_entry_direct(EW_INTOP, var_r1, r1_offset, add_asciistring(_T("1")), 0); + if (ret != PS_OK) return ret; + // StrCmp $1 "9" + ret=add_entry_direct(EW_STRCMP, r1_offset, add_asciistring(_T("9")), 0, ns_label.add(_T("Initialize_____Plugins_retry"),0)); + if (ret != PS_OK) return ret; // error message box ret=add_entry_direct(EW_MESSAGEBOX, MB_OK|MB_ICONSTOP|(IDOK<<21), add_asciistring(_T("Error! Can't initialize plug-ins directory. Please try again later."))); if (ret != PS_OK) return ret; diff --git a/Source/exehead/exec.c b/Source/exehead/exec.c index fdfed8bbdf..9039edc83f 100644 --- a/Source/exehead/exec.c +++ b/Source/exehead/exec.c @@ -378,7 +378,10 @@ static int NSISCALL ExecuteEntry(entry *entry_) p = findchar(p, _T('\\')); c = *p, *p = 0; if (!c && parm2 && UserIsAdminGrpMember()) // Lock down the final directory? + { ec = CreateRestrictedDirectory(buf1); + if (ec) exec_error++; // Report error to add_plugins_dir_initializer + } else ec = CreateNormalDirectory(buf1); if (ec) From 2aeb6b259732a290581534053830b2eeb612a921 Mon Sep 17 00:00:00 2001 From: Anders Date: Sun, 1 Dec 2024 18:09:37 +0000 Subject: [PATCH 4/5] Don't use middleman on 64-bit git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@7445 212acab6-be3b-0410-9dea-997c60f758d6 --- Contrib/nsExec/nsexec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Contrib/nsExec/nsexec.c b/Contrib/nsExec/nsexec.c index 6152073511..56cefe9e74 100644 --- a/Contrib/nsExec/nsexec.c +++ b/Contrib/nsExec/nsexec.c @@ -185,7 +185,7 @@ void ExecScript(int mode) { *szRet = _T('\0'); - if (!IsWOW64()) { + if (sizeof(void*) < 8 && !IsWOW64()) { TCHAR* p; int nComSpecSize; From a8c265f66c55086b6fe78364985fe91924e2823b Mon Sep 17 00:00:00 2001 From: Amir Szekely Date: Mon, 2 Dec 2024 18:53:48 +0000 Subject: [PATCH 5/5] credit for issue git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@7446 212acab6-be3b-0410-9dea-997c60f758d6 --- Docs/src/history.but | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Docs/src/history.but b/Docs/src/history.but index d491b798b0..8a655cdcc8 100644 --- a/Docs/src/history.but +++ b/Docs/src/history.but @@ -12,7 +12,7 @@ Workgroups party? The end of 16-bit? \S2{} Minor Changes -\b Retry creating restricted $PLUGINSDIR (\W{http://sf.net/p/nsis/bugs/1315}{bug #1315}) +\b Retry creating restricted $PLUGINSDIR (thanks Sandro Poppi, \W{http://sf.net/p/nsis/bugs/1315}{bug #1315}) \b Support setting source file decoding charset with magic comment (\W{http://sf.net/p/nsis/patches/292}{patch #292})