[PATCH] kernel32: implement GetLogicalProcessorInformation

Ken Thomases ken at codeweavers.com
Thu Nov 24 17:48:39 CST 2011


On Nov 24, 2011, at 5:13 PM, Charles Davis wrote:

> On Nov 24, 2011, at 4:21 AM, Claudio Fontana wrote:
> 
>> +    ret = GetLogicalProcessorInformation(buffer, &buflen);
>> +    ok(ret, "Normal glpi call (%d)\n", GetLastError());
> Don't call GetLastError() inside an ok(). (Actually, that's moot, because this test belongs in ntdll:process, but in general, you shouldn't call GetLastError() inside an ok().)

I don't think there's such a general rule.  As I understand it, one has to be mindful of the undefined order of evaluation of function arguments.  So, the call which may set the last error must not be in an argument list with the call of GetLastError(), because you can't be sure which will be called first.

That is, in this case, the call to GetLogicalProcessorInformation() must not be within the ok() argument list along with GetLastError().  Since it is not, the above code is fine.

(I also think your paranoia about access(2) is overblown, but I agree it isn't the best means of checking for the existence of a file.)

Regards,
Ken




More information about the wine-devel mailing list