ucrtbase: Add _o__*_onexit_table implementation.

Used by unofficial libcef build.

Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Piotr Caban 2018-11-20 01:00:27 +01:00 committed by Alexandre Julliard
parent f848d03f95
commit 4df6425a34
3 changed files with 55 additions and 8 deletions

View File

@ -226,7 +226,7 @@
@ stub _o__eof
@ stub _o__errno
@ stub _o__except1
@ stub _o__execute_onexit_table
@ cdecl _o__execute_onexit_table(ptr) ucrtbase._o__execute_onexit_table
@ stub _o__execv
@ stub _o__execve
@ stub _o__execvp
@ -345,7 +345,7 @@
@ stub _o__i64toa_s
@ stub _o__i64tow
@ stub _o__i64tow_s
@ stub _o__initialize_onexit_table
@ cdecl _o__initialize_onexit_table(ptr) ucrtbase._o__initialize_onexit_table
@ stub _o__invalid_parameter_noinfo
@ stub _o__invalid_parameter_noinfo_noreturn
@ stub _o__isatty
@ -630,7 +630,7 @@
@ stub _o__read
@ stub _o__realloc_base
@ stub _o__recalloc
@ stub _o__register_onexit_function
@ cdecl _o__register_onexit_function(ptr ptr) ucrtbase._o__register_onexit_function
@ stub _o__resetstkoflw
@ stub _o__rmdir
@ stub _o__rmtmp

View File

@ -105,6 +105,9 @@ static HMODULE module;
static int (CDECL *p_initialize_onexit_table)(MSVCRT__onexit_table_t *table);
static int (CDECL *p_register_onexit_function)(MSVCRT__onexit_table_t *table, MSVCRT__onexit_t func);
static int (CDECL *p_execute_onexit_table)(MSVCRT__onexit_table_t *table);
static int (CDECL *p_o__initialize_onexit_table)(MSVCRT__onexit_table_t *table);
static int (CDECL *p_o__register_onexit_function)(MSVCRT__onexit_table_t *table, MSVCRT__onexit_t func);
static int (CDECL *p_o__execute_onexit_table)(MSVCRT__onexit_table_t *table);
static int (CDECL *p___fpe_flt_rounds)(void);
static unsigned int (CDECL *p__controlfp)(unsigned int, unsigned int);
static _invalid_parameter_handler (CDECL *p__set_invalid_parameter_handler)(_invalid_parameter_handler);
@ -150,6 +153,15 @@ static void test__initialize_onexit_table(void)
ret = p_initialize_onexit_table(&table2);
ok(ret == 0, "got %d\n", ret);
ok(table2._first == table._first, "got %p, %p\n", table2._first, table._first);
ok(table2._last == table._last, "got %p, %p\n", table2._last, table._last);
ok(table2._end == table._end, "got %p, %p\n", table2._end, table._end);
memset(&table2, 0, sizeof(table2));
ret = p_o__initialize_onexit_table(&table2);
ok(ret == 0, "got %d\n", ret);
ok(table2._first == table._first, "got %p, %p\n", table2._first, table._first);
ok(table2._last == table._last, "got %p, %p\n", table2._last, table._last);
ok(table2._end == table._end, "got %p, %p\n", table2._end, table._end);
/* uninitialized table */
table._first = table._last = table._end = (void*)0x123;
@ -228,6 +240,16 @@ static void test__register_onexit_function(void)
ret = p_register_onexit_function(&table, onexit_func);
ok(ret == 0, "got %d\n", ret);
ok(f != table._last, "got %p, initial %p\n", table._last, f);
f = table._last;
ret = p_o__register_onexit_function(&table, NULL);
ok(ret == 0, "got %d\n", ret);
ok(f != table._last, "got %p, initial %p\n", table._last, f);
f = table._last;
ret = p_o__register_onexit_function(&table, onexit_func);
ok(ret == 0, "got %d\n", ret);
ok(f != table._last, "got %p, initial %p\n", table._last, f);
}
static void test__execute_onexit_table(void)
@ -246,7 +268,7 @@ static void test__execute_onexit_table(void)
ret = p_execute_onexit_table(&table);
ok(ret == 0, "got %d\n", ret);
/* same functions registered twice */
/* same function registered multiple times */
ret = p_register_onexit_function(&table, onexit_func);
ok(ret == 0, "got %d\n", ret);
@ -256,11 +278,33 @@ static void test__execute_onexit_table(void)
ret = p_register_onexit_function(&table, onexit_func);
ok(ret == 0, "got %d\n", ret);
ret = p_o__register_onexit_function(&table, onexit_func);
ok(ret == 0, "got %d\n", ret);
ok(table._first != table._end, "got %p, %p\n", table._first, table._end);
g_onexit_called = 0;
ret = p_execute_onexit_table(&table);
ok(ret == 0, "got %d\n", ret);
ok(g_onexit_called == 2, "got %d\n", g_onexit_called);
ok(g_onexit_called == 3, "got %d\n", g_onexit_called);
ok(table._first == table._end, "got %p, %p\n", table._first, table._end);
ret = p_register_onexit_function(&table, onexit_func);
ok(ret == 0, "got %d\n", ret);
ret = p_register_onexit_function(&table, NULL);
ok(ret == 0, "got %d\n", ret);
ret = p_register_onexit_function(&table, onexit_func);
ok(ret == 0, "got %d\n", ret);
ret = p_o__register_onexit_function(&table, onexit_func);
ok(ret == 0, "got %d\n", ret);
ok(table._first != table._end, "got %p, %p\n", table._first, table._end);
g_onexit_called = 0;
ret = p_o__execute_onexit_table(&table);
ok(ret == 0, "got %d\n", ret);
ok(g_onexit_called == 3, "got %d\n", g_onexit_called);
ok(table._first == table._end, "got %p, %p\n", table._first, table._end);
/* execute again, table is already empty */
@ -414,6 +458,9 @@ static BOOL init(void)
p_initialize_onexit_table = (void*)GetProcAddress(module, "_initialize_onexit_table");
p_register_onexit_function = (void*)GetProcAddress(module, "_register_onexit_function");
p_execute_onexit_table = (void*)GetProcAddress(module, "_execute_onexit_table");
p_o__initialize_onexit_table = (void*)GetProcAddress(module, "_o__initialize_onexit_table");
p_o__register_onexit_function = (void*)GetProcAddress(module, "_o__register_onexit_function");
p_o__execute_onexit_table = (void*)GetProcAddress(module, "_o__execute_onexit_table");
p___fpe_flt_rounds = (void*)GetProcAddress(module, "__fpe_flt_rounds");
p__controlfp = (void*)GetProcAddress(module, "_controlfp");
p__set_invalid_parameter_handler = (void*)GetProcAddress(module, "_set_invalid_parameter_handler");

View File

@ -906,7 +906,7 @@
@ stub _o__eof
@ stub _o__errno
@ stub _o__except1
@ stub _o__execute_onexit_table
@ cdecl _o__execute_onexit_table(ptr) MSVCRT__execute_onexit_table
@ stub _o__execv
@ stub _o__execve
@ stub _o__execvp
@ -1029,7 +1029,7 @@
@ stub _o__i64tow
@ stub _o__i64tow_s
@ stub _o__initialize_narrow_environment
@ stub _o__initialize_onexit_table
@ cdecl _o__initialize_onexit_table(ptr) MSVCRT__initialize_onexit_table
@ stub _o__initialize_wide_environment
@ stub _o__invalid_parameter_noinfo
@ stub _o__invalid_parameter_noinfo_noreturn
@ -1316,7 +1316,7 @@
@ stub _o__read
@ stub _o__realloc_base
@ stub _o__recalloc
@ stub _o__register_onexit_function
@ cdecl _o__register_onexit_function(ptr ptr) MSVCRT__register_onexit_function
@ stub _o__resetstkoflw
@ stub _o__rmdir
@ stub _o__rmtmp