http://bugs.winehq.org/show_bug.cgi?id=8511
Summary: DragQueryFile returns wrong string length
Product: Wine
Version: 0.9.33.
Platform: Other
OS/Version: other
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: wine-shell32
AssignedTo: wine-bugs(a)winehq.org
ReportedBy: hadrien-wine(a)psydk.org
Hi,
A friend of mine tried to run a win32 software I made, which relies on
drag-and-drop features. My software is currently not working on Wine. We tracked
the problem down to the DragQueryFileW function.
Here is a reminder of the declaration:
UINT DragQueryFileW(HDROP hDrop, UINT iFile, LPWSTR lpszFile, UINT nBufferSize);
To get the needed length to store the file path, I call this function with
lpszFile set to NULL:
UINT nNeededLength = DragQueryFileW(hDrop, iFile, NULL, 0);
nNeededLength is the total number of characters, not including the terminating
null character, as stated by the function documentation in MSDN.
Then I call the function again with a dynamically allocated buffer:
UINT nRet = DragQueryFileW(hDrop, iFile, pszFilePath, nNeededLength + 1);
The "+ 1" is because DragQueryFileW expects a buffer size that counts the
terminating null character. The return value, nRet, is equal to nNeededLength on
a real Windows.
On Wine 0.9.33 instead, we get the expected length + 1. I made a test I ran on
Windows 2000 then on Wine 0.9.33 that confirms the unexpected behavior.
By looking at Wine source code it looks like the same problem exists with
DragQueryFileA and DragQueryFile16 in shell.c and shellole.c
A possible test case in a WM_DROPFILES handler:
wchar szSuperBuffer[260];
UINT nFile = 0;
UINT nLengthNeeded = DragQueryFileW(hDrop, nFile, NULL, 0);
UINT nRet = DragQueryFileW(hDrop, nFile, szSuperBuffer, sizeof(szSuperBuffer));
UINT nLengthGot = strlenW(szSuperBuffer);
if( !(nLengthNeeded == nRet && nLengthNeeded == nLengthGot))
{
// ERROR ! (message box, error trace, or whatever)
}
--
Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
http://bugs.winehq.org/show_bug.cgi?id=6535
------- Additional Comments From pgr(a)arcelectronicsinc.com 2007-27-05 01:10 -------
No output on the console. I think before my hardware/software upgrade I was
running the mandrake 10 or mandriva 2005 le. Hardware went from PIII 733 to AMD
semipron 2.5Ghz with nvida 5200 FX. Current version is mandriva 2006 and I am in
the process of upgrading distro again as soon as I find one that does what I need.
--
Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
http://bugs.winehq.org/show_bug.cgi?id=8503
------- Additional Comments From dmitry(a)codeweavers.com 2007-27-05 00:33 -------
When a user reports a problem with an application he/she is running that's
fair to assume that the user is able to run the application, and report
the bugs he sees in the way. However the Wine tests are the different beast,
the tests are supposed to be ran and debugged by a developer, not by someone
who has no idea what/how/where/why to do.
No offence intended.
--
Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
http://bugs.winehq.org/show_bug.cgi?id=8442
------- Additional Comments From dmitry(a)codeweavers.com 2007-27-05 00:06 -------
> I believe that this bug (8442) and the previous one (8441) could be ignored
> and maybe closed. The reason is that there might show up an OpenBSD port of
> wine-0.9.37 (within a year or so? ;) from which you could extract all
> relevant changes.
Nobody is going to "extract relevant changes" and send them to wine-patches,
that's your job. Even you may not be able to do it at that time (one year from
now) since most likely the code will change a lot and there will be a lot of
conflicts.
In order to make it manageable for you and for us you have to send the patches
once they are ready. Be prepared to re-work the patches as there is a chance
that they are will be not acceptable due to various reasons.
--
Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
http://bugs.winehq.org/show_bug.cgi?id=8503
------- Additional Comments From trevor_boon(a)yahoo.com 2007-26-05 21:13 -------
I find that comment unfair and unkind. Yes, I made a mistake and ran make test
from the wrong directory, but doesn't make me an idiot. It still failed anyway
with an error 6 when compiling the dsound tests. I won't waste any more of your
intolerant time.
--
Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
http://bugs.winehq.org/show_bug.cgi?id=8508
------- Additional Comments From dank(a)kegel.com 2007-26-05 21:11 -------
Looks like a crash in ole. Does
winetricks dcom98
help? If so, it really is an ole bug...
--
Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
http://bugs.winehq.org/show_bug.cgi?id=8071
------- Additional Comments From Vectra.v(a)hotmail.fr 2007-26-05 19:25 -------
I have the same prob sorry i got duplicate this topic so i come here to get help.
--
Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
http://bugs.winehq.org/show_bug.cgi?id=8009
------- Additional Comments From saulius.krasuckas(a)elst.vtu.lt 2007-26-05 17:38 -------
Did you try running it in Managed mode?
--
Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
http://bugs.winehq.org/show_bug.cgi?id=8510
vitaliy(a)kievinfo.com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |CLOSED
------- Additional Comments From vitaliy(a)kievinfo.com 2007-26-05 17:32 -------
CLOSING DUPLICATE DO NOT REOPEN!
--
Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.