Linked API calls too

This commit is contained in:
Pulak Malhotra 2021-07-29 16:50:23 +05:30
parent ee0b0f5d1d
commit 1d69dd0bfe
6 changed files with 43 additions and 3 deletions

2
rizin

@ -1 +1 @@
Subproject commit e7f2c2a4305ff75bc3d4682a29c58bd12e73ee2a
Subproject commit 6fad1318d24968673e4092f9536e3e967147d081

View File

@ -1592,6 +1592,33 @@ QVector<Chunk> CutterCore::getHeapChunks(RVA arena_addr)
return chunks_vector;
}
QVector<HeapBlock> CutterCore::getHeapBlocks()
{
CORE_LOCK();
QVector<HeapBlock> blocks_vector;
RzList *blocks = rz_heap_windows_blocks_list(core);
if (!blocks || !rz_list_length(blocks)) {
rz_list_free(blocks);
return blocks_vector;
}
RzListIter *iter;
RzWindowsHeapBlock *data;
CutterRListForeach(blocks, iter, RzWindowsHeapBlock, data)
{
HeapBlock block;
block.headerAddress = data->headerAddress;
block.userAddress = data->userAddress;
block.granularity = data->granularity;
block.unusedBytes = data->unusedBytes;
block.size = data->size;
block.type = QString(data->type);
blocks_vector.append(block);
}
return blocks_vector;
}
int CutterCore::getArchBits()
{
CORE_LOCK();

View File

@ -432,6 +432,7 @@ public:
* @return true if the write succeeded else false
*/
bool writeHeapChunk(RzHeapChunkSimple *chunkSimple);
QVector<HeapBlock> getHeapBlocks();
int getArchBits();
void startDebug();
void startEmulation();

View File

@ -388,7 +388,8 @@ struct HeapBlock
RVA headerAddress;
RVA userAddress;
RVA size;
RVA unused_bytes;
RVA unusedBytes;
RVA granularity;
QString type;
};

View File

@ -12,6 +12,12 @@ WindowsHeapWidget::WindowsHeapWidget(MainWindow *main, QWidget *parent)
// change the scroll mode to ScrollPerPixel
viewHeap->setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel);
viewHeap->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
connect(Core(), &CutterCore::refreshAll, this, &WindowsHeapWidget::updateContents);
connect(Core(), &CutterCore::debugTaskStateChanged, this, &WindowsHeapWidget::updateContents);
refreshDeferrer = dynamic_cast<CutterDockWidget *>(parent)->createRefreshDeferrer(
[this]() { updateContents(); });
}
WindowsHeapWidget::~WindowsHeapWidget()
@ -21,6 +27,10 @@ WindowsHeapWidget::~WindowsHeapWidget()
void WindowsHeapWidget::updateContents()
{
if (!refreshDeferrer->attemptRefresh(nullptr) || Core()->isDebugTaskInProgress()) {
return;
}
modelHeap->reload();
viewHeap->resizeColumnsToContents();
}
@ -89,6 +99,6 @@ void WindowsHeapModel::reload()
{
beginResetModel();
values.clear();
// Call cutter core here for data
values = Core()->getHeapBlocks();
endResetModel();
}

View File

@ -40,6 +40,7 @@ private:
Ui::WindowsHeapWidget *ui;
QTableView *viewHeap;
WindowsHeapModel *modelHeap = new WindowsHeapModel(this);
RefreshDeferrer *refreshDeferrer {};
};
#endif // WINDOWSHEAPWIDGET_H