some ntdll functions [Virus checked]

thomas.mertes at t-mobile.at thomas.mertes at t-mobile.at
Wed Jan 29 04:11:13 CST 2003


"Dmitry Timoshkov" <dmitry at baikal.ru> wrote:

> >
/**************************************************************************
> > + *  RtlUpperChar   (NTDLL.@)
> > + */
> > +CHAR WINAPI RtlUpperChar( CHAR ch )
> > +{
> > +    return toupper(ch);
> > +}
>
> It's better to avoid using locale dependent functions from an underlying
> system because Wine internal code page almost always is different from OS
> locale. The way to go is convert to unicode, do desired things, and
convert
> the result back to ansi.

The implementation of RtlUpperString in rtlstr.c gave me the idea to use
toupper:

/**************************************************************************
 *   RtlUpperString   (NTDLL.@)
 */
void WINAPI RtlUpperString( STRING *dst, const STRING *src )
{
    unsigned int i, len = min(src->Length, dst->MaximumLength);

    for (i = 0; i < len; i++) dst->Buffer[i] = toupper(src->Buffer[i]);
    dst->Length = len;
}

The docu of RtlUpperChar says:

RtlUpperChar returns the uppercase version of the specified character or
returns the value specified by the caller for Character if the specified
character cannot be converted.

RtlUpperChar returns the input Character unconverted if it is the lead byte
of a multibyte character or if the uppercase equivalent of Character is a
double-byte character. To convert such characters, use
RtlUpcaseUnicodeChar.
--- End of docu --

IMHO RtlUpperChar has nothing to do for unicode chars.
Is there a way to use Wine internal code page to do the conversion without
converting to unicode and back?

BTW: If it is not ok to use toupper several other places in wine have a
problem:

$ grep toupper */*.c */*/*.c */*/*/*.c  | grep -v toupperW | grep -v
str_toupper

in wine-20030115 gives a longer list of usages of toupper.

Specially msvcrt toupper seems also to use the function from libc.

Greetings
Thomas Mertes






More information about the wine-devel mailing list