Skip to content

Commit 6de855b

Browse files
committed
Merge shell extension installer to main installer
IB-7980 Signed-off-by: Raul Metsma <raul@metsma.ee>
1 parent 30281d1 commit 6de855b

File tree

5 files changed

+44
-107
lines changed

5 files changed

+44
-107
lines changed

.github/workflows/build.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,10 @@ jobs:
6262
steps:
6363
- name: Install dependencies
6464
if: matrix.container == '20.04'
65-
run: apt update -qq && apt install --no-install-recommends -y git lsb-release fakeroot build-essential devscripts debhelper pkg-config cmake libldap2-dev gettext libpcsclite-dev libssl-dev libqt5svg5-dev qttools5-dev-tools qttools5-dev lintian libflatbuffers-dev zlib1g-dev
65+
run: apt update -qq && apt install --no-install-recommends -y git lsb-release build-essential devscripts debhelper pkg-config cmake libldap2-dev gettext libpcsclite-dev libssl-dev libqt5svg5-dev qttools5-dev-tools qttools5-dev lintian libflatbuffers-dev zlib1g-dev
6666
- name: Install dependencies
6767
if: matrix.container != '20.04'
68-
run: apt update -qq && apt install --no-install-recommends -y git lsb-release fakeroot build-essential devscripts debhelper pkg-config cmake libldap2-dev gettext libpcsclite-dev libssl-dev libgl-dev libqt6svg6-dev qt6-tools-dev qt6-tools-dev-tools qt6-l10n-tools lintian libflatbuffers-dev zlib1g-dev
68+
run: apt update -qq && apt install --no-install-recommends -y git lsb-release build-essential devscripts debhelper pkg-config cmake libldap2-dev gettext libpcsclite-dev libssl-dev libgl-dev libqt6svg6-dev qt6-tools-dev qt6-tools-dev-tools qt6-l10n-tools lintian libflatbuffers-dev zlib1g-dev
6969
- name: Checkout
7070
uses: actions/checkout@v4
7171
with:
@@ -190,7 +190,7 @@ jobs:
190190
- name: Install WiX
191191
run: |
192192
dotnet tool install --global wix
193-
wix extension -g add WixToolset.UI.wixext/4.0.4
193+
wix extension -g add WixToolset.UI.wixext/4.0.5
194194
- name: Build
195195
run: |
196196
md build/client
@@ -199,7 +199,6 @@ jobs:
199199
-DCMAKE_TOOLCHAIN_FILE=${{ env.RUNVCPKG_VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake `
200200
"-DLibDigiDocpp_ROOT=libs/PFiles64/libdigidocpp"
201201
cmake --build build --target msi
202-
cmake --build build --target msishellext
203202
cmake --build build --target appx
204203
- name: Archive artifacts
205204
uses: actions/upload-artifact@v4

client/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,11 +230,12 @@ elseif(WIN32)
230230
-d libs_path=${LIBS_PATH}
231231
-d client_path=$<TARGET_FILE:${PROJECT_NAME}>
232232
-d qt_suffix=$<$<CONFIG:Debug>:d>
233+
-d ShellExt=$<TARGET_FILE:EsteidShellExtension>
233234
${CMAKE_SOURCE_DIR}/${PROJECT_NAME}.wxs
234235
${CMAKE_SOURCE_DIR}/cmake/modules/WelcomeDlg.wxs
235236
${CMAKE_SOURCE_DIR}/cmake/modules/WixUI_Minimal.wxs
236237
)
237-
add_custom_target(msi DEPENDS ${PROJECT_NAME}
238+
add_custom_target(msi DEPENDS ${PROJECT_NAME} EsteidShellExtension
238239
COMMAND ${WIX_CMD} -o "${MSI_FILE}.msi"
239240
#Build MSI with QT
240241
COMMAND ${WIX_CMD} -d qt_path=${qtCore_install_prefix} -o "${MSI_FILE}.qt.msi"

extensions/windows/CMakeLists.txt

Lines changed: 8 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,18 @@
1-
cmake_minimum_required(VERSION 3.16)
2-
project(digidocshellextension VERSION 3.13.9)
3-
4-
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules)
5-
set(CMAKE_INCLUDE_CURRENT_DIR ON)
6-
7-
include( VersionInfo )
1+
project(EsteidShellExtension VERSION 3.13.9)
2+
include(VersionInfo)
83

94
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
105
set(MIDL_TARGET "x64")
11-
set(PLATFORM "x64")
126
else()
137
set(MIDL_TARGET "win32")
14-
set(PLATFORM "x86")
158
endif()
169

1710
add_custom_command(
1811
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/EsteidShellExtension_i.h
1912
${CMAKE_CURRENT_BINARY_DIR}/EsteidShellExtension_i.c
2013
${CMAKE_CURRENT_BINARY_DIR}/EsteidShellExtension_p.c
2114
COMMAND Midl.Exe ${CMAKE_CURRENT_SOURCE_DIR}/EsteidShellExtension.idl
22-
/nologo /no_robust /char signed /Oicf /env ${MIDL_TARGET}
15+
/nologo /char signed /Oicf /env ${MIDL_TARGET}
2316
/I ${CMAKE_CURRENT_SOURCE_DIR}
2417
/tlb EsteidShellExtension.tlb
2518
/h EsteidShellExtension_i.h
@@ -29,7 +22,7 @@ add_custom_command(
2922
VERBATIM
3023
)
3124

32-
add_library(EsteidShellExtension SHARED
25+
add_library(${PROJECT_NAME} SHARED
3326
${CMAKE_CURRENT_BINARY_DIR}/EsteidShellExtension_i.c
3427
dllmain.cpp
3528
EsteidShellExtension.cpp
@@ -41,44 +34,19 @@ add_library(EsteidShellExtension SHARED
4134
EsteidShlExt_x86.rgs
4235
EsteidShlExt_x64.rgs
4336
)
44-
set_target_properties(EsteidShellExtension PROPERTIES
37+
set_target_properties(${PROJECT_NAME} PROPERTIES
4538
MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>"
4639
COMPILE_DEFINITIONS "_UNICODE;UNICODE;_MERGE_PROXYSTUB;_WINDLL"
47-
COMPILE_OPTIONS "/guard:cf"
4840
INCLUDE_DIRECTORIES ${CMAKE_CURRENT_BINARY_DIR}
49-
INTERPROCEDURAL_OPTIMIZATION YES
41+
COMPILE_OPTIONS "/guard:cf"
5042
LINK_OPTIONS "/guard:cf"
5143
LINK_LIBRARIES "uxtheme.lib"
5244
SKIP_AUTOMOC ON
5345
)
5446

55-
add_custom_target(msishellext DEPENDS EsteidShellExtension
56-
COMMAND "$ENV{WIX}bin\\candle.exe" -nologo -arch ${PLATFORM}
57-
-dMSI_VERSION=${VERSION} -dShellExt=$<TARGET_FILE:EsteidShellExtension>
58-
${CMAKE_CURRENT_SOURCE_DIR}/EsteidShellExtension.wxs
59-
${CMAKE_MODULE_PATH}/WelcomeDlg2.wxs
60-
${CMAKE_MODULE_PATH}/WixUI_Minimal2.wxs
61-
COMMAND "$ENV{WIX}bin\\light.exe" -nologo -ext WixUIExtension
62-
EsteidShellExtension.wixobj WelcomeDlg2.wixobj WixUI_Minimal2.wixobj
63-
-dWixUIDialogBmp=${CMAKE_MODULE_PATH}/dlgbmp.bmp
64-
-dWixUIBannerBmp=${CMAKE_MODULE_PATH}/banner.bmp
65-
-o "Digidoc_ShellExt-${VERSION}$ENV{VER_SUFFIX}.${PLATFORM}.msi"
66-
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
67-
)
68-
6947
if(SIGNCERT)
70-
if(CROSSSIGNCERT)
71-
target_link_options(EsteidShellExtension PRIVATE "/INTEGRITYCHECK")
72-
endif()
73-
add_custom_command(TARGET EsteidShellExtension POST_BUILD
74-
COMMAND signtool.exe sign /a /v /s MY /n "${SIGNCERT}" /fd SHA256 /du http://installer.id.ee
75-
"$<$<BOOL:${CROSSSIGNCERT}>:/ph;/ac;${CROSSSIGNCERT}>"
76-
/tr http://sha256timestamp.ws.symantec.com/sha256/timestamp /td SHA256 $<TARGET_FILE:EsteidShellExtension>
77-
COMMAND_EXPAND_LISTS
78-
)
79-
add_custom_command(TARGET msishellext POST_BUILD
48+
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
8049
COMMAND signtool.exe sign /a /v /s MY /n "${SIGNCERT}" /fd SHA256 /du http://installer.id.ee
81-
/tr http://sha256timestamp.ws.symantec.com/sha256/timestamp /td SHA256
82-
"${CMAKE_BINARY_DIR}/Digidoc_ShellExt-${VERSION}$ENV{VER_SUFFIX}.${PLATFORM}.msi"
50+
/tr http://sha256timestamp.ws.symantec.com/sha256/timestamp /td SHA256 $<TARGET_FILE:${PROJECT_NAME}>
8351
)
8452
endif()

extensions/windows/EsteidShellExtension.wxs

Lines changed: 0 additions & 57 deletions
This file was deleted.

qdigidoc4.wxs

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
<?if $(sys.BUILDARCH) = x64 ?>
22
<?define OpenSSLSuffix = "-x64" ?>
3+
<!-- Separate upgrade code / component ID created for x64 installer because both 32-
4+
and 64-bit shell extensions are installed on x64 machine and x64 installer
5+
removes x86 component installed directly before it if same guids are used.
6+
-->
7+
<?define ShellExtId = "{5606A547-759D-43DA-AEEB-D3BF1D1E816D}" ?>
38
<?else?>
49
<?define OpenSSLSuffix = "" ?>
10+
<?define ShellExtId = "{310AAB39-76FE-401B-8A7F-0F578C5F6AB5}" ?>
511
<?endif?>
612

713
<?if $(env.VisualStudioVersion) = "17.0" ?>
@@ -23,8 +29,8 @@
2329
<MediaTemplate EmbedCab="yes" CompressionLevel="high" />
2430
<Icon Id="qdigidoc4.ico" SourceFile="$(var.ico_path)" />
2531
<Property Id="ARPPRODUCTICON" Value="qdigidoc4.ico" />
26-
<Property Id="APPLICATIONNAME" Value="qdigidoc4" />
2732
<Property Id="DESKTOP_SHORTCUT" Value="0" />
33+
<Property Id="SHELL_EXTENSION" Value="0" />
2834
<MajorUpgrade AllowSameVersionUpgrades="yes" Schedule="afterInstallInitialize" DowngradeErrorMessage=
2935
"A newer version of [ProductName] is already installed. If you are trying to downgrade, please uninstall the newer version first." />
3036
<Launch Condition="Installed OR (VersionNT &gt;= 601)" Message="[ProductName] requires Windows 7 or higher." />
@@ -33,17 +39,17 @@
3339
<!-- Desktop shortcut -->
3440
<StandardDirectory Id="DesktopFolder">
3541
<Component Id="DesktopShortcut4" Guid="7B821ED0-4838-4290-997C-AA4119F99DAD" Transitive="yes" Condition="DESKTOP_SHORTCUT = 1">
36-
<Shortcut Id="ClientDesktopShortcut4" Name="DigiDoc4" Target="[!qdigidoc4.exe]" WorkingDirectory="APPLICATIONFOLDER" />
37-
<RegistryValue Root="HKCU" Key="Software\[Manufacturer]\[APPLICATIONNAME]" Name="DesktopShortcut4" Value="1" Type="integer" KeyPath="yes" />
42+
<Shortcut Id="ClientDesktopShortcut4" Name="DigiDoc4" Target="[!qdigidoc4.exe]" WorkingDirectory="INSTALLFOLDER" />
43+
<RegistryValue Root="HKCU" Key="Software\[Manufacturer]\qdigidoc4" Name="DesktopShortcut4" Value="1" Type="integer" KeyPath="yes" />
3844
</Component>
3945
</StandardDirectory>
4046

4147
<StandardDirectory Id="ProgramFiles6432Folder">
42-
<Directory Id="APPLICATIONFOLDER" Name="DigiDoc4 Client" FileSource="$(var.libs_path)">
48+
<Directory Id="INSTALLFOLDER" Name="!(bind.Property.ProductName)" FileSource="$(var.libs_path)">
4349
<Component Id="Application4" Guid="316B00EB-7519-476F-BCA5-7C8C1A0DF5AB" Transitive="yes">
4450
<File Id="qdigidoc4.exe" Source="$(var.client_path)" KeyPath="yes">
4551
<Shortcut Id="ClientStartMenu4" Advertise="yes" Name="DigiDoc4" Icon="qdigidoc4.ico"
46-
Directory="ProgramMenuFolder" WorkingDirectory="APPLICATIONFOLDER" />
52+
Directory="ProgramMenuFolder" WorkingDirectory="INSTALLFOLDER" />
4753
</File>
4854
<ProgId Id="qdigidoc4.adoc" Description="DigiDoc signed document" Icon="qdigidoc4.exe" IconIndex="1">
4955
<Extension Id="adoc" ContentType="application/vnd.lt.archyvai.adoc-2008">
@@ -162,6 +168,23 @@
162168
<File Source="$(var.qt_path)\..\plugins\imageformats\qsvg$(var.qt_suffix).dll" />
163169
</Component>
164170
</Directory>
171+
<?endif?>
172+
<?ifdef var.ShellExt ?>
173+
<Component Id="ShellExt" Guid="7adaa2cc-c3f5-4e2e-a38d-5d9c9730444e" Transitive="yes" Condition="SHELL_EXTENSION = 1">
174+
<!--Does not work with multiple files -->
175+
<!--RegistryValue Root='HKCR' Key='*\shell\[ProductName]' Type='string' Value='Sign with [ProductName]' />
176+
<RegistryValue Root='HKCR' Key='*\shell\[ProductName]' Name="Icon" Type='string' Value='"[INSTALLFOLDER]qdigidoc4.exe",0' />
177+
<RegistryValue Root='HKCR' Key='*\shell\[ProductName]\command' Type='string' Value='"[INSTALLFOLDER]qdigidoc4.exe" "%1"' /-->
178+
<File Source="$(var.ShellExt)"/>
179+
<RegistryKey Root="HKCR" Key="CLSID\$(var.ShellExtId)\InprocServer32">
180+
<RegistryValue Type="string" Value="[INSTALLFOLDER]EsteidShellExtension.dll"/>
181+
<RegistryValue Type="string" Name="ThreadingModel" Value="Apartment" />
182+
</RegistryKey>
183+
<RegistryValue Root="HKCR" Key="*\shellex\ContextMenuHandlers\DigiDoc4ShellExtension$(sys.BUILDARCH)"
184+
Value="$(var.ShellExtId)" Type="string" />
185+
<RegistryValue Root="HKLM" Key="Software\Microsoft\Windows\CurrentVersion\Shell Extensions\Approved"
186+
Name="$(var.ShellExtId)" Value="DigiDoc4 Shell Extension" Type="string" />
187+
</Component>
165188
<?endif?>
166189
</Directory>
167190
</StandardDirectory>
@@ -176,6 +199,9 @@
176199
<ComponentRef Id="qwindowsvistastyle.dll" />
177200
<ComponentRef Id="qopensslbackend.dll" />
178201
<ComponentRef Id="imageformats.dll" />
202+
<?endif?>
203+
<?ifdef var.ShellExt ?>
204+
<ComponentRef Id="ShellExt"/>
179205
<?endif?>
180206
</Feature>
181207
</Package>

0 commit comments

Comments
 (0)