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:
anders_k 2019-06-06 00:42:08 +00:00
parent 68547d1e63
commit fb6945ec36
9 changed files with 50 additions and 11 deletions

View file

@ -301,6 +301,10 @@ Declare that the installer is compatible with the specified Windows version(s).
Windows 8.1 and later will fake its version number if you don't declare support for that particular version. You can read more about the other changes in behavior on \W{http://msdn.microsoft.com/en-us/library/windows/desktop/hh848036}{MSDN}.
\# \S2{amanifestmaxversiontested} ManifestMaxVersionTested
\#
\# \c maj.min.bld.rev
\S2{amiscbuttontext} MiscButtonText
\c [back_button_text [next_button_text] [cancel_button_text] [close_button_text]]

View file

@ -16,6 +16,8 @@ ANSI targets are deprecated, consider moving to Unicode.
\b Added \R{loadandsetimage}{LoadAndSetImage}
\# Undocumented: \b Added ManifestMaxVersionTested
\b Allow quoted library path in System::Call (\W{http://sf.net/p/nsis/bugs/546}{bug #546})
\b %1 in !finalize command can be specified multiple times
@ -55,6 +57,8 @@ Released on December 15th, 2018
\b AddBrandingImage now supports dialog units
\# Undocumented: \b Added ManifestDisableWindowFiltering and ManifestGdiScaling
\b Fixed !macroundef of last defined macro bug
\b Fixed MultiUser caption string bug (\W{http://sf.net/p/nsis/bugs/1012}{bug #1012})
@ -103,6 +107,8 @@ Released on January 29th, 2018
\b Added more !define /math operators
\# Undocumented: \b Added ManifestDPIAwareness
\b Added WinVer.nsh IsDomainController (\W{http://sf.net/p/nsis/patches/286}{patch #286})
\b Plug-ins now set the ASLR, DEP, LAA, NOSEH and TS PE flags (\W{http://sf.net/p/nsis/bugs/1188}{bug #1188})

View file

@ -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()));

View file

@ -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();

View file

@ -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)

View file

@ -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&);
};

View file

@ -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")))
{

View file

@ -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},

View file

@ -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,