Berger, Daniel
2007-Sep-25 18:22 UTC
[Win32utils-devel] Bug in win32-api with void prototypes?
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? 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.
Heesob Park
2007-Sep-26 13:30 UTC
[Win32utils-devel] Bug in win32-api with void prototypes?
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
Daniel Berger
2007-Sep-28 02:36 UTC
[Win32utils-devel] Bug in win32-api with void prototypes?
Heesob Park wrote:> Hi, > > 2007/9/26, Berger, Daniel <Daniel.Berger at qwest.com > <mailto: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].I released 1.0.1 tonight which fixes this issue. Regards, Dan