void CProcessBrowserDlg::LoadHeap
	(DWORD dwProcessID)
{
	HANDLE			hSnapshot;
	BOOL			bRet;
	BOOL				bEntryRet;
	HEAPLIST32			hlHeapList;
	HEAPENTRY32			heHeapEntry;
	hSnapshot = CreateToolhelp32Snapshot( TH32CS_SNAPHEAPLIST,dwProcessID );
	if( hSnapshot != NULL )
	{
		hlHeapList.dwSize = sizeof( HEAPLIST32 );
		bRet = Heap32ListFirst( hSnapshot,&hlHeapList );
		while( bRet )
		{
			heHeapEntry.dwSize = sizeof( HEAPENTRY32 );
			bEntryRet = Heap32First( &heHeapEntry,
			dwProcessID,hlHeapList.th32HeapID );
			while( bEntryRet )
			{
				………….
				bEntryRet = Heap32Next( &heHeapEntry );
			}
			bRet = Heap32ListNext( hSnapshot,&hlHeapList );
		}
		CloseHandle( hSnapshot );
	}
}

Поделитесь материалом с коллегами и друзьями