[v2 PATCH 1/3] ucrtbase: Implement _initialize_onexit_table()

Piotr Caban piotr.caban at gmail.com
Mon Apr 25 10:54:38 CDT 2016


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.

> +    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.

Thanks,
Piotr



More information about the wine-devel mailing list