Forum Discussion
How to Install a Copy Hook shell extension for a UWP app
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://learn.microsoft.com/en-us/uwp/schemas/appxpackage/uapmanifestschema/element-desktop9-extension
1 Reply
josuegomes I believe you are correct; Microsoft has not (yet?) created an extension for the Copy Hook handler.
Regarding the documentation you reference has a few things in it of note to point out in case someone wants to register.
- The extensions go into the AppXManifest.xml file (Perhaps just a typo on your post, but not AppManifest).
- The extension requires both that the MinOS field of the Identity element of the AppXManifest be at least that of the minimum OS for this extension 10.0.22159.0
- The extension only works on Windows 11 (NOT 10) 21H2 or above.
- The extension must be under an Application, and not the Package level extensions (the page title is wrong but syntax section correct (I have an outstanding issue against the documentation page).
- The requires specification of at least one file type (as indicated in the doc page) to associate the drag and drop handler..