WM_GETTEXTLENGTH returns double size

Andriy Palamarchuk apa3a at yahoo.com
Thu Jun 13 09:07:05 CDT 2002

--- Shachar Shemesh <wine-devel at sun.consumer.org.il>
> I think the correct thing to do is return the output
> of *_tcslen*. Since 
> we don't have TCHARs inside wine, this translates to
> using wcslen if 
> wer'e a UNICODE function, or strlen if wer'e not
> (notice that while 
> _mbslen returns the number of characters in the
> string, strlen returns 
> the number of bytes in the string. See 
> Also, assuming you are implementing this over my
> GetFontLanguageInfo 
> patch (the title was "Extremely preliminary BiDi
> patch" - not commited 
> yet), you can use that function to find out whether
> special MBCS 
> processing is necessary for the current locale. Just
> like I said in that 
> email, I am not sure it is worth it, performance
> wise.
> If you do decide to use my patch, notice that
> GetFontLanguageInfo is a 
> skeleton. I did include an MBCS pattern to those
> languages I happened to 
> know required MBCS, but as this is far from my main
> field of experties, 
> errors are not unlikely.

Sachar, this is a great explanation, but as I
understand the processing you mentioned should be done
in the controls (e.g. edit field) window procedures.
Can you submit a bug for this? You can give better
information than I and add dependencies on othe bugs
about MBCS, BiDi, etc. (I guess this bug will be
assigned to you as the component owner ;-)
Can you also make it depend on bug 791? 

To my rather limited knowlege the problem with
returning double size lays in different area - when a
chain of window procedures has in some cases W, in
others A procedures. If an A procedure gets results
from W procedure it has to map returned results from
Unicode to ASCII. The problem is that there is no way
of knowing if the returned number of Unicode
characters corresponds to length of MBCS which has
2-byte characters or plain 1-byte character string.
The current code accounts on the worst possible result
- for all the Unicode characters corresponding to
2-byte MBCS characters.

I submitted a bug for this:


Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup

More information about the wine-devel mailing list