Wine-Devel
By thread
wine-devel@list.winehq.org
By month
Messages by month
- ----- 2026 -----
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2002 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2001 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
June 2018
- 68 participants
- 1149 messages
[PATCH v2] msvcrt: Use already existent oneexit_table functions for _onexit and _c_exit
by Fabian Maurer
For that to work, MSVCRT__register_onexit_function and
MSVCRT__execute_onexit_table have to available all the time,
not only when _MSVCR_VER>=140
tests based on code by Piotr Caban
v2:
Create exit_event2 in test function, so it exists in child process
Signed-off-by: Fabian Maurer <dark.shadow4(a)web.de>
---
dlls/msvcrt/exit.c | 68 ++++++++++-------------------------
dlls/ucrtbase/tests/misc.c | 74 +++++++++++++++++++++++++++++++++++++-
2 files changed, 91 insertions(+), 51 deletions(-)
diff --git a/dlls/msvcrt/exit.c b/dlls/msvcrt/exit.c
index 7e1805569c..c90f7df953 100644
--- a/dlls/msvcrt/exit.c
+++ b/dlls/msvcrt/exit.c
@@ -25,13 +25,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(msvcrt);
-/* MT */
-#define LOCK_EXIT _mlock(_EXIT_LOCK1)
-#define UNLOCK_EXIT _munlock(_EXIT_LOCK1)
-
-static MSVCRT__onexit_t *MSVCRT_atexit_table = NULL;
-static int MSVCRT_atexit_table_size = 0;
-static int MSVCRT_atexit_registered = 0; /* Points to free slot */
static MSVCRT_purecall_handler purecall_handler = NULL;
typedef struct MSVCRT__onexit_table_t
@@ -41,6 +34,11 @@ typedef struct MSVCRT__onexit_table_t
MSVCRT__onexit_t *_end;
} MSVCRT__onexit_table_t;
+static MSVCRT__onexit_table_t MSVCRT_atexit_table;
+
+int CDECL MSVCRT__register_onexit_function(MSVCRT__onexit_table_t *table, MSVCRT__onexit_t func);
+int CDECL MSVCRT__execute_onexit_table(MSVCRT__onexit_table_t *table);
+
typedef void (__stdcall *_tls_callback_type)(void*,ULONG,void*);
static _tls_callback_type tls_atexit_callback;
@@ -65,17 +63,8 @@ void (*CDECL _aexit_rtn)(int) = MSVCRT__exit;
static void __MSVCRT__call_atexit(void)
{
/* Note: should only be called with the exit lock held */
- TRACE("%d atext functions to call\n", MSVCRT_atexit_registered);
if (tls_atexit_callback) tls_atexit_callback(NULL, DLL_PROCESS_DETACH, NULL);
- /* Last registered gets executed first */
- while (MSVCRT_atexit_registered > 0)
- {
- MSVCRT_atexit_registered--;
- TRACE("next is %p\n",MSVCRT_atexit_table[MSVCRT_atexit_registered]);
- if (MSVCRT_atexit_table[MSVCRT_atexit_registered])
- (*MSVCRT_atexit_table[MSVCRT_atexit_registered])();
- TRACE("returned\n");
- }
+ MSVCRT__execute_onexit_table(&MSVCRT_atexit_table);
}
/*********************************************************************
@@ -276,9 +265,7 @@ void CDECL MSVCRT__c_exit(void)
void CDECL MSVCRT__cexit(void)
{
TRACE("(void)\n");
- LOCK_EXIT;
__MSVCRT__call_atexit();
- UNLOCK_EXIT;
}
/*********************************************************************
@@ -291,26 +278,8 @@ MSVCRT__onexit_t CDECL MSVCRT__onexit(MSVCRT__onexit_t func)
if (!func)
return NULL;
- LOCK_EXIT;
- if (MSVCRT_atexit_registered > MSVCRT_atexit_table_size - 1)
- {
- MSVCRT__onexit_t *newtable;
- TRACE("expanding table\n");
- newtable = MSVCRT_calloc(MSVCRT_atexit_table_size + 32, sizeof(void *));
- if (!newtable)
- {
- TRACE("failed!\n");
- UNLOCK_EXIT;
- return NULL;
- }
- memcpy (newtable, MSVCRT_atexit_table, MSVCRT_atexit_table_size*sizeof(void *));
- MSVCRT_atexit_table_size += 32;
- MSVCRT_free (MSVCRT_atexit_table);
- MSVCRT_atexit_table = newtable;
- }
- MSVCRT_atexit_table[MSVCRT_atexit_registered] = func;
- MSVCRT_atexit_registered++;
- UNLOCK_EXIT;
+ MSVCRT__register_onexit_function(&MSVCRT_atexit_table, func);
+
return func;
}
@@ -359,6 +328,16 @@ int CDECL MSVCRT__crt_atexit(void (*func)(void))
return MSVCRT__onexit((MSVCRT__onexit_t)func) == (MSVCRT__onexit_t)func ? 0 : -1;
}
+/*********************************************************************
+ * _register_thread_local_exe_atexit_callback (UCRTBASE.@)
+ */
+void CDECL _register_thread_local_exe_atexit_callback(_tls_callback_type callback)
+{
+ TRACE("(%p)\n", callback);
+ tls_atexit_callback = callback;
+}
+
+#endif /* _MSVCR_VER>=140 */
/*********************************************************************
* _initialize_onexit_table (UCRTBASE.@)
@@ -457,17 +436,6 @@ int CDECL MSVCRT__execute_onexit_table(MSVCRT__onexit_table_t *table)
return 0;
}
-/*********************************************************************
- * _register_thread_local_exe_atexit_callback (UCRTBASE.@)
- */
-void CDECL _register_thread_local_exe_atexit_callback(_tls_callback_type callback)
-{
- TRACE("(%p)\n", callback);
- tls_atexit_callback = callback;
-}
-
-#endif /* _MSVCR_VER>=140 */
-
#if _MSVCR_VER>=71
/*********************************************************************
* _set_purecall_handler (MSVCR71.@)
diff --git a/dlls/ucrtbase/tests/misc.c b/dlls/ucrtbase/tests/misc.c
index 354fab1e94..ed5bb0589c 100644
--- a/dlls/ucrtbase/tests/misc.c
+++ b/dlls/ucrtbase/tests/misc.c
@@ -125,6 +125,8 @@ static int (CDECL *p_fesetround)(int);
static void (CDECL *p___setusermatherr)(MSVCRT_matherr_func);
static int* (CDECL *p_errno)(void);
static char* (CDECL *p_asctime)(const struct tm *);
+static void (CDECL *p_exit)(int);
+static int (CDECL *p__crt_atexit)(void (CDECL*)(void));
static void test__initialize_onexit_table(void)
{
@@ -429,6 +431,8 @@ static BOOL init(void)
p___setusermatherr = (void*)GetProcAddress(module, "__setusermatherr");
p_errno = (void*)GetProcAddress(module, "_errno");
p_asctime = (void*)GetProcAddress(module, "asctime");
+ p__crt_atexit = (void*)GetProcAddress(module, "_crt_atexit");
+ p_exit = (void*)GetProcAddress(module, "exit");
return TRUE;
}
@@ -765,6 +769,70 @@ static void test_asctime(void)
ok(!strcmp(ret, "Thu Jan 1 00:00:00 1970\n"), "asctime returned %s\n", ret);
}
+static void test_exit(const char *argv0)
+{
+ HANDLE exit_event1, exit_event2;
+ PROCESS_INFORMATION proc;
+ STARTUPINFOA startup = {0};
+ char path[MAX_PATH];
+ DWORD ret;
+
+ exit_event1 = CreateEventA(NULL, FALSE, FALSE, "exit_event1");
+ exit_event2 = CreateEventA(NULL, FALSE, FALSE, "exit_event2");
+
+ sprintf(path, "%s misc exit", argv0);
+ startup.cb = sizeof(startup);
+ CreateProcessA(NULL, path, NULL, NULL, TRUE, 0, NULL, NULL, &startup, &proc);
+ winetest_wait_child_process(proc.hProcess);
+
+ ret = WaitForSingleObject(exit_event1, 0);
+ ok(ret == WAIT_OBJECT_0, "exit_event1 was not set (%x)\n", ret);
+
+ CloseHandle(exit_event1);
+ CloseHandle(exit_event2);
+}
+
+static void CDECL at_exit_func1(void)
+{
+ HANDLE exit_event1 = CreateEventA(NULL, FALSE, FALSE, "exit_event1");
+ HANDLE exit_event2 = CreateEventA(NULL, FALSE, FALSE, "exit_event2");
+ DWORD ret;
+
+ ok(exit_event1 != NULL, "CreateEvent failed: %d\n", GetLastError());
+ ok(exit_event2 != NULL, "CreateEvent failed: %d\n", GetLastError());
+
+ ret = WaitForSingleObject(exit_event2, 0);
+ ok(ret == WAIT_OBJECT_0, "exit_event2 was not set (%x)\n", ret);
+
+ SetEvent(exit_event1);
+ CloseHandle(exit_event1);
+ CloseHandle(exit_event2);
+}
+
+static void CDECL at_exit_func2(void)
+{
+ HANDLE exit_event1 = CreateEventA(NULL, FALSE, FALSE, "exit_event1");
+ HANDLE exit_event2 = CreateEventA(NULL, FALSE, FALSE, "exit_event2");
+ DWORD ret;
+
+ ok(exit_event1 != NULL, "CreateEvent failed: %d\n", GetLastError());
+ ok(exit_event2 != NULL, "CreateEvent failed: %d\n", GetLastError());
+
+ ret = WaitForSingleObject(exit_event1, 0);
+ ok(ret == WAIT_TIMEOUT, "exit_event1 should not be set (%x)\n", ret);
+
+ SetEvent(exit_event2);
+ CloseHandle(exit_event1);
+ CloseHandle(exit_event2);
+}
+
+static void test_call_exit(void)
+{
+ ok(!p__crt_atexit(at_exit_func1), "_crt_atexit failed\n");
+ ok(!p__crt_atexit(at_exit_func2), "_crt_atexit failed\n");
+ p_exit(0);
+}
+
START_TEST(misc)
{
int arg_c;
@@ -775,7 +843,10 @@ START_TEST(misc)
arg_c = winetest_get_mainargs(&arg_v);
if(arg_c == 3) {
- test__get_narrow_winmain_command_line(NULL);
+ if(!strcmp(arg_v[2], "cmd"))
+ test__get_narrow_winmain_command_line(NULL);
+ else if(!strcmp(arg_v[2], "exit"))
+ test_call_exit();
return;
}
@@ -791,4 +862,5 @@ START_TEST(misc)
test_isblank();
test_math_errors();
test_asctime();
+ test_exit(arg_v[0]);
}
--
2.17.1
June 17, 2018
Re: [PATCH] msvcrt: Use already existent oneexit_table functions for _onexit and _c_exit
by Marvin
Hi,
While running your changed tests on Windows, I think I found new failures.
Being a bot and all I'm not very good at pattern recognition, so I might be
wrong, but could you please double-check?
Full results can be found at
https://testbot.winehq.org/JobDetails.pl?Key=39191
Your paranoid android.
=== wvistau64 (32 bit misc) ===
misc.c:803: Test failed: exit_event2 was not set (102)
ucrtbase:misc has unaccounted for failure messages
ucrtbase:misc returned success despite having failures
=== wvistau64_zh_CN (32 bit misc) ===
misc.c:803: Test failed: exit_event2 was not set (102)
ucrtbase:misc has unaccounted for failure messages
ucrtbase:misc returned success despite having failures
=== wvistau64_fr (32 bit misc) ===
misc.c:803: Test failed: exit_event2 was not set (102)
ucrtbase:misc has unaccounted for failure messages
ucrtbase:misc returned success despite having failures
=== wvistau64_he (32 bit misc) ===
misc.c:803: Test failed: exit_event2 was not set (102)
ucrtbase:misc has unaccounted for failure messages
ucrtbase:misc returned success despite having failures
=== w7u (32 bit misc) ===
misc.c:803: Test failed: exit_event2 was not set (102)
ucrtbase:misc has unaccounted for failure messages
ucrtbase:misc returned success despite having failures
=== w1064 (32 bit misc) ===
misc.c:803: Test failed: exit_event2 was not set (102)
ucrtbase:misc has unaccounted for failure messages
ucrtbase:misc returned success despite having failures
=== wvistau64 (64 bit misc) ===
misc.c:803: Test failed: exit_event2 was not set (102)
ucrtbase:misc has unaccounted for failure messages
ucrtbase:misc returned success despite having failures
=== w1064 (64 bit misc) ===
misc.c:803: Test failed: exit_event2 was not set (102)
ucrtbase:misc has unaccounted for failure messages
ucrtbase:misc returned success despite having failures
June 17, 2018
[PATCH] msvcrt: Use already existent oneexit_table functions for _onexit and _c_exit
by Fabian Maurer
For that to work, MSVCRT__register_onexit_function and
MSVCRT__execute_onexit_table have to available all the time,
not only when _MSVCR_VER>=140
tests based on code by Piotr Caban
Signed-off-by: Fabian Maurer <dark.shadow4(a)web.de>
---
dlls/msvcrt/exit.c | 68 ++++++++++-------------------------
dlls/ucrtbase/tests/misc.c | 72 +++++++++++++++++++++++++++++++++++++-
2 files changed, 89 insertions(+), 51 deletions(-)
diff --git a/dlls/msvcrt/exit.c b/dlls/msvcrt/exit.c
index 7e1805569c..c90f7df953 100644
--- a/dlls/msvcrt/exit.c
+++ b/dlls/msvcrt/exit.c
@@ -25,13 +25,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(msvcrt);
-/* MT */
-#define LOCK_EXIT _mlock(_EXIT_LOCK1)
-#define UNLOCK_EXIT _munlock(_EXIT_LOCK1)
-
-static MSVCRT__onexit_t *MSVCRT_atexit_table = NULL;
-static int MSVCRT_atexit_table_size = 0;
-static int MSVCRT_atexit_registered = 0; /* Points to free slot */
static MSVCRT_purecall_handler purecall_handler = NULL;
typedef struct MSVCRT__onexit_table_t
@@ -41,6 +34,11 @@ typedef struct MSVCRT__onexit_table_t
MSVCRT__onexit_t *_end;
} MSVCRT__onexit_table_t;
+static MSVCRT__onexit_table_t MSVCRT_atexit_table;
+
+int CDECL MSVCRT__register_onexit_function(MSVCRT__onexit_table_t *table, MSVCRT__onexit_t func);
+int CDECL MSVCRT__execute_onexit_table(MSVCRT__onexit_table_t *table);
+
typedef void (__stdcall *_tls_callback_type)(void*,ULONG,void*);
static _tls_callback_type tls_atexit_callback;
@@ -65,17 +63,8 @@ void (*CDECL _aexit_rtn)(int) = MSVCRT__exit;
static void __MSVCRT__call_atexit(void)
{
/* Note: should only be called with the exit lock held */
- TRACE("%d atext functions to call\n", MSVCRT_atexit_registered);
if (tls_atexit_callback) tls_atexit_callback(NULL, DLL_PROCESS_DETACH, NULL);
- /* Last registered gets executed first */
- while (MSVCRT_atexit_registered > 0)
- {
- MSVCRT_atexit_registered--;
- TRACE("next is %p\n",MSVCRT_atexit_table[MSVCRT_atexit_registered]);
- if (MSVCRT_atexit_table[MSVCRT_atexit_registered])
- (*MSVCRT_atexit_table[MSVCRT_atexit_registered])();
- TRACE("returned\n");
- }
+ MSVCRT__execute_onexit_table(&MSVCRT_atexit_table);
}
/*********************************************************************
@@ -276,9 +265,7 @@ void CDECL MSVCRT__c_exit(void)
void CDECL MSVCRT__cexit(void)
{
TRACE("(void)\n");
- LOCK_EXIT;
__MSVCRT__call_atexit();
- UNLOCK_EXIT;
}
/*********************************************************************
@@ -291,26 +278,8 @@ MSVCRT__onexit_t CDECL MSVCRT__onexit(MSVCRT__onexit_t func)
if (!func)
return NULL;
- LOCK_EXIT;
- if (MSVCRT_atexit_registered > MSVCRT_atexit_table_size - 1)
- {
- MSVCRT__onexit_t *newtable;
- TRACE("expanding table\n");
- newtable = MSVCRT_calloc(MSVCRT_atexit_table_size + 32, sizeof(void *));
- if (!newtable)
- {
- TRACE("failed!\n");
- UNLOCK_EXIT;
- return NULL;
- }
- memcpy (newtable, MSVCRT_atexit_table, MSVCRT_atexit_table_size*sizeof(void *));
- MSVCRT_atexit_table_size += 32;
- MSVCRT_free (MSVCRT_atexit_table);
- MSVCRT_atexit_table = newtable;
- }
- MSVCRT_atexit_table[MSVCRT_atexit_registered] = func;
- MSVCRT_atexit_registered++;
- UNLOCK_EXIT;
+ MSVCRT__register_onexit_function(&MSVCRT_atexit_table, func);
+
return func;
}
@@ -359,6 +328,16 @@ int CDECL MSVCRT__crt_atexit(void (*func)(void))
return MSVCRT__onexit((MSVCRT__onexit_t)func) == (MSVCRT__onexit_t)func ? 0 : -1;
}
+/*********************************************************************
+ * _register_thread_local_exe_atexit_callback (UCRTBASE.@)
+ */
+void CDECL _register_thread_local_exe_atexit_callback(_tls_callback_type callback)
+{
+ TRACE("(%p)\n", callback);
+ tls_atexit_callback = callback;
+}
+
+#endif /* _MSVCR_VER>=140 */
/*********************************************************************
* _initialize_onexit_table (UCRTBASE.@)
@@ -457,17 +436,6 @@ int CDECL MSVCRT__execute_onexit_table(MSVCRT__onexit_table_t *table)
return 0;
}
-/*********************************************************************
- * _register_thread_local_exe_atexit_callback (UCRTBASE.@)
- */
-void CDECL _register_thread_local_exe_atexit_callback(_tls_callback_type callback)
-{
- TRACE("(%p)\n", callback);
- tls_atexit_callback = callback;
-}
-
-#endif /* _MSVCR_VER>=140 */
-
#if _MSVCR_VER>=71
/*********************************************************************
* _set_purecall_handler (MSVCR71.@)
diff --git a/dlls/ucrtbase/tests/misc.c b/dlls/ucrtbase/tests/misc.c
index 354fab1e94..de27daaed9 100644
--- a/dlls/ucrtbase/tests/misc.c
+++ b/dlls/ucrtbase/tests/misc.c
@@ -125,6 +125,8 @@ static int (CDECL *p_fesetround)(int);
static void (CDECL *p___setusermatherr)(MSVCRT_matherr_func);
static int* (CDECL *p_errno)(void);
static char* (CDECL *p_asctime)(const struct tm *);
+static void (CDECL *p_exit)(int);
+static int (CDECL *p__crt_atexit)(void (CDECL*)(void));
static void test__initialize_onexit_table(void)
{
@@ -429,6 +431,8 @@ static BOOL init(void)
p___setusermatherr = (void*)GetProcAddress(module, "__setusermatherr");
p_errno = (void*)GetProcAddress(module, "_errno");
p_asctime = (void*)GetProcAddress(module, "asctime");
+ p__crt_atexit = (void*)GetProcAddress(module, "_crt_atexit");
+ p_exit = (void*)GetProcAddress(module, "exit");
return TRUE;
}
@@ -765,6 +769,68 @@ static void test_asctime(void)
ok(!strcmp(ret, "Thu Jan 1 00:00:00 1970\n"), "asctime returned %s\n", ret);
}
+static void test_exit(const char *argv0)
+{
+ HANDLE exit_event1;
+ PROCESS_INFORMATION proc;
+ STARTUPINFOA startup = {0};
+ char path[MAX_PATH];
+ DWORD ret;
+
+ exit_event1 = CreateEventA(NULL, FALSE, FALSE, "exit_event1");
+
+ sprintf(path, "%s misc exit", argv0);
+ startup.cb = sizeof(startup);
+ CreateProcessA(NULL, path, NULL, NULL, TRUE, 0, NULL, NULL, &startup, &proc);
+ winetest_wait_child_process(proc.hProcess);
+
+ ret = WaitForSingleObject(exit_event1, 0);
+ ok(ret == WAIT_OBJECT_0, "exit_event1 was not set (%x)\n", ret);
+
+ CloseHandle(exit_event1);
+}
+
+static void CDECL at_exit_func1(void)
+{
+ HANDLE exit_event1 = CreateEventA(NULL, FALSE, FALSE, "exit_event1");
+ HANDLE exit_event2 = CreateEventA(NULL, FALSE, FALSE, "exit_event2");
+ DWORD ret;
+
+ ok(exit_event1 != NULL, "CreateEvent failed: %d\n", GetLastError());
+ ok(exit_event2 != NULL, "CreateEvent failed: %d\n", GetLastError());
+
+ ret = WaitForSingleObject(exit_event2, 0);
+ ok(ret == WAIT_OBJECT_0, "exit_event2 was not set (%x)\n", ret);
+
+ SetEvent(exit_event1);
+ CloseHandle(exit_event1);
+ CloseHandle(exit_event2);
+}
+
+static void CDECL at_exit_func2(void)
+{
+ HANDLE exit_event1 = CreateEventA(NULL, FALSE, FALSE, "exit_event1");
+ HANDLE exit_event2 = CreateEventA(NULL, FALSE, FALSE, "exit_event2");
+ DWORD ret;
+
+ ok(exit_event1 != NULL, "CreateEvent failed: %d\n", GetLastError());
+ ok(exit_event2 != NULL, "CreateEvent failed: %d\n", GetLastError());
+
+ ret = WaitForSingleObject(exit_event1, 0);
+ ok(ret == WAIT_TIMEOUT, "exit_event1 should not be set (%x)\n", ret);
+
+ SetEvent(exit_event2);
+ CloseHandle(exit_event1);
+ CloseHandle(exit_event2);
+}
+
+static void test_call_exit(void)
+{
+ ok(!p__crt_atexit(at_exit_func1), "_crt_atexit failed\n");
+ ok(!p__crt_atexit(at_exit_func2), "_crt_atexit failed\n");
+ p_exit(0);
+}
+
START_TEST(misc)
{
int arg_c;
@@ -775,7 +841,10 @@ START_TEST(misc)
arg_c = winetest_get_mainargs(&arg_v);
if(arg_c == 3) {
- test__get_narrow_winmain_command_line(NULL);
+ if(!strcmp(arg_v[2], "cmd"))
+ test__get_narrow_winmain_command_line(NULL);
+ else if(!strcmp(arg_v[2], "exit"))
+ test_call_exit();
return;
}
@@ -791,4 +860,5 @@ START_TEST(misc)
test_isblank();
test_math_errors();
test_asctime();
+ test_exit(arg_v[0]);
}
--
2.17.1
June 17, 2018
[PATCH] winetest: Increase maximum tag length.
by Zebediah Figura
This should hopefully make those failures surrounding newtb-wvistau64-zh-CN go away.
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
---
programs/winetest/winetest.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/programs/winetest/winetest.h b/programs/winetest/winetest.h
index e74f126..0446ad5 100644
--- a/programs/winetest/winetest.h
+++ b/programs/winetest/winetest.h
@@ -66,7 +66,7 @@ enum report_type {
R_QUIET
};
-#define MAXTAGLEN 20
+#define MAXTAGLEN 30
extern char *tag;
extern char *email;
extern BOOL aborting;
--
2.7.4
June 17, 2018
[PATCH v2 2/2] hnetcfg: Store the UNC path in INetFwAuthorizedApplication_put_ProcessImageFileName().
by Zebediah Figura
Fixes test failures when running from virtual drive.
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
---
v2: add some changes I forgot to commit...
dlls/hnetcfg/Makefile.in | 2 +-
dlls/hnetcfg/apps.c | 32 +++++++++++++++++++++++++++-----
dlls/hnetcfg/tests/Makefile.in | 2 +-
dlls/hnetcfg/tests/policy.c | 15 ++++++++++++++-
4 files changed, 43 insertions(+), 8 deletions(-)
diff --git a/dlls/hnetcfg/Makefile.in b/dlls/hnetcfg/Makefile.in
index 3744368..44c9cb5 100644
--- a/dlls/hnetcfg/Makefile.in
+++ b/dlls/hnetcfg/Makefile.in
@@ -1,5 +1,5 @@
MODULE = hnetcfg.dll
-IMPORTS = oleaut32 ole32 advapi32
+IMPORTS = oleaut32 ole32 advapi32 mpr
C_SRCS = \
apps.c \
diff --git a/dlls/hnetcfg/apps.c b/dlls/hnetcfg/apps.c
index fda714e..34ef108 100644
--- a/dlls/hnetcfg/apps.c
+++ b/dlls/hnetcfg/apps.c
@@ -29,6 +29,7 @@
#include "netfw.h"
#include "wine/debug.h"
+#include "wine/heap.h"
#include "wine/unicode.h"
#include "hnetcfg_private.h"
@@ -263,18 +264,39 @@ static HRESULT WINAPI fw_app_get_ProcessImageFileName(
}
static HRESULT WINAPI fw_app_put_ProcessImageFileName(
- INetFwAuthorizedApplication *iface,
- BSTR imageFileName )
+ INetFwAuthorizedApplication *iface, BSTR image )
{
fw_app *This = impl_from_INetFwAuthorizedApplication( iface );
+ UNIVERSAL_NAME_INFOW *info;
+ WCHAR *netpath;
+ DWORD res;
+ DWORD sz;
- FIXME("%p, %s\n", This, debugstr_w(imageFileName));
+ FIXME("%p, %s\n", This, debugstr_w(image));
- if (!imageFileName || !imageFileName[0])
+ if (!image || !image[0])
return E_INVALIDARG;
+ sz = 0;
+ res = WNetGetUniversalNameW(image, UNIVERSAL_NAME_INFO_LEVEL, NULL, &sz);
+ if (res == WN_MORE_DATA)
+ {
+ if (!(netpath = heap_alloc(sz)))
+ return E_OUTOFMEMORY;
+
+ info = (UNIVERSAL_NAME_INFOW *)&netpath;
+ res = WNetGetUniversalNameW(image, UNIVERSAL_NAME_INFO_LEVEL, &info, &sz);
+ if (res == NO_ERROR)
+ {
+ SysFreeString(This->filename);
+ This->filename = SysAllocString(info->lpUniversalName);
+ }
+ heap_free(netpath);
+ return HRESULT_FROM_WIN32(res);
+ }
+
SysFreeString( This->filename );
- This->filename = SysAllocString( imageFileName );
+ This->filename = SysAllocString(image);
return This->filename ? S_OK : E_OUTOFMEMORY;
}
diff --git a/dlls/hnetcfg/tests/Makefile.in b/dlls/hnetcfg/tests/Makefile.in
index 8315b4b..922370a 100644
--- a/dlls/hnetcfg/tests/Makefile.in
+++ b/dlls/hnetcfg/tests/Makefile.in
@@ -1,5 +1,5 @@
TESTDLL = hnetcfg.dll
-IMPORTS = ole32 uuid oleaut32 advapi32
+IMPORTS = ole32 uuid oleaut32 advapi32 mpr
C_SRCS = \
policy.c
diff --git a/dlls/hnetcfg/tests/policy.c b/dlls/hnetcfg/tests/policy.c
index 012bbcd..f2d1372 100644
--- a/dlls/hnetcfg/tests/policy.c
+++ b/dlls/hnetcfg/tests/policy.c
@@ -106,9 +106,12 @@ static void test_NetFwAuthorizedApplication(void)
{
INetFwAuthorizedApplication *app;
static WCHAR empty[] = {0};
+ UNIVERSAL_NAME_INFOW *info;
+ WCHAR netpath[MAX_PATH];
WCHAR image[MAX_PATH];
HRESULT hr;
BSTR bstr;
+ DWORD sz;
hr = CoCreateInstance(&CLSID_NetFwAuthorizedApplication, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
&IID_INetFwAuthorizedApplication, (void**)&app);
@@ -135,9 +138,19 @@ static void test_NetFwAuthorizedApplication(void)
ok(hr == S_OK, "got: %08x\n", hr);
SysFreeString(bstr);
+ info = (UNIVERSAL_NAME_INFOW *)&netpath;
+ sz = sizeof(netpath);
+ hr = WNetGetUniversalNameW(image, UNIVERSAL_NAME_INFO_LEVEL, &info, &sz);
+ if (hr != NO_ERROR)
+ {
+ info->lpUniversalName = netpath + sizeof(*info)/sizeof(WCHAR);
+ lstrcpyW(info->lpUniversalName, image);
+ }
+
hr = INetFwAuthorizedApplication_get_ProcessImageFileName(app, &bstr);
ok(hr == S_OK, "got: %08x\n", hr);
- ok(!lstrcmpiW(bstr,image), "got: %s\n", wine_dbgstr_w(bstr));
+ ok(!lstrcmpW(bstr,info->lpUniversalName), "expected %s, got %s\n",
+ wine_dbgstr_w(info->lpUniversalName), wine_dbgstr_w(bstr));
SysFreeString(bstr);
INetFwAuthorizedApplication_Release(app);
--
2.7.4
June 17, 2018
[PATCH v2 1/2] hnetcfg/tests: Fix BSTR usage in test_NetFwAuthorizedApplication().
by Zebediah Figura
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
---
dlls/hnetcfg/tests/policy.c | 52 ++++++++++++++++++++-------------------------
1 file changed, 23 insertions(+), 29 deletions(-)
diff --git a/dlls/hnetcfg/tests/policy.c b/dlls/hnetcfg/tests/policy.c
index 4ee19d8..012bbcd 100644
--- a/dlls/hnetcfg/tests/policy.c
+++ b/dlls/hnetcfg/tests/policy.c
@@ -105,48 +105,42 @@ static void test_interfaces(void)
static void test_NetFwAuthorizedApplication(void)
{
INetFwAuthorizedApplication *app;
+ static WCHAR empty[] = {0};
+ WCHAR image[MAX_PATH];
HRESULT hr;
+ BSTR bstr;
hr = CoCreateInstance(&CLSID_NetFwAuthorizedApplication, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
&IID_INetFwAuthorizedApplication, (void**)&app);
ok(hr == S_OK, "got: %08x\n", hr);
- if(hr == S_OK)
- {
- BSTR image = SysAllocStringLen( NULL, MAX_PATH );
- static WCHAR empty[] = {0};
- BSTR bstr;
- if (!GetModuleFileNameW( NULL, image, MAX_PATH ))
- {
- ok(0, "Failed to get filename\n");
- SysFreeString( image );
- return;
- }
+ hr = GetModuleFileNameW(NULL, image, sizeof(image));
+ ok(hr, "GetModuleFileName failed: %u\n", GetLastError());
- hr = INetFwAuthorizedApplication_get_ProcessImageFileName(app, NULL);
- ok(hr == E_POINTER, "got: %08x\n", hr);
+ hr = INetFwAuthorizedApplication_get_ProcessImageFileName(app, NULL);
+ ok(hr == E_POINTER, "got: %08x\n", hr);
- hr = INetFwAuthorizedApplication_get_ProcessImageFileName(app, &bstr);
- ok(hr == S_OK || hr == HRESULT_FROM_WIN32(ERROR_NOT_ENOUGH_MEMORY), "got: %08x\n", hr);
- ok(!bstr, "got: %s\n", wine_dbgstr_w(bstr));
+ hr = INetFwAuthorizedApplication_get_ProcessImageFileName(app, &bstr);
+ ok(hr == S_OK || hr == HRESULT_FROM_WIN32(ERROR_NOT_ENOUGH_MEMORY), "got: %08x\n", hr);
+ ok(!bstr, "got: %s\n", wine_dbgstr_w(bstr));
- hr = INetFwAuthorizedApplication_put_ProcessImageFileName(app, NULL);
- ok(hr == E_INVALIDARG || hr == HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND), "got: %08x\n", hr);
+ hr = INetFwAuthorizedApplication_put_ProcessImageFileName(app, NULL);
+ ok(hr == E_INVALIDARG || hr == HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND), "got: %08x\n", hr);
- hr = INetFwAuthorizedApplication_put_ProcessImageFileName(app, empty);
- ok(hr == E_INVALIDARG || hr == HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND), "got: %08x\n", hr);
+ hr = INetFwAuthorizedApplication_put_ProcessImageFileName(app, empty);
+ ok(hr == E_INVALIDARG || hr == HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND), "got: %08x\n", hr);
- hr = INetFwAuthorizedApplication_put_ProcessImageFileName(app, image);
- ok(hr == S_OK, "got: %08x\n", hr);
+ bstr = SysAllocString(image);
+ hr = INetFwAuthorizedApplication_put_ProcessImageFileName(app, bstr);
+ ok(hr == S_OK, "got: %08x\n", hr);
+ SysFreeString(bstr);
- hr = INetFwAuthorizedApplication_get_ProcessImageFileName(app, &bstr);
- ok(hr == S_OK, "got: %08x\n", hr);
- ok(!lstrcmpiW(bstr,image), "got: %s\n", wine_dbgstr_w(bstr));
- SysFreeString( bstr );
+ hr = INetFwAuthorizedApplication_get_ProcessImageFileName(app, &bstr);
+ ok(hr == S_OK, "got: %08x\n", hr);
+ ok(!lstrcmpiW(bstr,image), "got: %s\n", wine_dbgstr_w(bstr));
+ SysFreeString(bstr);
- SysFreeString( image );
- INetFwAuthorizedApplication_Release(app);
- }
+ INetFwAuthorizedApplication_Release(app);
}
START_TEST(policy)
--
2.7.4
June 17, 2018
[PATCH] ntdll: Add stub for WinSqmSetDWORD
by Fabian Maurer
This is an undocumented win7 function appearently used to telemetry.
It's used by some native win7 dlls.
Signed-off-by: Fabian Maurer <dark.shadow4(a)web.de>
---
dlls/ntdll/misc.c | 10 ++++++++++
dlls/ntdll/ntdll.spec | 1 +
2 files changed, 11 insertions(+)
diff --git a/dlls/ntdll/misc.c b/dlls/ntdll/misc.c
index 88e8b33324..85000ab225 100644
--- a/dlls/ntdll/misc.c
+++ b/dlls/ntdll/misc.c
@@ -484,3 +484,13 @@ void WINAPI DbgUiRemoteBreakin( void *arg )
{
FIXME("stub\n");
}
+
+/***********************************************************************
+ * WinSqmSetDWORD (NTDLL.@)
+ *
+ * SQM seems to be used for telemetry
+ */
+void WINAPI WinSqmSetDWORD(HANDLE session, DWORD datapoint_id, DWORD datapoint_value)
+{
+ FIXME("(%p, %d, %d): stub\n", session, datapoint_id, datapoint_value);
+}
diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec
index fb505e2208..1c366649e0 100644
--- a/dlls/ntdll/ntdll.spec
+++ b/dlls/ntdll/ntdll.spec
@@ -1032,6 +1032,7 @@
@ stdcall -ret64 VerSetConditionMask(int64 long long)
@ stdcall WinSqmEndSession(long)
@ stdcall WinSqmIsOptedIn()
+@ stdcall WinSqmSetDWORD(ptr long long)
@ stdcall WinSqmStartSession(ptr long long)
@ stdcall -private ZwAcceptConnectPort(ptr long ptr long ptr ptr) NtAcceptConnectPort
@ stdcall -private ZwAccessCheck(ptr long long ptr ptr ptr ptr ptr) NtAccessCheck
--
2.17.1
June 17, 2018
[PATCH] ntdll: Add stub for RtlExpandEnvironmentStrings
by Fabian Maurer
This function is used by some native win7 dlls
Signed-off-by: Fabian Maurer <dark.shadow4(a)web.de>
---
dlls/ntdll/env.c | 8 ++++++++
dlls/ntdll/ntdll.spec | 1 +
2 files changed, 9 insertions(+)
diff --git a/dlls/ntdll/env.c b/dlls/ntdll/env.c
index a5bdf0f050..328ba79aaa 100644
--- a/dlls/ntdll/env.c
+++ b/dlls/ntdll/env.c
@@ -362,6 +362,14 @@ NTSTATUS WINAPI RtlExpandEnvironmentStrings_U(PCWSTR renv, const UNICODE_STRING*
return (count) ? STATUS_SUCCESS : STATUS_BUFFER_TOO_SMALL;
}
+/******************************************************************************
+ * RtlExpandEnvironmentStrings [NTDLL.@]
+ */
+NTSTATUS WINAPI RtlExpandEnvironmentStrings(PVOID environment, PWSTR src, SIZE_T src_length, PWSTR dst, SIZE_T dst_length, PSIZE_T return_length)
+{
+ FIXME("(%p, %p, %lu, %p, %lu, %p): stub\n", environment, src, src_length, dst, dst_length, return_length);
+ return STATUS_NOT_IMPLEMENTED;
+}
static inline void normalize( void *base, WCHAR **ptr )
{
diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec
index 45cedb74f5..fb505e2208 100644
--- a/dlls/ntdll/ntdll.spec
+++ b/dlls/ntdll/ntdll.spec
@@ -596,6 +596,7 @@
@ stdcall RtlEraseUnicodeString(ptr)
@ stdcall RtlExitUserProcess(long)
@ stdcall RtlExitUserThread(long)
+@ stdcall RtlExpandEnvironmentStrings(ptr ptr long ptr long ptr)
@ stdcall RtlExpandEnvironmentStrings_U(ptr ptr ptr ptr)
@ stub RtlExtendHeap
@ stdcall -arch=win32 -ret64 RtlExtendedIntegerMultiply(int64 long)
--
2.17.1
June 17, 2018
Re: [PATCH 2/2] msvcp120: Add test for Concurrent_vector_swap.
by Piotr Caban
Signed-off-by: Piotr Caban <piotr(a)codeweavers.com>
June 17, 2018
Re: [PATCH 1/2] msvcp120: Add test for Concurrent_vector_assign.
by Piotr Caban
Signed-off-by: Piotr Caban <piotr(a)codeweavers.com>
June 17, 2018