1.初始化链表头
//初始化链表头@qq1490900437
void InitialGloubleVar()
{
while (1)
{
G_Handle.SaveProcessThreadHandle = (PSLIST_HEADER)_aligned_malloc(sizeof(SLIST_HEADER), MEMORY_ALLOCATION_ALIGNMENT);
if (G_Handle.SaveProcessThreadHandle != NULL)
{
break;
}
}
InitializeSListHead(G_Handle.SaveProcessThreadHandle);
}
2.遍历链表
//遍历单链表@qq1490900437
VOID NTAPI NtMarkThreadHandle(DWORD dwThreadId)
{
PSLIST_ENTRY Entry = RtlFirstEntrySList(G_Handle.SaveProcessThreadHandle);
while (Entry !=NULL)
{
PSaveHandle Node = CONTAINING_RECORD(Entry, SaveHandle,Next);
if (Node->dwThreadId == dwThreadId)
{
Node->MarkThreadExit = TRUE;
break;
}
Entry = Entry->Next;
}
}