feat: support virtual and MTP mobile device items preview - #1995
Open
StevenWin818 wants to merge 1 commit into
Open
feat: support virtual and MTP mobile device items preview#1995StevenWin818 wants to merge 1 commit into
StevenWin818 wants to merge 1 commit into
Conversation
Reviewer's GuideThe PR adds an end-to-end virtual Shell-item preview path: native code identifies filesystem versus virtual selections and serializes safe metadata, managed code preserves and compares their canonical identities, and the viewer routes them to an InfoPanel that renders metadata and the corresponding system icon without exposing Shell parsing names to file-based plugins. Sequence diagram for virtual Shell item previewsequenceDiagram
participant Explorer
participant NativeSelection as NativeSelection
participant FocusMonitor
participant ViewWindowManager
participant InfoPanel
participant ShellIcon as ShellIcon
Explorer->>NativeSelection: GetCurrentSelection()
NativeSelection->>NativeSelection: GetDisplayName(SIGDN_FILESYSPATH)
alt virtual or MTP item
NativeSelection->>NativeSelection: GetDisplayName(SIGDN_DESKTOPABSOLUTEPARSING)
NativeSelection->>NativeSelection: FormatVirtualItem()
NativeSelection-->>FocusMonitor: ::QL_VIRTUAL metadata
FocusMonitor->>FocusMonitor: VirtualItemInfo.IsSameItem()
FocusMonitor->>ViewWindowManager: SendMessage(Switch, path)
ViewWindowManager->>InfoPanel: DisplayInfo(path)
InfoPanel->>InfoPanel: VirtualItemInfo.TryParse(path)
InfoPanel->>ShellIcon: GetJumboIcon(iconIndex)
ShellIcon-->>InfoPanel: BitmapSource
end
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 2 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="QuickLook/Plugin/InfoPanel/WindowsThumbnailProvider.cs" line_range="50-52" />
<code_context>
+ private const int IldTransparent = 0x00000001;
+ private static readonly Guid IidImageList = new("46EB5926-582E-4017-9FDF-E8998DAA0950");
+
+ [ComImport, Guid("46EB5926-582E-4017-9FDF-E8998DAA0950"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ private interface IImageList
+ {
+ [PreserveSig] int _0(); [PreserveSig] int _1(); [PreserveSig] int _2(); [PreserveSig] int _3();
+ [PreserveSig] int _4(); [PreserveSig] int _5(); [PreserveSig] int _6();
+ [PreserveSig] int GetIcon(int i, int flags, out IntPtr picon);
+ }
+
</code_context>
<issue_to_address>
**issue (bug_risk):** `IImageList.GetIcon` is declared at the eighth COM vtable slot, but the native `IImageList` interface has additional methods before `GetIcon` (including `GetImageInfo`, `Copy`, `Merge`, and `Clone`). The call therefore dispatches to the wrong method and can fail to return an icon or corrupt memory when a virtual item preview requests its jumbo icon.
**Triggers:** When a virtual item has a non-negative system icon index and `GetJumboIcon` calls `imageList.GetIcon`.
**Suggested fix:** Declare all preceding `IImageList` methods so `GetIcon` occupies its correct COM vtable slot, or use a correctly defined interop interface.
```suggestion
[PreserveSig] int GetImageCount(out int pCount);
[PreserveSig] int SetImageCount(int uNewCount);
[PreserveSig] int GetImageInfo(int i, IntPtr pImageInfo);
[PreserveSig] int Copy(int iDst, int iSrc, int uFlags);
[PreserveSig] int Merge(int i1, int i2, IntPtr ppim, int dx, int dy);
[PreserveSig] int Clone(IntPtr ppim);
[PreserveSig] int Draw(IntPtr pimldp);
[PreserveSig] int GetIcon(int i, int flags, out IntPtr picon);
```
</issue_to_address>
### Comment 2
<location path="QuickLook.Native/QuickLook.Native32/HelperMethods.cpp" line_range="164" />
<code_context>
+ ATL::CComHeapPtr<WCHAR> filePath;
+ if (SUCCEEDED(shellItem->GetDisplayName(SIGDN_FILESYSPATH, &filePath)) && filePath)
+ {
+ StringCchCopyW(buffer, MAX_PATH_EX, filePath);
+ }
+ else
</code_context>
<issue_to_address>
**issue (bug_risk):** The filesystem-path branch copies the `SIGDN_FILESYSPATH` result with a `MAX_PATH` capacity instead of `MAX_PATH_EX`. Long filesystem selections are truncated or cause `StringCchCopyW` to fail, leaving the selection buffer unusable even though the native API and the surrounding code support extended-length paths.
**Triggers:** When a normal filesystem selection has a path longer than 260 characters.
**Suggested fix:** Pass `MAX_PATH_EX` to `StringCchCopyW` in this branch and handle a failed copy consistently.
```suggestion
if (FAILED(StringCchCopyW(buffer, MAX_PATH_EX, filePath)))
buffer[0] = L'\0';
```
</issue_to_address>Sourcery assessment
Approval pending. 2 findings to address first.
Blocking findings: QuickLook/Plugin/InfoPanel/WindowsThumbnailProvider.cs:52, QuickLook.Native/QuickLook.Native32/HelperMethods.cpp:164
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
StevenWin818
force-pushed
the
master
branch
2 times, most recently
from
August 30, 2026 08:05
8a3581e to
123fb8c
Compare
sourcery-ai
Bot
dismissed
their stale review
August 30, 2026 08:05
Sourcery withdrew this approval because the latest commits introduced blocking findings.
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.
PR Checklist
Brief Description of Changes
This PR adds safe metadata previews for non-filesystem Windows Shell items, including MTP mobile-device files and folders.
SIGDN_FILESYSPATHfor normal filesystem selections.Related Issue (if any)
Fixes #1769
Additional Notes
Summary by Sourcery
Support safe previews for virtual and MTP Windows Shell items without treating them as filesystem paths.
New Features:
Bug Fixes:
Enhancements: