Commit 4df6425a authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

ucrtbase: Add _o__*_onexit_table implementation.

Used by unofficial libcef build. Signed-off-by: 's avatarPiotr Caban <piotr@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent f848d03f
...@@ -226,7 +226,7 @@ ...@@ -226,7 +226,7 @@
@ stub _o__eof @ stub _o__eof
@ stub _o__errno @ stub _o__errno
@ stub _o__except1 @ stub _o__except1
@ stub _o__execute_onexit_table @ cdecl _o__execute_onexit_table(ptr) ucrtbase._o__execute_onexit_table
@ stub _o__execv @ stub _o__execv
@ stub _o__execve @ stub _o__execve
@ stub _o__execvp @ stub _o__execvp
...@@ -345,7 +345,7 @@ ...@@ -345,7 +345,7 @@
@ stub _o__i64toa_s @ stub _o__i64toa_s
@ stub _o__i64tow @ stub _o__i64tow
@ stub _o__i64tow_s @ 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
@ stub _o__invalid_parameter_noinfo_noreturn @ stub _o__invalid_parameter_noinfo_noreturn
@ stub _o__isatty @ stub _o__isatty
...@@ -630,7 +630,7 @@ ...@@ -630,7 +630,7 @@
@ stub _o__read @ stub _o__read
@ stub _o__realloc_base @ stub _o__realloc_base
@ stub _o__recalloc @ 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__resetstkoflw
@ stub _o__rmdir @ stub _o__rmdir
@ stub _o__rmtmp @ stub _o__rmtmp
......
...@@ -105,6 +105,9 @@ static HMODULE module; ...@@ -105,6 +105,9 @@ static HMODULE module;
static int (CDECL *p_initialize_onexit_table)(MSVCRT__onexit_table_t *table); 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_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_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 int (CDECL *p___fpe_flt_rounds)(void);
static unsigned int (CDECL *p__controlfp)(unsigned int, unsigned int); static unsigned int (CDECL *p__controlfp)(unsigned int, unsigned int);
static _invalid_parameter_handler (CDECL *p__set_invalid_parameter_handler)(_invalid_parameter_handler); static _invalid_parameter_handler (CDECL *p__set_invalid_parameter_handler)(_invalid_parameter_handler);
...@@ -150,6 +153,15 @@ static void test__initialize_onexit_table(void) ...@@ -150,6 +153,15 @@ static void test__initialize_onexit_table(void)
ret = p_initialize_onexit_table(&table2); ret = p_initialize_onexit_table(&table2);
ok(ret == 0, "got %d\n", ret); ok(ret == 0, "got %d\n", ret);
ok(table2._first == table._first, "got %p, %p\n", table2._first, table._first); 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 */ /* uninitialized table */
table._first = table._last = table._end = (void*)0x123; table._first = table._last = table._end = (void*)0x123;
...@@ -228,6 +240,16 @@ static void test__register_onexit_function(void) ...@@ -228,6 +240,16 @@ static void test__register_onexit_function(void)
ret = p_register_onexit_function(&table, onexit_func); ret = p_register_onexit_function(&table, onexit_func);
ok(ret == 0, "got %d\n", ret); ok(ret == 0, "got %d\n", ret);
ok(f != table._last, "got %p, initial %p\n", table._last, f); 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) static void test__execute_onexit_table(void)
...@@ -246,7 +268,7 @@ static void test__execute_onexit_table(void) ...@@ -246,7 +268,7 @@ static void test__execute_onexit_table(void)
ret = p_execute_onexit_table(&table); ret = p_execute_onexit_table(&table);
ok(ret == 0, "got %d\n", ret); ok(ret == 0, "got %d\n", ret);
/* same functions registered twice */ /* same function registered multiple times */
ret = p_register_onexit_function(&table, onexit_func); ret = p_register_onexit_function(&table, onexit_func);
ok(ret == 0, "got %d\n", ret); ok(ret == 0, "got %d\n", ret);
...@@ -256,11 +278,33 @@ static void test__execute_onexit_table(void) ...@@ -256,11 +278,33 @@ static void test__execute_onexit_table(void)
ret = p_register_onexit_function(&table, onexit_func); ret = p_register_onexit_function(&table, onexit_func);
ok(ret == 0, "got %d\n", ret); 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); ok(table._first != table._end, "got %p, %p\n", table._first, table._end);
g_onexit_called = 0; g_onexit_called = 0;
ret = p_execute_onexit_table(&table); ret = p_execute_onexit_table(&table);
ok(ret == 0, "got %d\n", ret); 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); ok(table._first == table._end, "got %p, %p\n", table._first, table._end);
/* execute again, table is already empty */ /* execute again, table is already empty */
...@@ -414,6 +458,9 @@ static BOOL init(void) ...@@ -414,6 +458,9 @@ static BOOL init(void)
p_initialize_onexit_table = (void*)GetProcAddress(module, "_initialize_onexit_table"); p_initialize_onexit_table = (void*)GetProcAddress(module, "_initialize_onexit_table");
p_register_onexit_function = (void*)GetProcAddress(module, "_register_onexit_function"); p_register_onexit_function = (void*)GetProcAddress(module, "_register_onexit_function");
p_execute_onexit_table = (void*)GetProcAddress(module, "_execute_onexit_table"); 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___fpe_flt_rounds = (void*)GetProcAddress(module, "__fpe_flt_rounds");
p__controlfp = (void*)GetProcAddress(module, "_controlfp"); p__controlfp = (void*)GetProcAddress(module, "_controlfp");
p__set_invalid_parameter_handler = (void*)GetProcAddress(module, "_set_invalid_parameter_handler"); p__set_invalid_parameter_handler = (void*)GetProcAddress(module, "_set_invalid_parameter_handler");
......
...@@ -906,7 +906,7 @@ ...@@ -906,7 +906,7 @@
@ stub _o__eof @ stub _o__eof
@ stub _o__errno @ stub _o__errno
@ stub _o__except1 @ stub _o__except1
@ stub _o__execute_onexit_table @ cdecl _o__execute_onexit_table(ptr) MSVCRT__execute_onexit_table
@ stub _o__execv @ stub _o__execv
@ stub _o__execve @ stub _o__execve
@ stub _o__execvp @ stub _o__execvp
...@@ -1029,7 +1029,7 @@ ...@@ -1029,7 +1029,7 @@
@ stub _o__i64tow @ stub _o__i64tow
@ stub _o__i64tow_s @ stub _o__i64tow_s
@ stub _o__initialize_narrow_environment @ 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__initialize_wide_environment
@ stub _o__invalid_parameter_noinfo @ stub _o__invalid_parameter_noinfo
@ stub _o__invalid_parameter_noinfo_noreturn @ stub _o__invalid_parameter_noinfo_noreturn
...@@ -1316,7 +1316,7 @@ ...@@ -1316,7 +1316,7 @@
@ stub _o__read @ stub _o__read
@ stub _o__realloc_base @ stub _o__realloc_base
@ stub _o__recalloc @ stub _o__recalloc
@ stub _o__register_onexit_function @ cdecl _o__register_onexit_function(ptr ptr) MSVCRT__register_onexit_function
@ stub _o__resetstkoflw @ stub _o__resetstkoflw
@ stub _o__rmdir @ stub _o__rmdir
@ stub _o__rmtmp @ stub _o__rmtmp
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment