[PATCH 2/2] find.exe: Implement file searching

Alexandre Julliard julliard at winehq.org
Mon Feb 17 13:41:40 CST 2020


Fabian Maurer <dark.shadow4 at web.de> writes:

> +            if (attributes == INVALID_FILE_ATTRIBUTES || (attributes & FILE_ATTRIBUTE_DIRECTORY))
> +            {
> +                WCHAR buffer_message[64];
> +                WCHAR message[300];
> +
> +                LoadStringW(GetModuleHandleW(NULL), IDS_FILE_NOT_FOUND, buffer_message, ARRAY_SIZE(buffer_message));
> +
> +                wsprintfW(message, buffer_message, file_path_upper);
> +                write_to_stdout(message);
> +                continue;
> +            }
> +
> +            input = CreateFileW(file_paths[i], GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL);

You need to check for failure here, instead of checking attributes first
and assuming that the file can be opened.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list