Piotr Caban : ucrtbase: Add _o__*_onexit_table implementation.
Alexandre Julliard
julliard at winehq.org
Tue Nov 20 15:39:49 CST 2018
Module: wine
Branch: master
Commit: 4df6425a349ab193b14ac1ecdb50073b959b77fc
URL: https://source.winehq.org/git/wine.git/?a=commit;h=4df6425a349ab193b14ac1ecdb50073b959b77fc
Author: Piotr Caban <piotr at codeweavers.com>
Date: Tue Nov 20 01:00:27 2018 +0100
ucrtbase: Add _o__*_onexit_table implementation.
Used by unofficial libcef build.
Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
.../api-ms-win-crt-private-l1-1-0.spec | 6 +--
dlls/ucrtbase/tests/misc.c | 51 +++++++++++++++++++++-
dlls/ucrtbase/ucrtbase.spec | 6 +--
3 files changed, 55 insertions(+), 8 deletions(-)
diff --git a/dlls/api-ms-win-crt-private-l1-1-0/api-ms-win-crt-private-l1-1-0.spec b/dlls/api-ms-win-crt-private-l1-1-0/api-ms-win-crt-private-l1-1-0.spec
index 7cf4201..9fc7723 100644
--- a/dlls/api-ms-win-crt-private-l1-1-0/api-ms-win-crt-private-l1-1-0.spec
+++ b/dlls/api-ms-win-crt-private-l1-1-0/api-ms-win-crt-private-l1-1-0.spec
@@ -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
diff --git a/dlls/ucrtbase/tests/misc.c b/dlls/ucrtbase/tests/misc.c
index bd8034e..8a708da 100644
--- a/dlls/ucrtbase/tests/misc.c
+++ b/dlls/ucrtbase/tests/misc.c
@@ -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");
diff --git a/dlls/ucrtbase/ucrtbase.spec b/dlls/ucrtbase/ucrtbase.spec
index 1f0975d..34e6b0e 100644
--- a/dlls/ucrtbase/ucrtbase.spec
+++ b/dlls/ucrtbase/ucrtbase.spec
@@ -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
More information about the wine-cvs
mailing list