Partager via


2.2.40 SERVICE_FAILURE_ACTIONSW

The SERVICE_FAILURE_ACTIONSW structure defines the action that the service controller takes on each failure of a service. String values are stored in Unicode.

 typedef struct _SERVICE_FAILURE_ACTIONSW {
   DWORD dwResetPeriod;
   [string, range(0, 8 * 1024)] LPWSTR lpRebootMsg;
   [string, range(0, 8 * 1024)] LPWSTR lpCommand;
   [range(0, 1024)] DWORD cActions;
   [size_is(cActions)] SC_ACTION* lpsaActions;
 } SERVICE_FAILURE_ACTIONSW,
  *LPSERVICE_FAILURE_ACTIONSW;

dwResetPeriod: The time, in seconds, after which to reset the failure count to zero if there are no failures.

lpRebootMsg: The buffer that contains the message to be broadcast to server users before rebooting in response to the SC_ACTION_REBOOT service controller action.

lpCommand: The buffer that contains the command line of the process for the process creation function to execute in response to the SC_ACTION_RUN_COMMAND service controller action.

cActions: The number of elements in the lpsaActions array.

lpsaActions: A pointer to an array of SC_ACTION (section 2.2.19) structures.

The service controller counts the number of times each service has failed since the system booted. The count is reset to 0 if the service has not failed for dwResetPeriod seconds. When the service fails for the Nth time, the service controller performs the action specified in element [N-1] of the lpsaActions array. If N is greater than cActions, the service controller repeats the last action in the array.