Skip to content

Commit

Permalink
Merge shell extension installer to main installer
Browse files Browse the repository at this point in the history
IB-7980

Signed-off-by: Raul Metsma <[email protected]>
  • Loading branch information
metsma committed May 7, 2024
1 parent ccb29a5 commit 4628d90
Show file tree
Hide file tree
Showing 17 changed files with 53 additions and 210 deletions.
1 change: 0 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,6 @@ jobs:
-DCMAKE_TOOLCHAIN_FILE=${{ env.RUNVCPKG_VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake `
"-DLibDigiDocpp_ROOT=libs/PFiles64/libdigidocpp"
cmake --build build --target msi
cmake --build build --target msishellext
cmake --build build --target appx
- name: Archive artifacts
uses: actions/upload-artifact@v4
Expand Down
3 changes: 2 additions & 1 deletion client/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -233,11 +233,12 @@ elseif(WIN32)
-d libs_path=${LIBS_PATH}
-d client_path=$<TARGET_FILE:${PROJECT_NAME}>
-d qt_suffix=$<$<CONFIG:Debug>:d>
-d ShellExt=$<TARGET_FILE:EsteidShellExtension>
${CMAKE_SOURCE_DIR}/${PROJECT_NAME}.wxs
${CMAKE_SOURCE_DIR}/cmake/modules/WelcomeDlg.wxs
${CMAKE_SOURCE_DIR}/cmake/modules/WixUI_Minimal.wxs
)
add_custom_target(msi DEPENDS ${PROJECT_NAME}
add_custom_target(msi DEPENDS ${PROJECT_NAME} EsteidShellExtension
COMMAND ${WIX_CMD} -o "${MSI_FILE}.msi"
#Build MSI with QT
COMMAND ${WIX_CMD} -d qt_path=${qtCore_install_prefix} -o "${MSI_FILE}.qt.msi"
Expand Down
58 changes: 10 additions & 48 deletions extensions/windows/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,85 +1,47 @@
cmake_minimum_required(VERSION 3.16)
project(digidocshellextension VERSION 3.13.9)

set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules)
set(CMAKE_INCLUDE_CURRENT_DIR ON)

include( VersionInfo )
project(EsteidShellExtension VERSION 3.13.9)
include(VersionInfo)

if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(MIDL_TARGET "x64")
set(PLATFORM "x64")
else()
set(MIDL_TARGET "win32")
set(PLATFORM "x86")
endif()

add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/EsteidShellExtension_i.h
${CMAKE_CURRENT_BINARY_DIR}/EsteidShellExtension_i.c
${CMAKE_CURRENT_BINARY_DIR}/EsteidShellExtension_p.c
COMMAND Midl.Exe ${CMAKE_CURRENT_SOURCE_DIR}/EsteidShellExtension.idl
/nologo /no_robust /char signed /Oicf /env ${MIDL_TARGET}
/nologo /char signed /Oicf /env ${MIDL_TARGET}
/target NT100
/I ${CMAKE_CURRENT_SOURCE_DIR}
/tlb EsteidShellExtension.tlb
/h EsteidShellExtension_i.h
/iid EsteidShellExtension_i.c
/proxy EsteidShellExtension_p.c 2> nul
/iid EsteidShellExtension_i.c 2> nul
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
VERBATIM
)

add_library(EsteidShellExtension SHARED
add_library(${PROJECT_NAME} SHARED
${CMAKE_CURRENT_BINARY_DIR}/EsteidShellExtension_i.c
dllmain.cpp
EsteidShellExtension.cpp
EsteidShellExtension.def
EsteidShlExt.cpp
stdafx.cpp
EsteidShellExtension.rc
EsteidShellExtension.rgs
EsteidShlExt_x86.rgs
EsteidShlExt_x64.rgs
)
set_target_properties(EsteidShellExtension PROPERTIES
set_target_properties(${PROJECT_NAME} PROPERTIES
MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>"
COMPILE_DEFINITIONS "_UNICODE;UNICODE;_MERGE_PROXYSTUB;_WINDLL"
COMPILE_OPTIONS "/guard:cf"
INCLUDE_DIRECTORIES ${CMAKE_CURRENT_BINARY_DIR}
INTERPROCEDURAL_OPTIMIZATION YES
COMPILE_OPTIONS "/guard:cf"
LINK_OPTIONS "/guard:cf"
LINK_LIBRARIES "uxtheme.lib"
SKIP_AUTOMOC ON
)

add_custom_target(msishellext DEPENDS EsteidShellExtension
COMMAND wix.exe build -nologo
-arch ${PLATFORM}
-d MSI_VERSION=${VERSION}
-d ShellExt=$<TARGET_FILE:EsteidShellExtension>
${CMAKE_CURRENT_SOURCE_DIR}/EsteidShellExtension.wxs
${CMAKE_MODULE_PATH}/WelcomeDlg.wxs
${CMAKE_MODULE_PATH}/WixUI_Minimal.wxs
-ext WixToolset.UI.wixext
-bv WixUIDialogBmp=${CMAKE_MODULE_PATH}/dlgbmp.bmp
-bv WixUIBannerBmp=${CMAKE_MODULE_PATH}/banner.bmp
-o Digidoc_ShellExt-${VERSION}$ENV{VER_SUFFIX}.${PLATFORM}.msi
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
)

if(SIGNCERT)
if(CROSSSIGNCERT)
target_link_options(EsteidShellExtension PRIVATE "/INTEGRITYCHECK")
endif()
add_custom_command(TARGET EsteidShellExtension POST_BUILD
COMMAND signtool.exe sign /a /v /s MY /n "${SIGNCERT}" /fd SHA256 /du http://installer.id.ee
"$<$<BOOL:${CROSSSIGNCERT}>:/ph;/ac;${CROSSSIGNCERT}>"
/tr http://sha256timestamp.ws.symantec.com/sha256/timestamp /td SHA256 $<TARGET_FILE:EsteidShellExtension>
COMMAND_EXPAND_LISTS
)
add_custom_command(TARGET msishellext POST_BUILD
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND signtool.exe sign /a /v /s MY /n "${SIGNCERT}" /fd SHA256 /du http://installer.id.ee
/tr http://sha256timestamp.ws.symantec.com/sha256/timestamp /td SHA256
"${CMAKE_BINARY_DIR}/Digidoc_ShellExt-${VERSION}$ENV{VER_SUFFIX}.${PLATFORM}.msi"
/tr http://sha256timestamp.ws.symantec.com/sha256/timestamp /td SHA256 $<TARGET_FILE:${PROJECT_NAME}>
)
endif()
59 changes: 0 additions & 59 deletions extensions/windows/EsteidShellExtension.cpp

This file was deleted.

3 changes: 0 additions & 3 deletions extensions/windows/EsteidShellExtension.def
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,3 @@ LIBRARY "EsteidShellExtension.DLL"
EXPORTS
DllCanUnloadNow PRIVATE
DllGetClassObject PRIVATE
DllRegisterServer PRIVATE
DllUnregisterServer PRIVATE
DllInstall PRIVATE
17 changes: 3 additions & 14 deletions extensions/windows/EsteidShellExtension.idl
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,15 @@
// This file will be processed by the MIDL tool to
// produce the type library (EsteidShellExtension.tlb) and marshalling code.

import "oaidl.idl";
import "ocidl.idl";
import "shobjidl.idl";

[
object,
uuid(8BD7CE13-2DB7-4268-8201-CED0626CB94E),
dual,
nonextensible,
helpstring("IEsteidShlExt Interface"),
pointer_default(unique)
]
interface IEsteidShlExt : IDispatch{
};
[
uuid(F4748FA8-B59E-43FA-9D53-2380EB141AED),
version(1.0),
helpstring("EsteidShellExtension 1.0 Type Library")
]
library EsteidShellExtensionLib
{
importlib("stdole2.tlb");
[
#ifdef _WIN64
uuid(5606A547-759D-43DA-AEEB-D3BF1D1E816D),
Expand All @@ -35,6 +23,7 @@ library EsteidShellExtensionLib
]
coclass EsteidShlExt
{
[default] interface IEsteidShlExt;
[default] interface IShellExtInit;
interface IContextMenu;
};
};
19 changes: 0 additions & 19 deletions extensions/windows/EsteidShellExtension.rc
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,6 @@ BEGIN
END


/////////////////////////////////////////////////////////////////////////////
//
// REGISTRY
//

IDR_ESTEIDEXT REGISTRY "EsteidShellExtension.rgs"


/////////////////////////////////////////////////////////////////////////////
//
// String Table
Expand All @@ -120,17 +112,6 @@ END
LANGUAGE LANG_ESTONIAN, SUBLANG_DEFAULT
#pragma code_page(1257)

/////////////////////////////////////////////////////////////////////////////
//
// REGISTRY
//

#ifdef _WIN64
IDR_ESTEIDSHLEXT REGISTRY "EsteidShlExt_x64.rgs"
#else
IDR_ESTEIDSHLEXT REGISTRY "EsteidShlExt_x86.rgs"
#endif

/////////////////////////////////////////////////////////////////////////////
//
// Bitmap
Expand Down
11 changes: 0 additions & 11 deletions extensions/windows/EsteidShellExtension.rgs

This file was deleted.

2 changes: 0 additions & 2 deletions extensions/windows/EsteidShlExt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
#include "stdafx.h"
#include "EsteidShlExt.h"

#include <uxtheme.h>

typedef DWORD ARGB;

bool HasAlpha(ARGB *pargb, SIZE &sizeImage, int cxRow)
Expand Down
2 changes: 1 addition & 1 deletion extensions/windows/EsteidShlExt.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class ATL_NO_VTABLE CEsteidShlExt :
CEsteidShlExt();
~CEsteidShlExt();

DECLARE_REGISTRY_RESOURCEID(IDR_ESTEIDSHLEXT)
DECLARE_NO_REGISTRY()
DECLARE_NOT_AGGREGATABLE(CEsteidShlExt)

BEGIN_COM_MAP(CEsteidShlExt)
Expand Down
23 changes: 0 additions & 23 deletions extensions/windows/EsteidShlExt_x64.rgs

This file was deleted.

23 changes: 0 additions & 23 deletions extensions/windows/EsteidShlExt_x86.rgs

This file was deleted.

12 changes: 12 additions & 0 deletions extensions/windows/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,15 @@ extern "C" BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpRes
hInstance;
return _AtlModule.DllMain(dwReason, lpReserved);
}

// Used to determine whether the DLL can be unloaded by OLE
STDAPI DllCanUnloadNow(void)
{
return _AtlModule.DllCanUnloadNow();
}

// Returns a class factory to create an object of the requested type
STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
{
return _AtlModule.DllGetClassObject(rclsid, riid, ppv);
}
3 changes: 0 additions & 3 deletions extensions/windows/dllmain.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,4 @@ class CEsteidShellExtensionModule : public CAtlDllModuleT< CEsteidShellExtension
{
public :
DECLARE_LIBID(LIBID_EsteidShellExtensionLib)
DECLARE_REGISTRY_APPID_RESOURCEID(IDR_ESTEIDEXT, "{08BD50C2-0AFC-4ED0-BC78-78488EDF9E58}")
};

extern class CEsteidShellExtensionModule _AtlModule;
2 changes: 0 additions & 2 deletions extensions/windows/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
// Used by EsteidShellExtension.rc
//
#define IDS_PROJNAME 100
#define IDR_ESTEIDEXT 101
#define IDR_ESTEIDSHLEXT 102
#define IDB_DIGIDOCICO 201

// Next default values for new objects
Expand Down
1 change: 1 addition & 0 deletions extensions/windows/stdafx.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <atlcom.h>
#include <ShlObj.h>
#include <comdef.h>
#include <uxtheme.h>
#include <string>
#include <vector>

Expand Down
Loading

0 comments on commit 4628d90

Please sign in to comment.