From phasis at gmail.com Fri Jun 5 21:57:37 2009 From: phasis at gmail.com (Heesob Park) Date: Sat, 6 Jun 2009 10:57:37 +0900 Subject: [Win32utils-devel] [ win32utils-Feature Requests-25792 ] Create a pure Ruby win32-ole library In-Reply-To: <20090506002938.A2C8318581E9@rubyforge.org> References: <20090506002938.A2C8318581E9@rubyforge.org> Message-ID: Hi, 2009/5/6 : > Feature Requests item #25792, was opened at 2009-05-05 17:29 > You can respond by visiting: > http://rubyforge.org/tracker/?func=detail&atid=414&aid=25792&group_id=85 > > Category: None > Group: None > Status: Open > Resolution: None > Priority: 3 > Submitted By: Daniel Berger (djberg96) > Assigned to: Nobody (None) > Summary: Create a pure Ruby win32-ole library > > Initial Comment: > The current Win32OLE library is a C monster, has some bugs, and doesn't have a particularly good interface. > > I think a pure Ruby version would be easier to write and maintain, could have a more Ruby-ish interface, and could be installed as a gem instead of people having to wait for the next release of Ruby. > As you know, I have implemented a pure Ruby version last month. But there is no response or comment until now. Are you unhappy with my work? Do I have labored in vain? Regards, Park Heesob From djberg96 at gmail.com Fri Jun 5 22:36:11 2009 From: djberg96 at gmail.com (Daniel Berger) Date: Fri, 5 Jun 2009 20:36:11 -0600 Subject: [Win32utils-devel] [ win32utils-Feature Requests-25792 ] Create a pure Ruby win32-ole library In-Reply-To: References: <20090506002938.A2C8318581E9@rubyforge.org> Message-ID: <003a01c9e64f$918cabd0$b4a60370$@com> > -----Original Message----- > From: win32utils-devel-bounces at rubyforge.org [mailto:win32utils-devel- > bounces at rubyforge.org] On Behalf Of Heesob Park > Sent: Friday, June 05, 2009 7:58 PM > To: Development and ideas for win32utils projects > Subject: Re: [Win32utils-devel] [ win32utils-Feature Requests-25792 ] > Create a pure Ruby win32-ole library > > Hi, > > 2009/5/6 : > > Feature Requests item #25792, was opened at 2009-05-05 17:29 > > You can respond by visiting: > > > http://rubyforge.org/tracker/?func=detail&atid=414&aid=25792&group_id=8 > 5 > > > > Category: None > > Group: None > > Status: Open > > Resolution: None > > Priority: 3 > > Submitted By: Daniel Berger (djberg96) > > Assigned to: Nobody (None) > > Summary: Create a pure Ruby win32-ole library > > > > Initial Comment: > > The current Win32OLE library is a C monster, has some bugs, and > doesn't have a particularly good interface. > > > > I think a pure Ruby version would be easier to write and maintain, > could have a more Ruby-ish interface, and could be installed as a gem > instead of people having to wait for the next release of Ruby. > > > As you know, I have implemented a pure Ruby version last month. But > there is no response or comment until now. Are you unhappy with my > work? Do I have labored in vain? Absolutely not! I've just been busy lately working on a side project. I designed a game and its now going to be published: http://www.worthingtongames.com/CaesarsGallicWar.html My work on that is largely over, so I can refocus my efforts on Ruby. :) I've been working on the pure ruby pr-zlib library, and I wanted to get that tested and out first. Once I'm done with that, I'm going to start a separate pure project (pr/win32ole) and create a test suite for that. Honestly, I didn't expect you to finish it nearly as fast as you did. I thought I would have more time. :) Regards, Dan From phasis at gmail.com Fri Jun 5 23:06:36 2009 From: phasis at gmail.com (Heesob Park) Date: Sat, 6 Jun 2009 12:06:36 +0900 Subject: [Win32utils-devel] [ win32utils-Feature Requests-25792 ] Create a pure Ruby win32-ole library In-Reply-To: <003a01c9e64f$918cabd0$b4a60370$@com> References: <20090506002938.A2C8318581E9@rubyforge.org> <003a01c9e64f$918cabd0$b4a60370$@com> Message-ID: Hi Dan, 2009/6/6 Daniel Berger : > > >> -----Original Message----- >> From: win32utils-devel-bounces at rubyforge.org [mailto:win32utils-devel- >> bounces at rubyforge.org] On Behalf Of Heesob Park >> Sent: Friday, June 05, 2009 7:58 PM >> To: Development and ideas for win32utils projects >> Subject: Re: [Win32utils-devel] [ win32utils-Feature Requests-25792 ] >> Create a pure Ruby win32-ole library >> >> Hi, >> >> 2009/5/6 ?: >> > Feature Requests item #25792, was opened at 2009-05-05 17:29 >> > You can respond by visiting: >> > >> http://rubyforge.org/tracker/?func=detail&atid=414&aid=25792&group_id=8 >> 5 >> > >> > Category: None >> > Group: None >> > Status: Open >> > Resolution: None >> > Priority: 3 >> > Submitted By: Daniel Berger (djberg96) >> > Assigned to: Nobody (None) >> > Summary: Create a pure Ruby win32-ole library >> > >> > Initial Comment: >> > The current Win32OLE library is a C monster, has some bugs, and >> doesn't have a particularly good interface. >> > >> > I think a pure Ruby version would be easier to write and maintain, >> could have a more Ruby-ish interface, and could be installed as a gem >> instead of people having to wait for the next release of Ruby. >> > >> As you know, I have implemented a pure Ruby version last month. But >> there is no response or comment until now. Are you unhappy with my >> work? Do I have labored in vain? > > Absolutely not! I've just been busy lately working on a side project. I > designed a game and its now going to be published: > > http://www.worthingtongames.com/CaesarsGallicWar.html > > My work on that is largely over, so I can refocus my efforts on Ruby. :) > Congratulations! I read your blog. Welcome back to Ruby :) > I've been working on the pure ruby pr-zlib library, and I wanted to get that > tested and out first. Once I'm done with that, I'm going to start a separate > pure project (pr/win32ole) and create a test suite for that. > > Honestly, I didn't expect you to finish it nearly as fast as you did. I > thought I would have more time. :) > I think you are more busy now than in Qwest days. :) BTW, did you know win-user32-ruby project(http://rubyforge.org/projects/win-user32-ruby/) which is registered a few days ago by Jerry Fernholz? It is based on win32/api and aimed to implement user32 APIs. I guess many codes are duplicate with windows-pr and could be merged into windows-pr. We can co-work with Jerry in both win32-utils and win-user32-ruby projects. What do you think about this? Regards, Park Heesob From djberg96 at gmail.com Tue Jun 16 15:44:31 2009 From: djberg96 at gmail.com (Daniel Berger) Date: Tue, 16 Jun 2009 13:44:31 -0600 Subject: [Win32utils-devel] Implementing a TaskScheduler#exists? method Message-ID: <004a01c9eeba$e09cccf0$a1d666d0$@com> Hi, I'd like to add TaskScheduler#exists?(work_item) to the win32-taskscheduler library. Mostly I want it for testing, but it might come in handy for other people as well. What's the best way to approach this? Just enumerate the tasks, and check for the name? Regards, Dan From djberg96 at gmail.com Tue Jun 16 18:17:25 2009 From: djberg96 at gmail.com (Daniel Berger) Date: Tue, 16 Jun 2009 16:17:25 -0600 Subject: [Win32utils-devel] Question about TaskScheduler#enum on Vista Message-ID: <005101c9eed0$3c0fda90$b42f8fb0$@com> Hi, When I look at the Task Scheduler app on my Vista laptop, I see 17 active tasks. However, when I call TaskScheduler#enum I get an empty array. Is there a role/permissions issue of some kind? Regards, Dan From phasis at gmail.com Tue Jun 16 21:46:57 2009 From: phasis at gmail.com (Heesob Park) Date: Wed, 17 Jun 2009 10:46:57 +0900 Subject: [Win32utils-devel] Implementing a TaskScheduler#exists? method In-Reply-To: <004a01c9eeba$e09cccf0$a1d666d0$@com> References: <004a01c9eeba$e09cccf0$a1d666d0$@com> Message-ID: Hi, 2009/6/17 Daniel Berger : > Hi, > > I'd like to add TaskScheduler#exists?(work_item) to the win32-taskscheduler > library. Mostly I want it for testing, but it might come in handy for other > people as well. > > What's the best way to approach this? Just enumerate the tasks, and check > for the name? > I think the best way to check taskscheduler item is just go to the Scheduled Tasks folder (in most case c:\winodws\tasks) and see the .job files. You can write it with ruby like this: def TaskScheduler#exists?(work_item) File.exist?("#{ENV['windir']}\\Tasks\\#{work_item}.job") end BTW, Do you mind I write pure ruby taskscheduler? Regards, Park Heesob From djberg96 at gmail.com Tue Jun 16 23:15:18 2009 From: djberg96 at gmail.com (Daniel Berger) Date: Tue, 16 Jun 2009 21:15:18 -0600 Subject: [Win32utils-devel] Implementing a TaskScheduler#exists? method In-Reply-To: References: <004a01c9eeba$e09cccf0$a1d666d0$@com> Message-ID: <005901c9eef9$d8d95940$8a8c0bc0$@com> > -----Original Message----- > From: win32utils-devel-bounces at rubyforge.org [mailto:win32utils-devel- > bounces at rubyforge.org] On Behalf Of Heesob Park > Sent: Tuesday, June 16, 2009 7:47 PM > To: Development and ideas for win32utils projects > Subject: Re: [Win32utils-devel] Implementing a TaskScheduler#exists? > method > > Hi, > > 2009/6/17 Daniel Berger : > > Hi, > > > > I'd like to add TaskScheduler#exists?(work_item) to the win32- > taskscheduler > > library. Mostly I want it for testing, but it might come in handy for > other > > people as well. > > > > What's the best way to approach this? Just enumerate the tasks, and > check > > for the name? > > > I think the best way to check taskscheduler item is just go to the > Scheduled Tasks folder (in most case c:\winodws\tasks) and see the > .job files. > > You can write it with ruby like this: > > def TaskScheduler#exists?(work_item) > File.exist?("#{ENV['windir']}\\Tasks\\#{work_item}.job") > end That will work, though I don't think it's a requirement that the .job file live there, is it? > BTW, Do you mind I write pure ruby taskscheduler? I don't mind so long as you're not using WMI. I never completed that because of the restrictions. Regards, Dan From luislavena at gmail.com Tue Jun 16 23:54:42 2009 From: luislavena at gmail.com (Luis Lavena) Date: Wed, 17 Jun 2009 00:54:42 -0300 Subject: [Win32utils-devel] Implementing a TaskScheduler#exists? method In-Reply-To: <005901c9eef9$d8d95940$8a8c0bc0$@com> References: <004a01c9eeba$e09cccf0$a1d666d0$@com> <005901c9eef9$d8d95940$8a8c0bc0$@com> Message-ID: <71166b3b0906162054g5ceb31b8tf21e128cbaf30024@mail.gmail.com> On Wed, Jun 17, 2009 at 12:15 AM, Daniel Berger wrote: > > >> -----Original Message----- >> [...] >> I think the best way to check taskscheduler item is just go to the >> Scheduled Tasks folder (in most case c:\winodws\tasks) and see the >> .job files. >> >> You can write it with ruby like this: >> >> def TaskScheduler#exists?(work_item) >> ? File.exist?("#{ENV['windir']}\\Tasks\\#{work_item}.job") >> end > > That will work, though I don't think it's a requirement that the .job file > live there, is it? Well, on Windows 7 and Vista only list 2 job files for me, and are google related. On Windows 7 there is SchTasks which list *lot* of tasks not covered by Windows\Tasks folder. >> BTW, Do you mind I write pure ruby taskscheduler? > > I don't mind so long as you're not using WMI. I never completed that because > of the restrictions. > I believe there is an API not using instrumentation services, but quite don't remember. A partner at my old job used to play with it on Windows 2000. Will check and get back to you. -- Luis Lavena AREA 17 - Perfection in design is achieved not when there is nothing more to add, but rather when there is nothing more to take away. Antoine de Saint-Exup?ry From phasis at gmail.com Wed Jun 17 00:06:44 2009 From: phasis at gmail.com (Heesob Park) Date: Wed, 17 Jun 2009 13:06:44 +0900 Subject: [Win32utils-devel] Implementing a TaskScheduler#exists? method In-Reply-To: <005901c9eef9$d8d95940$8a8c0bc0$@com> References: <004a01c9eeba$e09cccf0$a1d666d0$@com> <005901c9eef9$d8d95940$8a8c0bc0$@com> Message-ID: 2009/6/17 Daniel Berger : > > >> -----Original Message----- >> From: win32utils-devel-bounces at rubyforge.org [mailto:win32utils-devel- >> bounces at rubyforge.org] On Behalf Of Heesob Park >> Sent: Tuesday, June 16, 2009 7:47 PM >> To: Development and ideas for win32utils projects >> Subject: Re: [Win32utils-devel] Implementing a TaskScheduler#exists? >> method >> >> Hi, >> >> 2009/6/17 Daniel Berger : >> > Hi, >> > >> > I'd like to add TaskScheduler#exists?(work_item) to the win32- >> taskscheduler >> > library. Mostly I want it for testing, but it might come in handy for >> other >> > people as well. >> > >> > What's the best way to approach this? Just enumerate the tasks, and >> check >> > for the name? >> > >> I think the best way to check taskscheduler item is just go to the >> Scheduled Tasks folder (in most case c:\winodws\tasks) and see the >> .job files. >> >> You can write it with ruby like this: >> >> def TaskScheduler#exists?(work_item) >> ? File.exist?("#{ENV['windir']}\\Tasks\\#{work_item}.job") >> end > > That will work, though I don't think it's a requirement that the .job file > live there, is it? > According to http://support.microsoft.com/kb/310424/en, I think so. >> BTW, Do you mind I write pure ruby taskscheduler? > > I don't mind so long as you're not using WMI. I never completed that because > of the restrictions. > Of course, I mean the literal translation of the current c code. I like to use the same technique used in pure win32ole ruby code. Regards, Park Heesob From djberg96 at gmail.com Wed Jun 17 00:36:47 2009 From: djberg96 at gmail.com (Daniel Berger) Date: Tue, 16 Jun 2009 22:36:47 -0600 Subject: [Win32utils-devel] Implementing a TaskScheduler#exists? method In-Reply-To: <71166b3b0906162054g5ceb31b8tf21e128cbaf30024@mail.gmail.com> References: <004a01c9eeba$e09cccf0$a1d666d0$@com> <005901c9eef9$d8d95940$8a8c0bc0$@com> <71166b3b0906162054g5ceb31b8tf21e128cbaf30024@mail.gmail.com> Message-ID: <006301c9ef05$3b6f61c0$b24e2540$@com> > -----Original Message----- > From: win32utils-devel-bounces at rubyforge.org [mailto:win32utils-devel- > bounces at rubyforge.org] On Behalf Of Luis Lavena > Sent: Tuesday, June 16, 2009 9:55 PM > To: Development and ideas for win32utils projects > Subject: Re: [Win32utils-devel] Implementing a TaskScheduler#exists? > method > > On Wed, Jun 17, 2009 at 12:15 AM, Daniel Berger > wrote: > > > > > >> -----Original Message----- > >> [...] > >> I think the best way to check taskscheduler item is just go to the > >> Scheduled Tasks folder (in most case c:\winodws\tasks) and see the > >> .job files. > >> > >> You can write it with ruby like this: > >> > >> def TaskScheduler#exists?(work_item) > >> ? File.exist?("#{ENV['windir']}\\Tasks\\#{work_item}.job") > >> end > > > > That will work, though I don't think it's a requirement that the .job > file > > live there, is it? > > Well, on Windows 7 and Vista only list 2 job files for me, and are > google related. > > On Windows 7 there is SchTasks which list *lot* of tasks not covered > by Windows\Tasks folder. On my Vista Home Premium laptop I only see a single file called SCHEDLGU.TXT under C:\Windows\Tasks. It appears to be nothing more than a record of the Task Scheduler Service. Regards, Dan From djberg96 at gmail.com Wed Jun 17 00:47:52 2009 From: djberg96 at gmail.com (Daniel Berger) Date: Tue, 16 Jun 2009 22:47:52 -0600 Subject: [Win32utils-devel] Implementing a TaskScheduler#exists? method In-Reply-To: References: <004a01c9eeba$e09cccf0$a1d666d0$@com> <005901c9eef9$d8d95940$8a8c0bc0$@com> Message-ID: <006701c9ef06$c74f8750$55ee95f0$@com> > -----Original Message----- > From: win32utils-devel-bounces at rubyforge.org [mailto:win32utils-devel- > bounces at rubyforge.org] On Behalf Of Heesob Park > Sent: Tuesday, June 16, 2009 10:07 PM > To: Development and ideas for win32utils projects > Subject: Re: [Win32utils-devel] Implementing a TaskScheduler#exists? > method > > 2009/6/17 Daniel Berger : > > > > > >> -----Original Message----- > >> From: win32utils-devel-bounces at rubyforge.org [mailto:win32utils- > devel- > >> bounces at rubyforge.org] On Behalf Of Heesob Park > >> Sent: Tuesday, June 16, 2009 7:47 PM > >> To: Development and ideas for win32utils projects > >> Subject: Re: [Win32utils-devel] Implementing a TaskScheduler#exists? > >> method > >> > >> Hi, > >> > >> 2009/6/17 Daniel Berger : > >> > Hi, > >> > > >> > I'd like to add TaskScheduler#exists?(work_item) to the win32- > >> taskscheduler > >> > library. Mostly I want it for testing, but it might come in handy > for > >> other > >> > people as well. > >> > > >> > What's the best way to approach this? Just enumerate the tasks, > and > >> check > >> > for the name? > >> > > >> I think the best way to check taskscheduler item is just go to the > >> Scheduled Tasks folder (in most case c:\winodws\tasks) and see the > >> .job files. > >> > >> You can write it with ruby like this: > >> > >> def TaskScheduler#exists?(work_item) > >> File.exist?("#{ENV['windir']}\\Tasks\\#{work_item}.job") > >> end > > > > That will work, though I don't think it's a requirement that the .job > file > > live there, is it? > > > According to http://support.microsoft.com/kb/310424/en, I think so. > > >> BTW, Do you mind I write pure ruby taskscheduler? > > > > I don't mind so long as you're not using WMI. I never completed that > because > > of the restrictions. > > > Of course, I mean the literal translation of the current c code. > I like to use the same technique used in pure win32ole ruby code. I thought it would be problematic because it's C++, but if you can do it, by all means please go for it! Regards, Dan From phasis at gmail.com Wed Jun 17 00:56:24 2009 From: phasis at gmail.com (Heesob Park) Date: Wed, 17 Jun 2009 13:56:24 +0900 Subject: [Win32utils-devel] Implementing a TaskScheduler#exists? method In-Reply-To: <006301c9ef05$3b6f61c0$b24e2540$@com> References: <004a01c9eeba$e09cccf0$a1d666d0$@com> <005901c9eef9$d8d95940$8a8c0bc0$@com> <71166b3b0906162054g5ceb31b8tf21e128cbaf30024@mail.gmail.com> <006301c9ef05$3b6f61c0$b24e2540$@com> Message-ID: 2009/6/17 Daniel Berger : > > >> -----Original Message----- >> From: win32utils-devel-bounces at rubyforge.org [mailto:win32utils-devel- >> bounces at rubyforge.org] On Behalf Of Luis Lavena >> Sent: Tuesday, June 16, 2009 9:55 PM >> To: Development and ideas for win32utils projects >> Subject: Re: [Win32utils-devel] Implementing a TaskScheduler#exists? >> method >> >> On Wed, Jun 17, 2009 at 12:15 AM, Daniel Berger >> wrote: >> > >> > >> >> -----Original Message----- >> >> [...] >> >> I think the best way to check taskscheduler item is just go to the >> >> Scheduled Tasks folder (in most case c:\winodws\tasks) and see the >> >> .job files. >> >> >> >> You can write it with ruby like this: >> >> >> >> def TaskScheduler#exists?(work_item) >> >> ? File.exist?("#{ENV['windir']}\\Tasks\\#{work_item}.job") >> >> end >> > >> > That will work, though I don't think it's a requirement that the .job >> file >> > live there, is it? >> >> Well, on Windows 7 and Vista only list 2 job files for me, and are >> google related. >> >> On Windows 7 there is SchTasks which list *lot* of tasks not covered >> by Windows\Tasks folder. > > On my Vista Home Premium laptop I only see a single file called SCHEDLGU.TXT > under C:\Windows\Tasks. It appears to be nothing more than a record of the > Task Scheduler Service. > It's in C:\Windows\System32\Tasks folder without .job extension. Regards, Park Heesob From djberg96 at gmail.com Wed Jun 17 12:19:36 2009 From: djberg96 at gmail.com (Daniel Berger) Date: Wed, 17 Jun 2009 10:19:36 -0600 Subject: [Win32utils-devel] The dreaded licensing question Message-ID: <007a01c9ef67$69e0f430$3da2dc90$@com> Hi all, So far I have put all of the Win32Utils code (and all of my OSS Ruby stuff, really) under "Ruby's" license. Ruby's license is a modified version of the LGPL. I was thinking of switching to Artistic 2.0, which is still "GPL compatible": http://en.wikipedia.org/wiki/Artistic_License http://www.opensource.org/licenses/artistic-license-2.0.php http://www.theperlreview.com/Interviews/allison-randal-artistic-license.html I like it because it's short and relatively easy to read. And it held up in US court: http://www.groklaw.net/article.php?story=2008081313212422 What do you think? Does anyone object to switching to Artistic 2.0? Regards, Dan From phasis at gmail.com Wed Jun 17 21:22:41 2009 From: phasis at gmail.com (Heesob Park) Date: Thu, 18 Jun 2009 10:22:41 +0900 Subject: [Win32utils-devel] Implementing a TaskScheduler#exists? method In-Reply-To: <006701c9ef06$c74f8750$55ee95f0$@com> References: <004a01c9eeba$e09cccf0$a1d666d0$@com> <005901c9eef9$d8d95940$8a8c0bc0$@com> <006701c9ef06$c74f8750$55ee95f0$@com> Message-ID: Hi, 2009/6/17 Daniel Berger : > > > 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 Regards, Park Heesob From djberg96 at gmail.com Thu Jun 18 09:24:42 2009 From: djberg96 at gmail.com (Daniel Berger) Date: Thu, 18 Jun 2009 07:24:42 -0600 Subject: [Win32utils-devel] Implementing a TaskScheduler#exists? method In-Reply-To: References: <004a01c9eeba$e09cccf0$a1d666d0$@com> <005901c9eef9$d8d95940$8a8c0bc0$@com> <006701c9ef06$c74f8750$55ee95f0$@com> Message-ID: <00b001c9f018$250cd890$6f2689b0$@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 : > > > > > > > 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 Awesome! I've got it committed and I'm just doing some formatting on it and adding some RDoc. I'll try to get this out as soon as possible. Regards, Dan From djberg96 at gmail.com Thu Jun 18 19:04:24 2009 From: djberg96 at gmail.com (Daniel Berger) Date: Thu, 18 Jun 2009 17:04:24 -0600 Subject: [Win32utils-devel] Implementing a TaskScheduler#exists? method In-Reply-To: References: <004a01c9eeba$e09cccf0$a1d666d0$@com> <005901c9eef9$d8d95940$8a8c0bc0$@com> <006701c9ef06$c74f8750$55ee95f0$@com> Message-ID: <00d601c9f069$21170980$63451c80$@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 : > > > > > > > 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. Regards, Dan From phasis at gmail.com Thu Jun 18 20:36:36 2009 From: phasis at gmail.com (Heesob Park) Date: Fri, 19 Jun 2009 09:36:36 +0900 Subject: [Win32utils-devel] Implementing a TaskScheduler#exists? method In-Reply-To: <00d601c9f069$21170980$63451c80$@com> References: <004a01c9eeba$e09cccf0$a1d666d0$@com> <005901c9eef9$d8d95940$8a8c0bc0$@com> <006701c9ef06$c74f8750$55ee95f0$@com> <00d601c9f069$21170980$63451c80$@com> Message-ID: Hi, 2009/6/19 Daniel Berger : > > >> -----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 : >> > >> > >> >> > 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? Regards, Park Heesob From djberg96 at gmail.com Thu Jun 18 21:05:30 2009 From: djberg96 at gmail.com (Daniel Berger) Date: Thu, 18 Jun 2009 19:05:30 -0600 Subject: [Win32utils-devel] Implementing a TaskScheduler#exists? method In-Reply-To: References: <004a01c9eeba$e09cccf0$a1d666d0$@com> <005901c9eef9$d8d95940$8a8c0bc0$@com> <006701c9ef06$c74f8750$55ee95f0$@com> <00d601c9f069$21170980$63451c80$@com> Message-ID: <6037b70c0906181805r4b2dd9b3paad34e3bf8fa140@mail.gmail.com> On Thu, Jun 18, 2009 at 6:36 PM, Heesob Park wrote: > Hi, > > 2009/6/19 Daniel Berger : >> >> >>> -----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 : >>> > >>> > >>> >>> > 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 From djberg96 at gmail.com Thu Jun 18 21:22:06 2009 From: djberg96 at gmail.com (Daniel Berger) Date: Thu, 18 Jun 2009 19:22:06 -0600 Subject: [Win32utils-devel] Implementing a TaskScheduler#exists? method In-Reply-To: References: <004a01c9eeba$e09cccf0$a1d666d0$@com> <005901c9eef9$d8d95940$8a8c0bc0$@com> <006701c9ef06$c74f8750$55ee95f0$@com> <00d601c9f069$21170980$63451c80$@com> Message-ID: <00dd01c9f07c$5d21ffd0$1765ff70$@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 : > > > > > >> -----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 : > >> > > >> > > >> > >> > 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). Regards, Dan From phasis at gmail.com Thu Jun 18 22:49:18 2009 From: phasis at gmail.com (Heesob Park) Date: Fri, 19 Jun 2009 11:49:18 +0900 Subject: [Win32utils-devel] Implementing a TaskScheduler#exists? method In-Reply-To: <00dd01c9f07c$5d21ffd0$1765ff70$@com> References: <004a01c9eeba$e09cccf0$a1d666d0$@com> <005901c9eef9$d8d95940$8a8c0bc0$@com> <006701c9ef06$c74f8750$55ee95f0$@com> <00d601c9f069$21170980$63451c80$@com> <00dd01c9f07c$5d21ffd0$1765ff70$@com> Message-ID: 2009/6/19 Daniel Berger : > > >> -----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 : >> > >> > >> >> -----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 : >> >> > >> >> > >> >> >> >> > 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 checked the code works fine on Windows 2003. Also I confirmed the error you mentioned is same on Windows 7. The error means NewWorkItem returns null pointer. I guess TaskScheduler API is changed on Vista or higher version. Regards, Park Heesob From phasis at gmail.com Thu Jun 18 23:21:46 2009 From: phasis at gmail.com (Heesob Park) Date: Fri, 19 Jun 2009 12:21:46 +0900 Subject: [Win32utils-devel] Implementing a TaskScheduler#exists? method In-Reply-To: <00dd01c9f07c$5d21ffd0$1765ff70$@com> References: <004a01c9eeba$e09cccf0$a1d666d0$@com> <005901c9eef9$d8d95940$8a8c0bc0$@com> <006701c9ef06$c74f8750$55ee95f0$@com> <00d601c9f069$21170980$63451c80$@com> <00dd01c9f07c$5d21ffd0$1765ff70$@com> Message-ID: 2009/6/19 Daniel Berger : > > >> -----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 : >> > >> > >> >> -----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 : >> >> > >> >> > >> >> >> >> > 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. Refer to http://msdn.microsoft.com/en-us/magazine/cc163350.aspx Regards, Park Heesob From djberg96 at gmail.com Fri Jun 19 00:23:14 2009 From: djberg96 at gmail.com (Daniel Berger) Date: Thu, 18 Jun 2009 22:23:14 -0600 Subject: [Win32utils-devel] Implementing a TaskScheduler#exists? method In-Reply-To: References: <004a01c9eeba$e09cccf0$a1d666d0$@com> <005901c9eef9$d8d95940$8a8c0bc0$@com> <006701c9ef06$c74f8750$55ee95f0$@com> <00d601c9f069$21170980$63451c80$@com> <00dd01c9f07c$5d21ffd0$1765ff70$@com> Message-ID: <00de01c9f095$ab908ba0$02b1a2e0$@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 : > > > > > >> -----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 : > >> > > >> > > >> >> -----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 : > >> >> > > >> >> > > >> >> > >> >> > 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? Regards, Dan From phasis at gmail.com Fri Jun 19 01:05:10 2009 From: phasis at gmail.com (Heesob Park) Date: Fri, 19 Jun 2009 14:05:10 +0900 Subject: [Win32utils-devel] Implementing a TaskScheduler#exists? method In-Reply-To: <00de01c9f095$ab908ba0$02b1a2e0$@com> References: <004a01c9eeba$e09cccf0$a1d666d0$@com> <005901c9eef9$d8d95940$8a8c0bc0$@com> <006701c9ef06$c74f8750$55ee95f0$@com> <00d601c9f069$21170980$63451c80$@com> <00dd01c9f07c$5d21ffd0$1765ff70$@com> <00de01c9f095$ab908ba0$02b1a2e0$@com> Message-ID: 2009/6/19 Daniel Berger : > > >> -----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 : >> > >> > >> >> -----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 : >> >> > >> >> > >> >> >> -----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 : >> >> >> > >> >> >> > >> >> >> >> >> >> > 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 From phasis at gmail.com Fri Jun 19 04:36:03 2009 From: phasis at gmail.com (Heesob Park) Date: Fri, 19 Jun 2009 17:36:03 +0900 Subject: [Win32utils-devel] Implementing a TaskScheduler#exists? method In-Reply-To: <00de01c9f095$ab908ba0$02b1a2e0$@com> References: <004a01c9eeba$e09cccf0$a1d666d0$@com> <005901c9eef9$d8d95940$8a8c0bc0$@com> <006701c9ef06$c74f8750$55ee95f0$@com> <00d601c9f069$21170980$63451c80$@com> <00dd01c9f07c$5d21ffd0$1765ff70$@com> <00de01c9f095$ab908ba0$02b1a2e0$@com> Message-ID: 2009/6/19 Daniel Berger : > > >> -----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 : >> > >> > >> >> -----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 : >> >> > >> >> > >> >> >> -----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 : >> >> >> > >> >> >> > >> >> >> >> >> >> > 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? > Good news is Task Sheduler 2.0 fully supports Scripting. Thus an implementation using win32ole is easy. Here is a sample for enumerating tasks: #--------------------------------------------------------- # This sample enumerates through the tasks on the local computer and # displays their name and state. #--------------------------------------------------------- require 'win32ole' # Create the TaskService object. service = WIN32OLE.new("Schedule.Service") service.Connect() # Get the task folder that contains the tasks. rootFolder = service.GetFolder("\\") taskCollection = rootFolder.GetTasks(0) numberOfTasks = taskCollection.Count if numberOfTasks == 0 puts "No tasks are registered." else puts "Number of tasks registered: #{numberOfTasks}" taskCollection.each do |registeredTask| puts "Task Name: #{registeredTask.Name}" case registeredTask.State when "0" taskState = "Unknown" when "1" taskState = "Disabled" when "2" taskState = "Queued" when "3" taskState = "Ready" when "4" taskState = "Running" end puts " Task State: #{taskState}" end end Regards, Park Heesob From djberg96 at gmail.com Fri Jun 19 16:52:07 2009 From: djberg96 at gmail.com (Daniel Berger) Date: Fri, 19 Jun 2009 14:52:07 -0600 Subject: [Win32utils-devel] Implementing a TaskScheduler#exists? method In-Reply-To: References: <004a01c9eeba$e09cccf0$a1d666d0$@com> <005901c9eef9$d8d95940$8a8c0bc0$@com> <006701c9ef06$c74f8750$55ee95f0$@com> <00d601c9f069$21170980$63451c80$@com> <00dd01c9f07c$5d21ffd0$1765ff70$@com> <00de01c9f095$ab908ba0$02b1a2e0$@com> Message-ID: <00ee01c9f11f$d1624b90$7426e2b0$@com> Hi, > > Ok, how would you like to proceed? Should I release the current (pure > Ruby) code with a warning regarding Vista or later? Or wait? > > > Good news is Task Sheduler 2.0 fully supports Scripting. > Thus an implementation using win32ole is easy. > > Here is a sample for enumerating tasks: > > #--------------------------------------------------------- > # This sample enumerates through the tasks on the local computer and > # displays their name and state. > #--------------------------------------------------------- > require 'win32ole' > > # Create the TaskService object. > service = WIN32OLE.new("Schedule.Service") > service.Connect() > > # Get the task folder that contains the tasks. > rootFolder = service.GetFolder("\\") > > taskCollection = rootFolder.GetTasks(0) > > numberOfTasks = taskCollection.Count > > if numberOfTasks == 0 > puts "No tasks are registered." > else > puts "Number of tasks registered: #{numberOfTasks}" > > taskCollection.each do |registeredTask| > puts "Task Name: #{registeredTask.Name}" > > case registeredTask.State > when "0" > taskState = "Unknown" > when "1" > taskState = "Disabled" > when "2" > taskState = "Queued" > when "3" > taskState = "Ready" > when "4" > taskState = "Running" > end > > puts " Task State: #{taskState}" > end > end Ok, cool. I went ahead and released 0.2.0 without Vista support for now. Version 0.3.0 will support Vista and use win32ole behind the scenes. Regards, Dan From phasis at gmail.com Fri Jun 19 23:42:12 2009 From: phasis at gmail.com (Heesob Park) Date: Sat, 20 Jun 2009 12:42:12 +0900 Subject: [Win32utils-devel] Implementing a TaskScheduler#exists? method In-Reply-To: <00ee01c9f11f$d1624b90$7426e2b0$@com> References: <004a01c9eeba$e09cccf0$a1d666d0$@com> <006701c9ef06$c74f8750$55ee95f0$@com> <00d601c9f069$21170980$63451c80$@com> <00dd01c9f07c$5d21ffd0$1765ff70$@com> <00de01c9f095$ab908ba0$02b1a2e0$@com> <00ee01c9f11f$d1624b90$7426e2b0$@com> Message-ID: HI, 2009/6/20 Daniel Berger : > Hi, > > > >> > Ok, how would you like to proceed? Should I release the current (pure >> Ruby) code with a warning regarding Vista or later? Or wait? >> > >> Good news is Task Sheduler 2.0 fully supports Scripting. >> Thus an implementation using win32ole is easy. >> >> Here is a sample for enumerating tasks: >> >> #--------------------------------------------------------- >> # This sample enumerates through the tasks on the local computer and >> # displays their name and state. >> #--------------------------------------------------------- >> require 'win32ole' >> >> # Create the TaskService object. >> service = ?WIN32OLE.new("Schedule.Service") >> service.Connect() >> >> # Get the task folder that contains the tasks. >> rootFolder = service.GetFolder("\\") >> >> taskCollection = rootFolder.GetTasks(0) >> >> numberOfTasks = taskCollection.Count >> >> if numberOfTasks == 0 >> ? ? puts "No tasks are registered." >> else >> ? ? puts "Number of tasks registered: #{numberOfTasks}" >> >> ? ? taskCollection.each do |registeredTask| >> ? ? ? ? puts "Task Name: #{registeredTask.Name}" >> >> ? ? ? ? case registeredTask.State >> ? ? ? ? ? ? when "0" >> ? ? ? ? ? ? ? ? taskState = "Unknown" >> ? ? ? ? ? ? when "1" >> ? ? ? ? ? ? ? ? taskState = "Disabled" >> ? ? ? ? ? ? when "2" >> ? ? ? ? ? ? ? ? taskState = "Queued" >> ? ? ? ? ? ? when "3" >> ? ? ? ? ? ? ? ? taskState = "Ready" >> ? ? ? ? ? ? when "4" >> ? ? ? ? ? ? ? ? taskState = "Running" >> ? ? ? ? end >> >> ? ? ? ? puts " ? ?Task State: #{taskState}" >> ? ? end >> ? end > > Ok, cool. I went ahead and released 0.2.0 without Vista support for now. Version 0.3.0 will support Vista and use win32ole behind the scenes. > Ok, I made taskscheduler version 2.0 and it is available at http://121.78.227.9/win32-taskscheduler/taskscheduler2.rb As you know, some operations need Administration right and some operations need password. Regards, Park Heesob From djberg96 at gmail.com Sun Jun 21 23:46:42 2009 From: djberg96 at gmail.com (Daniel Berger) Date: Sun, 21 Jun 2009 21:46:42 -0600 Subject: [Win32utils-devel] No more anonymous tracker posts Message-ID: <015401c9f2ec$10580f60$31082e20$@com> All, Just a quick note. Due to some recent spam on the trackers I no longer allow anonymous tracker posts. So, if anyone ever asks, you'll know why. Regards, Dan From djberg96 at gmail.com Wed Jun 24 12:25:27 2009 From: djberg96 at gmail.com (Daniel Berger) Date: Wed, 24 Jun 2009 10:25:27 -0600 Subject: [Win32utils-devel] Possible problem with msvcrt vs msvcrXX Message-ID: <01b901c9f4e8$641c0e00$2c542a00$@com> Hi, I tried this with a version of Ruby I built with VC++ 2008: irb(main):005:0> strlen = API.new('strlen', 'P', 'L', 'msvcrt') => # irb(main):006:0> strlen = API.new('strlen', 'P', 'L', 'msvcr90') Win32::API::LoadLibraryError: LoadLibrary() function failed for 'msvcr90': The specified module could not be found. from (irb):6:in `initialize' from (irb):6:in `new' from (irb):6 Do I have an environment issue? Do we need to revisit windows-api with regards to how it sets MSVCRT_DLL? Regards, Dan From phasis at gmail.com Wed Jun 24 21:28:13 2009 From: phasis at gmail.com (Heesob Park) Date: Thu, 25 Jun 2009 10:28:13 +0900 Subject: [Win32utils-devel] Possible problem with msvcrt vs msvcrXX In-Reply-To: <01b901c9f4e8$641c0e00$2c542a00$@com> References: <01b901c9f4e8$641c0e00$2c542a00$@com> Message-ID: Hi, 2009/6/25 Daniel Berger : > Hi, > > I tried this with a version of Ruby I built with VC++ 2008: > > irb(main):005:0> strlen = API.new('strlen', 'P', 'L', 'msvcrt') > => # > > irb(main):006:0> strlen = API.new('strlen', 'P', 'L', 'msvcr90') > Win32::API::LoadLibraryError: LoadLibrary() function failed for 'msvcr90': > The specified module could not be found. > ? ? ? ?from (irb):6:in `initialize' > ? ? ? ?from (irb):6:in `new' > ? ? ? ?from (irb):6 > > Do I have an environment issue? Do we need to revisit windows-api with > regards to how it sets MSVCRT_DLL? > I remember I saw almost same issue a few years ago :) MSVCR90.dll is not installed in system32, but in the side-by-side folder, hence the manifest is required. Create 'ruby.exe.manifest' in the ruby's bin folder like this: mt -inputresource:ruby.exe;2 -out:ruby.exe.manifest Regards, Park Heesob From djberg96 at gmail.com Wed Jun 24 22:49:06 2009 From: djberg96 at gmail.com (Daniel Berger) Date: Wed, 24 Jun 2009 20:49:06 -0600 Subject: [Win32utils-devel] Possible problem with msvcrt vs msvcrXX In-Reply-To: References: <01b901c9f4e8$641c0e00$2c542a00$@com> Message-ID: <01d501c9f53f$83e07580$8ba16080$@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 24, 2009 7:28 PM > To: Development and ideas for win32utils projects > Subject: Re: [Win32utils-devel] Possible problem with msvcrt vs msvcrXX > > Hi, > > 2009/6/25 Daniel Berger : > > Hi, > > > > I tried this with a version of Ruby I built with VC++ 2008: > > > > irb(main):005:0> strlen = API.new('strlen', 'P', 'L', 'msvcrt') > > => # > > > > irb(main):006:0> strlen = API.new('strlen', 'P', 'L', 'msvcr90') > > Win32::API::LoadLibraryError: LoadLibrary() function failed for > 'msvcr90': > > The specified module could not be found. > > from (irb):6:in `initialize' > > from (irb):6:in `new' > > from (irb):6 > > > > Do I have an environment issue? Do we need to revisit windows-api > with > > regards to how it sets MSVCRT_DLL? > > > I remember I saw almost same issue a few years ago :) > > MSVCR90.dll is not installed in system32, but in the side-by-side > folder, hence the manifest is required. > > Create 'ruby.exe.manifest' in the ruby's bin folder like this: > mt -inputresource:ruby.exe;2 -out:ruby.exe.manifest The ruby.exe.manifest *does* exist. I checked. It's also checked in the windows-api code: # With Microsoft Visual C++ 8 and later users should use the associated # DLL instead of msvcrt directly, if possible. if CONFIG['host_os'].split('_')[1] if CONFIG['host_os'].split('_')[1].to_i >= 80 && File.exists?(File.join(CONFIG['bindir'], 'ruby.exe.manifest')) then MSVCRT_DLL = 'msvcr' + CONFIG['host_os'].split('_')[1] else MSVCRT_DLL = 'msvcrt' end else MSVCRT_DLL = 'msvcrt' end Regards, Dan From phasis at gmail.com Wed Jun 24 23:19:46 2009 From: phasis at gmail.com (Heesob Park) Date: Thu, 25 Jun 2009 12:19:46 +0900 Subject: [Win32utils-devel] Possible problem with msvcrt vs msvcrXX In-Reply-To: <01d501c9f53f$83e07580$8ba16080$@com> References: <01b901c9f4e8$641c0e00$2c542a00$@com> <01d501c9f53f$83e07580$8ba16080$@com> Message-ID: Hi, 2009/6/25 Daniel Berger : > > >> -----Original Message----- >> From: win32utils-devel-bounces at rubyforge.org [mailto:win32utils-devel- >> bounces at rubyforge.org] On Behalf Of Heesob Park >> Sent: Wednesday, June 24, 2009 7:28 PM >> To: Development and ideas for win32utils projects >> Subject: Re: [Win32utils-devel] Possible problem with msvcrt vs msvcrXX >> >> Hi, >> >> 2009/6/25 Daniel Berger : >> > Hi, >> > >> > I tried this with a version of Ruby I built with VC++ 2008: >> > >> > irb(main):005:0> strlen = API.new('strlen', 'P', 'L', 'msvcrt') >> > => # >> > >> > irb(main):006:0> strlen = API.new('strlen', 'P', 'L', 'msvcr90') >> > Win32::API::LoadLibraryError: LoadLibrary() function failed for >> 'msvcr90': >> > The specified module could not be found. >> > ? ? ? ?from (irb):6:in `initialize' >> > ? ? ? ?from (irb):6:in `new' >> > ? ? ? ?from (irb):6 >> > >> > Do I have an environment issue? Do we need to revisit windows-api >> with >> > regards to how it sets MSVCRT_DLL? >> > >> I remember I saw almost same issue a few years ago :) >> >> MSVCR90.dll is not installed in system32, but in the side-by-side >> folder, hence the manifest is required. >> >> Create 'ruby.exe.manifest' in the ruby's bin folder like this: >> mt -inputresource:ruby.exe;2 -out:ruby.exe.manifest > > The ruby.exe.manifest *does* exist. I checked. It's also checked in the windows-api code: > > ? # With Microsoft Visual C++ 8 and later users should use the associated > ? # DLL instead of msvcrt directly, if possible. > ? if CONFIG['host_os'].split('_')[1] > ? ? ?if CONFIG['host_os'].split('_')[1].to_i >= 80 && > ? ? ? ? File.exists?(File.join(CONFIG['bindir'], 'ruby.exe.manifest')) > ? ? ?then > ? ? ? ? MSVCRT_DLL = 'msvcr' + CONFIG['host_os'].split('_')[1] > ? ? ?else > ? ? ? ? MSVCRT_DLL = 'msvcrt' > ? ? ?end > ? else > ? ? ?MSVCRT_DLL = 'msvcrt' > ? end > Did you install ruby binary and Microsoft Visual C++ 8 on the same computer? If not, Microsoft.VC90.CRT.manifest and msvcr90.dll must exist on the ruby bin folder. Regards, Park Heesob From djberg96 at gmail.com Thu Jun 25 00:11:13 2009 From: djberg96 at gmail.com (Daniel Berger) Date: Wed, 24 Jun 2009 22:11:13 -0600 Subject: [Win32utils-devel] Possible problem with msvcrt vs msvcrXX In-Reply-To: References: <01b901c9f4e8$641c0e00$2c542a00$@com> <01d501c9f53f$83e07580$8ba16080$@com> Message-ID: <01d801c9f54a$fc972a40$f5c57ec0$@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 24, 2009 9:20 PM > To: Development and ideas for win32utils projects > Subject: Re: [Win32utils-devel] Possible problem with msvcrt vs msvcrXX > > Hi, > > 2009/6/25 Daniel Berger : > > > > > >> -----Original Message----- > >> From: win32utils-devel-bounces at rubyforge.org [mailto:win32utils- > devel- > >> bounces at rubyforge.org] On Behalf Of Heesob Park > >> Sent: Wednesday, June 24, 2009 7:28 PM > >> To: Development and ideas for win32utils projects > >> Subject: Re: [Win32utils-devel] Possible problem with msvcrt vs > msvcrXX > >> > >> Hi, > >> > >> 2009/6/25 Daniel Berger : > >> > Hi, > >> > > >> > I tried this with a version of Ruby I built with VC++ 2008: > >> > > >> > irb(main):005:0> strlen = API.new('strlen', 'P', 'L', 'msvcrt') > >> > => # > >> > > >> > irb(main):006:0> strlen = API.new('strlen', 'P', 'L', 'msvcr90') > >> > Win32::API::LoadLibraryError: LoadLibrary() function failed for > >> 'msvcr90': > >> > The specified module could not be found. > >> > from (irb):6:in `initialize' > >> > from (irb):6:in `new' > >> > from (irb):6 > >> > > >> > Do I have an environment issue? Do we need to revisit windows-api > >> with > >> > regards to how it sets MSVCRT_DLL? > >> > > >> I remember I saw almost same issue a few years ago :) > >> > >> MSVCR90.dll is not installed in system32, but in the side-by-side > >> folder, hence the manifest is required. > >> > >> Create 'ruby.exe.manifest' in the ruby's bin folder like this: > >> mt -inputresource:ruby.exe;2 -out:ruby.exe.manifest > > > > The ruby.exe.manifest *does* exist. I checked. It's also checked in > the windows-api code: > > > > # With Microsoft Visual C++ 8 and later users should use the > associated > > # DLL instead of msvcrt directly, if possible. > > if CONFIG['host_os'].split('_')[1] > > if CONFIG['host_os'].split('_')[1].to_i >= 80 && > > File.exists?(File.join(CONFIG['bindir'], > 'ruby.exe.manifest')) > > then > > MSVCRT_DLL = 'msvcr' + CONFIG['host_os'].split('_')[1] > > else > > MSVCRT_DLL = 'msvcrt' > > end > > else > > MSVCRT_DLL = 'msvcrt' > > end > > > Did you install ruby binary and Microsoft Visual C++ 8 on the same > computer? Yes. > If not, Microsoft.VC90.CRT.manifest and msvcr90.dll must exist on the > ruby bin folder. I must have a path issue. Regards, Dan From phasis at gmail.com Thu Jun 25 00:45:52 2009 From: phasis at gmail.com (Heesob Park) Date: Thu, 25 Jun 2009 13:45:52 +0900 Subject: [Win32utils-devel] Possible problem with msvcrt vs msvcrXX In-Reply-To: <01d801c9f54a$fc972a40$f5c57ec0$@com> References: <01b901c9f4e8$641c0e00$2c542a00$@com> <01d501c9f53f$83e07580$8ba16080$@com> <01d801c9f54a$fc972a40$f5c57ec0$@com> Message-ID: 2009/6/25 Daniel Berger : > >> > The ruby.exe.manifest *does* exist. I checked. It's also checked in >> the windows-api code: >> > >> > ? # With Microsoft Visual C++ 8 and later users should use the >> associated >> > ? # DLL instead of msvcrt directly, if possible. >> > ? if CONFIG['host_os'].split('_')[1] >> > ? ? ?if CONFIG['host_os'].split('_')[1].to_i >= 80 && >> > ? ? ? ? File.exists?(File.join(CONFIG['bindir'], >> 'ruby.exe.manifest')) >> > ? ? ?then >> > ? ? ? ? MSVCRT_DLL = 'msvcr' + CONFIG['host_os'].split('_')[1] >> > ? ? ?else >> > ? ? ? ? MSVCRT_DLL = 'msvcrt' >> > ? ? ?end >> > ? else >> > ? ? ?MSVCRT_DLL = 'msvcrt' >> > ? end >> > >> Did you install ruby binary and Microsoft Visual C++ 8 on the same >> computer? > > Yes. > >> If not, Microsoft.VC90.CRT.manifest and msvcr90.dll must exist on the >> ruby bin folder. > > I must have a path issue. > That's odd. Did you build ruby with non default compiler option? Both ruby.exe and msvcr90-ruby18.dll have dependency with msvcr90.dll. You can check with "dumpbin /imports ruby.exe" If you have a path issue, ruby.exe and irb should failed to run. Regards, Park Heesob From waldo1979 at gmail.com Fri Jun 26 02:53:55 2009 From: waldo1979 at gmail.com (Robert Clugston) Date: Thu, 25 Jun 2009 23:53:55 -0700 Subject: [Win32utils-devel] Debugging Segmentation Faults Message-ID: <30A6915F-F438-409F-91DB-5F3AD8200631@gmail.com> All, I'm attempting to perform a remote registry query using win32- api. For some reason the last call to "RegQueryValueEx" is causing a segmentation fault. Any suggestions on how to resolve and/or debug this issue? >ruby win32.rb win32.rb:127: [BUG] Segmentation fault ruby 1.8.6 (2008-08-11) [i386-mswin32] This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information. >Exit code: 3 require "win32/api" require "windows/registry" include Win32 require "dl" class Win32APIExample def initialize @aKEY_QUERY_VALUE = 0x1 @aKEY_SET_VALUE = 0x2 @aKEY_ALL_ACCESS = 0x3 end def remotereg machine = "\\\\myhost" #http://support.microsoft.com/kb/315586 ############################ ## Connect to the remote registry service #RegConnectRegistry # http://msdn.microsoft.com/en-us/library/ms724840(VS. 85).aspx phkResult = 0.chr * 4 regConnectRegistry = API.new('RegConnectRegistry','PLP','L','advapi32') returncode = regConnectRegistry.call(machine, Windows::Registry::HKEY_LOCAL_MACHINE, phkResult) if returncode != Windows::Error::ERROR_SUCCESS puts "AN ERROR OCCURRED" return end phkResult = phkResult.unpack('L').first ########################### ## Open a handle to the specified Registry node #RegOpenKeyEx #http://msdn.microsoft.com/en-us/library/ms724897(VS.85).aspx hKey = 0.chr * 4 regOpenKeyEx = API.new('RegOpenKeyEx','PSLLP','L','advapi32') returncode = regOpenKeyEx.call(phkResult,"HARDWARE\ \DESCRIPTION\\System",0, at aKEY_QUERY_VALUE, hKey) if returncode != Windows::Error::ERROR_SUCCESS puts "AN ERROR OCCURRED" return end hKey = hKey.unpack('L').first ########################### ## GET the value of the specificed registry key #RegQueryValueEx #http://msdn.microsoft.com/en-us/library/ms724911(VS.85).aspx lpData = 0.chr * 8192 lpcbData = [lpData.length].pack('L') regQueryValueEx = API.new(' ','PSVLPP','L','advapi32') returncode = regQueryValueEx.call(hKey, "SystemBIOSVersion", nil, Windows::Registry::REG_MULTI_SZ, lpData, lpcbData) end end if __FILE__ == $0 b = Win32APIExample.new() puts b.remotereg end From phasis at gmail.com Fri Jun 26 03:28:57 2009 From: phasis at gmail.com (Heesob Park) Date: Fri, 26 Jun 2009 16:28:57 +0900 Subject: [Win32utils-devel] Debugging Segmentation Faults In-Reply-To: <30A6915F-F438-409F-91DB-5F3AD8200631@gmail.com> References: <30A6915F-F438-409F-91DB-5F3AD8200631@gmail.com> Message-ID: Hi, 2009/6/26 Robert Clugston : > All, I'm attempting to perform a remote registry query using win32-api. For > some reason the last call to "RegQueryValueEx" is causing a segmentation > fault. Any suggestions on how to resolve and/or debug this issue? > >>ruby win32.rb > win32.rb:127: [BUG] Segmentation fault > ruby 1.8.6 (2008-08-11) [i386-mswin32] > > > This application has requested the Runtime to terminate it in an unusual > way. > Please contact the application's support team for more information. >>Exit code: 3 > > > require "win32/api" > require "windows/registry" > include Win32 > require "dl" > > class Win32APIExample > ? ? ? ?def initialize > ? ? ? ? ? ?@aKEY_QUERY_VALUE = 0x1 > ? ? ? ? ? ?@aKEY_SET_VALUE = 0x2 > ? ? ? ? ? ?@aKEY_ALL_ACCESS = 0x3 > ? ? ? ?end > > ? ? ? ?def remotereg > ? ? ? ? ?machine = "\\\\myhost" > > ? ? ? ? ?#http://support.microsoft.com/kb/315586 > > ? ? ? ? ?############################ > ? ? ? ? ?## Connect to the remote registry service > ? ? ? ? ?#RegConnectRegistry > ? ? ? ? ?# http://msdn.microsoft.com/en-us/library/ms724840(VS.85).aspx > ? ? ? ? ?phkResult = 0.chr * 4 > ? ? ? ? ?regConnectRegistry = > API.new('RegConnectRegistry','PLP','L','advapi32') > ? ? ? ? ?returncode = regConnectRegistry.call(machine, > Windows::Registry::HKEY_LOCAL_MACHINE, phkResult) > > ? ? ? ? ?if returncode != Windows::Error::ERROR_SUCCESS > ? ? ? ? ? ?puts "AN ERROR OCCURRED" > ? ? ? ? ? ?return > ? ? ? ? ?end > > ? ? ? ? ?phkResult = phkResult.unpack('L').first > > ? ? ? ? ?########################### > ? ? ? ? ?## Open a handle to the specified Registry node > ? ? ? ? ?#RegOpenKeyEx > ? ? ? ? ?#http://msdn.microsoft.com/en-us/library/ms724897(VS.85).aspx > ? ? ? ? ?hKey = 0.chr * 4 > ? ? ? ? ?regOpenKeyEx = API.new('RegOpenKeyEx','PSLLP','L','advapi32') > ? ? ? ? ?returncode = > regOpenKeyEx.call(phkResult,"HARDWARE\\DESCRIPTION\\System",0, at aKEY_QUERY_VALUE, > hKey) > > ? ? ? ? ?if returncode != Windows::Error::ERROR_SUCCESS > ? ? ? ? ? ?puts "AN ERROR OCCURRED" > ? ? ? ? ? ?return > ? ? ? ? ?end > > ? ? ? ? ?hKey = hKey.unpack('L').first > > > ? ? ? ? ?########################### > ? ? ? ? ?## GET the value of the specificed registry key > ? ? ? ? ?#RegQueryValueEx > ? ? ? ? ?#http://msdn.microsoft.com/en-us/library/ms724911(VS.85).aspx > ? ? ? ? ?lpData = 0.chr * 8192 > ? ? ? ? ?lpcbData = [lpData.length].pack('L') > > ? ? ? ? ?regQueryValueEx = API.new(' ? ','PSVLPP','L','advapi32') > ? ? ? ? ?returncode = regQueryValueEx.call(hKey, "SystemBIOSVersion", nil, > Windows::Registry::REG_MULTI_SZ, lpData, lpcbData) > > ? ? ? ?end > end > > if __FILE__ == $0 > ? ? ? ?b = Win32APIExample.new() > ? ? ? ?puts b.remotereg > end > The 4th parameter is not an input but a ouput parameter. The following line regQueryValueEx = API.new(' ','PSVLPP','L','advapi32') returncode = regQueryValueEx.call(hKey, "SystemBIOSVersion", nil, Windows::Registry::REG_MULTI_SZ, lpData, lpcbData) should be regQueryValueEx = API.new('RegQueryValueEx','PSPPPP','L','advapi32') returncode = regQueryValueEx.call(hKey, "SystemBIOSVersion", nil, nil, lpData, lpcbData) lpData[0,lpcbData.unpack('L').first].strip Regards, Park Heesob From pawlowski at vivisimo.com Mon Jun 29 14:39:29 2009 From: pawlowski at vivisimo.com (Peter Pawlowski) Date: Mon, 29 Jun 2009 14:39:29 -0400 Subject: [Win32utils-devel] building ruby 1.8.7 in windows 64-bit environment? Message-ID: <4A490A61.80601@vivisimo.com> Hello, I'm having difficulty in trying to figure out how to handle building ruby in a 64-bit Windows environment. So far I have been able to build ruby in Windows using nmake on the command line. I have played with 1.8.7 and 1.9.1. Version 1.9.1 seems to support building with a target platform of 64-bit Windows, however 1.8.7 does not. So, one possible solution for me is to use ruby 1.9.1. The problem is that I need to run rails and some other common gems, but these don't seem to support 1.9.1 yet. I need to compile in 64-bit mode because I am integrating this into a much larger software platform that is all built in 64-bit. There isn't really a way to work around this. Can anyone help with an idea of whether or not this is possible? Or references to information I can find elsewhere? One thread I was able to find on this mailing list was helpful, pointing to the fact that the 64-bit compiler doesn't support __asm directives: http://rubyforge.org/pipermail/win32utils-devel/2008-November/001304.html I haven't been able to find much useful information on the web about this issue (maybe I'm not searching for the right things?), so any help you might be able to provide would be extremely useful. thanks so much, Peter Pawlowski From luislavena at gmail.com Mon Jun 29 17:41:50 2009 From: luislavena at gmail.com (Luis Lavena) Date: Mon, 29 Jun 2009 18:41:50 -0300 Subject: [Win32utils-devel] building ruby 1.8.7 in windows 64-bit environment? In-Reply-To: <4A490A61.80601@vivisimo.com> References: <4A490A61.80601@vivisimo.com> Message-ID: <71166b3b0906291441o223d6640n8f8ab80a895e4de4@mail.gmail.com> On Mon, Jun 29, 2009 at 3:39 PM, Peter Pawlowski wrote: > Hello, > > I'm having difficulty in trying to figure out how to handle building ruby in > a 64-bit Windows environment. > 1.8.x will not build on 64bits Windows, that was Ruby-core answer about it. Only 1.9 is prepared to handled 64bits properly. > So far I have been able to build ruby in Windows using nmake on the command > line. I have played with 1.8.7 and 1.9.1. > > Version 1.9.1 seems to support building with a target platform of 64-bit > Windows, however 1.8.7 does not. So, one possible solution for me is to use > ruby 1.9.1. The problem is that I need to run rails and some other common > gems, but these don't seem to support 1.9.1 yet. > See above answer. > I need to compile in 64-bit mode because I am integrating this into a much > larger software platform that is all built in 64-bit. There isn't really a > way to work around this. > Well, that is not 100% true. Unless you need to load ruby as DLL from a 64bits process, you're not forced to have Ruby as 64bits, 32bits process can run side-by-side thanks to SysWOW64. > Can anyone help with an idea of whether or not this is possible? > Not possible for 1.8 line of code. > Or references to information I can find elsewhere? Search at ruby-core, this was raised a few months ago. > One thread I was able to find on this mailing list was helpful, pointing to > the fact that the 64-bit compiler doesn't support __asm directives: > > http://rubyforge.org/pipermail/win32utils-devel/2008-November/001304.html > > > I haven't been able to find much useful information on the web about this > issue (maybe I'm not searching for the right things?), so any help you might > be able to provide would be extremely useful. No, there isn't much information, sorry. Please review my statement before about 32bits running side-by-side with 64bits. Unless you need to certificate 64bits installers (for Windows Logo) or calling ruby as library form 64bits process, then you don't need 64bits Ruby. > > thanks so much, > > Peter Pawlowski Regards, -- Luis Lavena AREA 17 - Perfection in design is achieved not when there is nothing more to add, but rather when there is nothing more to take away. Antoine de Saint-Exup?ry From djberg96 at gmail.com Tue Jun 30 20:51:57 2009 From: djberg96 at gmail.com (Daniel Berger) Date: Tue, 30 Jun 2009 18:51:57 -0600 Subject: [Win32utils-devel] win32-service 0.7.0 Message-ID: <6037b70c0906301751m1a224bf8vf93ee1bcfc6b9c3c@mail.gmail.com> Hi all, Just a quick heads up that I'll be releasing win32-service 0.7.0 tonight. I bumped the version because of an interface change I made to Service.create and Service.configure. There were bug fixes for both daemon.c and service.rb, too. However, I have still not converted the Daemon class to pure Ruby. I haven't forgotten the code you wrote Heesob, or the issues that Patrick and Luis brought up. I just want to get this release out before I start converting the code. I'm also still debating whether or not we should declare 1.9.x and/or JRuby as the required implementation. Regards, Dan