[PATCH 2/3] ntdll: Implement thread description as information class.

Alexandre Julliard julliard at winehq.org
Mon Nov 25 07:02:14 CST 2019


Nikolay Sivov <nsivov at codeweavers.com> writes:

> On 11/25/19 3:36 PM, Alexandre Julliard wrote:
>> Nikolay Sivov <nsivov at codeweavers.com> writes:
>>
>>> @@ -1436,6 +1461,14 @@ DECL_HANDLER(get_thread_info)
>>>           reply->priority       = thread->priority;
>>>           reply->affinity       = thread->affinity;
>>>           reply->last           = thread->process->running_threads == 1;
>>> +        reply->desc_length    = 0;
>>> +
>>> +        if (thread->desc && req->mask & SET_THREAD_INFO_DESCRIPTION)
>>> +        {
>>> +            reply->desc_length = strlenW( thread->desc ) * sizeof(WCHAR);
>>> +            if (get_reply_max_size() >= reply->desc_length)
>>> +                set_reply_data( thread->desc, min( reply->desc_length, get_reply_max_size() ));
>>> +        }
>> I don't see why you need to check the mask for the get request.
>> Also in general in the server we store the length with the strings, so
>> that we don't need to recompute it.
> I'm using mask to return this string only when asked for, because
> get_thread_info() is used for several classes.
> Or do you mean the fact that it's requested could be inferred in some
> way? Maybe I only need to compare current length to
> get_reply_max_size(),
> as an indication that it was requested.

Yes, if the caller doesn't want the description it won't pass a buffer.

> Regarding string length, it's not consistent apparently, it's used for
> dll names, but not for window text or console title.

Yes, it's not 100% consistent, but most strings are stored with explicit
length and without final null. This allows supporting embedded nulls
where necessary.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list