win7 64位驱动教程 断链隐藏进程几分钟后蓝屏。请问是什么问题?
//获得EPROCESS
PEPROCESS GetProcessObjectByName(char *name)
{
SIZE_T i;
for(i=100;i<20000;i+=4)
{
NTSTATUS st;
PEPROCESS ep;
st=PsLookupProcessByProcessId((HANDLE)i,&ep);
if(NT_SUCCESS(st))
{
char *pn=PsGetProcessImageFileName(ep);
if(_stricmp(pn,name)==0)
return ep;
}
}
return NULL;
}
//摘除双向链表的指定项
VOID RemoveListEntry(PLIST_ENTRY ListEntry)
{
KIRQL OldIrql;
OldIrql = KeRaiseIrqlToDpcLevel();
if (ListEntry->Flink != ListEntry &&
ListEntry->Blink != ListEntry &&
ListEntry->Blink->Flink == ListEntry &&
ListEntry->Flink->Blink == ListEntry)
{
ListEntry->Flink->Blink = ListEntry->Blink;
ListEntry->Blink->Flink = ListEntry->Flink;
ListEntry->Flink = ListEntry;
ListEntry->Blink = ListEntry;
}
KeLowerIrql(OldIrql);
}
//隐藏进程
VOID HideProcess(PEPROCESS Process)
{
RemoveListEntry((PLIST_ENTRY)((ULONG64)Process+PROCESS_ACTIVE_PROCESS_LINKS_OFFSET));
}
//保护进程
ULONG ProtectProcess(PEPROCESS Process, BOOLEAN bIsProtect, ULONG v)
{
ULONG op;
if(bIsProtect)
{
op=*(PULONG)((ULONG64)Process+PROCESS_FLAG_OFFSET);
*(PULONG)((ULONG64)Process+PROCESS_FLAG_OFFSET)=0;
return op;
}
else
{
*(PULONG)((ULONG64)Process+PROCESS_FLAG_OFFSET)=v;
return 0;
}
}
VOID test()
{
audiodg=GetProcessObjectByName("audiodg.exe");DbgPrint("audiodg: %p\n",audiodg);
if(audiodg)
{
op_dat=ProtectProcess(audiodg,1,0);
ObDereferenceObject(audiodg);
}
dwm=GetProcessObjectByName("dwm.exe");DbgPrint("dwm: %p\n",dwm);
if(dwm)
{
HideProcess(dwm);
ObDereferenceObject(dwm);
}
}
[注意]传递专业知识、拓宽行业人脉——看雪讲师团队等你加入!