Compare commits

...

2 Commits

Author SHA1 Message Date
copilot-swe-agent[bot]
9163005b9e Fix COMException 0x8004B207 (WTS_E_NOSTORAGEPROVIDERTHUMBNAILHANDLER) when generating thumbnails for PNG files on cloud storage
When a PNG file is stored on OneDrive or another cloud storage provider, Windows returns WTS_E_NOSTORAGEPROVIDERTHUMBNAILHANDLER (0x8004B207) because the storage provider lacks a thumbnail handler. The existing fallback only covered ExtractionFailed (0x8004B200). This change adds the missing error code to HResult and extends the IconOnly fallback to handle it gracefully.

Agent-Logs-Url: https://github.com/microsoft/PowerToys/sessions/23f4b22f-0823-47af-af4e-fa65f8e853b5

Co-authored-by: MuyuanMS <116717757+MuyuanMS@users.noreply.github.com>
2026-04-29 09:55:08 +00:00
copilot-swe-agent[bot]
dfcd1d79f6 Initial plan 2026-04-29 08:51:42 +00:00

View File

@@ -43,6 +43,7 @@ namespace Wox.Infrastructure.Image
NoInterface = unchecked((int)0x80004002),
Fail = unchecked((int)0x80004005),
ExtractionFailed = unchecked((int)0x8004B200),
NoStorageProviderThumbnailHandler = unchecked((int)0x8004B207),
ElementNotFound = unchecked((int)0x80070490),
TypeElementNotFound = unchecked((int)0x8002802B),
NoObject = unchecked((int)0x800401E5),
@@ -130,7 +131,7 @@ namespace Wox.Infrastructure.Image
HResult hr = ((IShellItemImageFactory)nativeShellItem).GetImage(nativeSize, options, out hBitmap);
// if extracting image thumbnail and failed, extract shell icon
if (options == ThumbnailOptions.ThumbnailOnly && hr == HResult.ExtractionFailed)
if (options == ThumbnailOptions.ThumbnailOnly && (hr == HResult.ExtractionFailed || hr == HResult.NoStorageProviderThumbnailHandler))
{
hr = ((IShellItemImageFactory)nativeShellItem).GetImage(nativeSize, ThumbnailOptions.IconOnly, out hBitmap);
}