wine-staging/patches/combase-Strings/0005-combase-Implement-WindowsConcatString.patch

81 lines
3.2 KiB
Diff
Raw Normal View History

From 5f3fb549f2442ee29ab6268a15a933a4363a467e Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
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