diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 360a9f74f..616d871de 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index ec54a7997..7c027a0c7 100644 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -233,11 +233,12 @@ elseif(WIN32) -d libs_path=${LIBS_PATH} -d client_path=$ -d qt_suffix=$<$:d> + -d ShellExt=$ ${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" diff --git a/extensions/windows/CMakeLists.txt b/extensions/windows/CMakeLists.txt index 49daab56e..25ab2714d 100644 --- a/extensions/windows/CMakeLists.txt +++ b/extensions/windows/CMakeLists.txt @@ -1,17 +1,10 @@ -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( @@ -19,67 +12,36 @@ add_custom_command( ${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$<$: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=$ - ${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 - "$<$:/ph;/ac;${CROSSSIGNCERT}>" - /tr http://sha256timestamp.ws.symantec.com/sha256/timestamp /td SHA256 $ - 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 $ ) endif() diff --git a/extensions/windows/EsteidShellExtension.cpp b/extensions/windows/EsteidShellExtension.cpp deleted file mode 100644 index 3de907dd0..000000000 --- a/extensions/windows/EsteidShellExtension.cpp +++ /dev/null @@ -1,59 +0,0 @@ -// EsteidShellExtension.cpp : Implementation of DLL Exports. - - -#include "stdafx.h" -#include "EsteidShellExtension_i.h" -#include "dllmain.h" - -// 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); -} - - -// DllRegisterServer - Adds entries to the system registry -STDAPI DllRegisterServer(void) -{ - // registers object, typelib and all interfaces in typelib - HRESULT hr = _AtlModule.DllRegisterServer(); - return hr; -} - - -// DllUnregisterServer - Removes entries from the system registry -STDAPI DllUnregisterServer(void) -{ - HRESULT hr = _AtlModule.DllUnregisterServer(); - return hr; -} - -// DllInstall - Adds/Removes entries to the system registry per user -// per machine. -STDAPI DllInstall(BOOL bInstall, LPCWSTR pszCmdLine) -{ - HRESULT hr = E_FAIL; - static const wchar_t szUserSwitch[] = _T("user"); - - if (pszCmdLine != NULL) { - if (_wcsnicmp(pszCmdLine, szUserSwitch, _countof(szUserSwitch)) == 0) - AtlSetPerUserRegistration(true); - } - - if (bInstall) { - hr = DllRegisterServer(); - if (FAILED(hr)) - DllUnregisterServer(); - } else { - hr = DllUnregisterServer(); - } - - return hr; -} diff --git a/extensions/windows/EsteidShellExtension.def b/extensions/windows/EsteidShellExtension.def index d606fda47..4a07f5a74 100644 --- a/extensions/windows/EsteidShellExtension.def +++ b/extensions/windows/EsteidShellExtension.def @@ -5,6 +5,3 @@ LIBRARY "EsteidShellExtension.DLL" EXPORTS DllCanUnloadNow PRIVATE DllGetClassObject PRIVATE - DllRegisterServer PRIVATE - DllUnregisterServer PRIVATE - DllInstall PRIVATE diff --git a/extensions/windows/EsteidShellExtension.idl b/extensions/windows/EsteidShellExtension.idl index 92361f614..90d4b6439 100644 --- a/extensions/windows/EsteidShellExtension.idl +++ b/extensions/windows/EsteidShellExtension.idl @@ -4,19 +4,8 @@ // 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), @@ -24,7 +13,6 @@ interface IEsteidShlExt : IDispatch{ ] library EsteidShellExtensionLib { - importlib("stdole2.tlb"); [ #ifdef _WIN64 uuid(5606A547-759D-43DA-AEEB-D3BF1D1E816D), @@ -35,6 +23,7 @@ library EsteidShellExtensionLib ] coclass EsteidShlExt { - [default] interface IEsteidShlExt; + [default] interface IShellExtInit; + interface IContextMenu; }; }; diff --git a/extensions/windows/EsteidShellExtension.rc b/extensions/windows/EsteidShellExtension.rc index 1dc252cb9..745dd783d 100644 --- a/extensions/windows/EsteidShellExtension.rc +++ b/extensions/windows/EsteidShellExtension.rc @@ -91,14 +91,6 @@ BEGIN END -///////////////////////////////////////////////////////////////////////////// -// -// REGISTRY -// - -IDR_ESTEIDEXT REGISTRY "EsteidShellExtension.rgs" - - ///////////////////////////////////////////////////////////////////////////// // // String Table @@ -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 diff --git a/extensions/windows/EsteidShellExtension.rgs b/extensions/windows/EsteidShellExtension.rgs deleted file mode 100644 index 1da405ca5..000000000 --- a/extensions/windows/EsteidShellExtension.rgs +++ /dev/null @@ -1,11 +0,0 @@ -HKCR -{ - NoRemove AppID - { - '%APPID%' = s 'EsteidShellExtension' - 'EsteidShellExtension.DLL' - { - val AppID = s '%APPID%' - } - } -} diff --git a/extensions/windows/EsteidShlExt.cpp b/extensions/windows/EsteidShlExt.cpp index 78e9c38e5..341e91b03 100644 --- a/extensions/windows/EsteidShlExt.cpp +++ b/extensions/windows/EsteidShlExt.cpp @@ -4,8 +4,6 @@ #include "stdafx.h" #include "EsteidShlExt.h" -#include - typedef DWORD ARGB; bool HasAlpha(ARGB *pargb, SIZE &sizeImage, int cxRow) diff --git a/extensions/windows/EsteidShlExt.h b/extensions/windows/EsteidShlExt.h index b4caba6a9..5d2569935 100644 --- a/extensions/windows/EsteidShlExt.h +++ b/extensions/windows/EsteidShlExt.h @@ -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) diff --git a/extensions/windows/EsteidShlExt_x64.rgs b/extensions/windows/EsteidShlExt_x64.rgs deleted file mode 100644 index a77b39827..000000000 --- a/extensions/windows/EsteidShlExt_x64.rgs +++ /dev/null @@ -1,23 +0,0 @@ -HKCR -{ - NoRemove CLSID - { - ForceRemove {5606A547-759D-43DA-AEEB-D3BF1D1E816D} = s 'EsteidShlExt Class' - { - InprocServer32 = s '%MODULE%' - { - val ThreadingModel = s 'Apartment' - } - } - } - NoRemove * - { - NoRemove ShellEx - { - NoRemove ContextMenuHandlers - { - ForceRemove EsteidShlExt = s '{5606A547-759D-43DA-AEEB-D3BF1D1E816D}' - } - } - } -} diff --git a/extensions/windows/EsteidShlExt_x86.rgs b/extensions/windows/EsteidShlExt_x86.rgs deleted file mode 100644 index 21b81d78c..000000000 --- a/extensions/windows/EsteidShlExt_x86.rgs +++ /dev/null @@ -1,23 +0,0 @@ -HKCR -{ - NoRemove CLSID - { - ForceRemove {310AAB39-76FE-401B-8A7F-0F578C5F6AB5} = s 'EsteidShlExt Class' - { - InprocServer32 = s '%MODULE%' - { - val ThreadingModel = s 'Apartment' - } - } - } - NoRemove * - { - NoRemove ShellEx - { - NoRemove ContextMenuHandlers - { - ForceRemove EsteidShlExt = s '{310AAB39-76FE-401B-8A7F-0F578C5F6AB5}' - } - } - } -} diff --git a/extensions/windows/dllmain.cpp b/extensions/windows/dllmain.cpp index c1ac50115..b7ac18b9c 100644 --- a/extensions/windows/dllmain.cpp +++ b/extensions/windows/dllmain.cpp @@ -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); +} \ No newline at end of file diff --git a/extensions/windows/dllmain.h b/extensions/windows/dllmain.h index 05f6a30d6..f63226e07 100644 --- a/extensions/windows/dllmain.h +++ b/extensions/windows/dllmain.h @@ -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; diff --git a/extensions/windows/resource.h b/extensions/windows/resource.h index 6d15be586..2e203ec2e 100644 --- a/extensions/windows/resource.h +++ b/extensions/windows/resource.h @@ -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 diff --git a/extensions/windows/stdafx.h b/extensions/windows/stdafx.h index fa0489713..3674e3cd7 100644 --- a/extensions/windows/stdafx.h +++ b/extensions/windows/stdafx.h @@ -20,6 +20,7 @@ #include #include #include +#include #include #include diff --git a/qdigidoc4.wxs b/qdigidoc4.wxs index a8c930026..529a9f407 100644 --- a/qdigidoc4.wxs +++ b/qdigidoc4.wxs @@ -1,7 +1,13 @@ + + + @@ -24,6 +30,7 @@ + @@ -139,6 +146,23 @@ + + + + + + + + + + + + +