Skip to content

Issue with W32Service.stopService() #797

@googol4u

Description

@googol4u

Thanks for develop such a great tool for java native bindings.

However, I have found a issue in W32Service.stopService(). In my scenario, when I use W32Service.stopService() to stop one of my windows services, it throws Unable to stop service exception. Digging into the issue, I find that in my scenario, When Advapi32.INSTANCE.ControlService(handle, Winsvc.SERVICE_CONTROL_STOP, new Winsvc.SERVICE_STATUS()) is called, the dwCurrentState of the service is not changed to SERVICE_STOP_PENDING but still is SERVICE_RUNNING. So, the waitForNonPendingState() will return immediately and queryStatus().dwCurrentState != Winsvc.SERVICE_STOPPED will be true.
Therefore, the Unable to stop service excepiton will be throwed.

My System is Windows 8.1.

  1. Version of JNA and related jars: 4.4.0
  2. oracle jdk 1.8.0_121
  3. Windows 8.1
  4. Intel64 Family 6 Model 61 Stepping 4 GenuineIntel ~1601 Mhz, JVM 32bit
  5. Complete description of the problem(see the above)
  6. Steps to reproduce ( see the above )

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions