[RESEND] regedit: Convert from WCHAR size to maximum required TCHAR size.

Byeong-Sik Jeon wjsqudtlr at gmail.com
Wed Apr 4 16:05:08 CDT 2007


Bill Medland wrote:
> On Thu, 2007-05-04 at 02:18 +0900, Byeong-Sik Jeon wrote:
> > Hi,
> > 
> > Currently regedit is not defined "UNICODE".
> > 
> > The point are "max_val_name_len", "valName", "valNameLen".
> > Not max_val_size, valSize.
> > 
> > RegQueryInfoKey set the "max_val_name_len" to the size of the longest
> > value name, in characters. This value is not required byte size. 
> > 
> 
> but the call to HeapAlloc multiplies by sizeof TCHAR already.
> 
> > N character string:
> > ==> w/  UNICODE, N WHAR string.
> > ==> w/o UNICODE, N ~ 2N unsigned char string.
> > 
> > Please, test the CJK locale. and See the "IDS_NEWKEY, IDS_NEWVALUE" in
> > Ja.rc or Ko.rc .
> > If we create the registry "value name" in the empty registry key,
> > we can't see any newly created reg value name.
> > 
> > Thanks.
> > 
> > Detlef Riekenberg wrote:
> > > On Mi, 2007-04-04 at 10:36 +0900, Byeong-Sik Jeon wrote:
> > > >  
> > > > +    /* convert from WCHAR size to maximum required TCHAR size */
> > > > +    max_val_name_len *= sizeof(WCHAR) / sizeof(TCHAR);
> > > > +
> > > >      valName = HeapAlloc(GetProcessHeap(), 0, max_val_name_len *
> > > > sizeof(TCHAR));
> 
> See!
> 
Without UNICODE, sizeof(TCHAR) == 1. This is no effect. CJK multibyte
character is 2 byte size. 

example:
string "새 값 #1" has 6 characters. It is  max_val_name_len.
w/  UNICODE, this string is 6 * sizeof(WCHAR) bytes.
w/o UNICODE, this string is 8 bytes.
             8 == space(1) * 2 + #(1) + 1(1) + 새(2) + 값(2)

If you can't non englidh character, please install following font:
"Arial Unicode"

I'm sorry my poor english. but it is true.
Thanks.





More information about the wine-devel mailing list