USER32: win16 applications should not see long filenames returned from dialog control (try 2)

Robert Shearman rob at codeweavers.com
Mon Nov 5 06:01:21 CST 2007


Dmitry Timoshkov wrote:
> "Alex Villacís Lasso" <a_villacis at palosanto.com> wrote:
>
>   
>>  BOOL16 WINAPI DlgDirSelectEx16( HWND16 hwnd, LPSTR str, INT16 len, INT16 id )
>>  {
>> -    return DlgDirSelectExA( WIN_Handle32(hwnd), str, len, id );
>> +    BOOL16 ret = DlgDirSelectExA( WIN_Handle32(hwnd), str, len, id );
>> +    GetShortPathNameA(str, str, len);
>> +    return ret;
>>  }
>>     
>
>   
>>  BOOL16 WINAPI DlgDirSelectComboBoxEx16( HWND16 hwnd, LPSTR str, INT16 len,
>>                                          INT16 id )
>>  {
>> -    return DlgDirSelectComboBoxExA( WIN_Handle32(hwnd), str, len, id );
>> +    BOOL16 ret = DlgDirSelectComboBoxExA( WIN_Handle32(hwnd), str, len, id );
>> +    GetShortPathNameA(str, str, len);
>> +    return ret;
>>  }
>>     
>
> You are passing garbage to GetShortPathNameA in the case of failure.
>   

And more importantly, the code in this patch is relying on 
GetShortPathNameA creating a copy of the long filename before copying it 
back.

Furthermore, the long file name might exceed the limit of len, whilst 
the short file name might not, prematurely truncating the short file name.

-- 
Rob Shearman




More information about the wine-devel mailing list