Sebastian Lackner : combase: Implement WindowsSubstringWithSpecifiedLength.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Oct 26 09:58:34 CDT 2015


Module: wine
Branch: master
Commit: 7d0dccd23421f09cab0e3ba5f96e9a932ff53cb1
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=7d0dccd23421f09cab0e3ba5f96e9a932ff53cb1

Author: Sebastian Lackner <sebastian at fds-team.de>
Date:   Sun Oct 25 15:32:37 2015 +0100

combase: Implement WindowsSubstringWithSpecifiedLength.

Signed-off-by: Sebastian Lackner <sebastian at fds-team.de>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 .../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 f629bcf..dc67deb 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 e7c8866..fcd5947 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 2146d61..49d7695 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)




More information about the wine-cvs mailing list