[Win32utils-devel] Implementing a TaskScheduler#exists? method

Daniel Berger djberg96 at gmail.com
Thu Jun 18 21:05:30 EDT 2009


On Thu, Jun 18, 2009 at 6:36 PM, Heesob Park<phasis at gmail.com> wrote:
> Hi,
>
> 2009/6/19 Daniel Berger <djberg96 at gmail.com>:
>>
>>
>>> -----Original Message-----
>>> From: win32utils-devel-bounces at rubyforge.org [mailto:win32utils-devel-
>>> bounces at rubyforge.org] On Behalf Of Heesob Park
>>> Sent: Wednesday, June 17, 2009 7:23 PM
>>> To: Development and ideas for win32utils projects
>>> Subject: Re: [Win32utils-devel] Implementing a TaskScheduler#exists?
>>> method
>>>
>>> Hi,
>>>
>>> 2009/6/17 Daniel Berger <djberg96 at gmail.com>:
>>> >
>>> >
>>> <snip>
>>> > I thought it would be problematic because it's C++, but if you can do
>>> it, by all means please go for it!
>>> >
>>> Here is a pure ruby win32-taskscheduler.
>>> http://121.78.227.9/win32-taskscheduler/taskscheduler.rb
>>
>> Looks like there's a bug in line 756 (in the file in CVS) in the
>> new_work_item method:
>>
>> memcpy(lpVtbl, @pITask, 4)
>>
>> That's segfaulting.
>>
>> Here's a small sample to demonstrate:
>>
>>   trigger = {
>>      'start_year'   => 2011,
>>      'start_month'  => 4,
>>      'start_day'    => 11,
>>      'start_hour'   => 7,
>>      'start_minute' => 14,
>>      'trigger_type' => TaskScheduler::DAILY,
>>      'type'         => { 'days_interval' => 1 }
>>   }
>>
>>   ts = Win32::TaskScheduler.new('foo', trigger)
>>   ts.save
>>   ts.activate('foo')
>>
>> Hopefully I didn't accidentally introduce it.
>>
> I works fine with my XP box.
> What's your OS and Ruby version?

Vista Home Premium
Ruby 1.8.6 p111 (one click)
windows-api 0.3.0
win32-api-1.4.2

Here's the actual message. It's the call at line 756 that's ultimately
causing the issue from what I can tell:

C:/Ruby/lib/ruby/gems/1.8/gems/windows-api-0.3.0/lib/windows/api.rb:484:
[BUG] Segmentation fault
ruby 1.8.6 (2007-09-24) [i386-mswin32]

Ideas?

Regards,

Dan

PS - In other news, I messed something up with windows-api and VC++ 9:

c:\Users\djberge\workspace\win32-taskscheduler\lib\win32>ruby9 taskscheduler.rb
c:/rubyvc9/lib/ruby/gems/1.8/gems/windows-api-0.3.0/lib/windows/api.rb:333:in
`initialize': LoadLibrary() function faile
d for 'msvcr90': The specified module could not be found.
(Win32::API::LoadLibraryError)
        from c:/rubyvc9/lib/ruby/gems/1.8/gems/windows-api-0.3.0/lib/windows/api.rb:333:in
`new'
        from c:/rubyvc9/lib/ruby/gems/1.8/gems/windows-api-0.3.0/lib/windows/api.rb:333:in
`initialize'
        from c:/rubyvc9/lib/ruby/gems/1.8/gems/windows-pr-1.0.5/lib/windows/msvcrt/string.rb:10:in
`new'
        from c:/rubyvc9/lib/ruby/gems/1.8/gems/windows-pr-1.0.5/lib/windows/msvcrt/string.rb:10
        from c:/rubyvc9/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`gem_original_require'
        from c:/rubyvc9/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`require'
        from c:/rubyvc9/lib/ruby/gems/1.8/gems/windows-pr-1.0.5/lib/windows/unicode.rb:2
        from c:/rubyvc9/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`gem_original_require'
        from c:/rubyvc9/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`require'
        from taskscheduler.rb:2


More information about the win32utils-devel mailing list