[v2 PATCH 1/3] ucrtbase: Implement _initialize_onexit_table()
Nikolay Sivov
bunglehead at gmail.com
Mon Apr 25 11:41:45 CDT 2016
On 25.04.2016 18:54, Piotr Caban wrote:
> On 04/24/16 20:51, Nikolay Sivov wrote:
>> dlls/ucrtbase/tests/onexit.c | 114
>> +++++++++++++++++++++
> Probably we don't need a separate file just for these tests. Could you
> please put them into a file with more generic name so it can be used for
> other tests in future.
Sure.
>
>> + memset(&table, 0, sizeof(table));
>> + ret = p_initialize_onexit_table(&table);
>> + ok(ret == 0, "got %d\n", ret);
>> + ok(table._first == table._last && table._first == table._end,
>> "got first %p, last %p, end %p\n",
>> + table._first, table._last, table._end);
>> +todo_wine
>> + ok(table._first != NULL, "got %p\n", table._first);
> We probably don't need to be binary compatible but native uses following
> algorithm (x - random number, 32-bit version):
> void* encode_ptr(void *p) {
> DWORD r = (DWORD)p;
> r = _rotl(r, x);
> return r^x;
> }
> void* decode_ptr(void *p) {
> DWORD r = (DWORD)p;
> r = r^x;
> return _rotr(r, x);
> }
> In theory this test may fail if x happens to be 0.
Yes, it's similar to Encode/DecodePointer(), with different parameters,
likely internal to CRT. I don't think we need to be that compatible, at
least I don't have any evidence right now that we should.
>
> Thanks,
> Piotr
>
>
More information about the wine-devel
mailing list