[PATCH 3 of 3] shell32: implement SHPathPrepareForWrite

Dmitry Timoshkov dmitry at codeweavers.com
Fri Sep 7 08:51:46 CDT 2007

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

>> Again StrCpyNW is a shlwapi export, and since you just allocated the buffer
>> of correct length memcpy + adding an explicit '\0' terminator look more
>> naturally here (if not kernel32.lstrcpynW).
> I'm allowed to use memcpy? Isn't that a native Linux function?

If Wine wouldn't be able to call native Linux APIs how it would work
at all?

>> You are still not checking SHCreateDirectoryExW return value.
> Nope. If SHCreateDirectoryExW returns ERROR_ALREADY_EXISTS, I need to
> return HRESULT_FROM_WIN32(ERROR_DIRECTORY) or S_OK, depending on
> whether it is a file or a directory.

I already pointed out that there is no such a test to show correct behaviour
of SHCreateDirectoryExW in that case. If you claim that there is inconsistency
you need to add a test case for it.

> And since I'd need to free
> temppath if and only if I'm returning early, I think that any way I
> could do that would make the code awkward/confusing.

I don't think that handling errors makes the code confusing. If
SHCreateDirectoryExW fails you can skip a fairly slow GetFileAttributesW
call, and that's another advantage.

>> There is no need to check temppath for NULL before HeapFree call.
> Oh. MSDN says there is. Not that I trust MSDN..

Even there is a janitorial task in Wine to remove NULL checks before
HeapFree calls.


More information about the wine-devel mailing list