"Jonathan Ernst" <Jonathan(a)ErnstFamily.ch> wrote:
> With some help I'll be able to improve it (more unicodification, etc.)
> when I'll come back.
You can't really convert to unicode partially, you have to do it in one go.
That not only will simplify things a lot, but also will save you a lot of time.
> + for (i=0; i < numentries; i++)
> + {
> + len = WideCharToMultiByte(CP_UNIXCP, 0, entries[i].descr, -1, NULL, 0, NULL, NULL);
> + descr = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
> + WideCharToMultiByte(CP_UNIXCP, 0, entries[i].descr, -1, descr, len, NULL, NULL);
> + printf("%s|||%s\n", entries[i].key, descr);
There is no need to allocate len * sizeof(WCHAR) bytes, len works just fine.
> +int wmain(int argc, char *argv[])
wmain takes 'WCHAR *argv[]' list.
All remaining problems are caused by the fact that now argv[] array
is passed in unicode but you still handle argv[] strings as ASCII and
pass them around to internal functions which accept 'char *' not 'WCHAR *'
strings.
--
Dmitry.