wine-staging/patches/combase-WindowsCompareStringOrdinal/0001-combase-Implement-WindowsCompareStringOrdinal.patch

82 lines
3.0 KiB
Diff

From 390bb740e27741df384d19e78cffa128e997d4f3 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sat, 16 Jan 2016 16:12:47 +0100
Subject: combase: Implement WindowsCompareStringOrdinal.
---
.../api-ms-win-core-winrt-string-l1-1-0.spec | 2 +-
dlls/combase/combase.spec | 2 +-
dlls/combase/string.c | 33 ++++++++++++++++++++++
3 files changed, 35 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 fa048d8..1b661aa 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
@@ -6,7 +6,7 @@
@ stub HSTRING_UserSize64
@ stub HSTRING_UserUnmarshal
@ stub HSTRING_UserUnmarshal64
-@ stub WindowsCompareStringOrdinal
+@ stdcall WindowsCompareStringOrdinal(ptr ptr ptr) combase.WindowsCompareStringOrdinal
@ stdcall WindowsConcatString(ptr ptr ptr) combase.WindowsConcatString
@ stdcall WindowsCreateString(wstr long ptr) combase.WindowsCreateString
@ stdcall WindowsCreateStringReference(wstr long ptr ptr) combase.WindowsCreateStringReference
diff --git a/dlls/combase/combase.spec b/dlls/combase/combase.spec
index 5082f39..430ca95 100644
--- a/dlls/combase/combase.spec
+++ b/dlls/combase/combase.spec
@@ -287,7 +287,7 @@
@ stub WdtpInterfacePointer_UserSize64
@ stdcall WdtpInterfacePointer_UserUnmarshal(ptr ptr ptr ptr) ole32.WdtpInterfacePointer_UserUnmarshal
@ stub WdtpInterfacePointer_UserUnmarshal64
-@ stub WindowsCompareStringOrdinal
+@ stdcall WindowsCompareStringOrdinal(ptr ptr ptr)
@ stdcall WindowsConcatString(ptr ptr ptr)
@ stdcall WindowsCreateString(wstr long ptr)
@ stdcall WindowsCreateStringReference(wstr long ptr ptr)
diff --git a/dlls/combase/string.c b/dlls/combase/string.c
index dd7c8e9..1d49c4b 100644
--- a/dlls/combase/string.c
+++ b/dlls/combase/string.c
@@ -372,3 +372,36 @@ BOOL WINAPI WindowsIsStringEmpty(HSTRING str)
return TRUE;
return priv->length == 0;
}
+
+/***********************************************************************
+ * WindowsCompareStringOrdinal (combase.@)
+ */
+HRESULT WINAPI WindowsCompareStringOrdinal(HSTRING str1, HSTRING str2, INT32 *res)
+{
+ struct hstring_private *priv1 = impl_from_HSTRING(str1);
+ struct hstring_private *priv2 = impl_from_HSTRING(str2);
+ const WCHAR *buf1 = empty, *buf2 = empty;
+ UINT32 len1 = 0, len2 = 0;
+
+ TRACE("(%p, %p, %p)\n", str1, str2, res);
+
+ if (res == NULL)
+ return E_INVALIDARG;
+ if (str1 == str2)
+ {
+ *res = 0;
+ return S_OK;
+ }
+ if (str1)
+ {
+ buf1 = priv1->buffer;
+ len1 = priv1->length;
+ }
+ if (str2)
+ {
+ buf2 = priv2->buffer;
+ len2 = priv2->length;
+ }
+ *res = CompareStringEx(NULL, 0, buf1, len1, buf2, len2, NULL, NULL, 0) - CSTR_EQUAL;
+ return S_OK;
+}
--
2.6.4