From eef3c06603778b9c06a8295f5e11b17255b52bb7 Mon Sep 17 00:00:00 2001
From: Joerg Bornemann <joerg.bornemann@digia.com>
Date: Wed, 22 Jan 2014 15:32:53 +0100
Subject: [PATCH] make the MinGW build of lupdate work for non-admin users

Windows User Access Control thinks that lupdate is an installer,
because of the string "update" in the executable name.
MSVC automatically creates and embeds a manifest into the executable
to state that lupdate doesn't need admin rights.
For MinGW we now embed a handcrafted manifest.

[ChangeLog][lupdate] Fixed lupdate requiring admin rights when built
with MinGW.

Task-number: QTBUG-36369
Change-Id: I306ba4c13014f2e39fc5785bb90bacd951726ad4
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
---
 src/linguist/lupdate/lupdate.exe.manifest | 13 +++++++++++++
 src/linguist/lupdate/lupdate.pro          |  4 ++++
 src/linguist/lupdate/lupdate.rc           |  4 ++++
 3 files changed, 21 insertions(+)
 create mode 100644 src/linguist/lupdate/lupdate.exe.manifest
 create mode 100644 src/linguist/lupdate/lupdate.rc

diff --git a/src/linguist/lupdate/lupdate.exe.manifest b/src/linguist/lupdate/lupdate.exe.manifest
new file mode 100644
index 000000000..945d28997
--- /dev/null
+++ b/src/linguist/lupdate/lupdate.exe.manifest
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
+  <!-- Make sure Windows UAC does not believe lupdate is an installer. -->
+  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
+    <security>
+      <requestedPrivileges>
+        <requestedExecutionLevel
+          level="asInvoker"
+          uiAccess="false"/>
+      </requestedPrivileges>
+    </security>
+  </trustInfo>
+</assembly>
diff --git a/src/linguist/lupdate/lupdate.pro b/src/linguist/lupdate/lupdate.pro
index bd67e49a0..710fd9b1d 100644
--- a/src/linguist/lupdate/lupdate.pro
+++ b/src/linguist/lupdate/lupdate.pro
@@ -29,6 +29,10 @@ HEADERS += \
     lupdate.h \
     ../shared/simtexth.h
 
+mingw {
+    RC_FILE = lupdate.rc
+}
+
 qmake.name = QMAKE
 qmake.value = $$shell_path($$QMAKE_QMAKE)
 QT_TOOL_ENV += qmake
diff --git a/src/linguist/lupdate/lupdate.rc b/src/linguist/lupdate/lupdate.rc
new file mode 100644
index 000000000..45c493576
--- /dev/null
+++ b/src/linguist/lupdate/lupdate.rc
@@ -0,0 +1,4 @@
+#define RT_MANIFEST 24
+#define CREATEPROCESS_MANIFEST_RESOURCE_ID 1
+
+CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "lupdate.exe.manifest"
-- 
GitLab