From e39405d44db8fa59a6f46b904fdb80ff29dc1866 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Wed, 10 Feb 2016 23:25:23 +0100 Subject: [PATCH] combase: Implement WindowsCompareStringOrdinal. Signed-off-by: Sebastian Lackner Signed-off-by: Alexandre Julliard --- .../api-ms-win-core-winrt-string-l1-1-0.spec | 2 +- dlls/combase/combase.spec | 2 +- dlls/combase/string.c | 33 +++++++++++++++++++ include/winnls.h | 1 + 4 files changed, 36 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 fa048d86a3f..1b661aa70b8 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 5082f396351..430ca955057 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 dd7c8e9fa49..bd18a73d175 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 = CompareStringOrdinal(buf1, len1, buf2, len2, FALSE) - CSTR_EQUAL; + return S_OK; +} diff --git a/include/winnls.h b/include/winnls.h index 603c408e7df..6e5897b22e7 100644 --- a/include/winnls.h +++ b/include/winnls.h @@ -831,6 +831,7 @@ WINBASEAPI INT WINAPI CompareStringA(LCID,DWORD,LPCSTR,INT,LPCSTR,INT); WINBASEAPI INT WINAPI CompareStringW(LCID,DWORD,LPCWSTR,INT,LPCWSTR,INT); #define CompareString WINELIB_NAME_AW(CompareString) WINBASEAPI INT WINAPI CompareStringEx(LPCWSTR,DWORD,LPCWSTR,INT,LPCWSTR,INT,LPNLSVERSIONINFO,LPVOID,LPARAM); +WINBASEAPI INT WINAPI CompareStringOrdinal(const WCHAR *,INT,const WCHAR *,INT,BOOL); WINBASEAPI LCID WINAPI ConvertDefaultLocale(LCID); WINBASEAPI BOOL WINAPI EnumCalendarInfoA(CALINFO_ENUMPROCA,LCID,CALID,CALTYPE); WINBASEAPI BOOL WINAPI EnumCalendarInfoW(CALINFO_ENUMPROCW,LCID,CALID,CALTYPE);