[Win32utils-devel] Need a second pair of eyes for controls_accepted in win32-service

Heesob Park phasis at gmail.com
Sun Feb 7 20:16:21 EST 2010


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


More information about the win32utils-devel mailing list