47 _In_opt_ PVOID Parameter1,
48 _In_opt_ PVOID Parameter2,
49 _In_opt_ PVOID Context
53 _In_ HWND ParentWindowHandle,
54 _In_ HWND TreeNewHandle,
65 Context->ParentWindowHandle = ParentWindowHandle;
66 Context->TreeNewHandle = TreeNewHandle;
103 for (i = 0; i < Context->AllocationBaseNodeList->Count; i++)
105 for (i = 0; i < Context->RegionNodeList->Count; i++)
144 settings =
PhCmSaveSettingsEx(Context->TreeNewHandle, &Context->Cm, 0, &sortSettings);
153 _In_ BOOLEAN HideFreeRegions
160 if (Context->HideFreeRegions != HideFreeRegions)
164 Context->HideFreeRegions = HideFreeRegions;
166 lists[0] = Context->AllocationBaseNodeList;
167 lists[1] = Context->RegionNodeList;
169 for (k = 0; k < 2; k++)
171 for (i = 0; i < lists[k]->
Count; i++)
223 _In_ PVOID AllocationBase
290 Destination->RegionType = Source->RegionType;
291 Destination->u = Source->u;
304 PLIST_ENTRY listEntry;
315 for (listEntry = List->ListHead.Flink; listEntry != &List->ListHead; listEntry = listEntry->Flink)
325 if (Context->HideFreeRegions && (memoryItem->
State & MEM_FREE))
330 if (!(memoryItem->
State & MEM_FREE))
332 memoryNode->
Parent = allocationBaseNode;
348 if (memoryItem->
State & MEM_FREE)
358 if (Context->HideFreeRegions && (allocationBaseNode->
MemoryItem->
State & MEM_FREE))
396 return MemoryItem->u.Custom.Text;
401 return MemoryItem->u.MappedFile.FileName;
410 type ==
Teb32Region ? L
" 32-bit" : L
"", (ULONG)MemoryItem->u.Teb.ThreadId);
414 type ==
Stack32Region ? L
" 32-bit" : L
"", (ULONG)MemoryItem->u.Stack.ThreadId);
418 type ==
Heap32Region ? L
" 32-bit" : L
"", (ULONG)MemoryItem->u.Heap.Index + 1);
422 type ==
HeapSegment32Region ? L
" 32-bit" : L
"", (ULONG)MemoryItem->u.HeapSegment.HeapItem->u.Heap.Index + 1);
432 if (!MemoryNode->UseText)
446 #define SORT_FUNCTION(Column) PhpMemoryTreeNewCompare##Column
448 #define BEGIN_SORT_FUNCTION(Column) static int __cdecl PhpMemoryTreeNewCompare##Column( \
449 _In_ void *_context, \
450 _In_ const void *_elem1, \
451 _In_ const void *_elem2 \
454 PPH_MEMORY_NODE node1 = *(PPH_MEMORY_NODE *)_elem1; \
455 PPH_MEMORY_NODE node2 = *(PPH_MEMORY_NODE *)_elem2; \
456 PPH_MEMORY_ITEM memoryItem1 = node1->MemoryItem; \
457 PPH_MEMORY_ITEM memoryItem2 = node2->MemoryItem; \
460 #define END_SORT_FUNCTION \
461 if (sortResult == 0) \
462 sortResult = uintptrcmp((ULONG_PTR)memoryItem1->BaseAddress, (ULONG_PTR)memoryItem2->BaseAddress); \
464 return PhModifySort(sortResult, ((PPH_MEMORY_LIST_CONTEXT)_context)->TreeNewSortOrder); \
482 sortResult =
uintptrcmp((ULONG_PTR)memoryItem1->BaseAddress, (ULONG_PTR)memoryItem2->BaseAddress);
488 sortResult =
uintcmp(memoryItem1->Type | memoryItem1->State, memoryItem2->Type | memoryItem2->State);
491 sortResult =
intcmp(memoryItem1->RegionType, memoryItem2->RegionType);
497 sortResult =
uintptrcmp(memoryItem1->RegionSize, memoryItem2->RegionSize);
517 sortResult =
uintptrcmp(memoryItem1->TotalWorkingSetPages, memoryItem2->TotalWorkingSetPages);
523 sortResult =
uintptrcmp(memoryItem1->PrivateWorkingSetPages, memoryItem2->PrivateWorkingSetPages);
529 sortResult =
uintptrcmp(memoryItem1->ShareableWorkingSetPages, memoryItem2->ShareableWorkingSetPages);
535 sortResult =
uintptrcmp(memoryItem1->SharedWorkingSetPages, memoryItem2->SharedWorkingSetPages);
541 sortResult =
uintptrcmp(memoryItem1->LockedWorkingSetPages, memoryItem2->LockedWorkingSetPages);
547 sortResult =
uintptrcmp(memoryItem1->CommittedSize, memoryItem2->CommittedSize);
553 sortResult =
uintptrcmp(memoryItem1->PrivateSize, memoryItem2->PrivateSize);
560 _In_opt_ PVOID Parameter1,
561 _In_opt_ PVOID Parameter2,
562 _In_opt_ PVOID Context
598 static PVOID sortFunctions[] =
613 int (__cdecl *sortFunction)(
void *,
const void *,
const void *);
664 switch (getCellText->
Id)
671 if (memoryItem->
State & MEM_FREE)
694 getCellText->
Text.
Length = returnLength -
sizeof(WCHAR);
771 if (GetKeyState(VK_CONTROL) < 0)
775 if (GetKeyState(VK_CONTROL) < 0)
824 PULONG code = Parameter2;
826 if (PtrToUlong(Parameter1) == VK_RETURN)
828 *code = DLGC_WANTMESSAGE;
846 for (i = 0; i < Context->AllocationBaseNodeList->Count; i++)
855 for (i = 0; i < Context->RegionNodeList->Count; i++)
869 _Out_ PULONG NumberOfMemoryNodes
879 for (i = 0; i < Context->AllocationBaseNodeList->Count; i++)
888 for (i = 0; i < Context->RegionNodeList->Count; i++)
897 *NumberOfMemoryNodes = list->
Count;