Added experimental ManifestDPIAwareness attribute so we can declare PerMonitorV2 awareness

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6899 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
anders_k 2017-09-14 17:10:33 +00:00
parent ca009c196b
commit 9f91316be0
10 changed files with 41 additions and 17 deletions

View file

@ -2384,7 +2384,7 @@ int CEXEBuild::SetManifest()
try {
init_res_editor();
// This should stay ANSI
string manifest = manifest::generate(manifest_comctl, manifest_exec_level, manifest_dpiaware, manifest_sosl);
string manifest = manifest::generate(manifest_comctl, manifest_exec_level, manifest_dpiaware, manifest_dpiawareness.c_str(), manifest_sosl);
if (manifest == "")
return PS_OK;

View file

@ -670,6 +670,7 @@ class CEXEBuild {
manifest::comctl manifest_comctl;
manifest::exec_level manifest_exec_level;
manifest::dpiaware manifest_dpiaware;
tstring manifest_dpiawareness;
manifest::SupportedOSList manifest_sosl;
CResourceEditor *res_editor;

View file

@ -402,20 +402,20 @@ FORCE_INLINE int NSISCALL ui_doinstall(void)
#ifdef NSIS_CONFIG_LICENSEPAGE
{ // load richedit DLL
static const CHAR riched20[]=("RichEd20");
static const CHAR riched32[]=("RichEd32");
static const CHAR riched20[]=("RichEd20"); // v2..3 DLL
static const CHAR riched32[]=("RichEd32"); // v1 DLL
#ifdef UNICODE
static const TCHAR richedit20t[]=_T("RichEdit20W");
#else
static const TCHAR richedit20t[]=_T("RichEdit20A");
#endif
static const TCHAR richedit[]=_T("RichEdit");
static const TCHAR richedit[]=_T("RichEdit"); // v1 class
if (!LoadSystemLibrary(riched20))
{
LoadSystemLibrary(riched32); // Win95 only ships with v1.0, NT4 has v2.0: web.archive.org/web/20030607222419/http://msdn.microsoft.com/library/en-us/shellcc/platform/commctls/richedit/richeditcontrols/aboutricheditcontrols.asp
}
// make richedit20a/w point to RICHEDIT
// Register RichEdit20A/W as a RICHEDIT clone (for Win95)
if (!GetClassInfo(NULL,richedit20t,&wc))
{
GetClassInfo(NULL,richedit,&wc);

View file

@ -34,11 +34,11 @@ TCHAR g_log_file[1024];
#endif
#endif
// *** DO NOT DECLARE MORE VARIABLES INSIDE THIS PRAGMAS ***
// *** DO NOT DECLARE MORE VARIABLES INSIDE THESE PRAGMAS ***
// This will produce a special section called ".ndata" (stands for nsis data)
// this way makensis during build time, can search for this section by name
// and change the virtual size of this section
// which result in extra memory for extra variables without code to do allocation :)
// which results in extra memory for extra variables without code to do allocation :)
// nsis then removes the "DISCARDABLE" style from section (for safe)
#ifdef _MSC_VER
# pragma bss_seg(NSIS_VARS_SECTION)

View file

@ -91,7 +91,7 @@ bool SupportedOSList::append(const TCHAR* osid)
}
string generate(comctl comctl_selection, exec_level exec_level_selection, dpiaware dpia, SupportedOSList& sosl)
string generate(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,11 +149,22 @@ string generate(comctl comctl_selection, exec_level exec_level_selection, dpiawa
xml += "</application></compatibility>";
}
if (dpiaware_notset != dpia)
if (dpiaware_notset != dpia || *dpia2)
{
xml += "<application xmlns=\"urn:schemas-microsoft-com:asm.v3\"><windowsSettings><dpiAware xmlns=\"http://schemas.microsoft.com/SMI/2005/WindowsSettings\">";
xml += dpiaware_false != dpia ? "true" : "false";
xml += "</dpiAware></windowsSettings></application>";
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 += "</windowsSettings></application>";
}
xml += "</assembly>";

View file

@ -42,7 +42,8 @@ namespace manifest
{
dpiaware_notset,
dpiaware_false,
dpiaware_true,
dpiaware_true, // System DPI on Vista+
dpiaware_permonitor // System DPI on Vista/7/8, PerMonitor on 8.1+
};
class SupportedOSList
@ -78,7 +79,7 @@ namespace manifest
}
};
std::string generate(comctl, exec_level, dpiaware, SupportedOSList&);
std::string generate(comctl, exec_level, dpiaware, const TCHAR*, SupportedOSList&);
};

View file

@ -2242,15 +2242,20 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
return PS_OK;
case TOK_MANIFEST_DPIAWARE:
switch(line.gettoken_enum(1,_T("none\0notset\0true\0false\0")))
switch(line.gettoken_enum(1,_T("none\0notset\0false\0true\0system\0permonitor\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;
case 2: manifest_dpiaware = manifest::dpiaware_true; break;
case 3: manifest_dpiaware = manifest::dpiaware_false; break;
case 2: manifest_dpiaware = manifest::dpiaware_false; break;
case 3: // "True" == "System DPI"
case 4: manifest_dpiaware = manifest::dpiaware_true; break;
case 5: manifest_dpiaware = manifest::dpiaware_permonitor; break;
default: PRINTHELP();
}
return PS_OK;
case TOK_MANIFEST_DPIAWARENESS:
manifest_dpiawareness = line.gettoken_str(1);
return PS_OK;
case TOK_MANIFEST_SUPPORTEDOS:
{

View file

@ -248,6 +248,7 @@ static tokenType tokenlist[TOK__LAST] =
{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_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_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},

View file

@ -64,6 +64,7 @@ enum
TOK_XPSTYLE,
TOK_REQEXECLEVEL,
TOK_MANIFEST_DPIAWARE,
TOK_MANIFEST_DPIAWARENESS,
TOK_MANIFEST_SUPPORTEDOS,
TOK_CHANGEUI,
TOK_ADDBRANDINGIMAGE,