How to Install a Copy Hook shell extension for a UWP app

Josué Andrade Gomes 1 Reputation point
2024-05-22T11:18:03.8633333+00:00

I'm packaging my classic Win32 application as a MSIX package to be distributed on MS Store.

The application includes a shell extension that implements ICopyHook. With the traditional installer, the shell extension DLL is registered under the CopyHookHandlers registry key.

With MSIX, the extension has to be declared in the AppManifest.xml file. However, per documentation [1], there is no way to add a copy hooker handler extension. The only handler types available are context menu and drag and drop.

This is an excerpt of my AppManifest.xml:


<com:Extension Category="windows.comServer">
  <com:ComServer>
    <com:SurrogateServer>
      <com:Class Id="cf1cbb8d-897c-45dc-b1a9-925201981d67" Path="VFS\ProgramFilesX64\MyApplication\shellext.dll" ThreadingModel="STA" />
    </com:SurrogateServer>
  </com:ComServer>
</com:Extension>
<desktop9:Extension Category="windows.fileExplorerClassicDragDropContextMenuHandler">
  <desktop9:FileExplorerClassicDragDropContextMenuHandler>
    <desktop9:ExtensionHandler Type="*" Clsid="cf1cbb8d-897c-45dc-b1a9-925201981d67" />
  </desktop9:FileExplorerClassicDragDropContextMenuHandler>
</desktop9:Extension>

I tried to manually register the shell extension DLL from the main app code, eg with LoadLibrary, GetProcAddress for the DllRegisterServer function and calling DllRegisterServer`. I get no error but the registry entries are not created.

Is there support for copy hooker shell extensions with AppManifest.xml? Is there a workaround?

[1] https://video2.skills-academy.com/en-us/uwp/schemas/appxpackage/uapmanifestschema/element-desktop9-extension

Universal Windows Platform (UWP)
{count} votes