[PATCH 2/2] kernel32/tests: Add test for 'all processors' flag on Vista and newer (try 3).

Erich Hoover ehoover at mines.edu
Fri Feb 19 18:49:12 CST 2010

On Fri, Feb 19, 2010 at 5:08 PM, Henri Verbeet <hverbeet at gmail.com> wrote:
> On 20 February 2010 00:19, Erich Hoover <ehoover at mines.edu> wrote:
>> +    /* NOTE: Pre-Vista does not recognize the "all processors" flag (-1) */
>> +    thread_affinity = -1;
> ~0UL probably makes more sense than -1 for an unsigned variable.
>> -            const ULONG_PTR *paff = data;
>> +            ULONG_PTR req_aff = *(ULONG_PTR *)data;
> You shouldn't cast const away.
> Is "-1" special, or does the call just always mask the requested mask
> with the available processors on Vista and above?

"-1" is special, I was honestly very surprised by this as it seems
like a dirty trick*.  You can see that this is the case from the test
for "other masks," which still errors out on Vista and Window 7 (ie.
the test succeeds):
      "SetThreadAffinityMask passed for an illegal processor\n");

Erich Hoover
ehoover at mines.edu

* That there's no good reason to do this except to artificially make
apps run better on Vista and Windows 7.

More information about the wine-devel mailing list