[Win32utils-devel] win32-api idea - wide method first based on $KCODE
Berger, Daniel
Daniel.Berger at qwest.com
Tue Nov 13 16:11:38 EST 2007
All,
Currently, the Win32::API.new method will search for the function name,
then the 'A' (ANSI) name, and finally the 'W' (Wide) name. The code
looks something like this:
fProc = GetProcAddress(hLibrary, TEXT(RSTRING(v_proc)->ptr));
if(!fProc){
VALUE v_ascii = rb_str_new3(v_proc);
v_ascii = rb_str_cat(v_ascii, "A", 1);
fProc = GetProcAddress(hLibrary, TEXT(RSTRING(v_ascii)->ptr));
if(!fProc){
VALUE v_unicode = rb_str_new3(v_proc);
v_unicode = rb_str_cat(v_unicode, "W", 1);
fProc = GetProcAddress(hLibrary, TEXT(RSTRING(v_unicode)->ptr));
...
So, for example, when you do this:
Win32::API.new('SomeFunc',...)
It looks for SomeFunc. If that fails it looks for SomeFuncA (which is
what most of the functions actually default to). If that fails it looks
for SomeFuncW. If that fails, then an error is raised.
What about switching the order so that it looks for SomeFuncW -first-
and SomeFuncA -second- if $KCODE = u? Does that seem reasonable?
Regards,
Dan
This communication is the property of Qwest and may contain confidential or
privileged information. Unauthorized use of this communication is strictly
prohibited and may be unlawful. If you have received this communication
in error, please immediately notify the sender by reply e-mail and destroy
all copies of the communication and any attachments.
More information about the win32utils-devel
mailing list