On Fri, 30 Sep 2011, Francois Gouget wrote:
This is necessary because LastError may already be set to ERROR_INSUFFICIENT_BUFFER which would mislead the caller.
And of course the older versions of Windows (up to XP SP3!) don't reset lasterror so the test bit of the patch cannot go in. I'd still argue that GetModuleFileNameW() should reset LastError though.