Alexandre Julliard : kernelbase: Don't use wcsicmp/wcsnicmp() on the full Unicode character range.

Alexandre Julliard julliard at winehq.org
Wed Mar 11 17:38:30 CDT 2020


Module: wine
Branch: master
Commit: ef95e4a8b9a4e772937514fb2538c145a07aa6c6
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=ef95e4a8b9a4e772937514fb2538c145a07aa6c6

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Mar  9 20:03:14 2020 +0100

kernelbase: Don't use wcsicmp/wcsnicmp() on the full Unicode character range.

Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/kernelbase/file.c     | 5 ++++-
 dlls/kernelbase/path.c     | 3 ++-
 dlls/kernelbase/registry.c | 2 +-
 dlls/kernelbase/string.c   | 2 +-
 4 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/dlls/kernelbase/file.c b/dlls/kernelbase/file.c
index 6591a11073..79e62716be 100644
--- a/dlls/kernelbase/file.c
+++ b/dlls/kernelbase/file.c
@@ -30,6 +30,7 @@
 #define WIN32_NO_STATUS
 #include "windef.h"
 #include "winbase.h"
+#include "winnls.h"
 #include "winternl.h"
 #include "winioctl.h"
 #include "wincon.h"
@@ -183,7 +184,9 @@ static NTSTATUS find_actctx_dllpath( const WCHAR *name, WCHAR **path )
         DWORD dirlen = info->ulAssemblyDirectoryNameLength / sizeof(WCHAR);
 
         p++;
-        if (!dirlen || wcsnicmp( p, info->lpAssemblyDirectoryName, dirlen ) || wcsicmp( p + dirlen, L".manifest" ))
+        if (!dirlen ||
+            CompareStringOrdinal( p, dirlen, info->lpAssemblyDirectoryName, dirlen, TRUE ) != CSTR_EQUAL ||
+            wcsicmp( p + dirlen, L".manifest" ))
         {
             /* manifest name does not match directory name, so it's not a global
              * windows/winsxs manifest; use the manifest directory name instead */
diff --git a/dlls/kernelbase/path.c b/dlls/kernelbase/path.c
index 0e0c3f3dbd..57102755c6 100644
--- a/dlls/kernelbase/path.c
+++ b/dlls/kernelbase/path.c
@@ -2713,7 +2713,8 @@ BOOL WINAPI PathUnExpandEnvStringsW(const WCHAR *path, WCHAR *buffer, UINT buf_l
     while (cur->var)
     {
         /* path can't contain expanded value or value wasn't retrieved */
-        if (cur->len == 0 || cur->len > pathlen || wcsnicmp(cur->path, path, cur->len))
+        if (cur->len == 0 || cur->len > pathlen ||
+            CompareStringOrdinal( cur->path, cur->len, path, cur->len, TRUE ) != CSTR_EQUAL)
         {
             cur++;
             continue;
diff --git a/dlls/kernelbase/registry.c b/dlls/kernelbase/registry.c
index 4f2234b1ef..e6f3722f70 100644
--- a/dlls/kernelbase/registry.c
+++ b/dlls/kernelbase/registry.c
@@ -2551,7 +2551,7 @@ static int reg_mui_cache_get(const WCHAR *file_name, UINT index, WCHAR **buffer)
     LIST_FOR_EACH_ENTRY(ent, &reg_mui_cache, struct mui_cache_entry, entry)
     {
         if (ent->index == index && ent->locale == GetThreadLocale() &&
-            !wcsicmp(ent->file_name, file_name))
+            !lstrcmpiW(ent->file_name, file_name))
             goto found;
     }
     return 0;
diff --git a/dlls/kernelbase/string.c b/dlls/kernelbase/string.c
index 75ee5b0512..bd6ff03643 100644
--- a/dlls/kernelbase/string.c
+++ b/dlls/kernelbase/string.c
@@ -416,7 +416,7 @@ WCHAR * WINAPI StrStrNIW(const WCHAR *str, const WCHAR *search, UINT max_len)
 
     for (i = max_len; *str && (i > 0); i--, str++)
     {
-        if (!wcsnicmp(str, search, len))
+        if (!StrCmpNIW(str, search, len))
             return (WCHAR *)str;
     }
 




More information about the wine-cvs mailing list