On Sep 4, 2009, at 8:39 AM, Masaki Suketa wrote:

> Hello,
>
> At 09/03/2009 07:23 AM, Chuck Remes wrote:
>>> C:/Ruby/lib/ruby/gems/1.8/gems/pr-win32ole-1.0.0/lib/pr/ 
>>> win32ole.rb:4481
>>>       from (eval):3:in `call'
>>>       from (eval):3:in `DispatchMessage'
>>>       from
>> Okay, dug into the pr-win32ole code and this is what I found.
>> Line 701 was trying to access index 8 of a string with only 4  
>> characters. Backing up the stack I looked at where it was passed in  
>> from and see that the +pvarResult+ variable passed into the lambda  
>> had the value "\n\000".  The lambda in question is on line 4400.
>> I don't know this code well enough to say where that came from  
>> originally, but that explains the IndexError anyway. It looks like  
>> the code that operates on those strings assumes they are 16  
>> characters long. That assumption blew it up.
>
> How about commenting the 3 lines from line 4480 to line 4482?
> Does it work?
>
>         ary2ptr_dispparams(outargv, pdispparams)
>      end
>
>      # if pvarResult
>      #    WIN32OLE.ole_val2variant(result,pvarResult)
>      # end
>      S_OK
>   })

Commenting out those lines fixes (hides?) the problem described above.  
It now runs the program successfully.

However, this pure ruby version of the library still crashes when I  
run the code described in my original post. It crashes without writing  
any error message to the Output window in NetBeans. I *assume* it is  
crashing somewhere in #message_loop but I don't know that for sure.

Is there any easy way to instrument the win32ole code so I can  
pinpoint the crash location?

cr