Added experimental ManifestAppendCustomString
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@7194 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
6c842ff1c3
commit
5ad1538a64
6 changed files with 72 additions and 3 deletions
|
@ -21,6 +21,7 @@
|
|||
#include <nsis-version.h>
|
||||
#include "tstring.h"
|
||||
#include "util.h" // RawTStrToASCII
|
||||
#include <vector>
|
||||
|
||||
// Jim Park: The manifest must stay UTF-8. Do not convert.
|
||||
|
||||
|
@ -91,6 +92,51 @@ bool SupportedOSList::append(const TCHAR* osid)
|
|||
}
|
||||
|
||||
|
||||
static const TCHAR*g_appendpaths[] = { // Basic simulated XPath support
|
||||
_T("/"),
|
||||
_T("/assembly"),
|
||||
_T("/assembly/dependency"),
|
||||
_T("/assembly/dependency/dependentAssembly"),
|
||||
_T("/assembly/compatibility/application"),
|
||||
_T("/assembly/application/windowsSettings")
|
||||
};
|
||||
std::vector<string> g_appendstrings[COUNTOF(g_appendpaths)];
|
||||
|
||||
static int isvalidappendpath(const TCHAR*path)
|
||||
{
|
||||
for (int i = 0; i < COUNTOF(g_appendpaths); ++i)
|
||||
if (!_tcsicmp(path, g_appendpaths[i]))
|
||||
return i;
|
||||
return -1;
|
||||
}
|
||||
|
||||
bool addappendstring(const TCHAR*path, const TCHAR*data)
|
||||
{
|
||||
int i = isvalidappendpath(path);
|
||||
if (i >= 0)
|
||||
{
|
||||
string str = TtoCString(data);
|
||||
g_appendstrings[i].push_back(str);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool append(string& xml, const TCHAR*path, const char*prefix = 0, const char*suffix = 0)
|
||||
{
|
||||
bool any = false;
|
||||
int i = isvalidappendpath(path);
|
||||
if (i >= 0)
|
||||
for (std::size_t j = 0; j < g_appendstrings[i].size(); ++j)
|
||||
{
|
||||
if (!any && prefix) xml += prefix, any = true;
|
||||
xml += g_appendstrings[i][j];
|
||||
}
|
||||
if (any && suffix)
|
||||
xml += suffix;
|
||||
return any;
|
||||
}
|
||||
|
||||
string generate(comctl comctl_selection, exec_level exec_level_selection, const SPECIFICATION&spec)
|
||||
{
|
||||
flags featureflags = spec.Flags;
|
||||
|
@ -100,18 +146,28 @@ string generate(comctl comctl_selection, exec_level exec_level_selection, const
|
|||
SupportedOSList& sosl = *spec.pSOSL;
|
||||
const TCHAR *mvt = spec.MaxVersionTested;
|
||||
|
||||
bool default_or_empty_sosl = sosl.isdefaultlist() || !sosl.getcount();
|
||||
bool default_or_empty_sosl = sosl.isdefaultlist() || !sosl.getcount(), any;
|
||||
if (comctl_selection == comctl_old && exec_level_selection == exec_level_none && default_or_empty_sosl && dpiaware_notset == dpia)
|
||||
return "";
|
||||
|
||||
string xmltmp;
|
||||
string xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\"><assemblyIdentity version=\"1.0.0.0\" processorArchitecture=\"*\" name=\"Nullsoft.NSIS.exehead\" type=\"win32\"/><description>Nullsoft Install System ";
|
||||
xml += TtoCString(NSIS_VERSION);
|
||||
xml += "</description>";
|
||||
|
||||
if (comctl_selection == comctl_xp)
|
||||
{
|
||||
xml += "<dependency><dependentAssembly><assemblyIdentity type=\"win32\" name=\"Microsoft.Windows.Common-Controls\" version=\"6.0.0.0\" processorArchitecture=\"*\" publicKeyToken=\"6595b64144ccf1df\" language=\"*\" /></dependentAssembly></dependency>";
|
||||
addappendstring(_T("/assembly/dependency/dependentAssembly"), _T("<assemblyIdentity type=\"win32\" name=\"Microsoft.Windows.Common-Controls\" version=\"6.0.0.0\" processorArchitecture=\"*\" publicKeyToken=\"6595b64144ccf1df\" language=\"*\" />"));
|
||||
}
|
||||
xmltmp = "<dependency>";
|
||||
any = append(xmltmp, _T("/assembly/dependency"));
|
||||
any |= append(xmltmp, _T("/assembly/dependency/dependentAssembly"), "<dependentAssembly>", "</dependentAssembly>");
|
||||
if (any)
|
||||
{
|
||||
xmltmp += "</dependency>";
|
||||
xml += xmltmp;
|
||||
}
|
||||
|
||||
|
||||
if (exec_level_selection != exec_level_none)
|
||||
{
|
||||
|
@ -142,8 +198,9 @@ string generate(comctl comctl_selection, exec_level exec_level_selection, const
|
|||
sosl.deleteall();
|
||||
}
|
||||
|
||||
xmltmp = "", append(xmltmp, _T("/assembly/compatibility/application"));
|
||||
int soslcount = sosl.getcount();
|
||||
if (soslcount || *mvt)
|
||||
if (!xmltmp.empty() || soslcount || *mvt)
|
||||
{
|
||||
char buf[38+1];
|
||||
xml += "<compatibility xmlns=\"urn:schemas-microsoft-com:compatibility.v1\"><application>";
|
||||
|
@ -159,6 +216,7 @@ string generate(comctl comctl_selection, exec_level exec_level_selection, const
|
|||
xml += TtoCString(mvt);
|
||||
xml += "\"/>";
|
||||
}
|
||||
xml += xmltmp;
|
||||
xml += "</application></compatibility>";
|
||||
}
|
||||
|
||||
|
@ -193,6 +251,7 @@ string generate(comctl comctl_selection, exec_level exec_level_selection, const
|
|||
xml_aws += lpaware_false != lpa ? "true" : "false";
|
||||
xml_aws += "</longPathAware>";
|
||||
}
|
||||
append(xml_aws, _T("/assembly/application/windowsSettings"));
|
||||
if (!xml_aws.empty())
|
||||
{
|
||||
xml += "<application xmlns=\"urn:schemas-microsoft-com:asm.v3\"><windowsSettings>";
|
||||
|
@ -200,7 +259,9 @@ string generate(comctl comctl_selection, exec_level exec_level_selection, const
|
|||
xml += "</windowsSettings></application>";
|
||||
}
|
||||
|
||||
append(xml, _T("/assembly"));
|
||||
xml += "</assembly>";
|
||||
append(xml, _T("/"));
|
||||
|
||||
return xml;
|
||||
}
|
||||
|
|
|
@ -104,6 +104,7 @@ namespace manifest
|
|||
} SPECIFICATION;
|
||||
|
||||
std::string generate(comctl, exec_level, const SPECIFICATION&);
|
||||
bool addappendstring(const TCHAR*path, const TCHAR*data);
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -2342,6 +2342,9 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
|
|||
}
|
||||
return PS_OK;
|
||||
|
||||
case TOK_MANIFEST_APPENDCUSTOMSTRING:
|
||||
if (!manifest::addappendstring(line.gettoken_str(1), line.gettoken_str(2))) PRINTHELP();
|
||||
return PS_OK;
|
||||
case TOK_MANIFEST_DPIAWARE:
|
||||
switch(line.gettoken_enum(1,_T("none\0notset\0false\0true\0system\0permonitor\0explorer\0")))
|
||||
{
|
||||
|
|
|
@ -263,6 +263,7 @@ static tokenType tokenlist[TOK__LAST] =
|
|||
{TOK_PESUBSYSVER,_T("PESubsysVer"),1,0,_T("major.minor"),TP_GLOBAL},
|
||||
{TOK_XPSTYLE,_T("XPStyle"),1,0,_T("(on|off)"),TP_GLOBAL},
|
||||
{TOK_REQEXECLEVEL,_T("RequestExecutionLevel"),1,0,_T("none|user|highest|admin"),TP_GLOBAL},
|
||||
{TOK_MANIFEST_APPENDCUSTOMSTRING,_T("ManifestAppendCustomString"),2,0,_T("path string"),TP_GLOBAL},
|
||||
{TOK_MANIFEST_DPIAWARE,_T("ManifestDPIAware"),1,0,_T("notset|true|false"),TP_GLOBAL},
|
||||
{TOK_MANIFEST_DPIAWARENESS,_T("ManifestDPIAwareness"),1,0,_T("comma_separated_string"),TP_GLOBAL},
|
||||
{TOK_MANIFEST_LPAWARE,_T("ManifestLongPathAware"),1,0,_T("notset|true|false"),TP_GLOBAL},
|
||||
|
|
|
@ -65,6 +65,7 @@ enum
|
|||
TOK_PESUBSYSVER,
|
||||
TOK_XPSTYLE,
|
||||
TOK_REQEXECLEVEL,
|
||||
TOK_MANIFEST_APPENDCUSTOMSTRING,
|
||||
TOK_MANIFEST_DPIAWARE,
|
||||
TOK_MANIFEST_DPIAWARENESS,
|
||||
TOK_MANIFEST_LPAWARE,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue