Skip to content

Commit

Permalink
Merge remote-tracking branch 'kichik/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
negrutiu committed Dec 14, 2024
2 parents 0c92863 + a8c265f commit 4eeba4f
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,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
Expand Down
2 changes: 1 addition & 1 deletion Contrib/nsExec/nsexec.c
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ void ExecScript(int mode) {

*szRet = _T('\0');

if (!IsWOW64()) {
if (sizeof(void*) < 8 && !IsWOW64()) {
TCHAR* p;
int nComSpecSize;

Expand Down
4 changes: 4 additions & 0 deletions Docs/src/history.but
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@ Workgroups party? The end of 16-bit?

\S2{} Minor Changes

\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})

\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})
Expand Down
43 changes: 30 additions & 13 deletions Source/build.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3785,18 +3785,17 @@ 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
ret=add_function(uninstall?_T("un.Initialize_____Plugins"):_T("Initialize_____Plugins"));
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);
Expand All @@ -3806,38 +3805,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;
Expand Down
3 changes: 3 additions & 0 deletions Source/exehead/exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
19 changes: 10 additions & 9 deletions Source/script.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4eeba4f

Please sign in to comment.