Winsvc (JNA API)
Description: declaration: package: com.sun.jna.platform.win32, interface: Winsvc

Package com.sun.jna.platform.win32

# Interface Winsvc

public interface Winsvc
This module defines the 32-Bit Windows types and constants that are defined by NT, but exposed through the Win32 API. Ported from Winsvc.h. Microsoft Windows SDK 7.0A.

Author:
  EugineLev

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Interface
  Description
  `static class`
  `Winsvc.ChangeServiceConfig2Info`
  `static class`
  `Winsvc.ENUM_SERVICE_STATUS`
  Contains the name of a service in a service control manager database and information about that service.
  `static class`
  `Winsvc.ENUM_SERVICE_STATUS_PROCESS`
  Contains the name of a service in a service control manager database and information about the service.
  `static interface`
  `Winsvc.Handler`
  An application-defined callback function used with the RegisterServiceCtrlHandler function.
  `static interface`
  `Winsvc.HandlerEx`
  An application-defined callback function used with the RegisterServiceCtrlHandlerEx function.
  `static class`
  `Winsvc.SC_ACTION`
  Represents an action that the service control manager can perform.
  `static class`
  `Winsvc.SC_HANDLE`
  `static class`
  `Winsvc.SC_STATUS_TYPE`
  The SC_STATUS_TYPE enumeration type contains values
  `static class`
  `Winsvc.SERVICE_DESCRIPTION`
  Contains a service description.
  `static class`
  `Winsvc.SERVICE_FAILURE_ACTIONS`
  Represents the action the service controller should take on each failure of a service.
  `static class`
  `Winsvc.SERVICE_FAILURE_ACTIONS_FLAG`
  Contains the failure actions flag setting of a service.
  `static interface`
  `Winsvc.SERVICE_MAIN_FUNCTION`
  The entry point for a service.
  `static class`
  `Winsvc.SERVICE_STATUS`
  Contains status information for a service.
  `static class`
  `Winsvc.SERVICE_STATUS_HANDLE`
  `static class`
  `Winsvc.SERVICE_STATUS_PROCESS`
  Contains process status information for a service.
  `static class`
  `Winsvc.SERVICE_TABLE_ENTRY`
  Specifies the ServiceMain function for a service that can run in the calling process.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final int`
  `SC_ACTION_NONE`
  `static final int`
  `SC_ACTION_REBOOT`
  `static final int`
  `SC_ACTION_RESTART`
  `static final int`
  `SC_ACTION_RUN_COMMAND`
  `static final int`
  `SC_ENUM_PROCESS_INFO`
  `static final int`
  `SC_MANAGER_ALL_ACCESS`
  `static final int`
  `SC_MANAGER_CONNECT`
  `static final int`
  `SC_MANAGER_CREATE_SERVICE`
  `static final int`
  `SC_MANAGER_ENUMERATE_SERVICE`
  `static final int`
  `SC_MANAGER_LOCK`
  `static final int`
  `SC_MANAGER_MODIFY_BOOT_CONFIG`
  `static final int`
  `SC_MANAGER_QUERY_LOCK_STATUS`
  `static final int`
  `SERVICE_ACCEPT_HARDWAREPROFILECHANGE`
  `static final int`
  `SERVICE_ACCEPT_NETBINDCHANGE`
  `static final int`
  `SERVICE_ACCEPT_PARAMCHANGE`
  `static final int`
  `SERVICE_ACCEPT_PAUSE_CONTINUE`
  `static final int`
  `SERVICE_ACCEPT_POWEREVENT`
  `static final int`
  `SERVICE_ACCEPT_PRESHUTDOWN`
  `static final int`
  `SERVICE_ACCEPT_SESSIONCHANGE`
  `static final int`
  `SERVICE_ACCEPT_SHUTDOWN`
  `static final int`
  `SERVICE_ACCEPT_STOP`
  `static final int`
  `SERVICE_ACCEPT_TIMECHANGE`
  `static final int`
  `SERVICE_ACCEPT_TRIGGEREVENT`
  `static final int`
  `SERVICE_ACTIVE`
  `static final int`
  `SERVICE_ALL_ACCESS`
  `static final int`
  `SERVICE_CHANGE_CONFIG`
  Required to call the ChangeServiceConfig or `Advapi32.ChangeServiceConfig2(com.sun.jna.platform.win32.Winsvc.SC_HANDLE, int, com.sun.jna.platform.win32.Winsvc.ChangeServiceConfig2Info)` function to change the service configuration.
  `static final int`
  `SERVICE_CONFIG_DELAYED_AUTO_START_INFO`
  `static final int`
  `SERVICE_CONFIG_DESCRIPTION`
  `static final int`
  `SERVICE_CONFIG_FAILURE_ACTIONS`
  `static final int`
  `SERVICE_CONFIG_FAILURE_ACTIONS_FLAG`
  `static final int`
  `SERVICE_CONFIG_LAUNCH_PROTECTED`
  `static final int`
  `SERVICE_CONFIG_PREFERRED_NODE`
  `static final int`
  `SERVICE_CONFIG_PRESHUTDOWN_INFO`
  `static final int`
  `SERVICE_CONFIG_REQUIRED_PRIVILEGES_INFO`
  `static final int`
  `SERVICE_CONFIG_SERVICE_SID_INFO`
  `static final int`
  `SERVICE_CONFIG_TRIGGER_INFO`
  `static final int`
  `SERVICE_CONTINUE_PENDING`
  `static final int`
  `SERVICE_CONTROL_CONTINUE`
  Notifies a service that its startup parameters have changed.
  `static final int`
  `SERVICE_CONTROL_DEVICEEVENT`
  `static final int`
  `SERVICE_CONTROL_HARDWAREPROFILECHANGE`
  `static final int`
  `SERVICE_CONTROL_INTERROGATE`
  Notifies a service that it should report its current status information to the service control manager.
  `static final int`
  `SERVICE_CONTROL_NETBINDADD`
  Notifies a network service that there is a new component for binding.
  `static final int`
  `SERVICE_CONTROL_NETBINDDISABLE`
  Notifies a network service that one of its bindings has been disabled.
  `static final int`
  `SERVICE_CONTROL_NETBINDENABLE`
  Notifies a network service that a disabled binding has been enabled.
  `static final int`
  `SERVICE_CONTROL_NETBINDREMOVE`
  Notifies a network service that a component for binding has been removed.
  `static final int`
  `SERVICE_CONTROL_PARAMCHANGE`
  `static final int`
  `SERVICE_CONTROL_PAUSE`
  Notifies a service that it should pause.
  `static final int`
  `SERVICE_CONTROL_POWEREVENT`
  `static final int`
  `SERVICE_CONTROL_PRESHUTDOWN`
  `static final int`
  `SERVICE_CONTROL_SESSIONCHANGE`
  `static final int`
  `SERVICE_CONTROL_SHUTDOWN`
  `static final int`
  `SERVICE_CONTROL_STOP`
  Notifies a service that it should stop.
  `static final int`
  `SERVICE_CONTROL_TIMECHANGE`
  `static final int`
  `SERVICE_CONTROL_TRIGGEREVENT`
  `static final int`
  `SERVICE_CONTROL_USERMODEREBOOT`
  `static final int`
  `SERVICE_ENUMERATE_DEPENDENTS`
  `static final int`
  `SERVICE_INACTIVE`
  `static final int`
  `SERVICE_INTERROGATE`
  Required to call the `Advapi32.ControlService(com.sun.jna.platform.win32.Winsvc.SC_HANDLE, int, com.sun.jna.platform.win32.Winsvc.SERVICE_STATUS)` function to pause or continue the service.
  `static final int`
  `SERVICE_PAUSE_CONTINUE`
  Required to call the `Advapi32.ControlService(com.sun.jna.platform.win32.Winsvc.SC_HANDLE, int, com.sun.jna.platform.win32.Winsvc.SERVICE_STATUS)` function to pause or continue the service.
  `static final int`
  `SERVICE_PAUSE_PENDING`
  `static final int`
  `SERVICE_PAUSED`
  `static final int`
  `SERVICE_QUERY_CONFIG`
  Required to call the QueryServiceConfig and `Advapi32.QueryServiceConfig2(com.sun.jna.platform.win32.Winsvc.SC_HANDLE, int, com.sun.jna.Pointer, int, com.sun.jna.ptr.IntByReference)` functions to query the service configuration.
  `static final int`
  `SERVICE_QUERY_STATUS`
  Required to call the QueryServiceStatus or `Advapi32.QueryServiceStatusEx(com.sun.jna.platform.win32.Winsvc.SC_HANDLE, int, com.sun.jna.platform.win32.Winsvc.SERVICE_STATUS_PROCESS, int, com.sun.jna.ptr.IntByReference)` function to ask the service control manager about the status of the service.
  `static final int`
  `SERVICE_RUNNING`
  `static final int`
  `SERVICE_RUNS_IN_SYSTEM_PROCESS`
  `static final int`
  `SERVICE_START`
  Required to call the `Advapi32.StartService(com.sun.jna.platform.win32.Winsvc.SC_HANDLE, int, java.lang.String[])` function to start the service.
  `static final int`
  `SERVICE_START_PENDING`
  `static final int`
  `SERVICE_STATE_ALL`
  `static final int`
  `SERVICE_STOP`
  Required to call the `Advapi32.ControlService(com.sun.jna.platform.win32.Winsvc.SC_HANDLE, int, com.sun.jna.platform.win32.Winsvc.SERVICE_STATUS)` function to stop the service.
  `static final int`
  `SERVICE_STOP_PENDING`
  `static final int`
  `SERVICE_STOPPED`
  `static final int`
  `SERVICE_USER_DEFINED_CONTROL`
  Required to call the `Advapi32.ControlService(com.sun.jna.platform.win32.Winsvc.SC_HANDLE, int, com.sun.jna.platform.win32.Winsvc.SERVICE_STATUS)` function to ask the service to report its status immediately.

- ## Field Details

  - ### SERVICE_RUNS_IN_SYSTEM_PROCESS

    static final int SERVICE_RUNS_IN_SYSTEM_PROCESS
    See Also:
      - Constant Field Values

  - ### SC_MANAGER_CONNECT

    static final int SC_MANAGER_CONNECT
    See Also:
      - Constant Field Values

  - ### SC_MANAGER_CREATE_SERVICE

    static final int SC_MANAGER_CREATE_SERVICE
    See Also:
      - Constant Field Values

  - ### SC_MANAGER_ENUMERATE_SERVICE

    static final int SC_MANAGER_ENUMERATE_SERVICE
    See Also:
      - Constant Field Values

  - ### SC_MANAGER_LOCK

    static final int SC_MANAGER_LOCK
    See Also:
      - Constant Field Values

  - ### SC_MANAGER_QUERY_LOCK_STATUS

    static final int SC_MANAGER_QUERY_LOCK_STATUS
    See Also:
      - Constant Field Values

  - ### SC_MANAGER_MODIFY_BOOT_CONFIG

    static final int SC_MANAGER_MODIFY_BOOT_CONFIG
    See Also:
      - Constant Field Values

  - ### SC_MANAGER_ALL_ACCESS

    static final int SC_MANAGER_ALL_ACCESS
    See Also:
      - Constant Field Values

  - ### SERVICE_QUERY_CONFIG

    static final int SERVICE_QUERY_CONFIG
    Required to call the QueryServiceConfig and `Advapi32.QueryServiceConfig2(com.sun.jna.platform.win32.Winsvc.SC_HANDLE, int, com.sun.jna.Pointer, int, com.sun.jna.ptr.IntByReference)` functions to query the service configuration.
    See Also:
      - Constant Field Values

  - ### SERVICE_CHANGE_CONFIG

    static final int SERVICE_CHANGE_CONFIG
    Required to call the ChangeServiceConfig or `Advapi32.ChangeServiceConfig2(com.sun.jna.platform.win32.Winsvc.SC_HANDLE, int, com.sun.jna.platform.win32.Winsvc.ChangeServiceConfig2Info)` function to change the service configuration. Because this grants the caller the right to change the executable file that the system runs, it should be granted only to administrators.
    See Also:
      - Constant Field Values

  - ### SERVICE_QUERY_STATUS

    static final int SERVICE_QUERY_STATUS
    Required to call the QueryServiceStatus or `Advapi32.QueryServiceStatusEx(com.sun.jna.platform.win32.Winsvc.SC_HANDLE, int, com.sun.jna.platform.win32.Winsvc.SERVICE_STATUS_PROCESS, int, com.sun.jna.ptr.IntByReference)` function to ask the service control manager about the status of the service.

    Required to call the NotifyServiceStatusChange function to receive notification when a service changes status.

    See Also:
      - Constant Field Values

  - ### SERVICE_ENUMERATE_DEPENDENTS

    static final int SERVICE_ENUMERATE_DEPENDENTS
    See Also:
      - Constant Field Values

  - ### SERVICE_START

    static final int SERVICE_START
    Required to call the `Advapi32.StartService(com.sun.jna.platform.win32.Winsvc.SC_HANDLE, int, java.lang.String[])` function to start the service.
    See Also:
      - Constant Field Values

  - ### SERVICE_STOP

    static final int SERVICE_STOP
    Required to call the `Advapi32.ControlService(com.sun.jna.platform.win32.Winsvc.SC_HANDLE, int, com.sun.jna.platform.win32.Winsvc.SERVICE_STATUS)` function to stop the service.
    See Also:
      - Constant Field Values

  - ### SERVICE_PAUSE_CONTINUE

    static final int SERVICE_PAUSE_CONTINUE
    Required to call the `Advapi32.ControlService(com.sun.jna.platform.win32.Winsvc.SC_HANDLE, int, com.sun.jna.platform.win32.Winsvc.SERVICE_STATUS)` function to pause or continue the service.
    See Also:
      - Constant Field Values

  - ### SERVICE_INTERROGATE

    static final int SERVICE_INTERROGATE
    Required to call the `Advapi32.ControlService(com.sun.jna.platform.win32.Winsvc.SC_HANDLE, int, com.sun.jna.platform.win32.Winsvc.SERVICE_STATUS)` function to pause or continue the service.
    See Also:
      - Constant Field Values

  - ### SERVICE_USER_DEFINED_CONTROL

    static final int SERVICE_USER_DEFINED_CONTROL
    Required to call the `Advapi32.ControlService(com.sun.jna.platform.win32.Winsvc.SC_HANDLE, int, com.sun.jna.platform.win32.Winsvc.SERVICE_STATUS)` function to ask the service to report its status immediately.
    See Also:
      - Constant Field Values

  - ### SERVICE_ALL_ACCESS

    static final int SERVICE_ALL_ACCESS
    See Also:
      - Constant Field Values

  - ### SERVICE_ACTIVE

    static final int SERVICE_ACTIVE
    See Also:
      - Constant Field Values

  - ### SERVICE_INACTIVE

    static final int SERVICE_INACTIVE
    See Also:
      - Constant Field Values

  - ### SERVICE_STATE_ALL

    static final int SERVICE_STATE_ALL
    See Also:
      - Constant Field Values

  - ### SERVICE_CONTROL_STOP

    static final int SERVICE_CONTROL_STOP
    Notifies a service that it should stop. The hService handle must have the `SERVICE_STOP` access right.

    After sending the stop request to a service, you should not send other controls to the service.

    See Also:
      - Constant Field Values

  - ### SERVICE_CONTROL_PAUSE

    static final int SERVICE_CONTROL_PAUSE
    Notifies a service that it should pause. The hService handle must have the `SERVICE_PAUSE_CONTINUE` access right.
    See Also:
      - Constant Field Values

  - ### SERVICE_CONTROL_CONTINUE

    static final int SERVICE_CONTROL_CONTINUE
    Notifies a service that its startup parameters have changed. The hService handle must have the `SERVICE_PAUSE_CONTINUE` access right.
    See Also:
      - Constant Field Values

  - ### SERVICE_CONTROL_INTERROGATE

    static final int SERVICE_CONTROL_INTERROGATE
    Notifies a service that it should report its current status information to the service control manager. The hService handle must have the `SERVICE_INTERROGATE` access right.

    Note that this control is not generally useful as the SCM is aware of the current state of the service.

    See Also:
      - Constant Field Values

  - ### SERVICE_CONTROL_SHUTDOWN

    static final int SERVICE_CONTROL_SHUTDOWN
    See Also:
      - Constant Field Values

  - ### SERVICE_CONTROL_PARAMCHANGE

    static final int SERVICE_CONTROL_PARAMCHANGE
    See Also:
      - Constant Field Values

  - ### SERVICE_CONTROL_NETBINDADD

    static final int SERVICE_CONTROL_NETBINDADD
    Notifies a network service that there is a new component for binding. The hService handle must have the `SERVICE_PAUSE_CONTINUE` access right. However, this control code has been deprecated; use Plug and Play functionality instead.
    See Also:
      - Constant Field Values

  - ### SERVICE_CONTROL_NETBINDREMOVE

    static final int SERVICE_CONTROL_NETBINDREMOVE
    Notifies a network service that a component for binding has been removed. The hService handle must have the `SERVICE_PAUSE_CONTINUE` access right. However, this control code has been deprecated; use Plug and Play functionality instead.
    See Also:
      - Constant Field Values

  - ### SERVICE_CONTROL_NETBINDENABLE

    static final int SERVICE_CONTROL_NETBINDENABLE
    Notifies a network service that a disabled binding has been enabled. The hService handle must have the `SERVICE_PAUSE_CONTINUE` access right. However, this control code has been deprecated; use Plug and Play functionality instead.
    See Also:
      - Constant Field Values

  - ### SERVICE_CONTROL_NETBINDDISABLE

    static final int SERVICE_CONTROL_NETBINDDISABLE
    Notifies a network service that one of its bindings has been disabled. The hService handle must have the `SERVICE_PAUSE_CONTINUE` access right. However, this control code has been deprecated; use Plug and Play functionality instead.
    See Also:
      - Constant Field Values

  - ### SERVICE_CONTROL_DEVICEEVENT

    static final int SERVICE_CONTROL_DEVICEEVENT
    See Also:
      - Constant Field Values

  - ### SERVICE_CONTROL_HARDWAREPROFILECHANGE

    static final int SERVICE_CONTROL_HARDWAREPROFILECHANGE
    See Also:
      - Constant Field Values

  - ### SERVICE_CONTROL_POWEREVENT

    static final int SERVICE_CONTROL_POWEREVENT
    See Also:
      - Constant Field Values

  - ### SERVICE_CONTROL_SESSIONCHANGE

    static final int SERVICE_CONTROL_SESSIONCHANGE
    See Also:
      - Constant Field Values

  - ### SERVICE_CONTROL_PRESHUTDOWN

    static final int SERVICE_CONTROL_PRESHUTDOWN
    See Also:
      - Constant Field Values

  - ### SERVICE_CONTROL_TIMECHANGE

    static final int SERVICE_CONTROL_TIMECHANGE
    See Also:
      - Constant Field Values

  - ### SERVICE_CONTROL_TRIGGEREVENT

    static final int SERVICE_CONTROL_TRIGGEREVENT
    See Also:
      - Constant Field Values

  - ### SERVICE_CONTROL_USERMODEREBOOT

    static final int SERVICE_CONTROL_USERMODEREBOOT
    See Also:
      - Constant Field Values

  - ### SERVICE_STOPPED

    static final int SERVICE_STOPPED
    See Also:
      - Constant Field Values

  - ### SERVICE_START_PENDING

    static final int SERVICE_START_PENDING
    See Also:
      - Constant Field Values

  - ### SERVICE_STOP_PENDING

    static final int SERVICE_STOP_PENDING
    See Also:
      - Constant Field Values

  - ### SERVICE_RUNNING

    static final int SERVICE_RUNNING
    See Also:
      - Constant Field Values

  - ### SERVICE_CONTINUE_PENDING

    static final int SERVICE_CONTINUE_PENDING
    See Also:
      - Constant Field Values

  - ### SERVICE_PAUSE_PENDING

    static final int SERVICE_PAUSE_PENDING
    See Also:
      - Constant Field Values

  - ### SERVICE_PAUSED

    static final int SERVICE_PAUSED
    See Also:
      - Constant Field Values

  - ### SERVICE_ACCEPT_STOP

    static final int SERVICE_ACCEPT_STOP
    See Also:
      - Constant Field Values

  - ### SERVICE_ACCEPT_PAUSE_CONTINUE

    static final int SERVICE_ACCEPT_PAUSE_CONTINUE
    See Also:
      - Constant Field Values

  - ### SERVICE_ACCEPT_SHUTDOWN

    static final int SERVICE_ACCEPT_SHUTDOWN
    See Also:
      - Constant Field Values

  - ### SERVICE_ACCEPT_PARAMCHANGE

    static final int SERVICE_ACCEPT_PARAMCHANGE
    See Also:
      - Constant Field Values

  - ### SERVICE_ACCEPT_NETBINDCHANGE

    static final int SERVICE_ACCEPT_NETBINDCHANGE
    See Also:
      - Constant Field Values

  - ### SERVICE_ACCEPT_HARDWAREPROFILECHANGE

    static final int SERVICE_ACCEPT_HARDWAREPROFILECHANGE
    See Also:
      - Constant Field Values

  - ### SERVICE_ACCEPT_POWEREVENT

    static final int SERVICE_ACCEPT_POWEREVENT
    See Also:
      - Constant Field Values

  - ### SERVICE_ACCEPT_SESSIONCHANGE

    static final int SERVICE_ACCEPT_SESSIONCHANGE
    See Also:
      - Constant Field Values

  - ### SERVICE_ACCEPT_PRESHUTDOWN

    static final int SERVICE_ACCEPT_PRESHUTDOWN
    See Also:
      - Constant Field Values

  - ### SERVICE_ACCEPT_TIMECHANGE

    static final int SERVICE_ACCEPT_TIMECHANGE
    See Also:
      - Constant Field Values

  - ### SERVICE_ACCEPT_TRIGGEREVENT

    static final int SERVICE_ACCEPT_TRIGGEREVENT
    See Also:
      - Constant Field Values

  - ### SERVICE_CONFIG_DESCRIPTION

    static final int SERVICE_CONFIG_DESCRIPTION
    See Also:
      - Constant Field Values

  - ### SERVICE_CONFIG_FAILURE_ACTIONS

    static final int SERVICE_CONFIG_FAILURE_ACTIONS
    See Also:
      - Constant Field Values

  - ### SERVICE_CONFIG_DELAYED_AUTO_START_INFO

    static final int SERVICE_CONFIG_DELAYED_AUTO_START_INFO
    See Also:
      - Constant Field Values

  - ### SERVICE_CONFIG_FAILURE_ACTIONS_FLAG

    static final int SERVICE_CONFIG_FAILURE_ACTIONS_FLAG
    See Also:
      - Constant Field Values

  - ### SERVICE_CONFIG_SERVICE_SID_INFO

    static final int SERVICE_CONFIG_SERVICE_SID_INFO
    See Also:
      - Constant Field Values

  - ### SERVICE_CONFIG_REQUIRED_PRIVILEGES_INFO

    static final int SERVICE_CONFIG_REQUIRED_PRIVILEGES_INFO
    See Also:
      - Constant Field Values

  - ### SERVICE_CONFIG_PRESHUTDOWN_INFO

    static final int SERVICE_CONFIG_PRESHUTDOWN_INFO
    See Also:
      - Constant Field Values

  - ### SERVICE_CONFIG_TRIGGER_INFO

    static final int SERVICE_CONFIG_TRIGGER_INFO
    See Also:
      - Constant Field Values

  - ### SERVICE_CONFIG_PREFERRED_NODE

    static final int SERVICE_CONFIG_PREFERRED_NODE
    See Also:
      - Constant Field Values

  - ### SERVICE_CONFIG_LAUNCH_PROTECTED

    static final int SERVICE_CONFIG_LAUNCH_PROTECTED
    See Also:
      - Constant Field Values

  - ### SC_ACTION_NONE

    static final int SC_ACTION_NONE
    See Also:
      - Constant Field Values

  - ### SC_ACTION_RESTART

    static final int SC_ACTION_RESTART
    See Also:
      - Constant Field Values

  - ### SC_ACTION_REBOOT

    static final int SC_ACTION_REBOOT
    See Also:
      - Constant Field Values

  - ### SC_ACTION_RUN_COMMAND

    static final int SC_ACTION_RUN_COMMAND
    See Also:
      - Constant Field Values

  - ### SC_ENUM_PROCESS_INFO

    static final int SC_ENUM_PROCESS_INFO
    See Also:
      - Constant Field Values