View Issue Details

IDProjectCategoryView StatusLast Update
0001671Double CommanderDefaultpublic2023-01-21 16:07
Reportercordylus Assigned To 
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
ProjectionnoneETAnone 
OSWindowsOS VersionXP 
Product Version0.7.6 
Fixed in Version1.0.0 
Summary0001671: Can't drag-n-drop from Windows Explorer when a zip archive is opened in it
DescriptionJust nothing happens.
TagsNo tags attached.
Attached Files
uOleDragDrop.pas.patch (1,464 bytes)   
Index: src/platform/uOleDragDrop.pas
===================================================================
--- src/platform/uOleDragDrop.pas	(revision 7570)
+++ src/platform/uOleDragDrop.pas	(working copy)
@@ -998,12 +998,12 @@
   tIID : PGuid;
   hFile: THandle;
   pvStrm: IStream;
+  pvStrmStatStg: TStatStg;
   dwSize:     LongInt;
   AnyPointer: PAnsiChar;
   InnerFilename: String;
   StgDocFile: WideString;
   msStream:   TMemoryStream;
-  i64Size, i64Move: {$IF FPC_FULLVERSION < 030002}Int64{$ELSE}QWord{$ENDIF};
 begin
   result:=FALSE;
   InnerFilename:= ExtractFilepath(WantedFilename) + TEMPFILENAME;
@@ -1045,16 +1045,14 @@
     begin
       pvStrm:=IStream(Medium.pstm);
       // Figure out how large the data is
-      if (pvStrm.Seek(0, STREAM_SEEK_END, i64Size) = S_OK) then
+      if (pvStrm.Stat(pvStrmStatStg, STATFLAG_NONAME) = S_OK) then
       begin
-        // Seek back to start of stream
-        pvStrm.Seek(0, STREAM_SEEK_SET, i64Move);
         // Create memory stream to convert to
         msStream:=TMemoryStream.Create;
         // Allocate size
-        msStream.Size:=i64Size;
+        msStream.Size:=pvStrmStatStg.cbSize;
         // Read from the IStream into the memory for the TMemoryStream
-        if pvStrm.Read(msStream.Memory, i64Size, @dwSize)=S_OK then
+        if pvStrm.Read(msStream.Memory, pvStrmStatStg.cbSize, @dwSize)=S_OK then
           msStream.Size:=dwSize
         else
           msStream.Size:=0;
uOleDragDrop.pas.patch (1,464 bytes)   
Fixed in Revision
Operating systemWindows
Widgetset
Architecture

Activities

cordylus

2017-05-07 01:38

developer   ~0002192

Found a workaround until this is fixed: files can be copy-pasted.

cordylus

2017-05-20 08:07

developer   ~0002245

I've tried to debug this. Strange thing happens with this bug: IStream.Seek returns -2147467263, this is not one of the documented return values. Searching the Internet shows that it is E_NOTIMPL.

The function call is pvStrm.Seek(0, STREAM_SEEK_END, i64Size) at line 1048 of src/platform/uOleDragDrop.pas (DC 0.8.0 r7570)

cordylus

2017-05-20 10:00

developer   ~0002246

I've added a patch, but this is NOT a solution, just a small optimization. Stat should be a better way to get the size than two Seek calls. But in this case it returns the same E_NOTIMPL and I don't know how to enter this code path with working data, so the patch is not tested.

Issue History

Date Modified Username Field Change
2016-12-20 21:44 cordylus New Issue
2017-05-07 01:38 cordylus Note Added: 0002192
2017-05-20 08:07 cordylus Note Added: 0002245
2017-05-20 10:00 cordylus File Added: uOleDragDrop.pas.patch
2017-05-20 10:00 cordylus Note Added: 0002246
2023-01-21 16:07 Alexx2000 Status new => closed
2023-01-21 16:07 Alexx2000 Resolution open => fixed
2023-01-21 16:07 Alexx2000 Fixed in Version => 1.0.0