From ebd213270a017a6830928ee2e1f4a9cabc799898 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Wed, 30 May 2018 12:08:26 +0000 Subject: curl.rc: embed manifest for correct Windows version detection * enable it in `src/Makefile.m32` * enable it in `winbuild/MakefileBuild.vc` if a custom manifest is _not_ enabled via the existing `EMBED_MANIFEST` option * enable it for all Windows CMake builds (also disable the built-in minimal manifest, added by CMake by default.) For other build systems, add the `-DCURL_EMBED_MANIFEST` option to the list of RC (Resource Compiler) flags to enable the manifest included in `src/curl.rc`. This may require to disable whatever automatic or other means in which way another manifest is added to `curl.exe`. Notice that Borland C doesn't support this method due to a long-pending resource compiler bug. Watcom C may also not handle it correctly when the `-zm` `wrc` option is used (this option may be unnecessary though) and regardless of options in certain earlier revisions of the 2.0 beta version. Closes https://github.com/curl/curl/pull/1221 Fixes https://github.com/curl/curl/issues/2591 --- src/Makefile.m32 | 4 ++-- src/curl.rc | 50 +++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 51 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/Makefile.m32 b/src/Makefile.m32 index 700cccfa8..33e4ecfc2 100644 --- a/src/Makefile.m32 +++ b/src/Makefile.m32 @@ -5,7 +5,7 @@ # | (__| |_| | _ <| |___ # \___|\___/|_| \_\_____| # -# Copyright (C) 1999 - 2017, Daniel Stenberg, , et al. +# Copyright (C) 1999 - 2018, Daniel Stenberg, , et al. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. The terms @@ -107,7 +107,7 @@ CFLAGS += -fno-strict-aliasing LDFLAGS = $(CURL_LDFLAG_EXTRAS) $(CURL_LDFLAG_EXTRAS_EXE) -s AR = $(CURL_AR) RC = $(CROSSPREFIX)windres -RCFLAGS = --include-dir=$(PROOT)/include -O COFF +RCFLAGS = --include-dir=$(PROOT)/include -O COFF -DCURL_EMBED_MANIFEST STRIP = $(CROSSPREFIX)strip -g # We may need these someday diff --git a/src/curl.rc b/src/curl.rc index 5f49d2236..d47f50635 100644 --- a/src/curl.rc +++ b/src/curl.rc @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2017, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2018, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -61,3 +61,51 @@ BEGIN VALUE "Translation", 0x409, 1200 END END + +/* Manifest */ + +#if defined(CURL_EMBED_MANIFEST) + +/* String escaping rules: + https://msdn.microsoft.com/library/aa381050 + Application Manifest doc, including the list of 'supportedOS Id's: + https://msdn.microsoft.com/library/aa374191 */ + +#ifndef CREATEPROCESS_MANIFEST_RESOURCE_ID +#define CREATEPROCESS_MANIFEST_RESOURCE_ID 1 +#endif +#ifndef RT_MANIFEST +#define RT_MANIFEST 24 +#endif + +#define _STR(macro) _STR_(macro) +#define _STR_(macro) #macro + +CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST +BEGIN + "" + "" + "" + "" + "" + "" /* Vista / Server 2008 */ + "" /* 7 / Server 2008 R2 */ + "" /* 8 / Server 2012 */ + "" /* 8.1 / Server 2012 R2 */ + "" /* 10 / Server 2016 */ + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" +END + +#endif -- cgit v1.2.3