Windows service states and service state transitions
Posted by jpluimers on 2018/09/12
States via [WayBack] SERVICE_STATUS structure (Windows)
Value Hex Meaning SERVICE_CONTINUE_PENDING 0x00000005 The service continue is pending. SERVICE_PAUSE_PENDING 0x00000006 The service pause is pending. SERVICE_PAUSED 0x00000007 The service is paused. SERVICE_RUNNING 0x00000004 The service is running. SERVICE_START_PENDING 0x00000002 The service is starting. SERVICE_STOP_PENDING 0x00000003 The service is stopping. SERVICE_STOPPED 0x00000001 The service is not running.
State transition overview
It’s complex as a table, so there are two.
Common transitions:
| From state | To state |
|---|---|
| SERVICE_STOPPED | SERVICE_START_PENDING |
| SERVICE_START_PENDING | SERVICE_RUNNING |
| SERVICE_START_PENDING | SERVICE_STOPPED |
| SERVICE_START_PENDING | SERVICE_STOP_PENDING |
| SERVICE_RUNNING | SERVICE_STOPPED |
| SERVICE_RUNNING | SERVICE_STOP_PENDING |
| SERVICE_STOP_PENDING | SERVICE_STOPPED |
Infrequent transitions:
| From state | To state |
|---|---|
| SERVICE_RUNNING | SERVICE_PAUSE_PENDING |
| SERVICE_RUNNING | SERVICE_PAUSED |
| SERVICE_PAUSE_PENDING | SERVICE_PAUSED |
| SERVICE_PAUSE_PENDING | SERVICE_STOP_PENDING |
| SERVICE_PAUSE_PENDING | SERVICE_STOPPED |
| SERVICE_PAUSED | SERVICE_RUNNING |
| SERVICE_PAUSED | SERVICE_CONTINUE_PENDING |
| SERVICE_PAUSED | SERVICE_STOP_PENDING |
| SERVICE_PAUSED | SERVICE_STOPPED |
| SERVICE_CONTINUE_PENDING | SERVICE_RUNNING |
| SERVICE_CONTINUE_PENDING | SERVICE_STOP_PENDING |
| SERVICE_CONTINUE_PENDING | SERVICE_STOPPED |
Detailed state transitions
There are in fact more transitions as some states can transit into themselves:
Source: [WayBack] Service State Transitions (Windows)
–jeroen








Leave a comment