The HeapWalk function enumerates the memory blocks in a specified heap.
BOOL HeapWalk(
HANDLE hHeap, |
// handle to the heap to enumerate |
LPPROCESS_HEAP_ENTRY lpEntry |
// points to structure that maintains enumeration state information |
); |
If the HeapWalk function succeeds, returning the value TRUE, this structure’s members contain information about the next memory block in the heap.
To initiate a heap enumeration, set the lpData field of the PROCESS_HEAP_ENTRY structure to NULL. To continue a particular heap enumeration, call the HeapWalk function repeatedly, with no changes to hHeap, lpEntry, or any of the members of the PROCESS_HEAP_ENTRY structure.
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
If the heap enumeration terminates successfully by reaching the end of the heap, the function returns FALSE, and GetLastError returns the error code ERROR_NO_MORE_ITEMS.
To initiate a heap enumeration, call HeapWalk with the lpData field of the PROCESS_HEAP_ENTRY structure pointed to by lpEntry set to NULL.
To continue a heap enumeration, call HeapWalk with the same hHeap and lpEntry values, and with the PROCESS_HEAP_ENTRY structure unchanged from the preceding call to HeapWalk. Repeat this process until you have no need for further enumeration, or until the function returns FALSE and GetLastError returns ERROR_NO_MORE_ITEMS, indicating that all of the heap’s memory blocks have been enumerated.
No special call of HeapWalk is needed to terminate the heap enumeration, since no enumeration state data is maintained outside the contents of the PROCESS_HEAP_ENTRY structure.
HeapWalk can fail in a multithreaded application if the heap is not locked during the heap enumeration. Use the HeapLock and HeapUnlock functions to control heap locking during heap enumeration.
HeapLock, HeapUnlock, HeapValidate, PROCESS_HEAP_ENTRY
See:
file: /Techref/os/win/api/win32/func/src/f45_3.htm, 3KB, , updated: 2001/6/26 10:25, local time: 2024/11/26 18:18,
3.141.2.191:LOG IN
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://massmind.org/Techref/os/win/api/win32/func/src/f45_3.htm"> HeapWalk</A> |
Did you find what you needed? |
Welcome to massmind.org! |
Welcome to massmind.org! |
.