| 105 | return result; |
| 106 | } |
| 107 | NTSTATUS NTAPI GetServiceStatus(LPCSTR lpServiceName) |
| 108 | { |
| 109 | |
| 110 | NTSTATUS result = NULL; |
| 111 | SC_HANDLE hSC = NULL, hService = NULL; |
| 112 | SERVICE_STATUS ss, sw; |
| 113 | ZeroMemory(&ss, sizeof(SERVICE_STATUS)); |
| 114 | ZeroMemory(&sw, sizeof(SERVICE_STATUS)); |
| 115 | hSC = OpenSCManagerA(0, 0, SC_MANAGER_ALL_ACCESS); |
| 116 | if (!hSC) |
| 117 | { |
| 118 | result = 0; |
| 119 | goto END; |
| 120 | } |
| 121 | hService = OpenServiceA(hSC, lpServiceName, SERVICE_ALL_ACCESS); |
| 122 | if (hService == NULL) |
| 123 | { |
| 124 | result = -1; |
| 125 | goto END; |
| 126 | } |
| 127 | if (!QueryServiceStatus(hService, &ss)) |
| 128 | { |
| 129 | result = 0; |
| 130 | goto END; |
| 131 | } |
| 132 | result = ss.dwCurrentState; |
| 133 | END: |
| 134 | if (hSC) |
| 135 | CloseServiceHandle(hSC); |
| 136 | if (hService) |
| 137 | CloseServiceHandle(hService); |
| 138 | |
| 139 | return result; |
| 140 | } |
| 141 | } |
| 142 | |
| 143 |
no outgoing calls
no test coverage detected