[Win32utils-devel] Bug in win32-api with void prototypes?

Heesob Park phasis at gmail.com
Wed Sep 26 09:30:38 EDT 2007


Hi,

2007/9/26, Berger, Daniel <Daniel.Berger at qwest.com>:
>
> Hi all,
>
> It seems that a void prototype requires an explicit argument in our
> version of win32/api:
>
> C:\>irb
> irb(main):001:0> require 'win32/api'
> => true
>
> irb(main):002:0> include Win32
> => Object
>
> irb(main):003:0> require 'Win32API'
> => true
>
> # Our version
> irb(main):004:0> GetLastErrorA = API.new('GetLastError', 'V', 'L',
> 'kernel32')
> => #<Win32::API:0x2db6314>
>
> # Old version
> irb(main):005:0> GetLastErrorB = Win32API.new('kernel32',
> 'GetLastError', 'V', 'L')
> => #<Win32API:0x2db0518>
>
> # Ours fails with no arguments
> irb(main):006:0> GetLastErrorA.call
> ArgumentError: wrong number of parameters: expected 1, got 0
>        from (irb):6:in `call'
>        from (irb):6
>
> # Works with an explicit nil - intentional?
> irb(main):007:0> GetLastErrorA.call(nil)
> => 10038
>
> # Old version ignores it
> irb(main):008:0> GetLastErrorB.call
> => 10038
>
> How should we handle this?


If the api_call function is called with no argument, just set the argument
v_args to [nil].

Regards,

Park Heesob
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/win32utils-devel/attachments/20070926/b3323ef4/attachment.html 


More information about the win32utils-devel mailing list