Alexandre Julliard : ntdll: Use wcsicmp() instead of strcmpiW() where possible.

Alexandre Julliard julliard at winehq.org
Fri Mar 27 16:14:38 CDT 2020


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Fri Mar 27 13:38:09 2020 +0100

ntdll: Use wcsicmp() instead of strcmpiW() where possible.

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

---

 dlls/ntdll/actctx.c     | 2 +-
 dlls/ntdll/loader.c     | 6 +++---
 dlls/ntdll/loadorder.c  | 2 +-
 dlls/ntdll/locale.c     | 4 ++--
 dlls/ntdll/ntdll_misc.h | 2 ++
 dlls/ntdll/path.c       | 2 +-
 dlls/ntdll/process.c    | 2 +-
 dlls/ntdll/relay.c      | 4 ++--
 dlls/ntdll/version.c    | 6 +++---
 9 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/dlls/ntdll/actctx.c b/dlls/ntdll/actctx.c
index 17f9cad084..236adf6c00 100644
--- a/dlls/ntdll/actctx.c
+++ b/dlls/ntdll/actctx.c
@@ -3101,7 +3101,7 @@ static WCHAR *lookup_manifest_file( HANDLE dir, struct assembly_identity *ai )
     unsigned int data_pos = 0, data_len;
     char buffer[8192];
 
-    if (!lang || !strcmpiW( lang, neutralW )) lang = wildcardW;
+    if (!lang || !wcsicmp( lang, neutralW )) lang = wildcardW;
 
     if (!(lookup = RtlAllocateHeap( GetProcessHeap(), 0,
                                     (strlenW(ai->arch) + strlenW(ai->name)
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index 1b641f1b9d..7aef68e39e 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -951,7 +951,7 @@ static BOOL is_dll_native_subsystem( LDR_MODULE *mod, const IMAGE_NT_HEADERS *nt
             DWORD len = strlen(name);
             if (len * sizeof(WCHAR) >= sizeof(buffer)) continue;
             ascii_to_unicode( buffer, name, len + 1 );
-            if (!strcmpiW( buffer, ntdllW ) || !strcmpiW( buffer, kernel32W ))
+            if (!wcsicmp( buffer, ntdllW ) || !wcsicmp( buffer, kernel32W ))
             {
                 TRACE( "%s imports %s, assuming not native\n", debugstr_w(filename), debugstr_w(buffer) );
                 return FALSE;
@@ -1761,7 +1761,7 @@ static BOOL get_builtin_fullname( UNICODE_STRING *nt_name, const UNICODE_STRING
         p++;
         for (i = 0; i < len; i++)
             if (tolowerW(p[i]) != tolowerW( (WCHAR)filename[i]) ) break;
-        if (i == len && (!p[len] || !strcmpiW( p + len, soW )))
+        if (i == len && (!p[len] || !wcsicmp( p + len, soW )))
         {
             /* the filename matches, use path as the full path */
             len += p - path->Buffer;
@@ -2768,7 +2768,7 @@ static NTSTATUS find_actctx_dll( LPCWSTR libname, LPWSTR *fullname )
         DWORD dirlen = info->ulAssemblyDirectoryNameLength / sizeof(WCHAR);
 
         p++;
-        if (!dirlen || strncmpiW( p, info->lpAssemblyDirectoryName, dirlen ) || strcmpiW( p + dirlen, dotManifestW ))
+        if (!dirlen || strncmpiW( p, info->lpAssemblyDirectoryName, dirlen ) || wcsicmp( p + dirlen, dotManifestW ))
         {
             /* 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/ntdll/loadorder.c b/dlls/ntdll/loadorder.c
index b965b96011..2d82b12a7a 100644
--- a/dlls/ntdll/loadorder.c
+++ b/dlls/ntdll/loadorder.c
@@ -65,7 +65,7 @@ static struct loadorder_list env_list;
  */
 static int cmp_sort_func(const void *s1, const void *s2)
 {
-    return strcmpiW(((const module_loadorder_t *)s1)->modulename, ((const module_loadorder_t *)s2)->modulename);
+    return wcsicmp(((const module_loadorder_t *)s1)->modulename, ((const module_loadorder_t *)s2)->modulename);
 }
 
 
diff --git a/dlls/ntdll/locale.c b/dlls/ntdll/locale.c
index 1be3086a1e..ea629e8393 100644
--- a/dlls/ntdll/locale.c
+++ b/dlls/ntdll/locale.c
@@ -1703,13 +1703,13 @@ NTSTATUS WINAPI RtlLocaleNameToLcid( const WCHAR *name, LCID *lcid, ULONG flags
 
         if (PRIMARYLANGID(id) == LANG_NEUTRAL) continue;
 
-        if (!load_string( LOCALE_SNAME, id, buf, ARRAY_SIZE(buf) ) && !strcmpiW( name, buf ))
+        if (!load_string( LOCALE_SNAME, id, buf, ARRAY_SIZE(buf) ) && !wcsicmp( name, buf ))
         {
             *lcid = MAKELCID( id, SORT_DEFAULT );  /* FIXME: handle sort order */
             goto found;
         }
 
-        if (load_string( LOCALE_SISO639LANGNAME, id, buf, ARRAY_SIZE(buf) ) || strcmpiW( lang, buf ))
+        if (load_string( LOCALE_SISO639LANGNAME, id, buf, ARRAY_SIZE(buf) ) || wcsicmp( lang, buf ))
             continue;
 
         if (script)
diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h
index 1e83478ce6..c22b32a5b7 100644
--- a/dlls/ntdll/ntdll_misc.h
+++ b/dlls/ntdll/ntdll_misc.h
@@ -296,4 +296,6 @@ LPWSTR __cdecl NTDLL_wcstok( LPWSTR str, LPCWSTR delim );
 LONG   __cdecl NTDLL_wcstol( LPCWSTR s, LPWSTR *end, INT base );
 ULONG  __cdecl NTDLL_wcstoul( LPCWSTR s, LPWSTR *end, INT base );
 
+#define wcsicmp(s1,s2) NTDLL__wcsicmp(s1,s2)
+
 #endif
diff --git a/dlls/ntdll/path.c b/dlls/ntdll/path.c
index 610646be85..adbfb4f526 100644
--- a/dlls/ntdll/path.c
+++ b/dlls/ntdll/path.c
@@ -280,7 +280,7 @@ ULONG WINAPI RtlIsDosDeviceName_U( PCWSTR dos_name )
     case UNC_PATH:
         return 0;
     case DEVICE_PATH:
-        if (!strcmpiW( dos_name, consoleW ))
+        if (!wcsicmp( dos_name, consoleW ))
             return MAKELONG( sizeof(conW), 4 * sizeof(WCHAR) );  /* 4 is length of \\.\ prefix */
         return 0;
     case ABSOLUTE_DRIVE_PATH:
diff --git a/dlls/ntdll/process.c b/dlls/ntdll/process.c
index 78e112bd3a..2290d5d186 100644
--- a/dlls/ntdll/process.c
+++ b/dlls/ntdll/process.c
@@ -1579,7 +1579,7 @@ NTSTATUS restart_process( RTL_USER_PROCESS_PARAMETERS *params, NTSTATUS status )
     /* check for .com or .pif extension */
     if (status == STATUS_INVALID_IMAGE_NOT_MZ &&
         (p = strrchrW( params->ImagePathName.Buffer, '.' )) &&
-        (!strcmpiW( p, comW ) || !strcmpiW( p, pifW )))
+        (!wcsicmp( p, comW ) || !wcsicmp( p, pifW )))
         status = STATUS_INVALID_IMAGE_WIN_16;
 
     switch (status)
diff --git a/dlls/ntdll/relay.c b/dlls/ntdll/relay.c
index 04957acf7b..b5db930e12 100644
--- a/dlls/ntdll/relay.c
+++ b/dlls/ntdll/relay.c
@@ -292,9 +292,9 @@ static BOOL check_from_module( const WCHAR **includelist, const WCHAR **excludel
     {
         int len;
 
-        if (!strcmpiW( *listitem, module )) return !show;
+        if (!wcsicmp( *listitem, module )) return !show;
         len = strlenW( *listitem );
-        if (!strncmpiW( *listitem, module, len ) && !strcmpiW( module + len, dllW ))
+        if (!strncmpiW( *listitem, module, len ) && !wcsicmp( module + len, dllW ))
             return !show;
     }
     return show;
diff --git a/dlls/ntdll/version.c b/dlls/ntdll/version.c
index 61e48f6fbd..4994dbbb5e 100644
--- a/dlls/ntdll/version.c
+++ b/dlls/ntdll/version.c
@@ -343,9 +343,9 @@ static BOOL get_nt_registry_version( RTL_OSVERSIONINFOEXW *version )
             {
                 WCHAR *str = (WCHAR *)info->Data;
                 str[info->DataLength / sizeof(WCHAR)] = 0;
-                if (!strcmpiW( str, WinNTW )) version->wProductType = VER_NT_WORKSTATION;
-                else if (!strcmpiW( str, LanmanNTW )) version->wProductType = VER_NT_DOMAIN_CONTROLLER;
-                else if (!strcmpiW( str, ServerNTW )) version->wProductType = VER_NT_SERVER;
+                if (!wcsicmp( str, WinNTW )) version->wProductType = VER_NT_WORKSTATION;
+                else if (!wcsicmp( str, LanmanNTW )) version->wProductType = VER_NT_DOMAIN_CONTROLLER;
+                else if (!wcsicmp( str, ServerNTW )) version->wProductType = VER_NT_SERVER;
             }
             NtClose( hkey2 );
         }




More information about the wine-cvs mailing list