Bug 106973 - Dragging FileList out of LO fails
Summary: Dragging FileList out of LO fails
Status: RESOLVED INSUFFICIENTDATA
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: sdk (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All Windows (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-04-05 12:37 UTC by christian.rufener
Modified: 2018-11-05 16:13 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description christian.rufener 2017-04-05 12:37:17 UTC
Hello

I try to implement drag and drop via Java UNO from an LO control (XTreeControl). 
Dropping of Text/Files onto the control works fine. 
However, dragging a "FileList" type (application/x-openoffice-filelist;windows_formatname="FileList") from LO to any 
application accepting files (FileList) fails with a crash of the receiving application e.g. Explorer/Notepad.

Dragging text from LO however works (sort of).

Due to little documentation I am not sure if I do this correctly.

Tried a number of different options returning raw byte[], many combinations of Any etc.

Debugging the receiving application crashes here (win32 api):
	
DragQueryFile(hDropInfo, 0, szFileName, _MAX_PATH);

The call succeeds however, szFileName contains garbage.

I use the following test Java code to implement the drag source:

//////////////////////////////////////////////////////////////// 
private static final String MIME_FILE_LIST = "application/x-openoffice-filelist;windows_formatname=\"FileList\"";

@Override
public void dragGestureRecognized(DragGestureEvent evt)
{

                        evt.DragSource.startDrag(evt, DNDConstants.ACTION_COPY, 0, 0, new XTransferable()
                        {
                            @Override
                            public Object getTransferData(DataFlavor dataFlavor) throws UnsupportedFlavorException, IOException
                            {
                                String s =  "C:\\Users\\xxx\\file.log";
                                if(dataFlavor.MimeType.equals(MIME_FILE_LIST)) {
                                    return new Any(byte[].class, s.getBytes()); 
                                } 
                                return null;

                            }

                            @Override
                            public DataFlavor[] getTransferDataFlavors()
                            {
                                return new DataFlavor[]{
                                    new DataFlavor(MIME_FILE_LIST, "FileList", new Type(byte[].class)),
                                };
                            }

                            @Override
                            public boolean isDataFlavorSupported(DataFlavor dataFlavor)
                            {
                                return true;
                            }

////
}
////////////////////////////////////////////////////////////////////////////////////////////////
Comment 1 christian.rufener 2017-04-05 12:41:27 UTC
Sorry, I was wrong.
The call DragQueryFile crashes with an Access Violation 0xC0000005.
Comment 2 Jean-Baptiste Faure 2017-04-25 04:53:02 UTC Comment hidden (obsolete)
Comment 3 christian.rufener 2017-04-25 07:37:44 UTC
I think the LO UNO API does not work as expected:
The receiving (Windows) application (e.g Explorer, Wordpad) gets the WM_DROP message, but when it is calling WIN32 API DragQueryFiles to get the list of dropped files, the (receiving) application crashes. I assume this is due to the fact that the passed data structure from LO is invalid.
As I understand the "getTransferData" needs to return a byte[] containing the list of files separated by a null byte(character?) and needs to be terminated by a null byte/character. This is what the WIN32 documentation claims. And this is what I get the other way around: If files are dropped to my LO extension, they're separated by a (byte)0.
I tried a lot of combinations of byte[] to be returned but never succeeded in any reasonable behavior. I tried to return wrapped byte[] in an Any or raw byte[]. 
Returning anything else e.g. char[] would not lead to any WM_DROP message at all, so I assume it needs to be byte[], which is what the LO UNO documentation says anyway.
Searching for documentation/example which demonstrated this was unsuccessful. Looking at the LO source code did not reveal any more clues.

I was hoping to get some hints by filing this issue.

Regards
Christian
Comment 4 Jean-Baptiste Faure 2018-03-11 07:52:25 UTC
Are you still facing this problem. If yes did you try to ask the developer mailing list for help ?

Set status to NEEDINFO, please set it back to UNCONFIRMED once requested
informations are provided.

Best regards. JBF
Comment 5 QA Administrators 2018-10-09 11:26:59 UTC Comment hidden (obsolete)
Comment 6 QA Administrators 2018-11-05 16:13:23 UTC
Dear Bug Submitter,

Please read this message in its entirety before proceeding.

Your bug report is being closed as INSUFFICIENTDATA due to inactivity and
a lack of information which is needed in order to accurately
reproduce and confirm the problem. We encourage you to retest
your bug against the latest release. If the issue is still
present in the latest stable release, we need the following
information (please ignore any that you've already provided):

a) Provide details of your system including your operating
   system and the latest version of LibreOffice that you have
   confirmed the bug to be present

b) Provide easy to reproduce steps – the simpler the better

c) Provide any test case(s) which will help us confirm the problem

d) Provide screenshots of the problem if you think it might help

e) Read all comments and provide any requested information

Once all of this is done, please set the bug back to UNCONFIRMED
and we will attempt to reproduce the issue. Please do not:

a) respond via email 

b) update the version field in the bug or any of the other details
   on the top section of our bug tracker

Warm Regards,
QA Team

MassPing-NeedInfo-20181105