diff --git a/README.md b/README.md index f072fc41..acca6be9 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ Wine. All those differences are also documented on the Included bug fixes and improvements =================================== -**Bugfixes and features included in the next upcoming release [10]:** +**Bugfixes and features included in the next upcoming release [11]:** * Add stub for PowerCreateRequest * Fix caps lock state issues with multiple processes ([Wine Bug #35907](https://bugs.winehq.org/show_bug.cgi?id=35907)) @@ -46,6 +46,7 @@ Included bug fixes and improvements * Fix wrong version of ID3DXEffect interface for d3dx9_24 * Fix wrong version of ID3DXEffect interface for d3dx9_25 ([Wine Bug #25138](https://bugs.winehq.org/show_bug.cgi?id=25138)) * GetMessage should remove already seen messages with higher priority ([Wine Bug #28884](https://bugs.winehq.org/show_bug.cgi?id=28884)) +* Implement combase.WindowsSubstring function * Implement locking and synchronization of key states ([Wine Bug #31899](https://bugs.winehq.org/show_bug.cgi?id=31899)) * Improve stub for ID3DXEffectImpl_CloneEffect * Invalidate key state cache globally after calling LL hooks ([Wine Bug #29871](https://bugs.winehq.org/show_bug.cgi?id=29871)) diff --git a/debian/changelog b/debian/changelog index 32b7ac8e..7327b434 100644 --- a/debian/changelog +++ b/debian/changelog @@ -22,6 +22,7 @@ wine-staging (1.7.39) UNRELEASED; urgency=low * Added patch with additional tests for server-PeekMessage. * Added patch to only zero the buffer up 32767 bytes in GetTempPathW. * Added patch to implement shared memory wineserver communication for various user32 functions. + * Added patch to implement combase.WindowsSubstring function. * Removed patch to avoid hardcoded values for sizeof(GUID) (accepted upstream). * Removed patches for SLGetWindowsInformationDWORD (accepted upstream). * Removed patches for _ismbckata and _mbctohira (fixed upstream). diff --git a/patches/combase-String/0001-combase-implement-WindowsSubstring-try-2.patch b/patches/combase-String/0001-combase-implement-WindowsSubstring-try-2.patch new file mode 100644 index 00000000..d68106a2 --- /dev/null +++ b/patches/combase-String/0001-combase-implement-WindowsSubstring-try-2.patch @@ -0,0 +1,181 @@ +From 397611b845973e2418118ffcb4aee305b671d533 Mon Sep 17 00:00:00 2001 +From: Thomas Pointhuber +Date: Mon, 16 Mar 2015 09:45:21 +0100 +Subject: combase: implement WindowsSubstring (try 2) + +--- + .../api-ms-win-core-winrt-string-l1-1-0.spec | 2 +- + dlls/combase/combase.spec | 2 +- + dlls/combase/string.c | 19 +++++++ + dlls/combase/tests/string.c | 60 ++++++++++++++++++++++ + include/winerror.h | 1 + + 5 files changed, 82 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 2361a1d..825980d 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 +@@ -21,7 +21,7 @@ + @ stdcall WindowsPromoteStringBuffer(ptr ptr) combase.WindowsPromoteStringBuffer + @ stub WindowsReplaceString + @ stdcall WindowsStringHasEmbeddedNull(ptr ptr) combase.WindowsStringHasEmbeddedNull +-@ stub WindowsSubstring ++@ stdcall WindowsSubstring(ptr long ptr) combase.WindowsSubstring + @ stub WindowsSubstringWithSpecifiedLength + @ stub WindowsTrimStringEnd + @ stub WindowsTrimStringStart +diff --git a/dlls/combase/combase.spec b/dlls/combase/combase.spec +index ac095ce..48c3a7e 100644 +--- a/dlls/combase/combase.spec ++++ b/dlls/combase/combase.spec +@@ -302,7 +302,7 @@ + @ stdcall WindowsPromoteStringBuffer(ptr ptr) + @ stub WindowsReplaceString + @ stdcall WindowsStringHasEmbeddedNull(ptr ptr) +-@ stub WindowsSubstring ++@ stdcall WindowsSubstring(ptr long ptr) + @ stub WindowsSubstringWithSpecifiedLength + @ stub WindowsTrimStringEnd + @ stub WindowsTrimStringStart +diff --git a/dlls/combase/string.c b/dlls/combase/string.c +index 7054af6..33e5100 100644 +--- a/dlls/combase/string.c ++++ b/dlls/combase/string.c +@@ -255,6 +255,25 @@ HRESULT WINAPI WindowsStringHasEmbeddedNull(HSTRING str, BOOL *out) + } + + /*********************************************************************** ++ * WindowsSubstring (combase.@) ++ */ ++HRESULT WINAPI WindowsSubstring(HSTRING str, UINT32 start, HSTRING *out) ++{ ++ struct hstring_private *priv = impl_from_HSTRING(str); ++ UINT32 len = WindowsGetStringLen(str); ++ if (out == NULL) ++ return E_INVALIDARG; ++ if (start > len) ++ return E_BOUNDS; ++ if (start == len) ++ { ++ *out = NULL; ++ return S_OK; ++ } ++ return WindowsCreateString(&priv->buffer[start], len - start, out); ++} ++ ++/*********************************************************************** + * WindowsIsStringEmpty (combase.@) + */ + BOOL WINAPI WindowsIsStringEmpty(HSTRING str) +diff --git a/dlls/combase/tests/string.c b/dlls/combase/tests/string.c +index 72eaa84..c46d04e 100644 +--- a/dlls/combase/tests/string.c ++++ b/dlls/combase/tests/string.c +@@ -38,6 +38,7 @@ static BOOL (WINAPI *pWindowsIsStringEmpty)(HSTRING); + static HRESULT (WINAPI *pWindowsPreallocateStringBuffer)(UINT32, WCHAR **, HSTRING_BUFFER *); + static HRESULT (WINAPI *pWindowsPromoteStringBuffer)(HSTRING_BUFFER, HSTRING *); + static HRESULT (WINAPI *pWindowsStringHasEmbeddedNull)(HSTRING, BOOL *); ++static HRESULT (WINAPI *pWindowsSubstring)(HSTRING, UINT32, HSTRING *); + + #define SET(x) p##x = (void*)GetProcAddress(hmod, #x) + +@@ -60,6 +61,7 @@ static BOOL init_functions(void) + SET(WindowsPreallocateStringBuffer); + SET(WindowsPromoteStringBuffer); + SET(WindowsStringHasEmbeddedNull); ++ SET(WindowsSubstring); + return TRUE; + } + +@@ -92,6 +94,7 @@ 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_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' }; + + static void test_create_delete(void) + { +@@ -236,6 +239,62 @@ static void test_string_buffer(void) + ok(pWindowsDeleteString(str) == S_OK, "Failed to delete string\n"); + } + ++static void test_substring(void) ++{ ++ HSTRING str, substr; ++ HSTRING_HEADER header; ++ ++ /* Test substring of string buffers */ ++ ok(pWindowsCreateString(input_string, 6, &str) == S_OK, "Failed to create string\n"); ++ 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(pWindowsDeleteString(str) == S_OK, "Failed to delete string\n"); ++ ++ /* Test duplication of string using substring */ ++ ok(pWindowsCreateString(input_string, 6, &str) == S_OK, "Failed to create string\n"); ++ ok(pWindowsSubstring(str, 0, &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 */ ++ ok(pWindowsCreateStringReference(input_string, 6, &header, &str) == S_OK, "Failed to create string ref\n"); ++ 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(pWindowsDeleteString(str) == S_OK, "Failed to delete string ref\n"); ++ ++ /* Test duplication of string reference using substring */ ++ ok(pWindowsCreateStringReference(input_string, 6, &header, &str) == S_OK, "Failed to create string ref\n"); ++ ok(pWindowsSubstring(str, 0, &substr) == S_OK, "Failed to create substring of string ref!\n"); ++ 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"); ++ ++ /* 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"); ++ ++ /* 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(pWindowsDeleteString(str) == S_OK, "Failed to delete string\n"); ++ ++ /* Test handling of using to high startIndex */ ++ 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(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(pWindowsDeleteString(str) == S_OK, "Failed to delete string\n"); ++} ++ + START_TEST(string) + { + if (!init_functions()) +@@ -244,4 +303,5 @@ START_TEST(string) + test_duplicate(); + test_access(); + test_string_buffer(); ++ test_substring(); + } +diff --git a/include/winerror.h b/include/winerror.h +index 2958cbd..9b9fb72 100644 +--- a/include/winerror.h ++++ b/include/winerror.h +@@ -2090,6 +2090,7 @@ static inline HRESULT HRESULT_FROM_WIN32(unsigned int x) + #define S_FALSE _HRESULT_TYPEDEF_(1) + + #define E_PENDING _HRESULT_TYPEDEF_(0x8000000A) ++#define E_BOUNDS _HRESULT_TYPEDEF_(0x8000000B) + + + #define E_NOTIMPL _HRESULT_TYPEDEF_(0x80004001) +-- +2.3.2 + diff --git a/patches/combase-String/definition b/patches/combase-String/definition new file mode 100644 index 00000000..42e48814 --- /dev/null +++ b/patches/combase-String/definition @@ -0,0 +1 @@ +Fixes: Implement combase.WindowsSubstring function diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 070bbb7b..00410692 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -68,6 +68,7 @@ patch_enable_all () enable_Staging="$1" enable_browseui_Progress_Dialog="$1" enable_browseui_Race_Conditions="$1" + enable_combase_String="$1" enable_comctl32_LoadIconMetric="$1" enable_configure_Absolute_RPATH="$1" enable_d3d8_Hotpatch="$1" @@ -257,6 +258,9 @@ patch_enable () browseui-Race_Conditions) enable_browseui_Race_Conditions="$2" ;; + combase-String) + enable_combase_String="$2" + ;; comctl32-LoadIconMetric) enable_comctl32_LoadIconMetric="$2" ;; @@ -1331,6 +1335,19 @@ if test "$enable_browseui_Race_Conditions" -eq 1; then ) >> "$patchlist" fi +# Patchset combase-String +# | +# | 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/winerror.h +# | +if test "$enable_combase_String" -eq 1; then + patch_apply combase-String/0001-combase-implement-WindowsSubstring-try-2.patch + ( + echo '+ { "Thomas Pointhuber", "combase: implement WindowsSubstring.", 2 },'; + ) >> "$patchlist" +fi + # Patchset comctl32-LoadIconMetric # | # | This patchset fixes the following Wine bugs: