New Shell Integration PowerToy: Copy as UNC#46056
Open
RamblingGeekUK wants to merge 13 commits intomicrosoft:mainfrom
Open
New Shell Integration PowerToy: Copy as UNC#46056RamblingGeekUK wants to merge 13 commits intomicrosoft:mainfrom
RamblingGeekUK wants to merge 13 commits intomicrosoft:mainfrom
Conversation
Adds a new PowerToys utility that copies the UNC path of files and folders on mapped network drives to the clipboard via the shell context menu. When a user right-clicks a file on a mapped drive, the command resolves the drive letter to its full UNC path using WNetGetUniversalNameW and writes it to the clipboard. Components added: - CopyAsUNCLib: static lib with settings model and singleton - CopyAsUNCContextMenu: COM shell extension DLL (IExplorerCommand) registered via MSIX sparse package - CopyAsUNCExt: PowertoyModuleIface DLL loaded by the runner - Settings UI: Library types, ViewModel, XAML page, nav entry, localization strings, and serialization context registrations GPO support is stubbed (returns Unavailable) pending a formal GPO policy entry. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Remove _enabledGpoRuleConfiguration field that was assigned but never read (GPO is stubbed to Unavailable; no conditional logic reads the field). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Register CopyAsUNCContextMenu sparse package for removal during uninstall alongside the other context menu packages. The DLLs and MSIX are automatically included in the installer via the existing WinUI3ApplicationsFiles component group. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Drop 'path' from all display strings for a cleaner, shorter name - Add CopyAsUNC.png to Assets/Settings/Icons/ so the navigation item shows the module icon Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Per PowerToys team feedback, Copy as UNC is not a standalone utility. Instead, integrate it as a 'Shell Integration' section on the File Explorer Add-ons settings page. - Remove CopyAsUNCPage, CopyAsUNCViewModel, nav entry, module PNGs - Remove ModuleType.CopyAsUNC (no longer a top-level module type) - Add IsCopyAsUNCEnabled property to PowerPreviewViewModel, writing to GeneralSettings.Enabled.CopyAsUNC via OutGoingGeneralSettings IPC - Add 'Shell Integration' SettingsGroup to PowerPreviewPage.xaml with a toggle for Copy as UNC - Replace CopyAsUNC-specific resource strings with FileExplorerPreview_ShellIntegration and FileExplorerPreview_CopyAsUNC_Enable entries The C++ module, runner integration, and settings library types are unchanged — only the Settings UI surface is affected. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The CopyAsUNC module's enable/disable state is held in GeneralSettings, so no module-specific settings file or types are needed. Remove CopyAsUNCSettings, CopyAsUNCProperties, CopyAsUNCLocalProperties and their JsonSerializable registrations. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Convert SVG icon to multi-size ICO (16/32/48/256px) and wire up the post-build copy step so GetIcon() can locate it at runtime from WinUI3Apps\Assets\CopyAsUNC\CopyAsUNC.ico. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Regenerated CopyAsUNC.ico with BMP-encoded DIB entries for 16/32/48px and PNG for 256px. Windows shell requires BMP encoding for small icon sizes in context menus; PNG-only ICOs fail to render. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- ESRPSigning_core.json: add CopyAsUNCExt.dll, CopyAsUNCContextMenu.dll, CopyAsUNCContextMenuPackage.msix for code signing - CopyAsUNC.wxs: new installer fragment for Assets\CopyAsUNC\ folder (mirrors FileLocksmith.wxs pattern) - Product.wxs: reference CopyAsUNCComponentGroup - PowerToysInstallerVNext.wixproj: compile CopyAsUNC.wxs, restore .bk on post-build - generateAllFileComponents.ps1: generate file components for CopyAsUNC assets Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This comment has been minimized.
This comment has been minimized.
Author
|
@microsoft-github-policy-service agree |
Adds COPYASUNCCONTEXTMENU, COPYASUNCEXT, WNet, and INFOW to the spell-check expect list. These are preprocessor macro names and Windows API identifiers flagged as false positives by CI. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Contributor
|
@RamblingGeekUK errored with:
|
Run clang-format on CopyAsUNC C++ files and XamlStyler on PowerPreviewPage.xaml to comply with repo style enforcement rules. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
- Add ConfigureEnabledUtilityCopyAsUNC GPO policy to gpo.h, GPOWrapper.h/.idl/.cpp and wire up in PowerToysModule.cpp - Remove hardcoded self-signed cert signtool post-build step from CopyAsUNCContextMenu.vcxproj (CI pipeline handles signing) - Remove TODO comment from AppxManifest.xml (PowerToys.exe confirmed as correct placeholder for modules with no UI executable) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds Copy as UNC as a Shell Integration toggle under File Explorer Add-ons.
When enabled, right-clicking a file or folder on a mapped network drive shows a
"Copy as UNC path" entry in the Windows 11 context menu. Invoking it resolves the
drive letter to its UNC path (via
WNetGetUniversalNameW) and copies it to theclipboard.
Implemented as a Windows 11 sparse MSIX
IExplorerCommandshell extension,following the FileLocksmith pattern. The toggle lives in Settings → File Explorer
Add-ons → Shell Integration, per feedback from the PowerToys team.
PR Checklist
feature be placed under File Explorer Add-ons (Shell Integration section)
rather than as a standalone module — implemented accordingly.
Resources.resw:FileExplorerPreview_ShellIntegration.Header("Shell integration") andFileExplorerPreview_CopyAsUNC_Enable.Header("Copy as UNC").ESRPSigning_core.json— addedPowerToys.CopyAsUNCExt.dll,PowerToys.CopyAsUNCContextMenu.dll,CopyAsUNCContextMenuPackage.msixinstaller/PowerToysSetupVNext/CopyAsUNC.wxs— new installer fragmentfor
Assets\CopyAsUNC\folder cleanup on uninstall (mirrorsFileLocksmith.wxs)Product.wxs—CopyAsUNCComponentGroupreferencedPowerToysInstallerVNext.wixproj—CopyAsUNC.wxscompiled,.bkrestore added to post-build event
generateAllFileComponents.ps1— asset file component generation addedDetailed Description of the Pull Request / Additional comments
New files:
src/modules/CopyAsUNC/CopyAsUNCContextMenu/—IExplorerCommandCOM DLLregistered via sparse MSIX package. Reads enabled/extended-menu settings,
checks the selected item is on a mapped network drive (
DRIVE_REMOTE), resolvesUNC via
WNetGetUniversalNameW, and writes the result to the clipboard. Iconreturned from
GetIconas a multi-size.ico(BMP-encoded 16/32/48px + PNG256px) following the FileLocksmith pattern.
src/modules/CopyAsUNC/CopyAsUNCExt/—PowertoyModuleIfaceDLL loaded by therunner. Calls
RegisterSparsePackageon enable, deregisters on disable.src/modules/CopyAsUNC/CopyAsUNCLib/— static lib with settings model/singleton.installer/PowerToysSetupVNext/CopyAsUNC.wxs— WiX installer fragment.Settings UI changes:
EnabledModules.cs— addedCopyAsUNCbool property(
[JsonPropertyName("Copy as UNC")]).PowerPreviewViewModel.cs— addedIsCopyAsUNCEnabledbacked byGeneralSettings.Enabled.CopyAsUNC, sendsOutGoingGeneralSettingsIPC.PowerPreviewPage.xaml— added Shell IntegrationSettingsGroupwith toggle.toggle is the only control needed.
Questions:
AppxManifest.xmlusesExecutable="PowerToys.exe"as a placeholder — Copyas UNC has no UI executable. Is this the correct value, or should it differ?
GpoRuleConfigured.Unavailable. Happy toadd a proper
gpo.h+GPOWrapperentry if the team points to the rightpattern.
it to run, should be removed, guidance required.
design guidelines.
this is, maybe it would be better at the top, suggestions welcome.
Validation Steps Performed
Z:\folder\file.txt) inWindows 11 File Explorer.
icon.
(e.g.
\\server\share\folder\file.txt).DRIVE_REMOTE).CopyAsUNCContextMenuis included in the sparse package uninstallcleanup list in
CustomAction.cpp.