From f599b2cf255353a7a406df8137b392117e0f6fe9 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Fri, 27 Mar 2020 13:43:20 +0100 Subject: [PATCH] ntdll: Use wcsupr() instead of toupperW(). Signed-off-by: Alexandre Julliard --- dlls/ntdll/directory.c | 13 ++++++------- dlls/ntdll/ntdll_misc.h | 1 + 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/dlls/ntdll/directory.c b/dlls/ntdll/directory.c index 53da0b0fc82..b8a23c4d4dc 100644 --- a/dlls/ntdll/directory.c +++ b/dlls/ntdll/directory.c @@ -1296,9 +1296,8 @@ BOOL DIR_is_hidden_file( const UNICODE_STRING *name ) /*********************************************************************** * hash_short_file_name * - * Transform a Unix file name into a hashed DOS name. If the name is a valid - * DOS name, it is converted to upper-case; otherwise it is replaced by a - * hashed version that fits in 8.3 format. + * Transform a Unix file name into a hashed DOS name. If the name is not a valid + * DOS name, it is replaced by a hashed version that fits in 8.3 format. * 'buffer' must be at least 12 characters long. * Returns length of short name in bytes; short name is NOT null-terminated. */ @@ -1334,7 +1333,7 @@ static ULONG hash_short_file_name( const UNICODE_STRING *name, LPWSTR buffer ) for (i = 4, p = name->Buffer, dst = buffer; i > 0; i--, p++) { if (p == end || p == ext) break; - *dst++ = is_invalid_dos_char(*p) ? '_' : toupperW(*p); + *dst++ = is_invalid_dos_char(*p) ? '_' : *p; } /* Pad to 5 chars with '~' */ while (i-- >= 0) *dst++ = '~'; @@ -1349,7 +1348,7 @@ static ULONG hash_short_file_name( const UNICODE_STRING *name, LPWSTR buffer ) { *dst++ = '.'; for (i = 3, ext++; (i > 0) && ext < end; i--, ext++) - *dst++ = is_invalid_dos_char(*ext) ? '_' : toupperW(*ext); + *dst++ = is_invalid_dos_char(*ext) ? '_' : *ext; } return dst - buffer; } @@ -1446,7 +1445,7 @@ static BOOLEAN match_filename( const UNICODE_STRING *name_str, const UNICODE_STR static BOOL append_entry( struct dir_data *data, const char *long_name, const char *short_name, const UNICODE_STRING *mask ) { - int i, long_len, short_len; + int long_len, short_len; WCHAR long_nameW[MAX_DIR_ENTRY_LEN + 1]; WCHAR short_nameW[13]; UNICODE_STRING str; @@ -1463,7 +1462,6 @@ static BOOL append_entry( struct dir_data *data, const char *long_name, { short_len = ntdll_umbstowcs( short_name, strlen(short_name), short_nameW, ARRAY_SIZE( short_nameW ) - 1 ); - for (i = 0; i < short_len; i++) short_nameW[i] = toupperW( short_nameW[i] ); } else /* generate a short name if necessary */ { @@ -1474,6 +1472,7 @@ static BOOL append_entry( struct dir_data *data, const char *long_name, short_len = hash_short_file_name( &str, short_nameW ); } short_nameW[short_len] = 0; + wcsupr( short_nameW ); TRACE( "long %s short %s mask %s\n", debugstr_w( long_nameW ), debugstr_w( short_nameW ), debugstr_us( mask )); diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h index 953b29dfe53..84493bc493a 100644 --- a/dlls/ntdll/ntdll_misc.h +++ b/dlls/ntdll/ntdll_misc.h @@ -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 wcsupr(s) NTDLL__wcsupr(s) /* convert from straight ASCII to Unicode without depending on the current codepage */ static inline void ascii_to_unicode( WCHAR *dst, const char *src, size_t len )