MCPcopy Create free account
hub / github.com/Vector35/binaryninja-api / FileInfoWidget

Method FileInfoWidget

examples/triage/fileinfo.cpp:68–94  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

66}
67
68FileInfoWidget::FileInfoWidget(QWidget* parent, BinaryViewRef bv)
69{
70 this->m_layout = new QGridLayout();
71 this->m_layout->setContentsMargins(0, 0, 0, 0);
72 this->m_layout->setVerticalSpacing(1);
73
74 const auto view = bv->GetParentView() ? bv->GetParentView() : bv;
75 const auto filePath = bv->GetFile()->GetOriginalFilename();
76 this->addCopyableField("Path: ", filePath.c_str());
77
78 const auto fileSize = QString::number(view->GetLength(), 16).prepend("0x");
79 this->addCopyableField("Size: ", fileSize);
80
81 const auto bufferSize = fileSize.toUInt(nullptr, 16);
82 const auto fileBuffer = std::make_unique<char[]>(bufferSize);
83 view->Read(fileBuffer.get(), 0, bufferSize);
84
85 const auto fileBytes = QByteArray(fileBuffer.get(), bufferSize);
86 this->addHashField("MD5: ", QCryptographicHash::Md5, fileBytes);
87 this->addHashField("SHA-1: ", QCryptographicHash::Sha1, fileBytes);
88 this->addHashField("SHA-256: ", QCryptographicHash::Sha256, fileBytes);
89
90 const auto scaledWidth = UIContext::getScaledWindowSize(20, 20).width();
91 this->m_layout->setColumnMinimumWidth(FileInfoWidget::m_maxColumns * 3 - 1, scaledWidth);
92 this->m_layout->setColumnStretch(FileInfoWidget::m_maxColumns * 3 - 1, 1);
93 setLayout(this->m_layout);
94}

Callers

nothing calls this directly

Calls 10

addCopyableFieldMethod · 0.95
addHashFieldMethod · 0.95
GetParentViewMethod · 0.80
GetOriginalFilenameMethod · 0.80
c_strMethod · 0.80
GetFileMethod · 0.45
GetLengthMethod · 0.45
ReadMethod · 0.45
getMethod · 0.45
widthMethod · 0.45

Tested by

no test coverage detected