Commit 1cde8696 authored by Alexandre Julliard's avatar Alexandre Julliard

ntdll: Avoid using toupperW().

parent 34f3e779
......@@ -1394,7 +1394,7 @@ static BOOLEAN match_filename( const UNICODE_STRING *name_str, const UNICODE_STR
if (is_case_sensitive)
while (name < name_end && (*name != *mask)) name++;
else
while (name < name_end && (toupperW(*name) != toupperW(*mask))) name++;
while (name < name_end && (towupper(*name) != towupper(*mask))) name++;
next_to_retry = name;
break;
case '?':
......@@ -1403,7 +1403,7 @@ static BOOLEAN match_filename( const UNICODE_STRING *name_str, const UNICODE_STR
break;
default:
if (is_case_sensitive) mismatch = (*mask != *name);
else mismatch = (toupperW(*mask) != toupperW(*name));
else mismatch = (towupper(*mask) != towupper(*name));
if (!mismatch)
{
......
......@@ -89,13 +89,12 @@ static const WCHAR *get_basename( const WCHAR *name )
*
* Remove extension if it is ".dll".
*/
static inline void remove_dll_ext( WCHAR *ext )
static inline void remove_dll_ext( WCHAR *name )
{
if (ext[0] == '.' &&
toupperW(ext[1]) == 'D' &&
toupperW(ext[2]) == 'L' &&
toupperW(ext[3]) == 'L' &&
!ext[4]) ext[0] = 0;
static const WCHAR dllW[] = {'.','d','l','l',0};
WCHAR *p = strrchrW( name, '.' );
if (p && !wcsicmp( p, dllW )) *p = 0;
}
......@@ -213,8 +212,7 @@ static void add_load_order_set( WCHAR *entry )
if (*end) *end++ = 0;
if (*entry)
{
WCHAR *ext = strrchrW(entry, '.');
if (ext) remove_dll_ext( ext );
remove_dll_ext( entry );
ldo.modulename = entry;
add_load_order( &ldo );
entry = end;
......@@ -457,10 +455,9 @@ enum loadorder get_load_order( const WCHAR *app_name, const UNICODE_STRING *nt_n
if (!(len = strlenW(path))) return ret;
if (!(module = RtlAllocateHeap( GetProcessHeap(), 0, (len + 2) * sizeof(WCHAR) ))) return ret;
strcpyW( module+1, path ); /* reserve module[0] for the wildcard char */
remove_dll_ext( module + 1 );
basename = (WCHAR *)get_basename( module+1 );
if (len >= 4) remove_dll_ext( module + 1 + len - 4 );
/* first explicit module name */
if ((ret = get_load_order_value( std_key, app_key, module+1 )) != LO_INVALID)
goto done;
......
......@@ -1638,7 +1638,8 @@ WCHAR __cdecl NTDLL_towlower( WCHAR ch )
*/
WCHAR __cdecl NTDLL_towupper( WCHAR ch )
{
return casemap( nls_info.UpperCaseTable, ch );
if (nls_info.UpperCaseTable) return casemap( nls_info.UpperCaseTable, ch );
return casemap_ascii( ch );
}
......
......@@ -298,6 +298,7 @@ ULONG __cdecl NTDLL_wcstoul( LPCWSTR s, LPWSTR *end, INT base );
#define wcsicmp(s1,s2) NTDLL__wcsicmp(s1,s2)
#define wcsnicmp(s1,s2,n) NTDLL__wcsnicmp(s1,s2,n)
#define towupper(c) NTDLL_towupper(c)
#define wcslwr(s) NTDLL__wcslwr(s)
#define wcsupr(s) NTDLL__wcsupr(s)
......
......@@ -670,7 +670,7 @@ static ULONG get_full_path_helper(LPCWSTR name, LPWSTR buffer, ULONG size)
case RELATIVE_DRIVE_PATH: /* c:foo */
dep = 2;
if (toupperW(name[0]) != toupperW(cd->Buffer[0]) || cd->Buffer[1] != ':')
if (wcsnicmp( name, cd->Buffer, 2 ))
{
UNICODE_STRING var, val;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment