[PATCH 3 of 3] shell32: implement SHPathPrepareForWrite

Vincent Povirk madewokherd+d41d at gmail.com
Sun Sep 2 21:53:46 CDT 2007

On 9/2/07, Dmitry Timoshkov <dmitry at codeweavers.com> wrote:
> "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.

After looking into this a bit more, yes, one of those calls will
always be sufficient to do the work and determine what the result
should be, at least in the cases I tested. Which one depends on flags
and whether the path is relative (to my knowledge no apps actually use
relative paths).

Vincent Povirk

More information about the wine-devel mailing list