Commit 074177b8 authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

ntdll: Rewrite RtlWalkHeap and enumerate large blocks.

parent 1196b46b
......@@ -601,12 +601,67 @@ BOOL WINAPI DECLSPEC_HOTPATCH HeapValidate( HANDLE heap, DWORD flags, LPCVOID pt
}
/* undocumented RtlWalkHeap structure */
struct rtl_heap_entry
{
LPVOID lpData;
SIZE_T cbData; /* differs from PROCESS_HEAP_ENTRY */
BYTE cbOverhead;
BYTE iRegionIndex;
WORD wFlags; /* value differs from PROCESS_HEAP_ENTRY */
union {
struct {
HANDLE hMem;
DWORD dwReserved[3];
} Block;
struct {
DWORD dwCommittedSize;
DWORD dwUnCommittedSize;
LPVOID lpFirstBlock;
LPVOID lpLastBlock;
} Region;
};
};
/* rtl_heap_entry flags, names made up */
#define RTL_HEAP_ENTRY_BUSY 0x0001
#define RTL_HEAP_ENTRY_REGION 0x0002
#define RTL_HEAP_ENTRY_BLOCK 0x0010
#define RTL_HEAP_ENTRY_UNCOMMITTED 0x1000
#define RTL_HEAP_ENTRY_COMMITTED 0x4000
#define RTL_HEAP_ENTRY_LFH 0x8000
/***********************************************************************
* HeapWalk (kernelbase.@)
*/
BOOL WINAPI DECLSPEC_HOTPATCH HeapWalk( HANDLE heap, PROCESS_HEAP_ENTRY *entry )
{
return set_ntstatus( RtlWalkHeap( heap, entry ));
struct rtl_heap_entry rtl_entry = {.lpData = entry->lpData};
NTSTATUS status;
if (!(status = RtlWalkHeap( heap, &rtl_entry )))
{
entry->lpData = rtl_entry.lpData;
entry->cbData = rtl_entry.cbData;
entry->cbOverhead = rtl_entry.cbOverhead;
entry->iRegionIndex = rtl_entry.iRegionIndex;
if (rtl_entry.wFlags & RTL_HEAP_ENTRY_BUSY)
entry->wFlags = PROCESS_HEAP_ENTRY_BUSY;
else if (rtl_entry.wFlags & RTL_HEAP_ENTRY_REGION)
entry->wFlags = PROCESS_HEAP_REGION;
else if (rtl_entry.wFlags & RTL_HEAP_ENTRY_UNCOMMITTED)
entry->wFlags = PROCESS_HEAP_UNCOMMITTED_RANGE;
else
entry->wFlags = 0;
memcpy( &entry->u.Region, &rtl_entry.Region, sizeof(entry->u.Region) );
}
return set_ntstatus( status );
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment