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

Berger, Daniel Daniel.Berger at qwest.com
Tue Sep 25 14:22:24 EDT 2007

Hi all,

It seems that a void prototype requires an explicit argument in our
version of win32/api:

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',
=> #<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?



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