From f2918f9e9eb277865c4d811932cc3bd03faede4c Mon Sep 17 00:00:00 2001
From: Andreas Mohr <amohr@codeweavers.com>
Date: Sat, 25 Nov 2000 01:25:16 +0000
Subject: [PATCH] CompareStringW returned wrong results sometimes.

---
 ole/ole2nls.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/ole/ole2nls.c b/ole/ole2nls.c
index 946609141d6..8cfd3388705 100644
--- a/ole/ole2nls.c
+++ b/ole/ole2nls.c
@@ -2533,7 +2533,10 @@ UINT WINAPI CompareStringW(DWORD lcid, DWORD fdwStyle,
 	len = l1<l2 ? l1:l2;
 	ret = (fdwStyle & NORM_IGNORECASE) ? strncmpiW(s1,s2,len) : strncmpW(s1,s2,len);
 	/* not equal, return 1 or 3 */
-	if(ret!=0) return ret+2;
+	if(ret!=0) {
+		/* need to translate result */
+		return ((int)ret < 0) ? 1 : 3;
+	}
 	/* same len, return 2 */
 	if(l1==l2) return 2;
 	/* the longer one is lexically greater */
-- 
GitLab