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

Package com.sun.jna.platform.win32

# Interface Winsvc.Handler

All Superinterfaces:
  `AltCallingConvention`, `Callback`, `StdCall`, `StdCallLibrary.StdCallCallback`

Enclosing interface:
  Winsvc

public static interface Winsvc.Handler extends StdCallLibrary.StdCallCallback
An application-defined callback function used with the RegisterServiceCtrlHandler function. A service program can use it as the control handler function of a particular service.

This function has been superseded by the `Winsvc.HandlerEx` control handler function used with the `Advapi32.RegisterServiceCtrlHandlerEx(java.lang.String, com.sun.jna.platform.win32.Winsvc.HandlerEx, com.sun.jna.Pointer)` function. A service can use either control handler, but the new control handler supports user-defined context data and additional extended control codes.

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from interface com.sun.jna.Callback

  `Callback.UncaughtExceptionHandler`

- ## Field Summary

  ### Fields inherited from interface com.sun.jna.Callback

  `FORBIDDEN_NAMES, METHOD_NAME`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `callback(int fdwControl)`

- ## Method Details

  - ### callback

    void callback(int fdwControl)
    Parameters:
      `fdwControl` - [in] The control code. This parameter can be one of the following values.

      Control code | Meaning
      --- | ---
      SERVICE_CONTROL_CONTINUE 0x00000003 | Notifies a paused service that it should resume.
      SERVICE_CONTROL_INTERROGATE 0x00000004 | Notifies a service that it should report its current status information to the service control manager. The handler should simply return NO_ERROR; the SCM is aware of the current state of the service.
      SERVICE_CONTROL_NETBINDADD 0x00000007 | Notifies a network service that there is a new component for binding. The service should bind to the new component. Applications should use Plug and Play functionality instead.
      SERVICE_CONTROL_NETBINDDISABLE 0x0000000A | Notifies a network service that one of its bindings has been disabled. The service should reread its binding information and remove the binding. Applications should use Plug and Play functionality instead.
      SERVICE_CONTROL_NETBINDENABLE 0x00000009 | Notifies a network service that a disabled binding has been enabled. The service should reread its binding information and add the new binding. Applications should use Plug and Play functionality instead.
      SERVICE_CONTROL_NETBINDREMOVE 0x00000008 | Notifies a network service that a component for binding has been removed. The service should reread its binding information and unbind from the removed component. Applications should use Plug and Play functionality instead.
      SERVICE_CONTROL_PARAMCHANGE 0x00000006 | Notifies a service that its startup parameters have changed. The service should reread its startup parameters.
      SERVICE_CONTROL_PAUSE 0x00000002 | Notifies a service that it should pause.
      SERVICE_CONTROL_SHUTDOWN 0x00000005 | Notifies a service that the system is shutting down so the service can perform cleanup tasks. If a service accepts this control code, it must stop after it performs its cleanup tasks and return NO_ERROR. After the SCM sends this control code, it will not send other control codes to the service.
      SERVICE_CONTROL_STOP 0x00000001 | Notifies a service that it should stop. If a service accepts this control code, it must stop upon receipt and return NO_ERROR. After the SCM sends this control code, it does not send other control codes. Windows XP: If the service returns NO_ERROR and continues to run, it continues to receive control codes. This behavior changed starting with Windows Server 2003 and Windows XP with SP2.

      This parameter can also be a user-defined control code, as described in the following table.

      Control code | Meaning
      --- | ---
      Range 128 to 255. | The service defines the action associated with the control code.