From: Daniel Berger Date: 2009-09-14T01:02:32+09:00 Subject: Re: ruby 1.8.6 p287 and p383 crashing in WIN32OLE_EVENT.message_loop On Sep 2, 4:23 pm, Chuck Remes wrote: > On Sep 2, 2009, at 4:58 PM, Chuck Remes wrote: > > > > > > > On Sep 2, 2009, at 4:43 PM, Daniel Berger wrote: > > >> > > >>> It can't seem to load a few of its dependencies like "windows/com". > > >>> 1. The gem doesn't have a dependency on the windows-api gem. > > >>> 2. The windows-api gem, after installation, doesn't have a lot of   > >>> the > >>> files that pr-win32ole wants to load. > > >> There is no gem for pr-win32ole. All you should need to do is: > > >> gem install windows-pr > > >> That should install win32-api and windows-api automatically. It   > >> should > >> then "just work" as long as RUBYOPT is set. If it doesn't, please   > >> give > >> me a specific error you're getting. > > > Well, I ran 'gem build pr-winole32.gemspec' so it was easy to install. > > > I now have everything up and going. When I run my program, it   > > crashes on a call toWIN32OLE_EVENT.message_loop. > > > starting... > > C:/Ruby/lib/ruby/gems/1.8/gems/pr-win32ole-1.0.0/lib/pr/win32ole.rb: > > 701:in `[]=': index 8 out of string (IndexError) > >        from C:/Ruby/lib/ruby/gems/1.8/gems/pr-win32ole-1.0.0/lib/pr/ > > win32ole.rb:701:in `ole_val2variant' > >        from 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 C:/Ruby/lib/ruby/gems/1.8/gems/pr-win32ole-1.0.0/lib/pr/ > > win32ole.rb:5034:in `ole_msg_loop' > >        from C:/Ruby/lib/ruby/gems/1.8/gems/pr-win32ole-1.0.0/lib/pr/ > > win32ole.rb:5039:in `message_loop' > >        from //.host/Shared Folders/My Documents/NetBeansProjects/ > > ChuckKit/lib/main.rb:165 > > > If that trace looks crappy, view it here:  http://pastie.org/603650 > > 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. It's been fixed in SVN. I'm curious if your code works with the updated version. Regards, Dan