| 57 | |
| 58 | |
| 59 | BOOL |
| 60 | ManagerReportStatus( |
| 61 | SERVICE_STATUS_HANDLE Handle, |
| 62 | SERVICE_STATUS* Status, |
| 63 | DWORD State, |
| 64 | DWORD Exitcode, |
| 65 | DWORD Timeout |
| 66 | ) |
| 67 | { |
| 68 | // If we're in the start state then we don't want the control manager |
| 69 | // sending us control messages because they'll confuse us. |
| 70 | if (State == SERVICE_START_PENDING) { |
| 71 | Status->dwControlsAccepted = 0; |
| 72 | } else { |
| 73 | Status->dwControlsAccepted = SERVICE_ACCEPT_STOP; |
| 74 | } |
| 75 | |
| 76 | // Save the new status we've been given |
| 77 | Status->dwCurrentState = State; |
| 78 | Status->dwWin32ExitCode = Exitcode; |
| 79 | Status->dwWaitHint = Timeout; |
| 80 | |
| 81 | // Update the checkpoint variable to let the SCM know that we |
| 82 | // haven't died if requests take a long time |
| 83 | if ((State == SERVICE_RUNNING) || (State == SERVICE_STOPPED)) { |
| 84 | Status->dwCheckPoint = 0; |
| 85 | } else { |
| 86 | Status->dwCheckPoint = Checkpoint++; |
| 87 | } |
| 88 | |
| 89 | // Tell the SCM our new status |
| 90 | return SetServiceStatus(Handle, Status); |
| 91 | } |
| 92 | |
| 93 | void ManagerStopService() |
| 94 | { |
no outgoing calls
no test coverage detected