From 1c6124cc6e842540c48c7a1bb5b4b28d06dadd40 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Sat, 24 Oct 2015 22:55:19 +0200 Subject: [PATCH] Added patch for implementation of additional HSTRING functions. --- README.md | 3 +- debian/changelog | 1 + ...mbase-Add-TRACEs-to-string-functions.patch | 145 ++++++++++++++++++ ...-check-for-NULL-pointer-in-WindowsCr.patch | 49 ++++++ ...t-WindowsSubstringWithSpecifiedLengt.patch | 71 +++++++++ ...d-tests-for-WindowsSubstringWithSpec.patch | 106 +++++++++++++ ...ombase-Implement-WindowsConcatString.patch | 80 ++++++++++ ...ts-Add-tests-for-WindowsConcatString.patch | 109 +++++++++++++ patches/combase-Strings/definition | 1 + patches/patchinstall.sh | 27 ++++ 10 files changed, 591 insertions(+), 1 deletion(-) create mode 100644 patches/combase-Strings/0001-combase-Add-TRACEs-to-string-functions.patch create mode 100644 patches/combase-Strings/0002-combase-Simplify-check-for-NULL-pointer-in-WindowsCr.patch create mode 100644 patches/combase-Strings/0003-combase-Implement-WindowsSubstringWithSpecifiedLengt.patch create mode 100644 patches/combase-Strings/0004-combase-tests-Add-tests-for-WindowsSubstringWithSpec.patch create mode 100644 patches/combase-Strings/0005-combase-Implement-WindowsConcatString.patch create mode 100644 patches/combase-Strings/0006-combase-tests-Add-tests-for-WindowsConcatString.patch create mode 100644 patches/combase-Strings/definition diff --git a/README.md b/README.md index d98e8099..4eb3b503 100644 --- a/README.md +++ b/README.md @@ -34,8 +34,9 @@ Wine. All those differences are also documented on the Included bug fixes and improvements ----------------------------------- -**Bug fixes and features included in the next upcoming release [3]:** +**Bug fixes and features included in the next upcoming release [4]:** +* Add implementation for additional HSTRING functions * Do not allow interruption of system APC in server_select ([Wine Bug #14697](https://bugs.winehq.org/show_bug.cgi?id=14697)) * Implement FileNamesInformation class support for NtQueryDirectoryFile * Implement stub for ProcessQuotaLimits info class diff --git a/debian/changelog b/debian/changelog index 2761d00e..ab96ade1 100644 --- a/debian/changelog +++ b/debian/changelog @@ -6,6 +6,7 @@ wine-staging (1.7.54) UNRELEASED; urgency=low * Added patch to block interruption of system APC in server_select. * Added patch to implement FileNamesInformation class support for NtQueryDirectoryFile. + * Added patch for implementation of additional HSTRING functions. * Removed patch to implement kernel32.GetPhysicallyInstalledSystemMemory (accepted upstream). * Partially removed patches for ws2_32 TransmitFile (accepted upstream). diff --git a/patches/combase-Strings/0001-combase-Add-TRACEs-to-string-functions.patch b/patches/combase-Strings/0001-combase-Add-TRACEs-to-string-functions.patch new file mode 100644 index 00000000..a3cc9489 --- /dev/null +++ b/patches/combase-Strings/0001-combase-Add-TRACEs-to-string-functions.patch @@ -0,0 +1,145 @@ +From 7544953e42915dccf4d3bc495d62503f2953cf9b Mon Sep 17 00:00:00 2001 +From: Sebastian Lackner +Date: Sat, 24 Oct 2015 17:51:13 +0200 +Subject: combase: Add TRACEs to string functions. + +--- + dlls/combase/string.c | 37 +++++++++++++++++++++++++++++++++++++ + 1 file changed, 37 insertions(+) + +diff --git a/dlls/combase/string.c b/dlls/combase/string.c +index 33e5100..766e765 100644 +--- a/dlls/combase/string.c ++++ b/dlls/combase/string.c +@@ -21,7 +21,9 @@ + #include "windows.h" + #include "winerror.h" + #include "hstring.h" ++#include "wine/debug.h" + ++WINE_DEFAULT_DEBUG_CHANNEL(winstring); + + struct hstring_private + { +@@ -72,6 +74,9 @@ HRESULT WINAPI WindowsCreateString(LPCWSTR ptr, UINT32 len, + HSTRING *out) + { + struct hstring_private *priv; ++ ++ TRACE("(%p, %u, %p)\n", ptr, len, out); ++ + if (out == NULL) + return E_INVALIDARG; + if (ptr == NULL && len > 0) +@@ -95,6 +100,9 @@ HRESULT WINAPI WindowsCreateStringReference(LPCWSTR ptr, UINT32 len, + HSTRING_HEADER *header, HSTRING *out) + { + struct hstring_private *priv = impl_from_HSTRING_HEADER(header); ++ ++ TRACE("(%p, %u, %p, %p)\n", ptr, len, header, out); ++ + if (out == NULL || header == NULL) + return E_INVALIDARG; + if (ptr == NULL && len > 0) +@@ -119,6 +127,9 @@ HRESULT WINAPI WindowsCreateStringReference(LPCWSTR ptr, UINT32 len, + HRESULT WINAPI WindowsDeleteString(HSTRING str) + { + struct hstring_private *priv = impl_from_HSTRING(str); ++ ++ TRACE("(%p)\n", str); ++ + if (str == NULL) + return S_OK; + if (priv->reference) +@@ -134,6 +145,9 @@ HRESULT WINAPI WindowsDeleteString(HSTRING str) + HRESULT WINAPI WindowsDuplicateString(HSTRING str, HSTRING *out) + { + struct hstring_private *priv = impl_from_HSTRING(str); ++ ++ TRACE("(%p, %p)\n", str, out); ++ + if (out == NULL) + return E_INVALIDARG; + if (str == NULL) +@@ -156,6 +170,9 @@ HRESULT WINAPI WindowsPreallocateStringBuffer(UINT32 len, WCHAR **outptr, + { + struct hstring_private *priv; + HSTRING str; ++ ++ TRACE("(%u, %p, %p)\n", len, outptr, out); ++ + if (outptr == NULL || out == NULL) + return E_POINTER; + if (len == 0) +@@ -178,6 +195,8 @@ HRESULT WINAPI WindowsPreallocateStringBuffer(UINT32 len, WCHAR **outptr, + */ + HRESULT WINAPI WindowsDeleteStringBuffer(HSTRING_BUFFER buf) + { ++ TRACE("(%p)\n", buf); ++ + return WindowsDeleteString((HSTRING)buf); + } + +@@ -187,6 +206,9 @@ HRESULT WINAPI WindowsDeleteStringBuffer(HSTRING_BUFFER buf) + HRESULT WINAPI WindowsPromoteStringBuffer(HSTRING_BUFFER buf, HSTRING *out) + { + struct hstring_private *priv = impl_from_HSTRING_BUFFER(buf); ++ ++ TRACE("(%p, %p)\n", buf, out); ++ + if (out == NULL) + return E_POINTER; + if (buf == NULL) +@@ -206,6 +228,9 @@ HRESULT WINAPI WindowsPromoteStringBuffer(HSTRING_BUFFER buf, HSTRING *out) + UINT32 WINAPI WindowsGetStringLen(HSTRING str) + { + struct hstring_private *priv = impl_from_HSTRING(str); ++ ++ TRACE("(%p)\n", str); ++ + if (str == NULL) + return 0; + return priv->length; +@@ -217,6 +242,9 @@ UINT32 WINAPI WindowsGetStringLen(HSTRING str) + LPCWSTR WINAPI WindowsGetStringRawBuffer(HSTRING str, UINT32 *len) + { + struct hstring_private *priv = impl_from_HSTRING(str); ++ ++ TRACE("(%p, %p)\n", str, len); ++ + if (str == NULL) + { + if (len) +@@ -235,6 +263,9 @@ HRESULT WINAPI WindowsStringHasEmbeddedNull(HSTRING str, BOOL *out) + { + UINT32 i; + struct hstring_private *priv = impl_from_HSTRING(str); ++ ++ TRACE("(%p, %p)\n", str, out); ++ + if (out == NULL) + return E_INVALIDARG; + if (str == NULL) +@@ -261,6 +292,9 @@ HRESULT WINAPI WindowsSubstring(HSTRING str, UINT32 start, HSTRING *out) + { + struct hstring_private *priv = impl_from_HSTRING(str); + UINT32 len = WindowsGetStringLen(str); ++ ++ TRACE("(%p, %u, %p)\n", str, start, out); ++ + if (out == NULL) + return E_INVALIDARG; + if (start > len) +@@ -279,6 +313,9 @@ HRESULT WINAPI WindowsSubstring(HSTRING str, UINT32 start, HSTRING *out) + BOOL WINAPI WindowsIsStringEmpty(HSTRING str) + { + struct hstring_private *priv = impl_from_HSTRING(str); ++ ++ TRACE("(%p)\n", str); ++ + if (str == NULL) + return TRUE; + return priv->length == 0; +-- +2.6.1 + diff --git a/patches/combase-Strings/0002-combase-Simplify-check-for-NULL-pointer-in-WindowsCr.patch b/patches/combase-Strings/0002-combase-Simplify-check-for-NULL-pointer-in-WindowsCr.patch new file mode 100644 index 00000000..79c74ef2 --- /dev/null +++ b/patches/combase-Strings/0002-combase-Simplify-check-for-NULL-pointer-in-WindowsCr.patch @@ -0,0 +1,49 @@ +From fe236be1d5f8285d4438afde1bd5b7b7d502341d Mon Sep 17 00:00:00 2001 +From: Sebastian Lackner +Date: Sat, 24 Oct 2015 22:52:44 +0200 +Subject: combase: Simplify check for NULL pointer in + WindowsCreateString[Reference]. + +--- + dlls/combase/string.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/dlls/combase/string.c b/dlls/combase/string.c +index 766e765..4344d36 100644 +--- a/dlls/combase/string.c ++++ b/dlls/combase/string.c +@@ -79,13 +79,13 @@ HRESULT WINAPI WindowsCreateString(LPCWSTR ptr, UINT32 len, + + if (out == NULL) + return E_INVALIDARG; +- if (ptr == NULL && len > 0) +- return E_POINTER; + if (len == 0) + { + *out = NULL; + return S_OK; + } ++ if (ptr == NULL) ++ return E_POINTER; + if (!alloc_string(len, out)) + return E_OUTOFMEMORY; + priv = impl_from_HSTRING(*out); +@@ -105,13 +105,13 @@ HRESULT WINAPI WindowsCreateStringReference(LPCWSTR ptr, UINT32 len, + + if (out == NULL || header == NULL) + return E_INVALIDARG; +- if (ptr == NULL && len > 0) +- return E_POINTER; + if (len == 0) + { + *out = NULL; + return S_OK; + } ++ if (ptr == NULL) ++ return E_POINTER; + if (ptr[len] != '\0') + return E_INVALIDARG; + priv->buffer = (LPWSTR)ptr; +-- +2.6.1 + diff --git a/patches/combase-Strings/0003-combase-Implement-WindowsSubstringWithSpecifiedLengt.patch b/patches/combase-Strings/0003-combase-Implement-WindowsSubstringWithSpecifiedLengt.patch new file mode 100644 index 00000000..fc00dff1 --- /dev/null +++ b/patches/combase-Strings/0003-combase-Implement-WindowsSubstringWithSpecifiedLengt.patch @@ -0,0 +1,71 @@ +From 8a60c9da79b9b03c8fa9e2b971b0f3e3c074014a Mon Sep 17 00:00:00 2001 +From: Sebastian Lackner +Date: Sat, 24 Oct 2015 17:54:52 +0200 +Subject: combase: Implement WindowsSubstringWithSpecifiedLength. + +--- + .../api-ms-win-core-winrt-string-l1-1-0.spec | 2 +- + dlls/combase/combase.spec | 2 +- + dlls/combase/string.c | 22 ++++++++++++++++++++++ + 3 files changed, 24 insertions(+), 2 deletions(-) + +diff --git a/dlls/api-ms-win-core-winrt-string-l1-1-0/api-ms-win-core-winrt-string-l1-1-0.spec b/dlls/api-ms-win-core-winrt-string-l1-1-0/api-ms-win-core-winrt-string-l1-1-0.spec +index 825980d..cb354f9 100644 +--- a/dlls/api-ms-win-core-winrt-string-l1-1-0/api-ms-win-core-winrt-string-l1-1-0.spec ++++ b/dlls/api-ms-win-core-winrt-string-l1-1-0/api-ms-win-core-winrt-string-l1-1-0.spec +@@ -22,6 +22,6 @@ + @ stub WindowsReplaceString + @ stdcall WindowsStringHasEmbeddedNull(ptr ptr) combase.WindowsStringHasEmbeddedNull + @ stdcall WindowsSubstring(ptr long ptr) combase.WindowsSubstring +-@ stub WindowsSubstringWithSpecifiedLength ++@ stdcall WindowsSubstringWithSpecifiedLength(ptr long long ptr) combase.WindowsSubstringWithSpecifiedLength + @ stub WindowsTrimStringEnd + @ stub WindowsTrimStringStart +diff --git a/dlls/combase/combase.spec b/dlls/combase/combase.spec +index bf8607a..3b3fd9c 100644 +--- a/dlls/combase/combase.spec ++++ b/dlls/combase/combase.spec +@@ -303,6 +303,6 @@ + @ stub WindowsReplaceString + @ stdcall WindowsStringHasEmbeddedNull(ptr ptr) + @ stdcall WindowsSubstring(ptr long ptr) +-@ stub WindowsSubstringWithSpecifiedLength ++@ stdcall WindowsSubstringWithSpecifiedLength(ptr long long ptr) + @ stub WindowsTrimStringEnd + @ stub WindowsTrimStringStart +diff --git a/dlls/combase/string.c b/dlls/combase/string.c +index 4344d36..92666b4 100644 +--- a/dlls/combase/string.c ++++ b/dlls/combase/string.c +@@ -308,6 +308,28 @@ HRESULT WINAPI WindowsSubstring(HSTRING str, UINT32 start, HSTRING *out) + } + + /*********************************************************************** ++ * WindowsSubstringWithSpecifiedLength (combase.@) ++ */ ++HRESULT WINAPI WindowsSubstringWithSpecifiedLength(HSTRING str, UINT32 start, UINT32 len, HSTRING *out) ++{ ++ struct hstring_private *priv = impl_from_HSTRING(str); ++ ++ TRACE("(%p, %u, %u, %p)\n", str, start, len, out); ++ ++ if (out == NULL) ++ return E_INVALIDARG; ++ if (start + len < start || ++ start + len > WindowsGetStringLen(str)) ++ return E_BOUNDS; ++ if (len == 0) ++ { ++ *out = NULL; ++ return S_OK; ++ } ++ return WindowsCreateString(&priv->buffer[start], len, out); ++} ++ ++/*********************************************************************** + * WindowsIsStringEmpty (combase.@) + */ + BOOL WINAPI WindowsIsStringEmpty(HSTRING str) +-- +2.6.1 + diff --git a/patches/combase-Strings/0004-combase-tests-Add-tests-for-WindowsSubstringWithSpec.patch b/patches/combase-Strings/0004-combase-tests-Add-tests-for-WindowsSubstringWithSpec.patch new file mode 100644 index 00000000..08f9cffd --- /dev/null +++ b/patches/combase-Strings/0004-combase-tests-Add-tests-for-WindowsSubstringWithSpec.patch @@ -0,0 +1,106 @@ +From 1612ae8d8b8112d7e4e6b9c6a51d1aaf3f1093ec Mon Sep 17 00:00:00 2001 +From: Sebastian Lackner +Date: Sat, 24 Oct 2015 17:58:09 +0200 +Subject: combase/tests: Add tests for WindowsSubstringWithSpecifiedLength. + +--- + dlls/combase/tests/string.c | 30 ++++++++++++++++++++++++++++-- + 1 file changed, 28 insertions(+), 2 deletions(-) + +diff --git a/dlls/combase/tests/string.c b/dlls/combase/tests/string.c +index a6b02c6..dd35fa8 100644 +--- a/dlls/combase/tests/string.c ++++ b/dlls/combase/tests/string.c +@@ -39,6 +39,8 @@ static HRESULT (WINAPI *pWindowsPreallocateStringBuffer)(UINT32, WCHAR **, HSTRI + static HRESULT (WINAPI *pWindowsPromoteStringBuffer)(HSTRING_BUFFER, HSTRING *); + static HRESULT (WINAPI *pWindowsStringHasEmbeddedNull)(HSTRING, BOOL *); + static HRESULT (WINAPI *pWindowsSubstring)(HSTRING, UINT32, HSTRING *); ++static HRESULT (WINAPI *pWindowsSubstringWithSpecifiedLength)(HSTRING, UINT32, UINT32, HSTRING *); ++ + + #define SET(x) p##x = (void*)GetProcAddress(hmod, #x) + +@@ -62,6 +64,8 @@ static BOOL init_functions(void) + SET(WindowsPromoteStringBuffer); + SET(WindowsStringHasEmbeddedNull); + SET(WindowsSubstring); ++ SET(WindowsSubstringWithSpecifiedLength); ++ + return TRUE; + } + +@@ -249,6 +253,9 @@ static void test_substring(void) + ok(pWindowsSubstring(str, 2, &substr) == S_OK, "Failed to create substring\n"); + check_string(substr, output_substring, 4, FALSE); + ok(pWindowsDeleteString(substr) == S_OK, "Failed to delete string\n"); ++ ok(pWindowsSubstringWithSpecifiedLength(str, 2, 3, &substr) == S_OK, "Failed to create substring\n"); ++ check_string(substr, output_substring, 3, FALSE); ++ ok(pWindowsDeleteString(substr) == S_OK, "Failed to delete string\n"); + ok(pWindowsDeleteString(str) == S_OK, "Failed to delete string\n"); + + /* Test duplication of string using substring */ +@@ -257,6 +264,10 @@ static void test_substring(void) + ok(str != substr, "Duplicated string didn't create new string\n"); + check_string(substr, input_string, 6, FALSE); + ok(pWindowsDeleteString(substr) == S_OK, "Failed to delete string\n"); ++ ok(pWindowsSubstringWithSpecifiedLength(str, 0, 6, &substr) == S_OK, "Failed to create substring\n"); ++ ok(str != substr, "Duplicated string didn't create new string\n"); ++ check_string(substr, input_string, 6, FALSE); ++ ok(pWindowsDeleteString(substr) == S_OK, "Failed to delete string\n"); + ok(pWindowsDeleteString(str) == S_OK, "Failed to delete string\n"); + + /* Test substring of string reference */ +@@ -264,6 +275,9 @@ static void test_substring(void) + ok(pWindowsSubstring(str, 2, &substr) == S_OK, "Failed to create substring of string ref\n"); + check_string(substr, output_substring, 4, FALSE); + ok(pWindowsDeleteString(substr) == S_OK, "Failed to delete string\n"); ++ ok(pWindowsSubstringWithSpecifiedLength(str, 2, 3, &substr) == S_OK, "Failed to create substring of string ref\n"); ++ check_string(substr, output_substring, 3, FALSE); ++ ok(pWindowsDeleteString(substr) == S_OK, "Failed to delete string\n"); + ok(pWindowsDeleteString(str) == S_OK, "Failed to delete string ref\n"); + + /* Test duplication of string reference using substring */ +@@ -272,26 +286,38 @@ static void test_substring(void) + ok(str != substr, "Duplicated string ref didn't create new string\n"); + check_string(substr, input_string, 6, FALSE); + ok(pWindowsDeleteString(substr) == S_OK, "Failed to delete string\n"); +- ok(pWindowsDeleteString(str) == S_OK, "Failed to delete string\n"); ++ ok(pWindowsSubstringWithSpecifiedLength(str, 0, 6, &substr) == S_OK, "Failed to create substring of string ref\n"); ++ ok(str != substr, "Duplicated string didn't create new string\n"); ++ check_string(substr, input_string, 6, FALSE); ++ ok(pWindowsDeleteString(substr) == S_OK, "Failed to delete string\n"); ++ ok(pWindowsDeleteString(str) == S_OK, "Failed to delete string ref\n"); + + /* Test get substring of empty string */ + ok(pWindowsSubstring(NULL, 0, &substr) == S_OK, "Failed to duplicate NULL string\n"); + ok(substr == NULL, "Substring created new string\n"); ++ ok(pWindowsSubstringWithSpecifiedLength(NULL, 0, 0, &substr) == S_OK, "Failed to duplicate NULL string\n"); ++ ok(substr == NULL, "Substring created new string\n"); + + /* Test get empty substring of string */ + ok(pWindowsCreateString(input_string, 6, &str) == S_OK, "Failed to create string\n"); + ok(pWindowsSubstring(str, 6, &substr) == S_OK, "Failed to create substring\n"); + ok(substr == NULL, "Substring created new string\n"); ++ ok(pWindowsSubstringWithSpecifiedLength(str, 6, 0, &substr) == S_OK, "Failed to create substring\n"); ++ ok(substr == NULL, "Substring created new string\n"); + ok(pWindowsDeleteString(str) == S_OK, "Failed to delete string\n"); + +- /* Test handling of using too high start index */ ++ /* Test handling of using too high start index or length */ + ok(pWindowsCreateString(input_string, 6, &str) == S_OK, "Failed to create string\n"); + ok(pWindowsSubstring(str, 7, &substr) == E_BOUNDS, "Incorrect error handling\n"); ++ ok(pWindowsSubstringWithSpecifiedLength(str, 7, 0, &substr) == E_BOUNDS, "Incorrect error handling\n"); ++ ok(pWindowsSubstringWithSpecifiedLength(str, 6, 1, &substr) == E_BOUNDS, "Incorrect error handling\n"); ++ ok(pWindowsSubstringWithSpecifiedLength(str, 7, 0xffffffff, &substr) == E_BOUNDS, "Incorrect error handling\n"); + ok(pWindowsDeleteString(str) == S_OK, "Failed to delete string\n"); + + /* Test handling of a NULL string */ + ok(pWindowsCreateString(input_string, 6, &str) == S_OK, "Failed to create string\n"); + ok(pWindowsSubstring(str, 7, NULL) == E_INVALIDARG, "Incorrect error handling\n"); ++ ok(pWindowsSubstringWithSpecifiedLength(str, 7, 0, NULL) == E_INVALIDARG, "Incorrect error handling\n"); + ok(pWindowsDeleteString(str) == S_OK, "Failed to delete string\n"); + } + +-- +2.6.1 + diff --git a/patches/combase-Strings/0005-combase-Implement-WindowsConcatString.patch b/patches/combase-Strings/0005-combase-Implement-WindowsConcatString.patch new file mode 100644 index 00000000..b1ea31f5 --- /dev/null +++ b/patches/combase-Strings/0005-combase-Implement-WindowsConcatString.patch @@ -0,0 +1,80 @@ +From 5f3fb549f2442ee29ab6268a15a933a4363a467e Mon Sep 17 00:00:00 2001 +From: Sebastian Lackner +Date: Sat, 24 Oct 2015 22:30:21 +0200 +Subject: combase: Implement WindowsConcatString. + +--- + .../api-ms-win-core-winrt-string-l1-1-0.spec | 2 +- + dlls/combase/combase.spec | 2 +- + dlls/combase/string.c | 29 ++++++++++++++++++++++ + 3 files changed, 31 insertions(+), 2 deletions(-) + +diff --git a/dlls/api-ms-win-core-winrt-string-l1-1-0/api-ms-win-core-winrt-string-l1-1-0.spec b/dlls/api-ms-win-core-winrt-string-l1-1-0/api-ms-win-core-winrt-string-l1-1-0.spec +index cb354f9..efe50d8 100644 +--- a/dlls/api-ms-win-core-winrt-string-l1-1-0/api-ms-win-core-winrt-string-l1-1-0.spec ++++ b/dlls/api-ms-win-core-winrt-string-l1-1-0/api-ms-win-core-winrt-string-l1-1-0.spec +@@ -7,7 +7,7 @@ + @ stub HSTRING_UserUnmarshal + @ stub HSTRING_UserUnmarshal64 + @ stub WindowsCompareStringOrdinal +-@ stub WindowsConcatString ++@ stdcall WindowsConcatString(ptr ptr ptr) combase.WindowsConcatString + @ stdcall WindowsCreateString(ptr long ptr) combase.WindowsCreateString + @ stdcall WindowsCreateStringReference(wstr long ptr ptr) combase.WindowsCreateStringReference + @ stdcall WindowsDeleteString(ptr) combase.WindowsDeleteString +diff --git a/dlls/combase/combase.spec b/dlls/combase/combase.spec +index 3b3fd9c..efb5b07 100644 +--- a/dlls/combase/combase.spec ++++ b/dlls/combase/combase.spec +@@ -288,7 +288,7 @@ + @ stdcall WdtpInterfacePointer_UserUnmarshal(ptr ptr ptr ptr) ole32.WdtpInterfacePointer_UserUnmarshal + @ stub WdtpInterfacePointer_UserUnmarshal64 + @ stub WindowsCompareStringOrdinal +-@ stub WindowsConcatString ++@ stdcall WindowsConcatString(ptr ptr ptr) + @ stdcall WindowsCreateString(ptr long ptr) + @ stdcall WindowsCreateStringReference(wstr long ptr ptr) + @ stdcall WindowsDeleteString(ptr) +diff --git a/dlls/combase/string.c b/dlls/combase/string.c +index 92666b4..6f9ec07 100644 +--- a/dlls/combase/string.c ++++ b/dlls/combase/string.c +@@ -330,6 +330,35 @@ HRESULT WINAPI WindowsSubstringWithSpecifiedLength(HSTRING str, UINT32 start, UI + } + + /*********************************************************************** ++ * WindowsConcatString (combase.@) ++ */ ++HRESULT WINAPI WindowsConcatString(HSTRING str1, HSTRING str2, HSTRING *out) ++{ ++ struct hstring_private *priv1 = impl_from_HSTRING(str1); ++ struct hstring_private *priv2 = impl_from_HSTRING(str2); ++ struct hstring_private *priv; ++ ++ TRACE("(%p, %p, %p)\n", str1, str2, out); ++ ++ if (str1 == NULL) ++ return WindowsDuplicateString(str2, out); ++ if (str2 == NULL) ++ return WindowsDuplicateString(str1, out); ++ if (priv1->length + priv2->length == 0) ++ { ++ *out = NULL; ++ return S_OK; ++ } ++ ++ if (!alloc_string(priv1->length + priv2->length, out)) ++ return E_OUTOFMEMORY; ++ priv = impl_from_HSTRING(*out); ++ memcpy(priv->buffer, priv1->buffer, priv1->length * sizeof(*priv1->buffer)); ++ memcpy(priv->buffer + priv1->length, priv2->buffer, priv2->length * sizeof(*priv2->buffer)); ++ return S_OK; ++} ++ ++/*********************************************************************** + * WindowsIsStringEmpty (combase.@) + */ + BOOL WINAPI WindowsIsStringEmpty(HSTRING str) +-- +2.6.1 + diff --git a/patches/combase-Strings/0006-combase-tests-Add-tests-for-WindowsConcatString.patch b/patches/combase-Strings/0006-combase-tests-Add-tests-for-WindowsConcatString.patch new file mode 100644 index 00000000..6765207f --- /dev/null +++ b/patches/combase-Strings/0006-combase-tests-Add-tests-for-WindowsConcatString.patch @@ -0,0 +1,109 @@ +From 3d933fb3c0278d2f3b90ca6929ddf7454710ca16 Mon Sep 17 00:00:00 2001 +From: Sebastian Lackner +Date: Sat, 24 Oct 2015 22:35:06 +0200 +Subject: combase/tests: Add tests for WindowsConcatString. + +--- + dlls/combase/tests/string.c | 60 +++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 60 insertions(+) + +diff --git a/dlls/combase/tests/string.c b/dlls/combase/tests/string.c +index dd35fa8..d39edbe 100644 +--- a/dlls/combase/tests/string.c ++++ b/dlls/combase/tests/string.c +@@ -27,6 +27,7 @@ + + #include "wine/test.h" + ++static HRESULT (WINAPI *pWindowsConcatString)(HSTRING, HSTRING, HSTRING *); + static HRESULT (WINAPI *pWindowsCreateString)(LPCWSTR, UINT32, HSTRING *); + static HRESULT (WINAPI *pWindowsCreateStringReference)(LPCWSTR, UINT32, HSTRING_HEADER *, HSTRING *); + static HRESULT (WINAPI *pWindowsDeleteString)(HSTRING); +@@ -52,6 +53,7 @@ static BOOL init_functions(void) + win_skip("Failed to load combase.dll, skipping tests\n"); + return FALSE; + } ++ SET(WindowsConcatString); + SET(WindowsCreateString); + SET(WindowsCreateStringReference); + SET(WindowsDeleteString); +@@ -96,6 +98,8 @@ static void _check_string(int line, HSTRING str, LPCWSTR content, UINT32 length, + } + + static const WCHAR input_string[] = { 'a', 'b', 'c', 'd', 'e', 'f', '\0', '\0' }; ++static const WCHAR input_string1[] = { 'a', 'b', 'c', '\0' }; ++static const WCHAR input_string2[] = { 'd', 'e', 'f', '\0' }; + static const WCHAR input_empty_string[] = { '\0' }; + static const WCHAR input_embed_null[] = { 'a', '\0', 'c', '\0', 'e', 'f', '\0' }; + static const WCHAR output_substring[] = { 'c', 'd', 'e', 'f', '\0' }; +@@ -321,6 +325,61 @@ static void test_substring(void) + ok(pWindowsDeleteString(str) == S_OK, "Failed to delete string\n"); + } + ++static void test_concat(void) ++{ ++ HSTRING str1, str2, concat; ++ HSTRING_HEADER header1, header2; ++ ++ /* Test concatenation of string buffers */ ++ ok(pWindowsCreateString(input_string1, 3, &str1) == S_OK, "Failed to create string\n"); ++ ok(pWindowsCreateString(input_string2, 3, &str2) == S_OK, "Failed to create string\n"); ++ ++ ok(pWindowsConcatString(str1, NULL, &concat) == S_OK, "Failed to concatenate string\n"); ++ ok(str1 == concat, "Concatenate created new string\n"); ++ check_string(concat, input_string1, 3, FALSE); ++ ok(pWindowsDeleteString(concat) == S_OK, "Failed to delete string\n"); ++ ++ ok(pWindowsConcatString(NULL, str2, &concat) == S_OK, "Failed to concatenate string\n"); ++ ok(str2 == concat, "Concatenate created new string\n"); ++ check_string(concat, input_string2, 3, FALSE); ++ ok(pWindowsDeleteString(concat) == S_OK, "Failed to delete string\n"); ++ ++ ok(pWindowsConcatString(str1, str2, &concat) == S_OK, "Failed to concatenate string\n"); ++ check_string(concat, input_string, 6, FALSE); ++ ok(pWindowsDeleteString(concat) == S_OK, "Failed to delete string\n"); ++ ++ ok(pWindowsDeleteString(str2) == S_OK, "Failed to delete string\n"); ++ ok(pWindowsDeleteString(str1) == S_OK, "Failed to delete string\n"); ++ ++ /* Test concatenation of string references */ ++ ok(pWindowsCreateStringReference(input_string1, 3, &header1, &str1) == S_OK, "Failed to create string ref\n"); ++ ok(pWindowsCreateStringReference(input_string2, 3, &header2, &str2) == S_OK, "Failed to create string ref\n"); ++ ++ ok(pWindowsConcatString(str1, NULL, &concat) == S_OK, "Failed to concatenate string\n"); ++ ok(str1 != concat, "Concatenate string ref didn't create new string\n"); ++ check_string(concat, input_string1, 3, FALSE); ++ ok(pWindowsDeleteString(concat) == S_OK, "Failed to delete string\n"); ++ ++ ok(pWindowsConcatString(NULL, str2, &concat) == S_OK, "Failed to concatenate string\n"); ++ ok(str2 != concat, "Concatenate string ref didn't create new string\n"); ++ check_string(concat, input_string2, 3, FALSE); ++ ok(pWindowsDeleteString(concat) == S_OK, "Failed to delete string\n"); ++ ++ ok(pWindowsConcatString(str1, str2, &concat) == S_OK, "Failed to concatenate string\n"); ++ check_string(concat, input_string, 6, FALSE); ++ ok(pWindowsDeleteString(concat) == S_OK, "Failed to delete string\n"); ++ ++ ok(pWindowsDeleteString(str2) == S_OK, "Failed to delete string ref\n"); ++ ok(pWindowsDeleteString(str1) == S_OK, "Failed to delete string ref\n"); ++ ++ /* Test concatenation of two empty strings */ ++ ok(pWindowsConcatString(NULL, NULL, &concat) == S_OK, "Failed to concatenate string\n"); ++ ok(concat == NULL, "Concatenate created new string\n"); ++ ++ /* Test handling of a NULL string */ ++ ok(pWindowsConcatString(NULL, NULL, NULL) == E_INVALIDARG, "Incorrect error handling\n"); ++} ++ + START_TEST(string) + { + if (!init_functions()) +@@ -330,4 +389,5 @@ START_TEST(string) + test_access(); + test_string_buffer(); + test_substring(); ++ test_concat(); + } +-- +2.6.1 + diff --git a/patches/combase-Strings/definition b/patches/combase-Strings/definition new file mode 100644 index 00000000..fad126e7 --- /dev/null +++ b/patches/combase-Strings/definition @@ -0,0 +1 @@ +Fixes: Add implementation for additional HSTRING functions diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 6df86f1c..66274773 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -92,6 +92,7 @@ patch_enable_all () enable_api_ms_win_crt_Stub_DLLs="$1" enable_authz_Stub_Functions="$1" enable_browseui_Progress_Dialog="$1" + enable_combase_Strings="$1" enable_comctl32_Button_Theming="$1" enable_comctl32_PROPSHEET_InsertPage="$1" enable_comctl32_TVM_GETITEM="$1" @@ -371,6 +372,9 @@ patch_enable () category-stable) enable_category_stable="$2" ;; + combase-Strings) + enable_combase_Strings="$2" + ;; comctl32-Button_Theming) enable_comctl32_Button_Theming="$2" ;; @@ -2322,6 +2326,29 @@ if test "$enable_browseui_Progress_Dialog" -eq 1; then ) >> "$patchlist" fi +# Patchset combase-Strings +# | +# | Modified files: +# | * dlls/api-ms-win-core-winrt-string-l1-1-0/api-ms-win-core-winrt-string-l1-1-0.spec, dlls/combase/combase.spec, +# | dlls/combase/string.c, dlls/combase/tests/string.c +# | +if test "$enable_combase_Strings" -eq 1; then + patch_apply combase-Strings/0001-combase-Add-TRACEs-to-string-functions.patch + patch_apply combase-Strings/0002-combase-Simplify-check-for-NULL-pointer-in-WindowsCr.patch + patch_apply combase-Strings/0003-combase-Implement-WindowsSubstringWithSpecifiedLengt.patch + patch_apply combase-Strings/0004-combase-tests-Add-tests-for-WindowsSubstringWithSpec.patch + patch_apply combase-Strings/0005-combase-Implement-WindowsConcatString.patch + patch_apply combase-Strings/0006-combase-tests-Add-tests-for-WindowsConcatString.patch + ( + echo '+ { "Sebastian Lackner", "combase: Add TRACEs to string functions.", 1 },'; + echo '+ { "Sebastian Lackner", "combase: Simplify check for NULL pointer in WindowsCreateString[Reference].", 1 },'; + echo '+ { "Sebastian Lackner", "combase: Implement WindowsSubstringWithSpecifiedLength.", 1 },'; + echo '+ { "Sebastian Lackner", "combase/tests: Add tests for WindowsSubstringWithSpecifiedLength.", 1 },'; + echo '+ { "Sebastian Lackner", "combase: Implement WindowsConcatString.", 1 },'; + echo '+ { "Sebastian Lackner", "combase/tests: Add tests for WindowsConcatString.", 1 },'; + ) >> "$patchlist" +fi + # Patchset comctl32-Button_Theming # | # | This patchset fixes the following Wine bugs: