Added ManifestMaxVersionTested
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@7096 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
68547d1e63
commit
fb6945ec36
9 changed files with 50 additions and 11 deletions
|
@ -2383,8 +2383,8 @@ int CEXEBuild::SetManifest()
|
|||
{
|
||||
try {
|
||||
init_res_editor();
|
||||
// This should stay ANSI
|
||||
string manifest = manifest::generate((manifest::flags)manifest_flags, manifest_comctl, manifest_exec_level, manifest_dpiaware, manifest_dpiawareness.c_str(), manifest_sosl);
|
||||
manifest::SPECIFICATION spec = { (manifest::flags) manifest_flags, manifest_dpiaware, manifest_dpiawareness.c_str(), manifest_sosl, manifest_maxversiontested.c_str() };
|
||||
string manifest = manifest::generate(manifest_comctl, manifest_exec_level, spec);
|
||||
|
||||
if (manifest == "")
|
||||
return PS_OK;
|
||||
|
@ -2394,7 +2394,7 @@ int CEXEBuild::SetManifest()
|
|||
// return PS_OK; // Allow user to completely override the manifest with PEAddResource
|
||||
|
||||
// Saved directly as binary into the exe.
|
||||
res_editor->UpdateResource(MAKEINTRESOURCE(24), 1, NSIS_DEFAULT_LANG, (LPBYTE) manifest.c_str(), (DWORD)manifest.length());
|
||||
res_editor->UpdateResource(MAKEINTRESOURCE(24), 1, NSIS_DEFAULT_LANG, (LPBYTE) const_cast<char*>(manifest.c_str()), (DWORD) manifest.length());
|
||||
}
|
||||
catch (exception& err) {
|
||||
ERROR_MSG(_T("Error setting manifest: %") NPRIs _T("\n"), CtoTStrParam(err.what()));
|
||||
|
|
|
@ -684,6 +684,7 @@ class CEXEBuild {
|
|||
manifest::dpiaware manifest_dpiaware;
|
||||
tstring manifest_dpiawareness;
|
||||
manifest::SupportedOSList manifest_sosl;
|
||||
tstring manifest_maxversiontested;
|
||||
|
||||
CResourceEditor *res_editor;
|
||||
void init_res_editor();
|
||||
|
|
|
@ -91,8 +91,14 @@ bool SupportedOSList::append(const TCHAR* osid)
|
|||
}
|
||||
|
||||
|
||||
string generate(flags featureflags, comctl comctl_selection, exec_level exec_level_selection, dpiaware dpia, const TCHAR*dpia2, SupportedOSList& sosl)
|
||||
string generate(comctl comctl_selection, exec_level exec_level_selection, const SPECIFICATION&spec)
|
||||
{
|
||||
flags featureflags = spec.Flags;
|
||||
dpiaware dpia = spec.DPIA;
|
||||
const TCHAR *dpia2 = spec.DPIA2;
|
||||
SupportedOSList& sosl = spec.SOSL;
|
||||
const TCHAR *mvt = spec.MaxVersionTested;
|
||||
|
||||
bool default_or_empty_sosl = sosl.isdefaultlist() || !sosl.getcount();
|
||||
if (comctl_selection == comctl_old && exec_level_selection == exec_level_none && default_or_empty_sosl && dpiaware_notset == dpia)
|
||||
return "";
|
||||
|
@ -136,15 +142,21 @@ string generate(flags featureflags, comctl comctl_selection, exec_level exec_lev
|
|||
}
|
||||
|
||||
int soslcount = sosl.getcount();
|
||||
if (soslcount)
|
||||
if (soslcount || *mvt)
|
||||
{
|
||||
char buf[38+1];
|
||||
xml += "<compatibility xmlns=\"urn:schemas-microsoft-com:compatibility.v1\"><application>";
|
||||
while(soslcount--)
|
||||
{
|
||||
xml += "<supportedOS Id=\"";
|
||||
RawTStrToASCII(sosl.get(soslcount), buf, COUNTOF(buf));
|
||||
xml += buf, xml += "\"/>";
|
||||
xml += (RawTStrToASCII(sosl.get(soslcount), buf, COUNTOF(buf)), buf);
|
||||
xml += "\"/>";
|
||||
}
|
||||
if (*mvt)
|
||||
{
|
||||
xml += "<maxVersionTested Id=\"";
|
||||
xml += TtoCString(mvt);
|
||||
xml += "\"/>";
|
||||
}
|
||||
xml += "</application></compatibility>";
|
||||
}
|
||||
|
@ -165,7 +177,7 @@ string generate(flags featureflags, comctl comctl_selection, exec_level exec_lev
|
|||
if (dpiaware_notset != dpia)
|
||||
{
|
||||
xml_aws += "<dpiAware xmlns=\"http://schemas.microsoft.com/SMI/2005/WindowsSettings\">";
|
||||
xml_aws += dpia >= dpiaware_permonitor ? "True/PM" : dpiaware_false != dpia ? "true" : "false";
|
||||
xml_aws += dpia == dpiaware_explorer ? "Explorer" : dpia >= dpiaware_permonitor ? "True/PM" : dpiaware_false != dpia ? "true" : "false";
|
||||
xml_aws += "</dpiAware>";
|
||||
}
|
||||
if (*dpia2)
|
||||
|
|
|
@ -50,7 +50,8 @@ namespace manifest
|
|||
dpiaware_notset,
|
||||
dpiaware_false,
|
||||
dpiaware_true, // System DPI on Vista+
|
||||
dpiaware_permonitor // System DPI on Vista/7/8, PerMonitor on 8.1+
|
||||
dpiaware_permonitor, // System DPI on Vista/7/8, PerMonitor on 8.1+
|
||||
dpiaware_explorer // Win8.1+? Undocumented?
|
||||
};
|
||||
|
||||
class SupportedOSList // Win7+
|
||||
|
@ -86,7 +87,15 @@ namespace manifest
|
|||
}
|
||||
};
|
||||
|
||||
std::string generate(flags, comctl, exec_level, dpiaware, const TCHAR*, SupportedOSList&);
|
||||
typedef struct {
|
||||
flags Flags;
|
||||
dpiaware DPIA;
|
||||
const TCHAR *DPIA2; // Win10FU1607+
|
||||
SupportedOSList& SOSL;
|
||||
const TCHAR *MaxVersionTested; // Win10FU1903+ github.com/microsoft/AppConsult-WinAppsModernizationWorkshop/tree/master/Exercise2
|
||||
} SPECIFICATION;
|
||||
|
||||
std::string generate(comctl, exec_level, const SPECIFICATION&);
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -2331,7 +2331,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
|
|||
return PS_OK;
|
||||
|
||||
case TOK_MANIFEST_DPIAWARE:
|
||||
switch(line.gettoken_enum(1,_T("none\0notset\0false\0true\0system\0permonitor\0")))
|
||||
switch(line.gettoken_enum(1,_T("none\0notset\0false\0true\0system\0permonitor\0explorer\0")))
|
||||
{
|
||||
case 0: // A lot of attributes use "none" so we support that along with the documented value
|
||||
case 1: manifest_dpiaware = manifest::dpiaware_notset; break;
|
||||
|
@ -2339,6 +2339,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
|
|||
case 3: // "True" == "System DPI"
|
||||
case 4: manifest_dpiaware = manifest::dpiaware_true; break;
|
||||
case 5: manifest_dpiaware = manifest::dpiaware_permonitor; break;
|
||||
case 6: manifest_dpiaware = manifest::dpiaware_explorer; break;
|
||||
default: PRINTHELP();
|
||||
}
|
||||
return PS_OK;
|
||||
|
@ -2360,6 +2361,10 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
|
|||
PRINTHELP();
|
||||
}
|
||||
return PS_OK;
|
||||
case TOK_MANIFEST_MAXVERSIONTESTED:
|
||||
manifest_maxversiontested = line.gettoken_enum(1, _T("none\0notset\0")) == -1 ? line.gettoken_str(1) : _T("");
|
||||
return PS_OK;
|
||||
|
||||
case TOK_MANIFEST_DISABLEWINDOWFILTERING:
|
||||
switch(line.gettoken_enum(1,_T("notset\0false\0true")))
|
||||
{
|
||||
|
|
|
@ -259,6 +259,7 @@ static tokenType tokenlist[TOK__LAST] =
|
|||
{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_SUPPORTEDOS,_T("ManifestSupportedOS"),1,-1,_T("none|all|WinVista|Win7|Win8|Win8.1|Win10|{GUID} [...]"),TP_GLOBAL},
|
||||
{TOK_MANIFEST_MAXVERSIONTESTED,_T("ManifestMaxVersionTested"),1,0,_T("maj.min.bld.rev"),TP_GLOBAL},
|
||||
{TOK_MANIFEST_DISABLEWINDOWFILTERING,_T("ManifestDisableWindowFiltering"),1,0,_T("notset|true"),TP_GLOBAL},
|
||||
{TOK_MANIFEST_GDISCALING,_T("ManifestGdiScaling"),1,0,_T("notset|true"),TP_GLOBAL},
|
||||
{TOK_P_PACKEXEHEADER,_T("!packhdr"),2,0,_T("temp_file_name command_line_to_compress_that_temp_file"),TP_ALL},
|
||||
|
|
|
@ -68,6 +68,7 @@ enum
|
|||
TOK_MANIFEST_DPIAWARE,
|
||||
TOK_MANIFEST_DPIAWARENESS,
|
||||
TOK_MANIFEST_SUPPORTEDOS,
|
||||
TOK_MANIFEST_MAXVERSIONTESTED,
|
||||
TOK_MANIFEST_DISABLEWINDOWFILTERING,
|
||||
TOK_MANIFEST_GDISCALING,
|
||||
TOK_CHANGEUI,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue