Class NTServiceStatus

  • All Implemented Interfaces:
    PropertyAccessible
    Direct Known Subclasses:
    Win2kServiceStatusProcess

    public class NTServiceStatus
    extends java.lang.Object
    implements PropertyAccessible
    This class is strictly used to store data about the status of an NT Service. It is used by Win32Service for both setting the status and querying the status of an NT Service.

    See the Win32 API documentation for the SERVICE_STATUS structure for more information.

    • Field Detail

      • SERVICE_CONTINUE_PENDING

        public static final int SERVICE_CONTINUE_PENDING
        Can be used for the currentState property.
        See Also:
        Constant Field Values
      • SERVICE_PAUSE_PENDING

        public static final int SERVICE_PAUSE_PENDING
        Can be used for the currentState property.
        See Also:
        Constant Field Values
      • SERVICE_PAUSED

        public static final int SERVICE_PAUSED
        Can be used for the currentState property.
        See Also:
        Constant Field Values
      • SERVICE_RUNNING

        public static final int SERVICE_RUNNING
        Can be used for the currentState property.
        See Also:
        Constant Field Values
      • SERVICE_START_PENDING

        public static final int SERVICE_START_PENDING
        Can be used for the currentState property.
        See Also:
        Constant Field Values
      • SERVICE_STOP_PENDING

        public static final int SERVICE_STOP_PENDING
        Can be used for the currentState property.
        See Also:
        Constant Field Values
      • SERVICE_STOPPED

        public static final int SERVICE_STOPPED
        Can be used for the currentState property.
        See Also:
        Constant Field Values
      • SERVICE_ACCEPT_STOP

        public static final int SERVICE_ACCEPT_STOP
        Can be used for the controlsAccepted property.
        See Also:
        Constant Field Values
      • SERVICE_ACCEPT_PAUSE_CONTINUE

        public static final int SERVICE_ACCEPT_PAUSE_CONTINUE
        Can be used for the controlsAccepted property.
        See Also:
        Constant Field Values
      • SERVICE_ACCEPT_SHUTDOWN

        public static final int SERVICE_ACCEPT_SHUTDOWN
        Can be used for the controlsAccepted property.
        See Also:
        Constant Field Values
      • SERVICE_ACCEPT_PARAMCHANGE

        public static final int SERVICE_ACCEPT_PARAMCHANGE
        Can be used for the controlsAccepted property.
        See Also:
        Constant Field Values
      • SERVICE_ACCEPT_NETBINDCHANGE

        public static final int SERVICE_ACCEPT_NETBINDCHANGE
        Can be used for the controlsAccepted property.
        See Also:
        Constant Field Values
      • SERVICE_ACCEPT_HARDWAREPROFILECHANGE

        public static final int SERVICE_ACCEPT_HARDWAREPROFILECHANGE
        Can be used for the controlsAccepted property on Windows 2000 and later.
        See Also:
        Constant Field Values
      • SERVICE_ACCEPT_POWEREVENT

        public static final int SERVICE_ACCEPT_POWEREVENT
        Can be used for the controlsAccepted property on Windows 2000 and later.
        See Also:
        Constant Field Values
      • ERROR_SERVICE_SPECIFIC_ERROR

        public static final int ERROR_SERVICE_SPECIFIC_ERROR
        Can be used for win32ExitCode.
        See Also:
        Constant Field Values
      • NO_ERROR

        public static final int NO_ERROR
        Can be used for win32ExitCode.
        See Also:
        Constant Field Values
    • Constructor Detail

      • NTServiceStatus

        public NTServiceStatus()
        Constructs a new instance of an NTServiceStatus object with default property values.
    • Method Detail

      • stateToString

        public static java.lang.String stateToString​(int state)
        Returns an English string representation of the state passed in for IDE display purposes.
      • setServiceType

        public void setServiceType​(int serviceType)
        Changes the serviceType assigned to this NTServiceStatus object. This should be one of:
          NTServiceConfig.SERVICE_FILE_SYSTEM_DRIVER
        • NTServiceConfig.SERVICE_KERNEL_DRIVER
        • NTServiceConfig.SERVICE_ADAPTER
        • NTServiceConfig.SERVICE_RECOGNIZER_DRIVER
        • NTServiceConfig.SERVICE_DRIVER
        • NTServiceConfig.SERVICE_WIN32_OWN_PROCESS
        • NTServiceConfig.SERVICE_WIN32_SHARE_PROCESS
        • NTServiceConfig.SERVICE_WIN32
        • NTServiceConfig.SERVICE_TYPE_ALL
      • getServiceType

        public int getServiceType()
        Returns the serviceType from this service status object.
      • setCurrentState

        public void setCurrentState​(int currentState)
        Changes the currentState assigned to this NTServiceStatus object. This should be one of:
          SERVICE_CONTINUE_PENDING
        • SERVICE_PAUSE_PENDING
        • SERVICE_PAUSED
        • SERVICE_RUNNING
        • SERVICE_START_PENDING
        • SERVICE_STOP_PENDING
        • SERVICE_STOPPED
      • getCurrentState

        public int getCurrentState()
        Returns the currentState from the service status object.
      • setControlsAccepted

        public void setControlsAccepted​(int controlsAccepted)
        Changes the currentState assigned to this NTServiceStatus object. This should be one of:
          SERVICE_ACCEPT_STOP
        • SERVICE_ACCEPT_PAUSE_CONTINUE
        • SERVICE_ACCEPT_SHUTDOWN
        • SERVICE_ACCEPT_PARAMCHANGE
        • SERVICE_ACCEPT_NETBINDCHANGE
        • SERVICE_ACCEPT_HARDWAREPROFILECHANGE
        • SERVICE_ACCEPT_POWEREVENT
      • getControlsAccepted

        public int getControlsAccepted()
        Returns the value of the controlsAccepted for this service status object.
      • setWin32ExitCode

        public void setWin32ExitCode​(int win32ExitCode)
        Sets the Win32 exit code in this service status object.
        Parameters:
        win32ExitCode - Set this to ERROR_SERVICE_SPECIFIC_ERROR if the service needs to return an error specific to itself instead of a more generic Win32 error.
      • getWin32ExitCode

        public int getWin32ExitCode()
        Returns the win32 exit code from this service status object. If it is ERROR_SERVICE_SPECIFIC_ERROR, then the serviceSpecificExitCode should be retrieved too.
      • setServiceSpecificExitCode

        public void setServiceSpecificExitCode​(int serviceSpecificExitCode)
        Sets the service specific error code. If this is set to a meaningful value, then setWin32ExitCode should be called with a code of ERROR_SERVICE_SPECIFIC_ERROR.
      • getServiceSpecificExitCode

        public int getServiceSpecificExitCode()
        Returns the service specific exit code. For this to be meaningful, getWin32ExitCode() should also return ERROR_SERVICE_SPECIFIC_ERROR.
      • setCheckPoint

        public void setCheckPoint​(int checkPoint)
        Updates the checkpoint value for this service. This should be set when a service is undergoing a lengthy start, stop, pause or continue operation.
      • getCheckPoint

        public int getCheckPoint()
        Returns the current checkpoint value from this service status object.
      • setWaitHint

        public void setWaitHint​(int waitHint)
        Sets the wait hint for this service status object. This represents the length of time (in milliseconds) before the pedning operation will be complete.
      • getWaitHint

        public int getWaitHint()
        Returns the wait hint for this service status object.