| 84 | |
| 85 | |
| 86 | VOID WINAPI ServiceHandler(DWORD CtrlCode) |
| 87 | { |
| 88 | switch (CtrlCode) |
| 89 | { |
| 90 | case SERVICE_CONTROL_STOP: |
| 91 | |
| 92 | if (g_ServiceStatus.dwCurrentState != SERVICE_RUNNING) |
| 93 | break; |
| 94 | |
| 95 | g_ServiceStatus.dwControlsAccepted = 0; |
| 96 | g_ServiceStatus.dwCurrentState = SERVICE_STOP_PENDING; |
| 97 | g_ServiceStatus.dwWin32ExitCode = 0; |
| 98 | g_ServiceStatus.dwCheckPoint = 4; |
| 99 | |
| 100 | if (SetServiceStatus(g_StatusHandle, &g_ServiceStatus) == FALSE) |
| 101 | { |
| 102 | OutputDebugString("AmdK9: SetServiceStatus returned error"); |
| 103 | } |
| 104 | SetEvent(g_ServiceStopEvent); |
| 105 | CloseHandle(g_ServiceStopEvent); |
| 106 | for (auto Thread : Threads) |
| 107 | { |
| 108 | TerminateThread(Thread, CtrlCode); |
| 109 | CloseHandle(Thread); |
| 110 | } |
| 111 | |
| 112 | break; |
| 113 | default: |
| 114 | break; |
| 115 | } |
| 116 | |
| 117 | } |
| 118 | |
| 119 | DWORD WINAPI ServiceThread(LPVOID lpParam) |
| 120 | { |
nothing calls this directly
no outgoing calls
no test coverage detected