diff --git a/UEFITool/hexviewdialog.cpp b/UEFITool/hexviewdialog.cpp
index 60ac464..e1d217f 100644
--- a/UEFITool/hexviewdialog.cpp
+++ b/UEFITool/hexviewdialog.cpp
@@ -37,7 +37,7 @@ void HexViewDialog::setFont(const QFont &font)
hexView->setFont(font);
}
-void HexViewDialog::setItem(const UModelIndex & index)
+void HexViewDialog::setItem(const UModelIndex & index, bool bodyOnly)
{
const TreeModel * model = (const TreeModel*)index.model();
@@ -47,6 +47,8 @@ void HexViewDialog::setItem(const UModelIndex & index)
setWindowTitle(UString("Hex view: ") + (itemText.isEmpty() ? itemName : itemName + " | " + itemText));
// Set hex data
- QByteArray data = model->header(index) + model->body(index) + model->tail(index);
+ QByteArray data;
+ if (bodyOnly) data = model->body(index);
+ else data = model->header(index) + model->body(index) + model->tail(index);
hexView->setData(data);
}
\ No newline at end of file
diff --git a/UEFITool/hexviewdialog.h b/UEFITool/hexviewdialog.h
index 0cd2fe9..a221a01 100644
--- a/UEFITool/hexviewdialog.h
+++ b/UEFITool/hexviewdialog.h
@@ -28,7 +28,7 @@ public:
~HexViewDialog();
Ui::HexViewDialog* ui;
- void setItem(const UModelIndex & index);
+ void setItem(const UModelIndex & index, bool bodyOnly);
void setFont(const QFont &font);
private:
diff --git a/UEFITool/uefitool.cpp b/UEFITool/uefitool.cpp
index 399c590..d1b9895 100644
--- a/UEFITool/uefitool.cpp
+++ b/UEFITool/uefitool.cpp
@@ -18,7 +18,7 @@
UEFITool::UEFITool(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::UEFITool),
-version(tr("NE Alpha35"))
+version(tr("NE Alpha36"))
{
clipboard = QApplication::clipboard();
@@ -39,6 +39,7 @@ version(tr("NE Alpha35"))
connect(ui->actionSaveImageFile, SIGNAL(triggered()), this, SLOT(saveImageFile()));
connect(ui->actionSearch, SIGNAL(triggered()), this, SLOT(search()));
connect(ui->actionHexView, SIGNAL(triggered()), this, SLOT(hexView()));
+ connect(ui->actionBodyHexView, SIGNAL(triggered()), this, SLOT(bodyHexView()));
connect(ui->actionExtract, SIGNAL(triggered()), this, SLOT(extractAsIs()));
connect(ui->actionExtractBody, SIGNAL(triggered()), this, SLOT(extractBody()));
connect(ui->actionExtractBodyUncompressed, SIGNAL(triggered()), this, SLOT(extractBodyUncompressed()));
@@ -198,6 +199,7 @@ void UEFITool::populateUi(const QModelIndex ¤t)
// Enable actions
ui->actionHexView->setDisabled(model->hasEmptyHeader(current) && model->hasEmptyBody(current) && model->hasEmptyTail(current));
+ ui->actionBodyHexView->setDisabled(model->hasEmptyBody(current));
ui->actionExtract->setDisabled(model->hasEmptyHeader(current) && model->hasEmptyBody(current) && model->hasEmptyTail(current));
ui->actionGoToData->setEnabled(type == Types::NvarEntry && subtype == Subtypes::LinkNvarEntry);
@@ -309,7 +311,17 @@ void UEFITool::hexView()
if (!index.isValid())
return;
- hexViewDialog->setItem(index);
+ hexViewDialog->setItem(index, false);
+ hexViewDialog->exec();
+}
+
+void UEFITool::bodyHexView()
+{
+ QModelIndex index = ui->structureTreeView->selectionModel()->currentIndex();
+ if (!index.isValid())
+ return;
+
+ hexViewDialog->setItem(index, true);
hexViewDialog->exec();
}
@@ -364,7 +376,7 @@ void UEFITool::goToData()
void UEFITool::insert(const UINT8 mode)
{
U_UNUSED_PARAMETER(mode);
-
+
/*QModelIndex index = ui->structureTreeView->selectionModel()->currentIndex();
if (!index.isValid())
return;
diff --git a/UEFITool/uefitool.h b/UEFITool/uefitool.h
index 0c9eaa2..ddcb77f 100644
--- a/UEFITool/uefitool.h
+++ b/UEFITool/uefitool.h
@@ -78,6 +78,7 @@ private slots:
void goToOffset();
void hexView();
+ void bodyHexView();
void goToData();
void extract(const UINT8 mode);
diff --git a/UEFITool/uefitool.ui b/UEFITool/uefitool.ui
index b4f002f..c8daf82 100644
--- a/UEFITool/uefitool.ui
+++ b/UEFITool/uefitool.ui
@@ -305,6 +305,7 @@
&Capsule
+
@@ -354,6 +355,7 @@
&Volume
+
@@ -373,6 +375,7 @@
&File
+
@@ -396,6 +399,7 @@
&Section
+
@@ -432,6 +436,7 @@
Variable
+
@@ -456,6 +461,7 @@
S&tore
+
@@ -771,6 +777,17 @@
Ctrl+G
+
+
+ false
+
+
+ Body hex vie&w...
+
+
+ Ctrl+Shift+D
+
+
diff --git a/common/ffsparser.cpp b/common/ffsparser.cpp
index 49c9002..469bb82 100644
--- a/common/ffsparser.cpp
+++ b/common/ffsparser.cpp
@@ -1063,7 +1063,7 @@ USTATUS FfsParser::parseVolumeHeader(const UByteArray & volume, const UINT32 loc
}
index = model->addItem(model->offset(parent) + localOffset, Types::Volume, subtype, name, text, info, header, body, UByteArray(), Fixed, parent);
- // Set parsing data for created item
+ // Set parsing data for created volume
VOLUME_PARSING_DATA pdata;
pdata.emptyByte = emptyByte;
pdata.ffsVersion = ffsVersion;
@@ -1488,6 +1488,8 @@ USTATUS FfsParser::parseFileHeader(const UByteArray & file, const UINT32 localOf
FILE_PARSING_DATA pdata;
pdata.emptyByte = (fileHeader->State & EFI_FILE_ERASE_POLARITY) ? 0xFF : 0x00;
pdata.guid = fileHeader->Name;
+ model->setParsingData(index, UByteArray((const char*)&pdata, sizeof(pdata)));
+
// Override lastVtf index, if needed
if (isVtf) {
@@ -2904,6 +2906,7 @@ USTATUS FfsParser::parseFit(const UModelIndex & index, const UINT32 diff)
UString info;
for (UINT32 i = 1; i < fitHeader->Size; i++) {
currentStrings.clear();
+ info.clear();
const FIT_ENTRY* currentEntry = fitHeader + i;
UINT32 currentEntrySize = currentEntry->Size;
@@ -2916,13 +2919,13 @@ USTATUS FfsParser::parseFit(const UModelIndex & index, const UINT32 diff)
case FIT_TYPE_EMPTY:
break;
- case FIT_TYPE_MICROCODE:
+ case FIT_TYPE_MICROCODE: {
//TODO: refactor into function with error reporting
if (currentEntry->Address > diff && currentEntry->Address < 0xFFFFFFFFUL) {
UINT32 offset = currentEntry->Address - diff;
UModelIndex mcIndex = model->findByOffset(offset);
UByteArray mcFile = model->header(mcIndex) + model->body(mcIndex) + model->tail(mcIndex);
-
+
UINT32 mcOffset = offset - model->offset(mcIndex);
if (mcOffset + sizeof(INTEL_MICROCODE_HEADER) <= (UINT32)mcFile.size()) {
const INTEL_MICROCODE_HEADER* header = (const INTEL_MICROCODE_HEADER*)(mcFile.constData() + mcOffset);
@@ -2936,7 +2939,7 @@ USTATUS FfsParser::parseFit(const UModelIndex & index, const UINT32 diff)
if (reservedBytesValid) {
UINT32 mcSize = header->TotalSize;
if (mcOffset + mcSize <= (UINT32)mcFile.size()) {
- info = usprintf("LocalOffset %08Xh, CPUID %Xh, Revision %Xh, Date %08Xh",
+ info = usprintf("LocalOffset %08Xh, CPUID %08Xh, Revision %08Xh, Date %08Xh",
mcOffset,
header->CpuSignature,
header->Revision,
@@ -2948,7 +2951,7 @@ USTATUS FfsParser::parseFit(const UModelIndex & index, const UINT32 diff)
}
}
}
- break;
+ } break;
case FIT_TYPE_BIOS_AC_MODULE:
case FIT_TYPE_BIOS_INIT_MODULE:
diff --git a/common/nvramparser.cpp b/common/nvramparser.cpp
index 0434841..1a9a6cc 100644
--- a/common/nvramparser.cpp
+++ b/common/nvramparser.cpp
@@ -57,7 +57,6 @@ USTATUS NvramParser::parseNvarStore(const UModelIndex & index)
bool isInvalid = false;
bool isInvalidLink = false;
- //bool isDataOnly = false;
bool hasExtendedHeader = false;
bool hasChecksum = false;
bool hasTimestamp = false;
@@ -113,7 +112,7 @@ USTATUS NvramParser::parseNvarStore(const UModelIndex & index)
// Add GUID store area
UByteArray guidArea = data.right(guidAreaSize);
// Get info
- name = UString("GUID store area");
+ name = UString("GUID store");
info = usprintf("Full size: %Xh (%u)\nGUIDs in store: %u",
guidArea.size(), guidArea.size(),
guidsInStore);
@@ -412,8 +411,7 @@ USTATUS NvramParser::parseNvramVolumeBody(const UModelIndex & index)
UINT32 storeOffset = prevStoreOffset;
UINT32 prevStoreSize = 0;
- while (!result)
- {
+ while (!result) {
// Padding between stores
if (storeOffset > prevStoreOffset + prevStoreSize) {
UINT32 paddingOffset = prevStoreOffset + prevStoreSize;
@@ -476,7 +474,6 @@ USTATUS NvramParser::parseNvramVolumeBody(const UModelIndex & index)
info = usprintf("Full size: %Xh (%u)", padding.size(), padding.size());
if (padding.count(emptyByte) == padding.size()) { // Free space
-
// Add tree item
model->addItem(localOffset + storeOffset, Types::FreeSpace, 0, UString("Free space"), UString(), info, UByteArray(), padding, UByteArray(), Movable, index);
}
@@ -781,7 +778,7 @@ USTATUS NvramParser::parseFtwStoreHeader(const UByteArray & store, const UINT32
if (parentVolumeIndex.isValid() && model->hasEmptyParsingData(parentVolumeIndex) == false) {
UByteArray data = model->parsingData(parentVolumeIndex);
const VOLUME_PARSING_DATA* pdata = (const VOLUME_PARSING_DATA*)data.constData();
- emptyByte = pdata->ffsVersion;
+ emptyByte = pdata->emptyByte;
}
// Get FTW block headers
@@ -1185,7 +1182,7 @@ USTATUS NvramParser::parseIntelMicrocodeHeader(const UByteArray & store, const U
// Add info
UString name("Intel microcode");
- UString info = usprintf("\nFull size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)\n"
+ UString info = usprintf("Full size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)\n"
"Date: %08Xh\nCPU signature: %08Xh\nRevision: %08Xh\nChecksum: %08Xh\nLoader revision: %08Xh\nCPU flags: %08Xh",
ucodeHeader->TotalSize, ucodeHeader->TotalSize,
header.size(), header.size(),
@@ -1262,7 +1259,7 @@ USTATUS NvramParser::parseVssStoreBody(const UModelIndex & index)
if (parentVolumeIndex.isValid() && model->hasEmptyParsingData(parentVolumeIndex) == false) {
UByteArray data = model->parsingData(parentVolumeIndex);
const VOLUME_PARSING_DATA* pdata = (const VOLUME_PARSING_DATA*)data.constData();
- emptyByte = pdata->ffsVersion;
+ emptyByte = pdata->emptyByte;
}
// Get local offset
@@ -1553,7 +1550,7 @@ USTATUS NvramParser::parseEvsaStoreBody(const UModelIndex & index)
if (parentVolumeIndex.isValid() && model->hasEmptyParsingData(parentVolumeIndex) == false) {
UByteArray data = model->parsingData(parentVolumeIndex);
const VOLUME_PARSING_DATA* pdata = (const VOLUME_PARSING_DATA*)data.constData();
- emptyByte = pdata->ffsVersion;
+ emptyByte = pdata->emptyByte;
}
// Get local offset