List Info

Thread: Bug in win32-api with void prototypes?




Bug in win32-api with void prototypes?
user name
2007-09-25 13:22:24
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.
_______________________________________________
win32utils-devel mailing list
win32utils-develrubyforge.org
http://rubyforge.org/mailman/listinfo/win32utils-devel


Re: Bug in win32-api with void prototypes?
user name
2007-09-26 08:30:38
Hi,

2007/9/26, Berger, Daniel < Daniel.Bergerqwest.com">Daniel.Bergerqwest.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'
=&gt; true

# Our version
irb(main):004:0> GetLastErrorA = API.new(&#39;GetLastError', 'V';, 'L';,
'kernel32')
=> #<Win32::API:0x2db6314>

# Old version
irb(main):005:0> GetLastErrorB = Win32API.new ('kernel32';,
'GetLastError&#39;, 'V';, 'L';)
=> #<Win32API:0x2db0518>

# Ours fails with no arguments
irb(main):006:0> GetLastErrorA.call
ArgumentError: wrong number of parameters: expected 1, got 0
   ; &nbsp;  from (irb):6:in `call'
 &nbsp; &nbsp; &nbsp; 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?
&nbsp;
If the api_call function is called with no argument, just set the argument v_args to [nil].
 
Regards,
 
Park Heesob
 

&nbsp;
Re: Bug in win32-api with void prototypes?
country flaguser name
United States
2007-09-27 21:36:15
Heesob Park wrote:
> Hi,
> 
> 2007/9/26, Berger, Daniel <Daniel.Bergerqwest.com

> <mailtoaniel.Be
rgerqwest.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
_______________________________________________
win32utils-devel mailing list
win32utils-develrubyforge.org
http://rubyforge.org/mailman/listinfo/win32utils-devel


[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )