calling *W functions in wt (Was: dlls/shell32/shfldr_desktop.c)
wine-devel at shemesh.biz
Mon Aug 15 05:55:58 CDT 2005
Saulius Krasuckas wrote:
>*FileW and *DirectoryW functions fail on every win9x box as they are
> They succeed only when app is linked to MS Layer for
>Unicode (MSLU) and MSLU is installed. 
A royal pain.
>I was trying to replace every failing unicode function with its ascii
>counterpart in one of the wt files , but that looked ugly to me.
>Maybe it would be really nice and possible to link wt to unicows.lib on
>windows. In this case we need a corresponding static lib in Wine too,
>right? It probably will be "empty" because UNICOWS.DLL shouldn't be
>loaded as Wine doesn't lack implementation of mentioned functions.
>Though, I have no guess if this could be done easily.
Unicows is a pain. First of all, in order to link with it, you will have
to remove all standard links (kernel, gdi, advapi, etc), put unicows.lib
at the beginning, and then put all standard library links again. Unicows
takes over all of the function calls, and on NT and above just redirects
them to the usual places. On Windows 98 it does ugly simulations of the
actual original call.
What I am most afraid of, if using Unicows, is that we will be
destroying the validity of the tests. The main question, I guess, is
whether these are Unicode tests (i.e. - tests meant to find out whether
the Unicode functions are working correctly), or whether these are
unrelated tests that merely use the Unicode interface.
As for defining unicows.lib - we could do that, sure. We could either
export everything there (Unicows.dll today is merely a redirection to
the other functions), or we could make it a lib exporting nothing. The
first is truer to what the real unicows.dll does (not 100% the same
still, thankfully), but the second would probably work better. I would
really prefer it if unicows.dll was only ever referenced by PE programs
compiled on Windows.
>What could be a clean and acceptable solution? Your comments, please.
The these are Unicode tests, use the Unicode interface. If these are
just file system tests, I suggest you use the TCHAR functions. In other
words, define your buffers as TCHAR buffer (rather than char or
wchar), and call the functions without any prefix (neither W nor A).
When compiling under NT, define a compiler variable "UNICODE", which
will map TCHAR to WCHAR.
Now, I know that Wine code is forbidden from using the non-suffixed
calls, but the wine tests are not Wine code, they are winelib
applications. I don't think there is any problem in using these
functions there. We could even run the tests both in ANSI and in Unicode
mode, to compare results.
Lingnu Open Source Consulting ltd.
More information about the wine-devel