use of com.sun.jna.platform.win32.Winsvc.SERVICE_FAILURE_ACTIONS_FLAG in project jna by java-native-access.
the class W32Service method setFailureActionsFlag.
/**
* Set the failure action flag of the specified service. Corresponds to
* <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/ms681988.aspx">ChangeServiceConfig2</a>
* with parameter dwInfoLevel set to SERVICE_CONFIG_FAILURE_ACTIONS_FLAG.
*/
public void setFailureActionsFlag(boolean flagValue) {
SERVICE_FAILURE_ACTIONS_FLAG flag = new SERVICE_FAILURE_ACTIONS_FLAG();
flag.fFailureActionsOnNonCrashFailures = flagValue ? 1 : 0;
if (!Advapi32.INSTANCE.ChangeServiceConfig2(_handle, Winsvc.SERVICE_CONFIG_FAILURE_ACTIONS_FLAG, flag)) {
throw new Win32Exception(Kernel32.INSTANCE.GetLastError());
}
}
use of com.sun.jna.platform.win32.Winsvc.SERVICE_FAILURE_ACTIONS_FLAG in project jna by java-native-access.
the class W32Service method getFailureActionsFlag.
/**
* Get the failure actions flag of the specified service. Corresponds to
* <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/ms681988.aspx">QueryServiceConfig2</a>
* with parameter dwInfoLevel set to SERVICE_CONFIG_FAILURE_ACTIONS_FLAG.
*/
public boolean getFailureActionsFlag() {
Pointer buffer = queryServiceConfig2(Winsvc.SERVICE_CONFIG_FAILURE_ACTIONS_FLAG);
SERVICE_FAILURE_ACTIONS_FLAG result = new SERVICE_FAILURE_ACTIONS_FLAG(buffer);
return result.fFailureActionsOnNonCrashFailures != 0;
}
Aggregations