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

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2020-03-27 13:38:09 +01:00
parent 6226be3656
commit 3e049b6b96
9 changed files with 16 additions and 14 deletions

View File

@ -3101,7 +3101,7 @@ static WCHAR *lookup_manifest_file( HANDLE dir, struct assembly_identity *ai )
unsigned int data_pos = 0, data_len; unsigned int data_pos = 0, data_len;
char buffer[8192]; char buffer[8192];
if (!lang || !strcmpiW( lang, neutralW )) lang = wildcardW; if (!lang || !wcsicmp( lang, neutralW )) lang = wildcardW;
if (!(lookup = RtlAllocateHeap( GetProcessHeap(), 0, if (!(lookup = RtlAllocateHeap( GetProcessHeap(), 0,
(strlenW(ai->arch) + strlenW(ai->name) (strlenW(ai->arch) + strlenW(ai->name)

View File

@ -951,7 +951,7 @@ static BOOL is_dll_native_subsystem( LDR_MODULE *mod, const IMAGE_NT_HEADERS *nt
DWORD len = strlen(name); DWORD len = strlen(name);
if (len * sizeof(WCHAR) >= sizeof(buffer)) continue; if (len * sizeof(WCHAR) >= sizeof(buffer)) continue;
ascii_to_unicode( buffer, name, len + 1 ); 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) ); TRACE( "%s imports %s, assuming not native\n", debugstr_w(filename), debugstr_w(buffer) );
return FALSE; return FALSE;
@ -1761,7 +1761,7 @@ static BOOL get_builtin_fullname( UNICODE_STRING *nt_name, const UNICODE_STRING
p++; p++;
for (i = 0; i < len; i++) for (i = 0; i < len; i++)
if (tolowerW(p[i]) != tolowerW( (WCHAR)filename[i]) ) break; 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 */ /* the filename matches, use path as the full path */
len += p - path->Buffer; len += p - path->Buffer;
@ -2768,7 +2768,7 @@ static NTSTATUS find_actctx_dll( LPCWSTR libname, LPWSTR *fullname )
DWORD dirlen = info->ulAssemblyDirectoryNameLength / sizeof(WCHAR); DWORD dirlen = info->ulAssemblyDirectoryNameLength / sizeof(WCHAR);
p++; 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 /* manifest name does not match directory name, so it's not a global
* windows/winsxs manifest; use the manifest directory name instead */ * windows/winsxs manifest; use the manifest directory name instead */

View File

@ -65,7 +65,7 @@ static struct loadorder_list env_list;
*/ */
static int cmp_sort_func(const void *s1, const void *s2) 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);
} }

View File

@ -1703,13 +1703,13 @@ NTSTATUS WINAPI RtlLocaleNameToLcid( const WCHAR *name, LCID *lcid, ULONG flags
if (PRIMARYLANGID(id) == LANG_NEUTRAL) continue; 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 */ *lcid = MAKELCID( id, SORT_DEFAULT ); /* FIXME: handle sort order */
goto found; 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; continue;
if (script) if (script)

View File

@ -296,4 +296,6 @@ LPWSTR __cdecl NTDLL_wcstok( LPWSTR str, LPCWSTR delim );
LONG __cdecl NTDLL_wcstol( LPCWSTR s, LPWSTR *end, INT base ); LONG __cdecl NTDLL_wcstol( LPCWSTR s, LPWSTR *end, INT base );
ULONG __cdecl NTDLL_wcstoul( 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 #endif

View File

@ -280,7 +280,7 @@ ULONG WINAPI RtlIsDosDeviceName_U( PCWSTR dos_name )
case UNC_PATH: case UNC_PATH:
return 0; return 0;
case DEVICE_PATH: 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 MAKELONG( sizeof(conW), 4 * sizeof(WCHAR) ); /* 4 is length of \\.\ prefix */
return 0; return 0;
case ABSOLUTE_DRIVE_PATH: case ABSOLUTE_DRIVE_PATH:

View File

@ -1579,7 +1579,7 @@ NTSTATUS restart_process( RTL_USER_PROCESS_PARAMETERS *params, NTSTATUS status )
/* check for .com or .pif extension */ /* check for .com or .pif extension */
if (status == STATUS_INVALID_IMAGE_NOT_MZ && if (status == STATUS_INVALID_IMAGE_NOT_MZ &&
(p = strrchrW( params->ImagePathName.Buffer, '.' )) && (p = strrchrW( params->ImagePathName.Buffer, '.' )) &&
(!strcmpiW( p, comW ) || !strcmpiW( p, pifW ))) (!wcsicmp( p, comW ) || !wcsicmp( p, pifW )))
status = STATUS_INVALID_IMAGE_WIN_16; status = STATUS_INVALID_IMAGE_WIN_16;
switch (status) switch (status)

View File

@ -292,9 +292,9 @@ static BOOL check_from_module( const WCHAR **includelist, const WCHAR **excludel
{ {
int len; int len;
if (!strcmpiW( *listitem, module )) return !show; if (!wcsicmp( *listitem, module )) return !show;
len = strlenW( *listitem ); 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;
} }
return show; return show;

View File

@ -343,9 +343,9 @@ static BOOL get_nt_registry_version( RTL_OSVERSIONINFOEXW *version )
{ {
WCHAR *str = (WCHAR *)info->Data; WCHAR *str = (WCHAR *)info->Data;
str[info->DataLength / sizeof(WCHAR)] = 0; str[info->DataLength / sizeof(WCHAR)] = 0;
if (!strcmpiW( str, WinNTW )) version->wProductType = VER_NT_WORKSTATION; if (!wcsicmp( str, WinNTW )) version->wProductType = VER_NT_WORKSTATION;
else if (!strcmpiW( str, LanmanNTW )) version->wProductType = VER_NT_DOMAIN_CONTROLLER; else if (!wcsicmp( str, LanmanNTW )) version->wProductType = VER_NT_DOMAIN_CONTROLLER;
else if (!strcmpiW( str, ServerNTW )) version->wProductType = VER_NT_SERVER; else if (!wcsicmp( str, ServerNTW )) version->wProductType = VER_NT_SERVER;
} }
NtClose( hkey2 ); NtClose( hkey2 );
} }