Converting resources from A to W and vica versa
Shachar Shemesh
wine-devel at sun.consumer.org.il
Tue Jul 9 13:54:24 CDT 2002
Hi list,
Returning after a short absence, I have bug 864 to discuss (I have
opened it, and will soon be closing it).
The problem was that a program I wrote used "ChooseFont" with a
resource. I know those are not supported, but when compiled for Unicode
(in VC), the program crashed when trying to open the dialog.
Investigation revealed that a function called "ChooseFontWtoA" is
called, and that, in turn, assumes that lpTemplateName argument is a
string. In practice, this argument was actually an int after being
handled with "MAKEINTRESOURCE".
I will shortly be sending a fix to wine-patches, but I just wanted to
draw your attention to the fact that when handling resources, they are
not necessarily strings. Failure to recognize this will crash programs.
Worst, and this is not the first place I have seen this, this argument
is accessed and handled even if the "CF_ENABLETEMPLATE" flag is not set.
In other words, an argument that the MSDN promises will not be touched
unless a flag is set can crash a program if not set correctly, even if
the relevant flag is not set.
In short - pay attention, people. Even when implementing stubs, do read
through the arguments list and meanings.
Shachar
More information about the wine-devel
mailing list