@@ -751,22 +751,27 @@ public static async Task<IEnumerable<IStorageItemWithPath>> GetDraggedStorageIte
751
751
}
752
752
753
753
// workaround for pasting folders from remote desktop (#12318)
754
- if ( hasVirtualItems && packageView . Contains ( "FileContents" ) )
754
+ try
755
755
{
756
- var descriptor = NativeClipboard . CurrentDataObject . GetData < Shell32 . FILEGROUPDESCRIPTOR > ( "FileGroupDescriptorW" ) ;
757
- for ( var ii = 0 ; ii < descriptor . cItems ; ii ++ )
756
+ if ( hasVirtualItems && packageView . Contains ( "FileContents" ) )
758
757
{
759
- if ( descriptor . fgd [ ii ] . dwFileAttributes . HasFlag ( FileFlagsAndAttributes . FILE_ATTRIBUTE_DIRECTORY ) )
760
- {
761
- itemsList . Add ( new VirtualStorageFolder ( descriptor . fgd [ ii ] . cFileName ) . FromStorageItem ( ) ) ;
762
- }
763
- else if ( NativeClipboard . CurrentDataObject . GetData ( "FileContents" , DVASPECT . DVASPECT_CONTENT , ii ) is IStream stream )
758
+ var descriptor = NativeClipboard . CurrentDataObject . GetData < Shell32 . FILEGROUPDESCRIPTOR > ( "FileGroupDescriptorW" ) ;
759
+ for ( var ii = 0 ; ii < descriptor . cItems ; ii ++ )
764
760
{
765
- var streamContent = new ComStreamWrapper ( stream ) ;
766
- itemsList . Add ( new VirtualStorageFile ( streamContent , descriptor . fgd [ ii ] . cFileName ) . FromStorageItem ( ) ) ;
761
+ if ( descriptor . fgd [ ii ] . dwFileAttributes . HasFlag ( FileFlagsAndAttributes . FILE_ATTRIBUTE_DIRECTORY ) )
762
+ itemsList . Add ( new VirtualStorageFolder ( descriptor . fgd [ ii ] . cFileName ) . FromStorageItem ( ) ) ;
763
+ else if ( NativeClipboard . CurrentDataObject . GetData ( "FileContents" , DVASPECT . DVASPECT_CONTENT , ii ) is IStream stream )
764
+ {
765
+ var streamContent = new ComStreamWrapper ( stream ) ;
766
+ itemsList . Add ( new VirtualStorageFile ( streamContent , descriptor . fgd [ ii ] . cFileName ) . FromStorageItem ( ) ) ;
767
+ }
767
768
}
768
769
}
769
770
}
771
+ catch ( Exception ex )
772
+ {
773
+ App . Logger . LogWarning ( ex , ex . Message ) ;
774
+ }
770
775
771
776
// workaround for GetStorageItemsAsync() bug that only yields 16 items at most
772
777
// https://learn.microsoft.com/windows/win32/shell/clipboard#cf_hdrop
0 commit comments