[PATCH v4 1/4] ntdll: Factor out capture_stack_back_trace() helper.

Paul Gofman pgofman at codeweavers.com
Wed Nov 3 04:44:28 CDT 2021


On 11/2/21 18:06, Giovanni Mascellani wrote:
> Hi,
>
> On 01/11/21 12:13, Paul Gofman wrote:
>> +USHORT WINAPI RtlCaptureStackBackTrace( ULONG skip, ULONG count, 
>> PVOID *buffer, ULONG *hash )
>> +{
>> +    ULONG ret;
>> +
>> +    ret = capture_stack_back_trace( skip, count, buffer, hash );
>> +    return min( ret, ~(USHORT)0 );
>
> I don't think this does what you mean: even if you cast to USHORT, the 
> operand gets implicitly promoted to int when you pass it to operator 
> ~, so the result of that expression is 0xffffffff, not 0xffff, which I 
> guess is what you meant.
>
> See for example https://godbolt.org/z/azzejdWM6.
>
> I would suggest to just write 0xffff, or USHRT_MAX.
>
> Thanks, Giovanni.
>
Indeed, thanks!




More information about the wine-devel mailing list