Re: Questions about MSDN for some DDK functions



See comments inline:

"Norman Diamond" <ndiamond@xxxxxxxxxxxxxxxx> wrote in message
news:uxBBwK6gFHA.3608@xxxxxxxxxxxxxxxxxxxxxxx
> 1.
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/kmarch/hh/kmarch/k109_81806669-d742-4cb9-b4dd-d7e40fef171a.xml.asp
> says:
>> Return Value
>> RtlUpcaseUnicodeChar returns the uppercase version of the specified
>> Unicode character.
>
> MSDN gives no exceptions. Even if the uppercase version of the specified
> Unicode character requires two Unicode characters to express,
> RtlUpcaseUnicodeChar returns it in one WCHAR. May I express some doubts
> about this definition?

You are confusing things here, all UNICODE characters are 16 bits, this is
not a multibyte model where some things are lead characters.


> 2.
> http://msdn.microsoft.com/library/en-us/kmarch/hh/kmarch/k109_c1a13e9a-f863-4bcd-ae89-daee0c3d3a4b.xml.asp
> says:
>> Return Value
>> 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.
>
> That makes sense. In a case where the relevant ANSI character fits in a
> single byte and was specified, but the uppercase version requires two ANSI
> characters and therefore cannot be converted, we can figure out what this
> function will do.
>
> The page continues:
>> 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.
>
> That makes sense too. If the relevant ANSI character doesn't fit in a
> single byte then we have to convert the character from ANSI to Unicode,
> then
> call RtlUpcaseUnicodeChar, then convert the result from Unicode to ANSI.
>
> But something is missing. If the relevant ANSI character does fit in a
> single byte but cannot be directly converted, then in this case also
> should
> we convert the character from ANSI to Unicode and call
> RtlUpcaseUnicodeChar
> and convert the result back? I think not because of problem 1 above. So
> there is still no way?

There is not a direct call to do this, multibyte character stuff has limited
support in the kernel, the expectation is you go with UNICODE where
everything is the same size, therefore faster and safer to use.

> 3.
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/kmarch/hh/kmarch/k109_c1a13e9a-f863-4bcd-ae89-daee0c3d3a4b.xml.asp
> says (for RtlUpperString):
>> The number of bytes copied from SourceString is either the Length of
>> SourceString or the MaximumLength of DestinationString, whichever is
>> smaller.
>
> So even if the MaximumLength of DestinationString is longer than the
> Length
> of SourceString and is also long enough to hold the entire uppercase
> conversion of SourceString, RtlUpperString will still truncate the result
> at
> the Length of SourceString, will waste the remaining available space, and
> will lose some of the characters that should have been converted. Why?

Without checking the source, so this is from memory. RtlUpperString will
use the RtlUpperChar type conversion model if this is upper case able and
not part of multi-character string it is uppered, otherwise not.

> 4.
> A little bird told me why RtlIsValidOemCharacter isn't documented.
> Probably
> the thing takes a single byte parameter and returns a single byte result
> and
> is thoroughly incapable of distinguishing valid OEM characters from
> garbage.
> But why is the thing exported? Are there really some callers that call
> it?
> If so, aren't the callers guaranteed to fail? Wouldn't it be better to
> delete the function RtlIsValidOemCharacter entirely?

It is documents in the IFS kit.




--
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Remove StopSpam from the email to reply



.



Relevant Pages

  • Questions about MSDN for some DDK functions
    ... RtlUpcaseUnicodeChar returns the uppercase version of the specified ... Unicode character requires two Unicode characters to express, ... RtlUpcaseUnicodeChar returns it in one WCHAR. ...
    (microsoft.public.development.device.drivers)
  • Re: What is better encoding method?
    ... the Unicode character encoding, version 2.1 or later, using the UTF-16 ... though they were performing normalisation of text, ... ECMAScript source text can contain any of the Unicode characters. ...
    (comp.lang.javascript)
  • Re: Perl opting for double-byte chars?
    ... If by "a Unicode character" you mean one whose code value is greater ... incur some processing overhead due to the extra work of Perl handling ... because Perl takes care of it for you (if you're ...
    (comp.lang.perl.misc)
  • Re: PEP 3131: Supporting Non-ASCII Identifiers
    ... The C# identifier syntax from http://msdn2.microsoft.com/en-us/library/aa664670.aspx ... A unicode-escape-sequence representing a character of classes Lu, Ll, Lt, Lm, Lo, or Nl ... A Unicode character of classes Mn or Mc ... A unicode-escape-sequence representing a character of classes Mn or Mc ...
    (comp.lang.python)
  • Re: Is there any way to insert a "double accent" (as in Hungarian) mark ABOVE a letter?
    ... You want to use a Unicode character. ... You say Word 98 suits your needs. ... Entourage FAQ Page: ...
    (microsoft.public.mac.office.word)