diff options
author | Michael Schuster <michael@schuster.ms> | 2020-08-18 22:42:31 +0300 |
---|---|---|
committer | Michael Schuster <michael@schuster.ms> | 2020-08-20 19:50:05 +0300 |
commit | db05f65e0d0c9de85e8f737bc331eea6de491137 (patch) | |
tree | 18be98d6aa33b7f881840851b2a5622e7c147316 /shell_integration | |
parent | 11632da7ea36c8c501866aa220cb28365cf110cc (diff) |
Windows shell extensions: Add WiX (MSI) fragment
Use CMake to generate a WXI fragment to handle the DLL registration and file deployment for the shellext components.
Signed-off-by: Michael Schuster <michael@schuster.ms>
Diffstat (limited to 'shell_integration')
-rw-r--r-- | shell_integration/windows/CMakeLists.txt | 2 | ||||
-rw-r--r-- | shell_integration/windows/WinShellExt.wxs.in | 93 | ||||
-rw-r--r-- | shell_integration/windows/WinShellExtConstants.h.in | 2 | ||||
-rw-r--r-- | shell_integration/windows/WinShellExtConstants.wxi.in | 50 |
4 files changed, 95 insertions, 52 deletions
diff --git a/shell_integration/windows/CMakeLists.txt b/shell_integration/windows/CMakeLists.txt index a350b09d6..d75d2574d 100644 --- a/shell_integration/windows/CMakeLists.txt +++ b/shell_integration/windows/CMakeLists.txt @@ -7,7 +7,7 @@ include_directories( ${CMAKE_CURRENT_BINARY_DIR} ) configure_file(WinShellExtConstants.h.in ${CMAKE_CURRENT_BINARY_DIR}/WinShellExtConstants.h) -configure_file(WinShellExtConstants.wxi.in ${CMAKE_CURRENT_BINARY_DIR}/WinShellExtConstants.wxi) +configure_file(WinShellExt.wxs.in ${CMAKE_CURRENT_BINARY_DIR}/WinShellExt.wxs) add_subdirectory(NCContextMenu) add_subdirectory(NCOverlays) diff --git a/shell_integration/windows/WinShellExt.wxs.in b/shell_integration/windows/WinShellExt.wxs.in new file mode 100644 index 000000000..6ac42dca4 --- /dev/null +++ b/shell_integration/windows/WinShellExt.wxs.in @@ -0,0 +1,93 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * + * Copyright (C) by Michael Schuster <michael.schuster@nextcloud.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * +--> +<?include $(var.ProjectPath)Platform.wxi?> + +<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> + <Fragment> + + <!-- + IMPORTANT: Keep these constants in sync with WinShellExtConstants.h.in + --> + + <!-- Context Menu --> + <?define ContextMenuGuid = "@WIN_SHELLEXT_CONTEXT_MENU_GUID@" ?> + <?define ContextMenuRegKeyName = "@APPLICATION_SHORTNAME@ContextMenuHandler" ?> + + <?define ContextMenuDescription = "@APPLICATION_SHORTNAME@ context menu handler" ?> + + <!-- Overlays --> + <?define OverlayGuidError = "@WIN_SHELLEXT_OVERLAY_GUID_ERROR@" ?> + <?define OverlayGuidOK = "@WIN_SHELLEXT_OVERLAY_GUID_OK@" ?> + <?define OverlayGuidOKShared = "@WIN_SHELLEXT_OVERLAY_GUID_OK_SHARED@" ?> + <?define OverlayGuidSync = "@WIN_SHELLEXT_OVERLAY_GUID_SYNC@" ?> + <?define OverlayGuidWarning = "@WIN_SHELLEXT_OVERLAY_GUID_WARNING@" ?> + + <!-- + Preceeding spaces are intended, two spaces to put us ahead of the competition :/ + + There is a limit in Windows (oh wonder^^) so that only the first 15 extensions get invoked, this is why to use that dirty little trick to get ahead ;) + See: https://docs.microsoft.com/en-us/windows/win32/shell/context-menu-handlers?redirectedfrom=MSDN#employing-the-verb-selection-model + --> + <?define OverlayNameError = " @APPLICATION_SHORTNAME@Error" ?> + <?define OverlayNameOK = " @APPLICATION_SHORTNAME@OK" ?> + <?define OverlayNameOKShared = " @APPLICATION_SHORTNAME@OKShared" ?> + <?define OverlayNameSync = " @APPLICATION_SHORTNAME@Sync" ?> + <?define OverlayNameWarning = " @APPLICATION_SHORTNAME@Warning" ?> + + <?define OverlayDescription = "@APPLICATION_SHORTNAME@ overlay handler" ?> + + <!-- + Integration for Windows Explorer + + Avoid SelfReg by the DLLs, see: + https://stackoverflow.com/questions/364187/how-do-you-register-a-win32-com-dll-file-in-wix-3#364210 + https://docs.microsoft.com/en-us/windows/win32/msi/selfreg-table#remarks + --> + + <DirectoryRef Id="ShellExtDir"> + <Component Id="NCContextMenu" Guid="*" Win64="$(var.PlatformWin64)"> + <File Id="NCContextMenu.dll" KeyPath="yes" Source="$(var.HarvestAppDir)\shellext\NCContextMenu.dll"> + <Class Id="$(var.ContextMenuGuid)" Context="InprocServer32" Description="$(var.ContextMenuDescription)" ThreadingModel="apartment" /> + </File> + <RegistryValue Root="HKCR" Key="AllFileSystemObjects\shellex\ContextMenuHandlers\$(var.ContextMenuRegKeyName)" Value="$(var.ContextMenuGuid)" Type="string" Action="write" /> + </Component> + + <Component Id="NCOverlays" Guid="*" Win64="$(var.PlatformWin64)"> + <File Id="NCOverlays.dll" KeyPath="yes" Source="$(var.HarvestAppDir)\shellext\NCOverlays.dll"> + <Class Id="$(var.OverlayGuidError)" Context="InprocServer32" Description="$(var.OverlayDescription)" ThreadingModel="apartment" Version="1.0" /> + <Class Id="$(var.OverlayGuidOK)" Context="InprocServer32" Description="$(var.OverlayDescription)" ThreadingModel="apartment" Version="1.0" /> + <Class Id="$(var.OverlayGuidOKShared)" Context="InprocServer32" Description="$(var.OverlayDescription)" ThreadingModel="apartment" Version="1.0" /> + <Class Id="$(var.OverlayGuidSync)" Context="InprocServer32" Description="$(var.OverlayDescription)" ThreadingModel="apartment" Version="1.0" /> + <Class Id="$(var.OverlayGuidWarning)" Context="InprocServer32" Description="$(var.OverlayDescription)" ThreadingModel="apartment" Version="1.0" /> + </File> + <RegistryKey Root="HKLM" Key="SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ShellIconOverlayIdentifiers"> + <RegistryValue Key="$(var.OverlayNameError)" Value="$(var.OverlayGuidError)" Type="string" Action="write" /> + <RegistryValue Key="$(var.OverlayNameOK)" Value="$(var.OverlayGuidOK)" Type="string" Action="write" /> + <RegistryValue Key="$(var.OverlayNameOKShared)" Value="$(var.OverlayGuidOKShared)" Type="string" Action="write" /> + <RegistryValue Key="$(var.OverlayNameSync)" Value="$(var.OverlayGuidSync)" Type="string" Action="write" /> + <RegistryValue Key="$(var.OverlayNameWarning)" Value="$(var.OverlayGuidWarning)" Type="string" Action="write" /> + </RegistryKey> + </Component> + </DirectoryRef> + + <ComponentGroup Id="ShellExtensions"> + <ComponentRef Id="NCContextMenu" /> + <ComponentRef Id="NCOverlays" /> + </ComponentGroup> + + </Fragment> +</Wix> diff --git a/shell_integration/windows/WinShellExtConstants.h.in b/shell_integration/windows/WinShellExtConstants.h.in index 0303ac174..cad7539d2 100644 --- a/shell_integration/windows/WinShellExtConstants.h.in +++ b/shell_integration/windows/WinShellExtConstants.h.in @@ -14,7 +14,7 @@ #pragma once -// IMPORTANT: Keep this file in sync with WinShellExtConstants.wxi.in +// IMPORTANT: Keep these constants in sync with WinShellExtConstants.wxi.in // Context Menu #define CONTEXT_MENU_GUID L"@WIN_SHELLEXT_CONTEXT_MENU_GUID@" diff --git a/shell_integration/windows/WinShellExtConstants.wxi.in b/shell_integration/windows/WinShellExtConstants.wxi.in deleted file mode 100644 index 9e65fd0e7..000000000 --- a/shell_integration/windows/WinShellExtConstants.wxi.in +++ /dev/null @@ -1,50 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - * - * Copyright (C) by Michael Schuster <michael.schuster@nextcloud.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * ---> -<Include> - - <!-- - IMPORTANT: Keep this file in sync with WinShellExtConstants.h.in - --> - - <!-- Context Menu --> - <?define ContextMenuGuid = "@WIN_SHELLEXT_CONTEXT_MENU_GUID@" ?> - <?define ContextMenuRegKeyName = "@APPLICATION_SHORTNAME@ContextMenuHandler" ?> - - <?define ContextMenuDescription = "@APPLICATION_SHORTNAME@ context menu handler" ?> - - <!-- Overlays --> - <?define OverlayGuidError = "@WIN_SHELLEXT_OVERLAY_GUID_ERROR@" ?> - <?define OverlayGuidOK = "@WIN_SHELLEXT_OVERLAY_GUID_OK@" ?> - <?define OverlayGuidOKShared = "@WIN_SHELLEXT_OVERLAY_GUID_OK_SHARED@" ?> - <?define OverlayGuidSync = "@WIN_SHELLEXT_OVERLAY_GUID_SYNC@" ?> - <?define OverlayGuidWarning = "@WIN_SHELLEXT_OVERLAY_GUID_WARNING@" ?> - - <!-- - Preceeding spaces are intended, two spaces to put us ahead of the competition :/ - - There is a limit in Windows (oh wonder^^) so that only the first 15 extensions get invoked, this is why to use that dirty little trick to get ahead ;) - See: https://docs.microsoft.com/en-us/windows/win32/shell/context-menu-handlers?redirectedfrom=MSDN#employing-the-verb-selection-model - --> - <?define OverlayNameError = " @APPLICATION_SHORTNAME@Error" ?> - <?define OverlayNameOK = " @APPLICATION_SHORTNAME@OK" ?> - <?define OverlayNameOKShared = " @APPLICATION_SHORTNAME@OKShared" ?> - <?define OverlayNameSync = " @APPLICATION_SHORTNAME@Sync" ?> - <?define OverlayNameWarning = " @APPLICATION_SHORTNAME@Warning" ?> - - <?define OverlayDescription = "@APPLICATION_SHORTNAME@ overlay handler" ?> - -</Include> |