[PATCH 2/2] kernel32/tests: Test bytes left in PeekNamedPipe().

Thomas Faber thomas.faber at reactos.org
Sun May 21 03:21:01 CDT 2017


Your 'left' variable is DWORD aka unsigned int, which is 32 bits on x64
Windows. That means its value in the operation in question is 0xffffffeb
or 4294967275.
(If you built with native headers or MSVC it would be unsigned long, but
 that is also 32 bits so there's no meaningful difference)

The right side of the expression is of type size_t (type of a sizeof
expression), which is an unsigned 64 bit type on x64 Windows.
Note in particular that the unary minus operator does not convert this
to a signed type.
That means its value will be 0xffffffffffffffeb or 18446744073709551595.

In order to compare them, the smaller type (unsigned int) will be
converted to the larger type (unsigned __int64) so your comparison looks
something like this:
(unsigned __int64)0xffffffebU == 0xffffffffffffffebULL
... which is obviously false.

Possible fixes would be a cast (e.g. right expression to DWORD, which
would truncate those extra f's) or changing the type of 'left' to be
signed (in which case it would be sign-extended for the comparison
instead of zero-extended).


On 2017-05-21 00:47, Zebediah Figura wrote:
> Does anyone know why this is happening? -21 should be the expected value.
> 
> On 05/20/2017 04:59 PM, Marvin wrote:
>> Hi,
>>
>> While running your changed tests on Windows, I think I found new 
>> failures.
>> Being a bot and all I'm not very good at pattern recognition, so I 
>> might be
>> wrong, but could you please double-check?
>> Full results can be found at
>> https://testbot.winehq.org/JobDetails.pl?Key=31073
>>
>> Your paranoid android.
>>
>>
>> === wvistau64 (64 bit pipe) ===
>> pipe.c:356: Test failed: peek3 got -21 bytes left
>> pipe.c:395: Test failed: peek4 got -21 bytes left
>>
>> === w2008s64 (64 bit pipe) ===
>> pipe.c:356: Test failed: peek3 got -21 bytes left
>> pipe.c:395: Test failed: peek4 got -21 bytes left
>>
>> === w7pro64 (64 bit pipe) ===
>> pipe.c:356: Test failed: peek3 got -21 bytes left
>> pipe.c:395: Test failed: peek4 got -21 bytes left
>>
>> === w864 (64 bit pipe) ===
>> pipe.c:356: Test failed: peek3 got -21 bytes left
>> pipe.c:395: Test failed: peek4 got -21 bytes left
>>
>> === w1064 (64 bit pipe) ===
>> pipe.c:356: Test failed: peek3 got -21 bytes left
>> pipe.c:395: Test failed: peek4 got -21 bytes left
>>
> 
> 




More information about the wine-devel mailing list