[PATCH 3 of 3] shell32: implement SHPathPrepareForWrite

Dmitry Timoshkov dmitry at codeweavers.com
Sun Sep 2 20:59:48 CDT 2007

"Vincent Povirk" <madewokherd+d41d at gmail.com> wrote:

>> Why there is no check for SHCreateDirectoryExW return value?
> The return value of SHCreateDirectoryExW doesn't matter. All that
> matters is whether the directory exists when the function returns. It
> may or may not have existed when the function was called
> (SHCreateDirectoryExW fails when that happens, but
> SHPathPrepareForWrite should not fail).
> I could check the SHCreateDirectoryExW return value and probably
> decide on a result based on that, but I think it's better to write the
> result-deciding logic only once.

By checking return value of SHCreateDirectoryExW you can make a shortcut
in the deciding logic, in both cases: when the function fails you exit
right away (returning *correct* error to the caller and not a guessed one),
in the case of success GetFileAttributes call is redundant and you exit
right away again.


More information about the wine-devel mailing list