diff --git a/patches/combase-WindowsCompareStringOrdinal/definition b/patches/combase-WindowsCompareStringOrdinal/definition deleted file mode 100644 index 07610fc3..00000000 --- a/patches/combase-WindowsCompareStringOrdinal/definition +++ /dev/null @@ -1 +0,0 @@ -Fixes: Implement combase.WindowsCompareStringOrdinal diff --git a/patches/combase-WindowsCompareStringOrdinal/0001-combase-Implement-WindowsCompareStringOrdinal.patch b/patches/combase-WindowsString/0001-combase-Implement-WindowsCompareStringOrdinal.patch similarity index 100% rename from patches/combase-WindowsCompareStringOrdinal/0001-combase-Implement-WindowsCompareStringOrdinal.patch rename to patches/combase-WindowsString/0001-combase-Implement-WindowsCompareStringOrdinal.patch diff --git a/patches/combase-WindowsCompareStringOrdinal/0002-combase-tests-Add-tests-for-WindowsCompareStringOrdi.patch b/patches/combase-WindowsString/0002-combase-tests-Add-tests-for-WindowsCompareStringOrdi.patch similarity index 100% rename from patches/combase-WindowsCompareStringOrdinal/0002-combase-tests-Add-tests-for-WindowsCompareStringOrdi.patch rename to patches/combase-WindowsString/0002-combase-tests-Add-tests-for-WindowsCompareStringOrdi.patch diff --git a/patches/combase-WindowsString/0003-combase-Implement-WindowsTrimStringStart.patch b/patches/combase-WindowsString/0003-combase-Implement-WindowsTrimStringStart.patch new file mode 100644 index 00000000..51a9f439 --- /dev/null +++ b/patches/combase-WindowsString/0003-combase-Implement-WindowsTrimStringStart.patch @@ -0,0 +1,66 @@ +From 93a197217df87f95ed2111358fbb6efb89ba0c04 Mon Sep 17 00:00:00 2001 +From: Sebastian Lackner +Date: Sun, 17 Jan 2016 05:55:43 +0100 +Subject: combase: Implement WindowsTrimStringStart. + +--- + dlls/combase/combase.spec | 2 +- + dlls/combase/string.c | 28 ++++++++++++++++++++++++++++ + 2 files changed, 29 insertions(+), 1 deletion(-) + +diff --git a/dlls/combase/combase.spec b/dlls/combase/combase.spec +index 430ca95..69f47d0 100644 +--- a/dlls/combase/combase.spec ++++ b/dlls/combase/combase.spec +@@ -305,4 +305,4 @@ + @ stdcall WindowsSubstring(ptr long ptr) + @ stdcall WindowsSubstringWithSpecifiedLength(ptr long long ptr) + @ stub WindowsTrimStringEnd +-@ stub WindowsTrimStringStart ++@ stdcall WindowsTrimStringStart(ptr ptr ptr) +diff --git a/dlls/combase/string.c b/dlls/combase/string.c +index bd18a73..868411c 100644 +--- a/dlls/combase/string.c ++++ b/dlls/combase/string.c +@@ -21,6 +21,7 @@ + #include "windows.h" + #include "winerror.h" + #include "hstring.h" ++#include "wine/unicode.h" + #include "wine/debug.h" + + WINE_DEFAULT_DEBUG_CHANNEL(winstring); +@@ -405,3 +406,30 @@ HRESULT WINAPI WindowsCompareStringOrdinal(HSTRING str1, HSTRING str2, INT32 *re + *res = CompareStringOrdinal(buf1, len1, buf2, len2, FALSE) - CSTR_EQUAL; + return S_OK; + } ++ ++/*********************************************************************** ++ * WindowsTrimStringStart (combase.@) ++ */ ++HRESULT WINAPI WindowsTrimStringStart(HSTRING str1, HSTRING str2, HSTRING *out) ++{ ++ struct hstring_private *priv1 = impl_from_HSTRING(str1); ++ struct hstring_private *priv2 = impl_from_HSTRING(str2); ++ UINT32 start = 0; ++ ++ TRACE("(%p, %p, %p)\n", str1, str2, out); ++ ++ if (!out || !str2 || !priv2->length) ++ return E_INVALIDARG; ++ if (!str1) ++ { ++ *out = NULL; ++ return S_OK; ++ } ++ for (start = 0; start < priv1->length; start++) ++ { ++ if (!memchrW(priv2->buffer, priv1->buffer[start], priv2->length)) ++ break; ++ } ++ return start ? WindowsCreateString(&priv1->buffer[start], priv1->length - start, out) : ++ WindowsDuplicateString(str1, out); ++} +-- +2.6.4 + diff --git a/patches/combase-WindowsString/0004-combase-Implement-WindowsTrimStringEnd.patch b/patches/combase-WindowsString/0004-combase-Implement-WindowsTrimStringEnd.patch new file mode 100644 index 00000000..ba92a85f --- /dev/null +++ b/patches/combase-WindowsString/0004-combase-Implement-WindowsTrimStringEnd.patch @@ -0,0 +1,59 @@ +From 356dff154c4885bfba910b0ea8febd978e2bf824 Mon Sep 17 00:00:00 2001 +From: Sebastian Lackner +Date: Sun, 17 Jan 2016 05:56:50 +0100 +Subject: combase: Implement WindowsTrimStringEnd. + +--- + dlls/combase/combase.spec | 2 +- + dlls/combase/string.c | 27 +++++++++++++++++++++++++++ + 2 files changed, 28 insertions(+), 1 deletion(-) + +diff --git a/dlls/combase/combase.spec b/dlls/combase/combase.spec +index 69f47d0..4bda470 100644 +--- a/dlls/combase/combase.spec ++++ b/dlls/combase/combase.spec +@@ -304,5 +304,5 @@ + @ stdcall WindowsStringHasEmbeddedNull(ptr ptr) + @ stdcall WindowsSubstring(ptr long ptr) + @ stdcall WindowsSubstringWithSpecifiedLength(ptr long long ptr) +-@ stub WindowsTrimStringEnd ++@ stdcall WindowsTrimStringEnd(ptr ptr ptr) + @ stdcall WindowsTrimStringStart(ptr ptr ptr) +diff --git a/dlls/combase/string.c b/dlls/combase/string.c +index 868411c..56d84ad 100644 +--- a/dlls/combase/string.c ++++ b/dlls/combase/string.c +@@ -433,3 +433,30 @@ HRESULT WINAPI WindowsTrimStringStart(HSTRING str1, HSTRING str2, HSTRING *out) + return start ? WindowsCreateString(&priv1->buffer[start], priv1->length - start, out) : + WindowsDuplicateString(str1, out); + } ++ ++/*********************************************************************** ++ * WindowsTrimStringEnd (combase.@) ++ */ ++HRESULT WINAPI WindowsTrimStringEnd(HSTRING str1, HSTRING str2, HSTRING *out) ++{ ++ struct hstring_private *priv1 = impl_from_HSTRING(str1); ++ struct hstring_private *priv2 = impl_from_HSTRING(str2); ++ UINT32 len; ++ ++ TRACE("(%p, %p, %p)\n", str1, str2, out); ++ ++ if (!out || !str2 || !priv2->length) ++ return E_INVALIDARG; ++ if (!str1) ++ { ++ *out = NULL; ++ return S_OK; ++ } ++ for (len = priv1->length; len > 0; len--) ++ { ++ if (!memchrW(priv2->buffer, priv1->buffer[len - 1], priv2->length)) ++ break; ++ } ++ return (len < priv1->length) ? WindowsCreateString(priv1->buffer, len, out) : ++ WindowsDuplicateString(str1, out); ++} +-- +2.6.4 + diff --git a/patches/combase-WindowsString/0005-combase-tests-Add-tests-for-WindowsTrimString-Start-.patch b/patches/combase-WindowsString/0005-combase-tests-Add-tests-for-WindowsTrimString-Start-.patch new file mode 100644 index 00000000..78b8e759 --- /dev/null +++ b/patches/combase-WindowsString/0005-combase-tests-Add-tests-for-WindowsTrimString-Start-.patch @@ -0,0 +1,119 @@ +From 6a3505cc0e0a632cdf9fb10c0b38b8f0a435a13d Mon Sep 17 00:00:00 2001 +From: Sebastian Lackner +Date: Sun, 17 Jan 2016 05:58:08 +0100 +Subject: combase/tests: Add tests for WindowsTrimString{Start,End}. + +--- + dlls/combase/tests/string.c | 77 +++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 77 insertions(+) + +diff --git a/dlls/combase/tests/string.c b/dlls/combase/tests/string.c +index db6c8f5..ac6c587 100644 +--- a/dlls/combase/tests/string.c ++++ b/dlls/combase/tests/string.c +@@ -42,6 +42,8 @@ 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 *); ++static HRESULT (WINAPI *pWindowsTrimStringEnd)(HSTRING, HSTRING, HSTRING *); ++static HRESULT (WINAPI *pWindowsTrimStringStart)(HSTRING, HSTRING, HSTRING *); + + #define SET(x) p##x = (void*)GetProcAddress(hmod, #x) + +@@ -68,6 +70,8 @@ static BOOL init_functions(void) + SET(WindowsStringHasEmbeddedNull); + SET(WindowsSubstring); + SET(WindowsSubstringWithSpecifiedLength); ++ SET(WindowsTrimStringEnd); ++ SET(WindowsTrimStringStart); + return TRUE; + } + +@@ -456,6 +460,78 @@ static void test_compare(void) + ok(res == 0, "Expected 0, got %d\n", res); + } + ++static void test_trim(void) ++{ ++ HSTRING str1, str2, trimmed; ++ HSTRING_HEADER header1, header2; ++ ++ /* Test trimming of string buffers */ ++ ok(pWindowsCreateString(input_string, 6, &str1) == S_OK, "Failed to create string\n"); ++ ok(pWindowsCreateString(input_string1, 3, &str2) == S_OK, "Failed to create string\n"); ++ ++ ok(pWindowsTrimStringStart(str1, str2, &trimmed) == S_OK, "Failed to trim string\n"); ++ check_string(trimmed, input_string2, 3, FALSE); ++ ok(pWindowsDeleteString(trimmed) == S_OK, "Failed to delete string\n"); ++ ok(pWindowsTrimStringEnd(str1, str2, &trimmed) == S_OK, "Failed to trim string\n"); ++ ok(trimmed == str1, "Trimmed string created new string\n"); ++ check_string(trimmed, input_string, 6, FALSE); ++ ok(pWindowsDeleteString(trimmed) == S_OK, "Failed to delete string\n"); ++ ++ ok(pWindowsDeleteString(str2) == S_OK, "Failed to delete string\n"); ++ ok(pWindowsCreateString(input_string2, 3, &str2) == S_OK, "Failed to create string\n"); ++ ++ ok(pWindowsTrimStringStart(str1, str2, &trimmed) == S_OK, "Failed to trim string\n"); ++ ok(trimmed == str1, "Trimmed string created new string\n"); ++ check_string(trimmed, input_string, 6, FALSE); ++ ok(pWindowsDeleteString(trimmed) == S_OK, "Failed to delete string\n"); ++ ok(pWindowsTrimStringEnd(str1, str2, &trimmed) == S_OK, "Failed to trim string\n"); ++ check_string(trimmed, input_string1, 3, FALSE); ++ ok(pWindowsDeleteString(trimmed) == 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 trimming of string references */ ++ ok(pWindowsCreateStringReference(input_string, 6, &header1, &str1) == S_OK, "Failed to create string ref\n"); ++ ok(pWindowsCreateStringReference(input_string1, 3, &header2, &str2) == S_OK, "Failed to create string ref\n"); ++ ++ ok(pWindowsTrimStringStart(str1, str2, &trimmed) == S_OK, "Failed to trim string\n"); ++ check_string(trimmed, input_string2, 3, FALSE); ++ ok(pWindowsDeleteString(trimmed) == S_OK, "Failed to delete string\n"); ++ ok(pWindowsTrimStringEnd(str1, str2, &trimmed) == S_OK, "Failed to trim string\n"); ++ ok(trimmed != str1, "Trimmed string ref didn't create new string\n"); ++ check_string(trimmed, input_string, 6, FALSE); ++ ok(pWindowsDeleteString(trimmed) == S_OK, "Failed to delete string\n"); ++ ++ ok(pWindowsDeleteString(str2) == S_OK, "Failed to delete string ref\n"); ++ ok(pWindowsCreateStringReference(input_string2, 3, &header2, &str2) == S_OK, "Failed to create string ref\n"); ++ ++ ok(pWindowsTrimStringStart(str1, str2, &trimmed) == S_OK, "Failed to trim string\n"); ++ ok(trimmed != str1, "Trimmed string ref didn't create new string\n"); ++ check_string(trimmed, input_string, 6, FALSE); ++ ok(pWindowsDeleteString(trimmed) == S_OK, "Failed to delete string\n"); ++ ok(pWindowsTrimStringEnd(str1, str2, &trimmed) == S_OK, "Failed to trim string\n"); ++ check_string(trimmed, input_string1, 3, FALSE); ++ ok(pWindowsDeleteString(trimmed) == 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 handling of a NULL string */ ++ ok(pWindowsCreateString(input_string, 6, &str1) == S_OK, "Failed to create string\n"); ++ ok(pWindowsTrimStringStart(NULL, NULL, NULL) == E_INVALIDARG, "Incorrect error handling\n"); ++ ok(pWindowsTrimStringStart(NULL, str1, NULL) == E_INVALIDARG, "Incorrect error handling\n"); ++ ok(pWindowsTrimStringStart(NULL, NULL, &trimmed) == E_INVALIDARG, "Incorrect error handling\n"); ++ ok(pWindowsTrimStringStart(NULL, str1, &trimmed) == S_OK, "Failed to trim empty string\n"); ++ ok(trimmed == NULL, "Trimming created new string\n"); ++ ok(pWindowsTrimStringEnd(NULL, NULL, NULL) == E_INVALIDARG, "Incorrect error handling\n"); ++ ok(pWindowsTrimStringEnd(NULL, str1, NULL) == E_INVALIDARG, "Incorrect error handling\n"); ++ ok(pWindowsTrimStringEnd(NULL, NULL, &trimmed) == E_INVALIDARG, "Incorrect error handling\n"); ++ ok(pWindowsTrimStringEnd(NULL, str1, &trimmed) == S_OK, "Failed to trim empty string\n"); ++ ok(trimmed == NULL, "Trimming created new string\n"); ++ ok(pWindowsDeleteString(str1) == S_OK, "Failed to delete string\n"); ++} ++ + START_TEST(string) + { + if (!init_functions()) +@@ -467,4 +543,5 @@ START_TEST(string) + test_substring(); + test_concat(); + test_compare(); ++ test_trim(); + } +-- +2.6.4 + diff --git a/patches/combase-WindowsString/definition b/patches/combase-WindowsString/definition new file mode 100644 index 00000000..5195ee7e --- /dev/null +++ b/patches/combase-WindowsString/definition @@ -0,0 +1,3 @@ +Fixes: Implement combase.WindowsCompareStringOrdinal +Fixes: Implement combase.WindowsTrimStringStart +Fixes: Implement combase.WindowsTrimStringEnd diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 16d1e84b..72810b22 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -92,7 +92,7 @@ patch_enable_all () enable_api_ms_win_Stub_DLLs="$1" enable_authz_Stub_Functions="$1" enable_browseui_Progress_Dialog="$1" - enable_combase_WindowsCompareStringOrdinal="$1" + enable_combase_WindowsString="$1" enable_comctl32_Button_Theming="$1" enable_comctl32_PROPSHEET_InsertPage="$1" enable_configure_Absolute_RPATH="$1" @@ -406,8 +406,8 @@ patch_enable () category-stable) enable_category_stable="$2" ;; - combase-WindowsCompareStringOrdinal) - enable_combase_WindowsCompareStringOrdinal="$2" + combase-WindowsString) + enable_combase_WindowsString="$2" ;; comctl32-Button_Theming) enable_comctl32_Button_Theming="$2" @@ -2575,18 +2575,24 @@ if test "$enable_browseui_Progress_Dialog" -eq 1; then ) >> "$patchlist" fi -# Patchset combase-WindowsCompareStringOrdinal +# Patchset combase-WindowsString # | # | 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, include/winnls.h # | -if test "$enable_combase_WindowsCompareStringOrdinal" -eq 1; then - patch_apply combase-WindowsCompareStringOrdinal/0001-combase-Implement-WindowsCompareStringOrdinal.patch - patch_apply combase-WindowsCompareStringOrdinal/0002-combase-tests-Add-tests-for-WindowsCompareStringOrdi.patch +if test "$enable_combase_WindowsString" -eq 1; then + patch_apply combase-WindowsString/0001-combase-Implement-WindowsCompareStringOrdinal.patch + patch_apply combase-WindowsString/0002-combase-tests-Add-tests-for-WindowsCompareStringOrdi.patch + patch_apply combase-WindowsString/0003-combase-Implement-WindowsTrimStringStart.patch + patch_apply combase-WindowsString/0004-combase-Implement-WindowsTrimStringEnd.patch + patch_apply combase-WindowsString/0005-combase-tests-Add-tests-for-WindowsTrimString-Start-.patch ( echo '+ { "Sebastian Lackner", "combase: Implement WindowsCompareStringOrdinal.", 2 },'; echo '+ { "Sebastian Lackner", "combase/tests: Add tests for WindowsCompareStringOrdinal.", 1 },'; + echo '+ { "Sebastian Lackner", "combase: Implement WindowsTrimStringStart.", 1 },'; + echo '+ { "Sebastian Lackner", "combase: Implement WindowsTrimStringEnd.", 1 },'; + echo '+ { "Sebastian Lackner", "combase/tests: Add tests for WindowsTrimString{Start,End}.", 1 },'; ) >> "$patchlist" fi