58 _In_opt_ PVOID Parameter1,
59 _In_opt_ PVOID Parameter2,
60 _In_opt_ PVOID Context
64 _In_ HWND ParentWindowHandle,
65 _In_ HWND TreeNewHandle,
72 Context->EnableStateHighlighting =
TRUE;
82 Context->ParentWindowHandle = ParentWindowHandle;
83 Context->TreeNewHandle = TreeNewHandle;
114 for (i = 0; i < Context->NodeList->Count; i++)
149 if (!Context->UseCycleTime)
152 column.
Text = L
"Context Switches Delta";
156 if (Context->HasServices)
195 _In_ BOOLEAN FirstRun
204 if (Context->EnableStateHighlighting && !FirstRun)
209 &Context->NodeStateList,
216 threadNode->
ThreadId = ThreadItem->ThreadId;
243 lookupThreadNode.
ThreadId = ThreadId;
246 Context->NodeHashtable,
264 if (Context->EnableStateHighlighting)
268 &ThreadNode->ShState,
269 &Context->NodeStateList,
272 Context->TreeNewHandle
305 if ((index = PhFindItemList(Context->NodeList, ThreadNode)) != -1)
320 ThreadNode->ValidMask = 0;
332 #define SORT_FUNCTION(Column) PhpThreadTreeNewCompare##Column
334 #define BEGIN_SORT_FUNCTION(Column) static int __cdecl PhpThreadTreeNewCompare##Column( \
335 _In_ void *_context, \
336 _In_ const void *_elem1, \
337 _In_ const void *_elem2 \
340 PPH_THREAD_NODE node1 = *(PPH_THREAD_NODE *)_elem1; \
341 PPH_THREAD_NODE node2 = *(PPH_THREAD_NODE *)_elem2; \
342 PPH_THREAD_ITEM threadItem1 = node1->ThreadItem; \
343 PPH_THREAD_ITEM threadItem2 = node2->ThreadItem; \
344 PPH_THREAD_LIST_CONTEXT context = (PPH_THREAD_LIST_CONTEXT)_context; \
347 #define END_SORT_FUNCTION \
348 if (sortResult == 0) \
349 sortResult = uintptrcmp((ULONG_PTR)node1->ThreadId, (ULONG_PTR)node2->ThreadId); \
351 return PhModifySort(sortResult, context->TreeNewSortOrder); \
369 sortResult =
uintptrcmp((ULONG_PTR)node1->ThreadId, (ULONG_PTR)node2->ThreadId);
375 sortResult =
singlecmp(threadItem1->CpuUsage, threadItem2->CpuUsage);
379 if (context->UseCycleTime)
380 sortResult =
uint64cmp(threadItem1->CyclesDelta.Delta, threadItem2->CyclesDelta.Delta);
382 sortResult =
uintcmp(threadItem1->ContextSwitchesDelta.Delta, threadItem2->ContextSwitchesDelta.Delta);
389 if (context->UseCycleTime)
390 sortResult =
uint64cmp(threadItem1->CyclesDelta.Delta, threadItem2->CyclesDelta.Delta);
392 sortResult =
uintcmp(threadItem1->ContextSwitchesDelta.Delta, threadItem2->ContextSwitchesDelta.Delta);
404 sortResult =
intcmp(threadItem1->PriorityWin32, threadItem2->PriorityWin32);
417 _In_opt_ PVOID Parameter1,
418 _In_opt_ PVOID Parameter2,
419 _In_opt_ PVOID Context
436 if (!getChildren->
Node)
438 static PVOID sortFunctions[] =
447 int (__cdecl *sortFunction)(
void *,
const void *,
const void *);
492 switch (getCellText->
Id)
501 cpuUsage = threadItem->
CpuUsage * 100;
503 if (cpuUsage >= 0.01)
513 getCellText->
Text.
Length = returnLength -
sizeof(WCHAR);
527 getCellText->
Text.
Length = returnLength -
sizeof(WCHAR);
605 if (GetKeyState(VK_CONTROL) < 0)
609 if (GetKeyState(VK_CONTROL) < 0)
655 PULONG code = Parameter2;
657 if (PtrToUlong(Parameter1) == VK_RETURN)
659 *code = DLGC_WANTMESSAGE;
676 for (i = 0; i < Context->NodeList->Count; i++)
693 _Out_ PULONG NumberOfThreads
701 for (i = 0; i < Context->NodeList->Count; i++)
712 *NumberOfThreads = list->
Count;