From 16adde64688ffcc28a64eae79505e01237a1b6fb Mon Sep 17 00:00:00 2001 From: Ralf Habacker Date: Tue, 26 Sep 2017 12:06:10 +0200 Subject: [PATCH] Avoid dbus-update-activation-environment being catched by UAC https://bugs.freedesktop.org/show_bug.cgi?id=102558 --- cmake/tools/CMakeLists.txt | 9 +++++++++ tools/Makefile.am | 12 ++++++++++++ tools/Win32.Manifest.in | 10 ++++++++++ 3 files changed, 31 insertions(+) create mode 100644 tools/Win32.Manifest.in diff --git a/cmake/tools/CMakeLists.txt b/cmake/tools/CMakeLists.txt index 8b3de0c9..ff8d8ca1 100644 --- a/cmake/tools/CMakeLists.txt +++ b/cmake/tools/CMakeLists.txt @@ -62,6 +62,15 @@ add_executable(dbus-test-tool ${dbus_test_tool_SOURCES}) target_link_libraries(dbus-test-tool ${DBUS_LIBRARIES}) install(TARGETS dbus-test-tool ${INSTALL_TARGETS_DEFAULT_ARGS}) +if(WIN32) + # avoid dbus_update_activation_environment being catched by uac + # 1 is the resource ID, ID_MANIFEST + # 24 is the resource type, RT_MANIFEST + # constants are used because of a bug in windres + # see https://stackoverflow.com/questions/33000158/embed-manifest-file-to-require-administrator-execution-level-with-mingw32 + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/duae-manifest.rc "1 24 \"${CMAKE_SOURCE_DIR}/../tools/Win32.Manifest.in\"\n") + list(APPEND dbus_update_activation_environment_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/duae-manifest.rc) +endif() add_executable(dbus-update-activation-environment ${dbus_update_activation_environment_SOURCES}) target_link_libraries(dbus-update-activation-environment ${DBUS_LIBRARIES}) install(TARGETS dbus-update-activation-environment ${INSTALL_TARGETS_DEFAULT_ARGS}) diff --git a/tools/Makefile.am b/tools/Makefile.am index 19aaf363..aea3850f 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -114,6 +114,18 @@ dbus_update_activation_environment_SOURCES = \ $(NULL) dbus_update_activation_environment_LDADD = $(top_builddir)/dbus/libdbus-1.la +if DBUS_WIN +SUFFIXES = .rc + +.rc.o: + $(WINDRES) $< -o $@ + +dbus_update_activation_environment_SOURCES += duae_manifest.rc $(NULL) + +duae_manifest.rc: $(top_srcdir)/tools/Win32.Manifest.in + echo -e "1 24 \"$<\"" > $@ +endif + EXTRA_DIST = run-with-tmp-session-bus.sh strtoll.c strtoull.c CLEANFILES = \ run-with-tmp-session-bus.conf diff --git a/tools/Win32.Manifest.in b/tools/Win32.Manifest.in new file mode 100644 index 00000000..63dce3b5 --- /dev/null +++ b/tools/Win32.Manifest.in @@ -0,0 +1,10 @@ + + + + + + + + + + -- 2.12.3