msvcp90-basic_string_dtor: Fix behaviour for both char and wchar strings.

This commit is contained in:
Sebastian Lackner 2015-05-06 17:55:10 +02:00
parent 8ace9d57c0
commit a78acf275d
5 changed files with 99 additions and 59 deletions

View File

@ -0,0 +1,65 @@
From b4db8b5c0ed023c05792ebfe6aef07edb7fb4327 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Thu, 9 Oct 2014 17:32:58 +0200
Subject: msvcp90: basic_string_wchar_dtor needs to return NULL
---
dlls/msvcp90/msvcp90.h | 4 ++--
dlls/msvcp90/string.c | 6 ++++--
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/dlls/msvcp90/msvcp90.h b/dlls/msvcp90/msvcp90.h
index 17d582c..dc71a74 100644
--- a/dlls/msvcp90/msvcp90.h
+++ b/dlls/msvcp90/msvcp90.h
@@ -94,7 +94,7 @@ basic_string_char* __thiscall MSVCP_basic_string_char_ctor(basic_string_char*);
basic_string_char* __thiscall MSVCP_basic_string_char_ctor_cstr(basic_string_char*, const char*);
basic_string_char* __thiscall MSVCP_basic_string_char_ctor_cstr_len(basic_string_char*, const char*, MSVCP_size_t);
basic_string_char* __thiscall MSVCP_basic_string_char_copy_ctor(basic_string_char*, const basic_string_char*);
-void __thiscall MSVCP_basic_string_char_dtor(basic_string_char*);
+void* __thiscall MSVCP_basic_string_char_dtor(basic_string_char*);
const char* __thiscall MSVCP_basic_string_char_c_str(const basic_string_char*);
void __thiscall MSVCP_basic_string_char_clear(basic_string_char*);
basic_string_char* __thiscall MSVCP_basic_string_char_append_ch(basic_string_char*, char);
@@ -123,7 +123,7 @@ typedef struct
basic_string_wchar* __thiscall MSVCP_basic_string_wchar_ctor(basic_string_wchar*);
basic_string_wchar* __thiscall MSVCP_basic_string_wchar_ctor_cstr(basic_string_wchar*, const wchar_t*);
basic_string_wchar* __thiscall MSVCP_basic_string_wchar_ctor_cstr_len(basic_string_wchar*, const wchar_t*, MSVCP_size_t);
-void __thiscall MSVCP_basic_string_wchar_dtor(basic_string_wchar*);
+void* __thiscall MSVCP_basic_string_wchar_dtor(basic_string_wchar*);
const wchar_t* __thiscall MSVCP_basic_string_wchar_c_str(const basic_string_wchar*);
void __thiscall MSVCP_basic_string_wchar_clear(basic_string_wchar*);
basic_string_wchar* __thiscall MSVCP_basic_string_wchar_append_ch(basic_string_wchar*, wchar_t);
diff --git a/dlls/msvcp90/string.c b/dlls/msvcp90/string.c
index 3afb375..86b4f8e 100644
--- a/dlls/msvcp90/string.c
+++ b/dlls/msvcp90/string.c
@@ -973,10 +973,11 @@ basic_string_char* __thiscall MSVCP_basic_string_char_ctor_ptr_ptr(basic_string_
/* ??1?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ */
/* ??1?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAA@XZ */
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_dtor, 4)
-void __thiscall MSVCP_basic_string_char_dtor(basic_string_char *this)
+void* __thiscall MSVCP_basic_string_char_dtor(basic_string_char *this)
{
TRACE("%p\n", this);
basic_string_char_tidy(this, TRUE, 0);
+ return NULL;
}
/* ?size@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEIXZ */
@@ -2712,10 +2713,11 @@ basic_string_wchar* __thiscall MSVCP_basic_string_wchar_ctor_ptr_ptr(basic_strin
/* ??1?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAE@XZ */
/* ??1?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAA@XZ */
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_dtor, 4)
-void __thiscall MSVCP_basic_string_wchar_dtor(basic_string_wchar *this)
+void* __thiscall MSVCP_basic_string_wchar_dtor(basic_string_wchar *this)
{
TRACE("%p\n", this);
basic_string_wchar_tidy(this, TRUE, 0);
+ return NULL;
}
/* ?size@?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QBEIXZ */
--
2.3.7

View File

@ -1,17 +1,26 @@
From 5514f8e7f8421577dc300c146ed1943d254d903c Mon Sep 17 00:00:00 2001
From 98cd419f1bea2a0002ff4d768680862e88bdcad0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Thu, 9 Oct 2014 17:35:50 +0200
Subject: msvcp90/tests: Add tests to check that basic_string_wchar_dtor
returns NULL.
---
dlls/msvcp90/tests/string.c | 79 +++++++++++++++++++++++++++++----------------
1 file changed, 52 insertions(+), 27 deletions(-)
dlls/msvcp90/tests/string.c | 90 +++++++++++++++++++++++++++++++--------------
1 file changed, 62 insertions(+), 28 deletions(-)
diff --git a/dlls/msvcp90/tests/string.c b/dlls/msvcp90/tests/string.c
index f1aa92a..a2cd46f 100644
index f1aa92a..68a432f 100644
--- a/dlls/msvcp90/tests/string.c
+++ b/dlls/msvcp90/tests/string.c
@@ -63,7 +63,7 @@ static basic_string_char* (__cdecl *p_basic_string_char_concatenate_cstr)(basic_
static basic_string_char* (__thiscall *p_basic_string_char_ctor)(basic_string_char*);
static basic_string_char* (__thiscall *p_basic_string_char_copy_ctor)(basic_string_char*, basic_string_char*);
static basic_string_char* (__thiscall *p_basic_string_char_ctor_cstr)(basic_string_char*, const char*);
-static void (__thiscall *p_basic_string_char_dtor)(basic_string_char*);
+static void* (__thiscall *p_basic_string_char_dtor)(basic_string_char*);
static basic_string_char* (__thiscall *p_basic_string_char_erase)(basic_string_char*, size_t, size_t);
static basic_string_char* (__thiscall *p_basic_string_char_assign_cstr_len)(basic_string_char*, const char*, size_t);
static const char* (__thiscall *p_basic_string_char_cstr)(basic_string_char*);
@@ -85,7 +85,7 @@ static size_t *p_basic_string_char_npos;
static basic_string_wchar* (__thiscall *p_basic_string_wchar_ctor)(basic_string_wchar*);
static basic_string_wchar* (__thiscall *p_basic_string_wchar_copy_ctor)(basic_string_wchar*, basic_string_wchar*);
@ -100,13 +109,14 @@ index f1aa92a..a2cd46f 100644
#else
@@ -767,6 +771,26 @@ static void test_basic_string_char_find_last_not_of(void) {
@@ -767,6 +771,35 @@ static void test_basic_string_char_find_last_not_of(void) {
}
}
+static void test_basic_string_dtor_eax(void) {
+#ifdef __i386__
+ basic_string_wchar str1;
+ basic_string_char str2;
+ void *ret;
+ wchar_t wtmp1[32];
+
@ -115,19 +125,27 @@ index f1aa92a..a2cd46f 100644
+ /* eax = 0x1337 */
+ call_func2(p_basic_string_wchar_ctor_cstr, &str1, wtmp1);
+ ret = call_func1_eax(p_basic_string_wchar_dtor, 0x1337, &str1);
+ ok (ret == (void *)0x0, "Expected eax value 0x%x, got 0x%x\n", 0x0, (unsigned int)ret);
+ ok(ret == (void *)0x0, "Expected eax value 0x%x, got 0x%x\n", 0x0, (unsigned int)ret);
+
+ call_func2(p_basic_string_char_ctor_cstr, &str2, "qwerty");
+ ret = call_func1_eax(p_basic_string_char_dtor, 0x1337, &str2);
+ ok(ret == (void *)0x0, "Expected eax value 0x%x, got 0x%x\n", 0x0, (unsigned int)ret);
+
+ /* eax = 0xdeadbeef */
+ call_func2(p_basic_string_wchar_ctor_cstr, &str1, wtmp1);
+ ret = call_func1_eax(p_basic_string_wchar_dtor, 0xdeadbeef, &str1);
+ ok (ret == (void *)0x0, "Expected eax value 0x%x, got 0x%x\n", 0x0, (unsigned int)ret);
+ ok(ret == (void *)0x0, "Expected eax value 0x%x, got 0x%x\n", 0x0, (unsigned int)ret);
+
+ call_func2(p_basic_string_char_ctor_cstr, &str2, "qwerty");
+ ret = call_func1_eax(p_basic_string_char_dtor, 0xdeadbeef, &str2);
+ ok(ret == (void *)0x0, "Expected eax value 0x%x, got 0x%x\n", 0x0, (unsigned int)ret);
+#endif
+}
+
START_TEST(string)
{
if(!init())
@@ -783,6 +807,7 @@ START_TEST(string)
@@ -783,6 +816,7 @@ START_TEST(string)
test_basic_string_wchar();
test_basic_string_wchar_swap();
test_basic_string_char_find_last_not_of();
@ -136,5 +154,5 @@ index f1aa92a..a2cd46f 100644
ok(!invalid_parameter, "invalid_parameter_handler was invoked too many times\n");
--
1.9.1
2.3.7

View File

@ -1,43 +0,0 @@
From ee4a399d58b884d54387aeb1290fba2e304157d7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Thu, 9 Oct 2014 17:32:58 +0200
Subject: msvcp90: basic_string_wchar_dtor needs to return NULL
---
dlls/msvcp90/msvcp90.h | 2 +-
dlls/msvcp90/string.c | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/dlls/msvcp90/msvcp90.h b/dlls/msvcp90/msvcp90.h
index 5062bdc..be87efb 100644
--- a/dlls/msvcp90/msvcp90.h
+++ b/dlls/msvcp90/msvcp90.h
@@ -109,7 +109,7 @@ typedef struct
basic_string_wchar* __thiscall MSVCP_basic_string_wchar_ctor(basic_string_wchar*);
basic_string_wchar* __thiscall MSVCP_basic_string_wchar_ctor_cstr(basic_string_wchar*, const wchar_t*);
basic_string_wchar* __thiscall MSVCP_basic_string_wchar_ctor_cstr_len(basic_string_wchar*, const wchar_t*, MSVCP_size_t);
-void __thiscall MSVCP_basic_string_wchar_dtor(basic_string_wchar*);
+void* __thiscall MSVCP_basic_string_wchar_dtor(basic_string_wchar*);
const wchar_t* __thiscall MSVCP_basic_string_wchar_c_str(const basic_string_wchar*);
void __thiscall MSVCP_basic_string_wchar_clear(basic_string_wchar*);
basic_string_wchar* __thiscall MSVCP_basic_string_wchar_append_ch(basic_string_wchar*, wchar_t);
diff --git a/dlls/msvcp90/string.c b/dlls/msvcp90/string.c
index ce05613..982b801 100644
--- a/dlls/msvcp90/string.c
+++ b/dlls/msvcp90/string.c
@@ -2704,10 +2704,11 @@ basic_string_wchar* __thiscall MSVCP_basic_string_wchar_ctor_ptr_ptr(basic_strin
/* ??1?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAE@XZ */
/* ??1?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAA@XZ */
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_dtor, 4)
-void __thiscall MSVCP_basic_string_wchar_dtor(basic_string_wchar *this)
+void* __thiscall MSVCP_basic_string_wchar_dtor(basic_string_wchar *this)
{
TRACE("%p\n", this);
basic_string_wchar_tidy(this, TRUE, 0);
+ return NULL;
}
/* ?size@?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QBEIXZ */
--
1.9.1

View File

@ -133,7 +133,7 @@ patch_enable_all ()
enable_mountmgr_DosDevices="$1"
enable_mountmgr_Null_Device="$1"
enable_mscoree_CorValidateImage="$1"
enable_msvcp90_basic_string_wchar_dtor="$1"
enable_msvcp90_basic_string_dtor="$1"
enable_msvcrt_Math_Precision="$1"
enable_msvcrt_atof_strtod="$1"
enable_msvfw32_Image_Size="$1"
@ -477,8 +477,8 @@ patch_enable ()
mscoree-CorValidateImage)
enable_mscoree_CorValidateImage="$2"
;;
msvcp90-basic_string_wchar_dtor)
enable_msvcp90_basic_string_wchar_dtor="$2"
msvcp90-basic_string_dtor)
enable_msvcp90_basic_string_dtor="$2"
;;
msvcrt-Math_Precision)
enable_msvcrt_Math_Precision="$2"
@ -3308,7 +3308,7 @@ if test "$enable_mscoree_CorValidateImage" -eq 1; then
) >> "$patchlist"
fi
# Patchset msvcp90-basic_string_wchar_dtor
# Patchset msvcp90-basic_string_dtor
# |
# | This patchset fixes the following Wine bugs:
# | * [#37358] FEAR 1 installer expects basic_string_wchar_dtor to return NULL
@ -3316,9 +3316,9 @@ fi
# | Modified files:
# | * dlls/msvcp90/msvcp90.h, dlls/msvcp90/string.c, dlls/msvcp90/tests/string.c
# |
if test "$enable_msvcp90_basic_string_wchar_dtor" -eq 1; then
patch_apply msvcp90-basic_string_wchar_dtor/0001-msvcp90-basic_string_wchar_dtor-needs-to-return-NULL.patch
patch_apply msvcp90-basic_string_wchar_dtor/0002-msvcp90-tests-Add-tests-to-check-that-basic_string_w.patch
if test "$enable_msvcp90_basic_string_dtor" -eq 1; then
patch_apply msvcp90-basic_string_dtor/0001-msvcp90-basic_string_wchar_dtor-needs-to-return-NULL.patch
patch_apply msvcp90-basic_string_dtor/0002-msvcp90-tests-Add-tests-to-check-that-basic_string_w.patch
(
echo '+ { "Michael Müller", "msvcp90: basic_string_wchar_dtor needs to return NULL.", 1 },';
echo '+ { "Michael Müller", "msvcp90/tests: Add tests to check that basic_string_wchar_dtor returns NULL.", 1 },';