<AWT Dev> [8] Review request for 8021943: FileDialog getFile returns corrupted string after previous setFile

Sergey Bylokhov Sergey.Bylokhov at oracle.com
Tue Aug 6 07:26:31 PDT 2013

Hi, Alexander.
Fix looks fine.
On 01.08.2013 21:03, Alexander Zvegintsev wrote:
> Hello,
> Could you please review a fix for the following issue:
> http://bugs.sun.com/view_bug.do?bug_id=8021943
> The fix is available at:
> http://cr.openjdk.java.net/~serb/8021943/webrev.00/
> lpstrFile should be treated as double NULL terminated (DNT) string 
> only when OFN_ALLOWMULTISELECT flag is set.
> http://msdn.microsoft.com/en-us/library/windows/desktop/ms646839%28v=vs.85%29.aspx
>> If the *OFN_ALLOWMULTISELECT* flag is set and the user selects 
>> multiple files, the buffer contains the current directory followed by 
>> the file names of the selected files. For Explorer-style dialog 
>> boxes, the directory and file name strings are *NULL* separated, with 
>> an extra *NULL* character after the last file name. 
> Currently we check length of a lpstrFile with GetBufferLength() which 
> treats \0\0 as an end of a string.
> It works nice, unless we call setFile() with a filename longer than a 
> path of a saved file (in single-select mode).
> In single-select mode lpstrFile string ends with single \0, and 
> GetBufferLength() fails to find correct length and we pass 
> \0-separated buffer to
> WFileDialogPeer.handleSelected()  which will be treated as 
> multi-select mode.
> -- 
> Thanks,
> Alexander.

Best regards, Sergey.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/awt-dev/attachments/20130806/0144a5e8/attachment-0001.html 

More information about the awt-dev mailing list