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

Heesob Park phasis at gmail.com
Fri Jun 19 01:05:10 EDT 2009


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: Thursday, June 18, 2009 9:22 PM
>> To: Development and ideas for win32utils projects
>> Subject: Re: [Win32utils-devel] Implementing a TaskScheduler#exists?
>> method
>>
>> 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: Thursday, June 18, 2009 6:37 PM
>> >> To: Development and ideas for win32utils projects
>> >> Subject: Re: [Win32utils-devel] Implementing a TaskScheduler#exists?
>> >> method
>> >>
>> >> 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?
>> >
>> > Quick followup. One of the things I changed was:
>> >
>> > hr != S_OK
>> >
>> > to
>> >
>> > FAILED(hr)
>> >
>> > I thought it looked a little nicer and it more closely follows the C
>> code. But the FAILED() macro method only checks to see if its argument
>> is less than 0. When I inspected the hr variable, it's actually
>> 2147942480 (The operation completed successfully).
>> >
>> I noticed the current taskscheduler implementation is using Task
>> Scheduler 1.0.
>> In order to work with Vista or later, we should implement a new
>> version using Task Scheduler 2.0.
>> The header file for Task Scheduler 2.0 is taskchd.h, whereas for 1.0
>> is MSTask.h.
>
> Ok, how would you like to proceed? Should I release the current (pure Ruby) code with a warning regarding Vista or later? Or wait?
>
It is up to you. I don't mind whether you release it or not.

Regards,

Park Heesob


More information about the win32utils-devel mailing list