[1/2] shell32: Check IsWow64Process() before calling Wow64 functions.

Nikolay Sivov bunglehead at gmail.com
Thu Apr 21 00:33:53 CDT 2016

On 21.04.2016 7:04, Olivier F. R. Dierick wrote:
> Le jeudi 21 avril 2016 à 03:28 +0300, Nikolay Sivov a écrit :
>> On 21.04.2016 3:12, Olivier F. R. Dierick wrote:
>>> See bug 36838 for comments and discussion.
>>> Supersedes patch submission 121402.
>>> Better version of the patch. Call IsWow64Process() only once on dll
>>> initialization and setup a global variable.
>> Like I said in bug comment, doing this is depending on a side effect.
>> SHFileOperation() could do anything internally, if you want to have
>> consistent ERROR_SUCCESS last error (even though it's kind of wrong to
>> check it, since it returns error code already), why not force it in
>> SHFileOperation() directly? Changing internal path is wrong in my opinion.
> I don't know if resetting last error in SHFileOperation() is conformant.
> That's why I took the route to fix one error at a time until there were
> none left. More errors may be introduced later, but for now this patch
> is the last one needed to fix bug 36838.
> I find forcing ERROR_SUCCESS in SHFileOperation() a brute and lazy way
> to fix things. It may hide other errors. Fixing the internal code itself
> may avoid bugs in other functions and is the way to go in my opinion.

Well, it's clearly an application bug to check it in a first place.
Fixing it this way you're now depending on implementation details, and
like you said it can affect more than you tested.

More information about the wine-devel mailing list