WinShellExt.wxs.in 5.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <!--
  3. *
  4. * Copyright (C) by Michael Schuster <michael@schuster.ms>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful, but
  12. * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  13. * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  14. * for more details.
  15. *
  16. -->
  17. <?include $(sys.CURRENTDIR)Platform.wxi?>
  18. <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
  19. <Fragment>
  20. <!--
  21. IMPORTANT: Keep these constants in sync with WinShellExtConstants.h.in
  22. -->
  23. <!-- Context Menu -->
  24. <?define ContextMenuGuid = "@WIN_SHELLEXT_CONTEXT_MENU_GUID@" ?>
  25. <?define ContextMenuRegKeyName = "@APPLICATION_SHORTNAME@ContextMenuHandler" ?>
  26. <?define ContextMenuDescription = "@APPLICATION_SHORTNAME@ context menu handler" ?>
  27. <!-- Overlays -->
  28. <?define OverlayGuidError = "@WIN_SHELLEXT_OVERLAY_GUID_ERROR@" ?>
  29. <?define OverlayGuidOK = "@WIN_SHELLEXT_OVERLAY_GUID_OK@" ?>
  30. <?define OverlayGuidOKShared = "@WIN_SHELLEXT_OVERLAY_GUID_OK_SHARED@" ?>
  31. <?define OverlayGuidSync = "@WIN_SHELLEXT_OVERLAY_GUID_SYNC@" ?>
  32. <?define OverlayGuidWarning = "@WIN_SHELLEXT_OVERLAY_GUID_WARNING@" ?>
  33. <!--
  34. Preceding spaces are intended, two spaces to put us ahead of the competition :/
  35. 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 ;)
  36. See: https://docs.microsoft.com/en-us/windows/win32/shell/context-menu-handlers?redirectedfrom=MSDN#employing-the-verb-selection-model
  37. -->
  38. <?define OverlayNameError = " @APPLICATION_SHORTNAME@Error" ?>
  39. <?define OverlayNameOK = " @APPLICATION_SHORTNAME@OK" ?>
  40. <?define OverlayNameOKShared = " @APPLICATION_SHORTNAME@OKShared" ?>
  41. <?define OverlayNameSync = " @APPLICATION_SHORTNAME@Sync" ?>
  42. <?define OverlayNameWarning = " @APPLICATION_SHORTNAME@Warning" ?>
  43. <?define OverlayDescription = "@APPLICATION_SHORTNAME@ overlay handler" ?>
  44. <!--
  45. Integration for Windows Explorer
  46. Avoid SelfReg by the DLLs, see:
  47. https://stackoverflow.com/questions/364187/how-do-you-register-a-win32-com-dll-file-in-wix-3#364210
  48. https://docs.microsoft.com/en-us/windows/win32/msi/selfreg-table#remarks
  49. -->
  50. <DirectoryRef Id="ShellExtDir">
  51. <Component Id="NCContextMenu" Guid="*" Win64="$(var.PlatformWin64)">
  52. <File Id="NCContextMenu.dll" KeyPath="yes" Source="$(var.HarvestAppDir)\NCContextMenu.dll">
  53. <Class Id="$(var.ContextMenuGuid)" Context="InprocServer32" Description="$(var.ContextMenuDescription)" ThreadingModel="apartment" />
  54. </File>
  55. <RegistryValue Root="HKCR" Key="CLSID\$(var.ContextMenuGuid)" Name="ContextMenuOptIn" Value="" Type="string" Action="write" />
  56. <RegistryValue Root="HKCR" Key="AllFileSystemObjects\shellex\ContextMenuHandlers\$(var.ContextMenuRegKeyName)" Value="$(var.ContextMenuGuid)" Type="string" Action="write" />
  57. </Component>
  58. <Component Id="NCOverlays" Guid="*" Win64="$(var.PlatformWin64)">
  59. <File Id="NCOverlays.dll" KeyPath="yes" Source="$(var.HarvestAppDir)\NCOverlays.dll">
  60. <Class Id="$(var.OverlayGuidError)" Context="InprocServer32" Description="$(var.OverlayDescription)" ThreadingModel="apartment" Version="1.0" />
  61. <Class Id="$(var.OverlayGuidOK)" Context="InprocServer32" Description="$(var.OverlayDescription)" ThreadingModel="apartment" Version="1.0" />
  62. <Class Id="$(var.OverlayGuidOKShared)" Context="InprocServer32" Description="$(var.OverlayDescription)" ThreadingModel="apartment" Version="1.0" />
  63. <Class Id="$(var.OverlayGuidSync)" Context="InprocServer32" Description="$(var.OverlayDescription)" ThreadingModel="apartment" Version="1.0" />
  64. <Class Id="$(var.OverlayGuidWarning)" Context="InprocServer32" Description="$(var.OverlayDescription)" ThreadingModel="apartment" Version="1.0" />
  65. </File>
  66. <RegistryKey Root="HKLM" Key="SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ShellIconOverlayIdentifiers">
  67. <RegistryValue Key="$(var.OverlayNameError)" Value="$(var.OverlayGuidError)" Type="string" Action="write" />
  68. <RegistryValue Key="$(var.OverlayNameOK)" Value="$(var.OverlayGuidOK)" Type="string" Action="write" />
  69. <RegistryValue Key="$(var.OverlayNameOKShared)" Value="$(var.OverlayGuidOKShared)" Type="string" Action="write" />
  70. <RegistryValue Key="$(var.OverlayNameSync)" Value="$(var.OverlayGuidSync)" Type="string" Action="write" />
  71. <RegistryValue Key="$(var.OverlayNameWarning)" Value="$(var.OverlayGuidWarning)" Type="string" Action="write" />
  72. </RegistryKey>
  73. </Component>
  74. </DirectoryRef>
  75. <ComponentGroup Id="ShellExtensions">
  76. <ComponentRef Id="NCContextMenu" />
  77. <ComponentRef Id="NCOverlays" />
  78. </ComponentGroup>
  79. </Fragment>
  80. </Wix>