[PATCH 03/12] msvcp110: Add tr2_sys__Open_dir implementation.(resend)

Piotr Caban piotr.caban at gmail.com
Wed Sep 30 03:48:45 CDT 2015


On 09/29/15 18:03, YongHao Hu wrote:
> Hi,
>
> On 15/9/28 下午7:51, Piotr Caban wrote:
>> Hi,
>>
>> On 09/07/15 16:21, YongHao Hu wrote:
>>> +/* ?_Open_dir at sys@tr2 at std@@YAPAXAAY0BAE at DPBDAAHAAW4file_type@123@@Z */
>>> +/*
>>> ?_Open_dir at sys@tr2 at std@@YAPEAXAEAY0BAE at DPEBDAEAHAEAW4file_type@123@@Z */
>>> +void* __cdecl tr2_sys__Open_dir(char* target, char const* dest, int*
>>> err_code, enum file_type* type)
>>> +{
>>> +    HANDLE handle;
>>> +    WIN32_FIND_DATAA data;
>>> +    char temppath[MAX_PATH];
>>> +    TRACE("(%s %s %p %p)\n", debugstr_a(target), debugstr_a(dest),
>>> err_code, type);
>>> +    strcpy(temppath, dest);
>>> +    strcat(temppath, "\\*.*");
>> Is native limiting the path to MAX_PATH characters? What happens if
>> longer path is passed?
>>
> As far as I know, we can not create a file or directory when their path
> longer than MAX_PATH on Windows, so it is impossible to pass a longer
> valid path to tr2_sys__Open_dir.
> If we pass a longer invalid path, I think that it's err_code would be
> ERROR_PATH_NOT_FOUND( GetLastError() )
You can specify a longer path by prepending it with "\\?\" prefix. Even 
if longer paths are not supported you should probably detect that case 
instead of possibly crashing in strcpy call.

Thanks,
Piotr




More information about the wine-devel mailing list