Daniel Berger
2010-Feb-07 18:09 UTC
[Win32utils-devel] Need a second pair of eyes for controls_accepted in win32-service
Hi, I''m getting bad results for the controls_accepted results in win32-service for the ServiceInfo struct, and I''m not sure why, even after I thought I fixed this (previously it always returned nil). Please checkout the latest code from github. For example: require ''win32/service'' include Win32 Service.services{ |s| next unless s.service_name == ''W32Time'' p s.controls_accepted } That returns: ["netbind change", "param change", "pause continue", "shutdown", "stop", "hardware profile change", "power event", "interrogate"] However, W32Time cannot be paused/resumed, so the ''pause continue'' result (among others I suspect) is bogus. Any ideas why? It''s probably something simple, but I''m not getting it. Regards, Dan
Heesob Park
2010-Feb-08 01:16 UTC
[Win32utils-devel] Need a second pair of eyes for controls_accepted in win32-service
Hi Dan, 2010/2/8 Daniel Berger <djberg96 at gmail.com>:> Hi, > > I''m getting bad results for the controls_accepted results in win32-service > for the ServiceInfo struct, and I''m not sure why, even after I thought I > fixed this (previously it always returned nil). Please checkout the latest > code from github. > > For example: > > require ''win32/service'' > include Win32 > > Service.services{ |s| > ?next unless s.service_name == ''W32Time'' > ?p s.controls_accepted > } > > That returns: > > ["netbind change", "param change", "pause continue", "shutdown", "stop", > "hardware profile change", "power event", "interrogate"] > > However, W32Time cannot be paused/resumed, so the ''pause continue'' result > (among others I suspect) is bogus. > > Any ideas why? It''s probably something simple, but I''m not getting it. >You must need some sleep :) You should use SERVICE_ACCEPT_PAUSE_CONTINUE instead of SERVICE_PAUSE_CONTINUE. The line #1220 if controls & SERVICE_PAUSE_CONTINUE> 0 should be if controls & SERVICE_ACCEPT_PAUSE_CONTINUE > 0 Also, the line #1548 - 1550 if controls & SERVICE_CONTROL_INTERROGATE > 0 array << ''interrogate'' end shoud be removed. Regards, Park Heesob
Daniel Berger
2010-Feb-08 05:39 UTC
[Win32utils-devel] Need a second pair of eyes for controls_accepted in win32-service
On Sun, Feb 7, 2010 at 6:16 PM, Heesob Park <phasis at gmail.com> wrote:> Hi Dan, > > 2010/2/8 Daniel Berger <djberg96 at gmail.com>: >> Hi, >> >> I''m getting bad results for the controls_accepted results in win32-service >> for the ServiceInfo struct, and I''m not sure why, even after I thought I >> fixed this (previously it always returned nil). Please checkout the latest >> code from github. >> >> For example: >> >> require ''win32/service'' >> include Win32 >> >> Service.services{ |s| >> ?next unless s.service_name == ''W32Time'' >> ?p s.controls_accepted >> } >> >> That returns: >> >> ["netbind change", "param change", "pause continue", "shutdown", "stop", >> "hardware profile change", "power event", "interrogate"] >> >> However, W32Time cannot be paused/resumed, so the ''pause continue'' result >> (among others I suspect) is bogus. >> >> Any ideas why? It''s probably something simple, but I''m not getting it. >> > You must need some sleep :) > > You should use SERVICE_ACCEPT_PAUSE_CONTINUE instead of SERVICE_PAUSE_CONTINUE. > The line #1220 > ? ? ?if controls & SERVICE_PAUSE_CONTINUE> 0 > should be > ? ? ?if controls & SERVICE_ACCEPT_PAUSE_CONTINUE > 0Thanks! Silly me.> Also, the line #1548 - 1550 > ? ? ?if controls & SERVICE_CONTROL_INTERROGATE > 0 > ? ? ? ?array << ''interrogate'' > ? ? ?end > shoud be removed.Ok. It''s not really a control and pretty much every service can be interrogated anyway, right? Changes applied in git. Thanks, Dan