Preliminary support for disableWindowFiltering and gdiScaling manifest elements
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6993 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
11c050f118
commit
b0430b251b
7 changed files with 65 additions and 20 deletions
|
@ -281,6 +281,7 @@ CEXEBuild::CEXEBuild(signed char pponly, bool warnaserror) :
|
|||
|
||||
PEDllCharacteristics = IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE|IMAGE_DLLCHARACTERISTICS_NO_SEH|IMAGE_DLLCHARACTERISTICS_NX_COMPAT|IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE; //forums.winamp.com/showthread.php?t=344755
|
||||
PESubsysVerMaj = PESubsysVerMin = (WORD) -1;
|
||||
manifest_flags = manifest::flags_default;
|
||||
manifest_comctl = manifest::comctl_old;
|
||||
manifest_exec_level = manifest::exec_level_admin;
|
||||
manifest_dpiaware = manifest::dpiaware_notset;
|
||||
|
@ -2384,7 +2385,7 @@ int CEXEBuild::SetManifest()
|
|||
try {
|
||||
init_res_editor();
|
||||
// This should stay ANSI
|
||||
string manifest = manifest::generate(manifest_comctl, manifest_exec_level, manifest_dpiaware, manifest_dpiawareness.c_str(), manifest_sosl);
|
||||
string manifest = manifest::generate((manifest::flags)manifest_flags, manifest_comctl, manifest_exec_level, manifest_dpiaware, manifest_dpiawareness.c_str(), manifest_sosl);
|
||||
|
||||
if (manifest == "")
|
||||
return PS_OK;
|
||||
|
|
|
@ -674,6 +674,7 @@ class CEXEBuild {
|
|||
#endif
|
||||
|
||||
WORD PEDllCharacteristics, PESubsysVerMaj, PESubsysVerMin;
|
||||
unsigned int manifest_flags;
|
||||
manifest::comctl manifest_comctl;
|
||||
manifest::exec_level manifest_exec_level;
|
||||
manifest::dpiaware manifest_dpiaware;
|
||||
|
|
|
@ -91,7 +91,7 @@ bool SupportedOSList::append(const TCHAR* osid)
|
|||
}
|
||||
|
||||
|
||||
string generate(comctl comctl_selection, exec_level exec_level_selection, dpiaware dpia, const TCHAR*dpia2, SupportedOSList& sosl)
|
||||
string generate(flags featureflags, comctl comctl_selection, exec_level exec_level_selection, dpiaware dpia, const TCHAR*dpia2, SupportedOSList& sosl)
|
||||
{
|
||||
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)
|
||||
|
@ -149,21 +149,35 @@ string generate(comctl comctl_selection, exec_level exec_level_selection, dpiawa
|
|||
xml += "</application></compatibility>";
|
||||
}
|
||||
|
||||
if (dpiaware_notset != dpia || *dpia2)
|
||||
string xml_aws = ""; // <application><windowsSettings>
|
||||
if (featureflags & disablewindowfiltering)
|
||||
{
|
||||
xml_aws += "<disableWindowFiltering xmlns=\"http://schemas.microsoft.com/SMI/2011/WindowsSettings\">";
|
||||
xml_aws += "true";
|
||||
xml_aws += "</disableWindowFiltering>";
|
||||
}
|
||||
if (featureflags & gdiscaling)
|
||||
{
|
||||
xml_aws += "<gdiScaling xmlns=\"http://schemas.microsoft.com/SMI/2017/WindowsSettings\">";
|
||||
xml_aws += "true";
|
||||
xml_aws += "</gdiScaling>";
|
||||
}
|
||||
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 += "</dpiAware>";
|
||||
}
|
||||
if (*dpia2)
|
||||
{
|
||||
xml_aws += "<dpiAwareness xmlns=\"http://schemas.microsoft.com/SMI/2016/WindowsSettings\">";
|
||||
xml_aws += TtoCString(dpia2);
|
||||
xml_aws += "</dpiAwareness>";
|
||||
}
|
||||
if (!xml_aws.empty())
|
||||
{
|
||||
xml += "<application xmlns=\"urn:schemas-microsoft-com:asm.v3\"><windowsSettings>";
|
||||
if (dpiaware_notset != dpia)
|
||||
{
|
||||
xml += "<dpiAware xmlns=\"http://schemas.microsoft.com/SMI/2005/WindowsSettings\">";
|
||||
xml += dpia >= dpiaware_permonitor ? "True/PM" : dpiaware_false != dpia ? "true" : "false";
|
||||
xml += "</dpiAware>";
|
||||
}
|
||||
if (*dpia2)
|
||||
{
|
||||
xml += "<dpiAwareness xmlns=\"http://schemas.microsoft.com/SMI/2016/WindowsSettings\">";
|
||||
xml += TtoCString(dpia2);
|
||||
xml += "</dpiAwareness>";
|
||||
}
|
||||
xml += xml_aws;
|
||||
xml += "</windowsSettings></application>";
|
||||
}
|
||||
|
||||
|
|
|
@ -24,13 +24,20 @@
|
|||
|
||||
namespace manifest
|
||||
{
|
||||
enum comctl
|
||||
enum flags
|
||||
{
|
||||
disablewindowfiltering = 0x01, // Win8+
|
||||
gdiscaling = 0x02, // Win10FU1703+
|
||||
flags_default = 0
|
||||
};
|
||||
|
||||
enum comctl // WinXP+
|
||||
{
|
||||
comctl_old,
|
||||
comctl_xp
|
||||
};
|
||||
|
||||
enum exec_level
|
||||
enum exec_level // WinVista+
|
||||
{
|
||||
exec_level_none,
|
||||
exec_level_user,
|
||||
|
@ -38,7 +45,7 @@ namespace manifest
|
|||
exec_level_admin
|
||||
};
|
||||
|
||||
enum dpiaware
|
||||
enum dpiaware // WinVista+
|
||||
{
|
||||
dpiaware_notset,
|
||||
dpiaware_false,
|
||||
|
@ -46,7 +53,7 @@ namespace manifest
|
|||
dpiaware_permonitor // System DPI on Vista/7/8, PerMonitor on 8.1+
|
||||
};
|
||||
|
||||
class SupportedOSList
|
||||
class SupportedOSList // Win7+
|
||||
{
|
||||
StringList m_list;
|
||||
bool m_isdefaultlist;
|
||||
|
@ -79,7 +86,7 @@ namespace manifest
|
|||
}
|
||||
};
|
||||
|
||||
std::string generate(comctl, exec_level, dpiaware, const TCHAR*, SupportedOSList&);
|
||||
std::string generate(flags, comctl, exec_level, dpiaware, const TCHAR*, SupportedOSList&);
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -2293,6 +2293,24 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
|
|||
}
|
||||
}
|
||||
return PS_OK;
|
||||
case TOK_MANIFEST_DISABLEWINDOWFILTERING:
|
||||
switch(line.gettoken_enum(1,_T("notset\0false\0true")))
|
||||
{
|
||||
case 0:
|
||||
case 1: manifest_flags &= ~manifest::disablewindowfiltering; break;
|
||||
case 2: manifest_flags |= manifest::disablewindowfiltering; break;
|
||||
default: PRINTHELP();
|
||||
}
|
||||
return PS_OK;
|
||||
case TOK_MANIFEST_GDISCALING:
|
||||
switch(line.gettoken_enum(1,_T("notset\0false\0true")))
|
||||
{
|
||||
case 0:
|
||||
case 1: manifest_flags &= ~manifest::gdiscaling; break;
|
||||
case 2: manifest_flags |= manifest::gdiscaling; break;
|
||||
default: PRINTHELP();
|
||||
}
|
||||
return PS_OK;
|
||||
|
||||
#ifdef _UNICODE
|
||||
case TOK_TARGET:
|
||||
|
|
|
@ -256,6 +256,8 @@ 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_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},
|
||||
{TOK_P_FINALIZE,_T("!finalize"),1,2,_T("command_with_%1 [<OP retval>]"),TP_ALL},
|
||||
{TOK_P_SYSTEMEXEC,_T("!system"),1,2,_T("command [<OP retval> | <retvalsymbol>]\n OP=(< > <> =)"),TP_ALL},
|
||||
|
|
|
@ -66,6 +66,8 @@ enum
|
|||
TOK_MANIFEST_DPIAWARE,
|
||||
TOK_MANIFEST_DPIAWARENESS,
|
||||
TOK_MANIFEST_SUPPORTEDOS,
|
||||
TOK_MANIFEST_DISABLEWINDOWFILTERING,
|
||||
TOK_MANIFEST_GDISCALING,
|
||||
TOK_CHANGEUI,
|
||||
TOK_ADDBRANDINGIMAGE,
|
||||
TOK_SETFONT,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue