Of wchar_t and WCHAR and incompatibilities....

Subhobroto Sinha subhobrotosinha at rediffmail.com
Thu Dec 25 12:50:15 CST 2003


An HTML attachment was scrubbed...
URL: http://www.winehq.org/pipermail/wine-devel/attachments/20031225/73a69b86/attachment.htm
-------------- next part --------------
As most of you might be aware, I and Robert are progressing with a Start Menu.

All the functionality is there now (except menu icons, and shell namespaces..).

However, I had to write a .lnk parser for it and till date, I made it compatible ONLY with UTF-8 and thus did not require to use glibc's Unicode functions.

Today, I was getting dirty with a full blown Unicode implementation and I noticed that GNU defines a wchar_t as an (unsigned long) - it's 4 bytes long, wheras a WCHAR (which is a typedefed wchar_t) is an (unsigned short) on Windows !

As a result, Unicode strings on Windows are unsigned long arrays and thus I had to convert them into glibc's own wchar_t format using a hack like this:

void ConvertWCHARTo_wchar_t(const WCHAR* wszIn,wchar_t* wszOut)
{
	if(wszIn) while(*wszOut++=*wszIn++);
}

and vice versa for the opposite conversion.

Believe me, it works, but not always... (any body interested in debugging with the source, please ask me for it..)

Any sugestions as to handle the situation please?
I need to use GLibc's Unicode functions and NOT WINE's implmentation of Mutibyte...(), because I want to keep the .lnk parser in pure C++

Regards

Subhobroto Sinha


More information about the wine-devel mailing list