[PATCH] ntdll/tests: Add basic tests for NtSetInformationThread(), class ThreadAffinityMask

Chris Robinson chris.kcat at gmail.com
Sun Sep 9 14:10:27 CDT 2018


On 09/09/2018 11:16 AM, Roger Zoellner wrote:
> +static DWORD WINAPI thread_main(LPVOID lpParam)
> +{
> +    /* Thread is created with CREATE_SUSPENDED flag set and isn't doing anything */
> +}

You should still probably do

(void)lpParam;
return 0;

to avoid compiler warnings about unused parameters and lacking a return 
value.

> +    /* Test required affinity mask, all bits set */
> +    req_aff = ~0u;

This isn't all bits set for 64-bit targets. Try

req_aff = ~(ULONG_PTR)0;

for that.

> +    status = pNtSetInformationThread(thread, class, &req_aff, req_aff_length);
> +    ok(status == STATUS_SUCCESS, "NtSetInformationThread failed. Expected STATUS_SUCCESS, got %08x (class=ThreadAffinityMask, case 2, req_aff=%08x, process_aff=%08x)\n", status, req_aff, process_aff);
> ...
> +    /* Test required affinity mask = process affinity mask with a prepended bit set */
> +    req_aff = (process_aff << 1) | process_aff;
> +    status = pNtSetInformationThread(thread, class, &req_aff, req_aff_length);
> +    ok(status == STATUS_SUCCESS, "NtSetInformationThread failed. Expected STATUS_SUCCESS, got %08x (class=ThreadAffinityMask, case 4, req_aff=%08x, process_aff=%08x)\n", status, req_aff, process_aff);

Might it be worth checking to see what's returned from 
NtQueryInformationThread after trying to set extraneous mask bits?

Also, the tests that currently fail under Wine should be marked with 
todo_wine until a proper fix is made, and such a fix would remove the 
rodo_wines (unless the tests are part of a series that come after the fix).



More information about the wine-devel mailing list