HANDLE hHeap, // handle to the heap to enumerate
LPPROCESS_HEAP_ENTRY lpEntry // points to structure that maintains enumeration state information
);
Example
/* HEAPWALK.C: This program "walks" the heap, starting
* at the beginning (_pentry = NULL). It prints out each
* heap entry's use, location, and size. It also prints
* out information about the overall state of the heap as
* soon as _heapwalk returns a value other than _HEAPOK.
*/
switch( heapstatus )
{
case _HEAPEMPTY:
printf( "OK - empty heap\n" );
break;
case _HEAPEND:
printf( "OK - end of heap\n" );
break;
case _HEAPBADPTR:
printf( "ERROR - bad pointer to heap\n" );
break;
case _HEAPBADBEGIN:
printf( "ERROR - bad start of heap\n" );
break;
case _HEAPBADNODE:
printf( "ERROR - bad node in heap\n" );
break;
}
}
Output
USED block at 002C0004 of size 0014
USED block at 002C001C of size 0054
USED block at 002C0074 of size 0024
USED block at 002C009C of size 0010
USED block at 002C00B0 of size 0018
USED block at 002C00CC of size 000C
USED block at 002C00DC of size 001C
USED block at 002C00FC of size 0010
USED block at 002C0110 of size 0014
USED block at 002C0128 of size 0010
USED block at 002C013C of size 0028
USED block at 002C0168 of size 0088
USED block at 002C01F4 of size 001C
USED block at 002C0214 of size 0014
USED block at 002C022C of size 0010
USED block at 002C0240 of size 0014
USED block at 002C0258 of size 0010
USED block at 002C026C of size 000C
USED block at 002C027C of size 0010
USED block at 002C0290 of size 0014
USED block at 002C02A8 of size 0010
USED block at 002C02BC of size 0010
USED block at 002C02D0 of size 1000
FREE block at 002C12D4 of size ED2C
OK - end of heap