mirror of
https://github.com/LongSoft/UEFITool.git
synced 2024-11-25 01:18:22 +08:00
NE Alpha 44
+ support of MS Surface implementation of Intel Boot Guard + optional disabling Intel Boot Guard marking
This commit is contained in:
parent
68df5a64a3
commit
02369442a2
@ -60,6 +60,7 @@ version(tr("NE alpha 44"))
|
|||||||
connect(ui->actionGoToOffset, SIGNAL(triggered()), this, SLOT(goToOffset()));
|
connect(ui->actionGoToOffset, SIGNAL(triggered()), this, SLOT(goToOffset()));
|
||||||
connect(ui->actionGoToAddress, SIGNAL(triggered()), this, SLOT(goToAddress()));
|
connect(ui->actionGoToAddress, SIGNAL(triggered()), this, SLOT(goToAddress()));
|
||||||
connect(ui->actionLoadGuidDatabase, SIGNAL(triggered()), this, SLOT(loadGuidDatabase()));
|
connect(ui->actionLoadGuidDatabase, SIGNAL(triggered()), this, SLOT(loadGuidDatabase()));
|
||||||
|
connect(ui->actionToggleBootGuardMarking, SIGNAL(toggled(bool)), this, SLOT(toggleBootGuardMarking(bool)));
|
||||||
connect(QCoreApplication::instance(), SIGNAL(aboutToQuit()), this, SLOT(writeSettings()));
|
connect(QCoreApplication::instance(), SIGNAL(aboutToQuit()), this, SLOT(writeSettings()));
|
||||||
|
|
||||||
// Enable Drag-and-Drop actions
|
// Enable Drag-and-Drop actions
|
||||||
@ -198,6 +199,7 @@ void UEFITool::populateUi(const QModelIndex ¤t)
|
|||||||
|| type == Types::EvsaEntry
|
|| type == Types::EvsaEntry
|
||||||
|| type == Types::FlashMapEntry);
|
|| type == Types::FlashMapEntry);
|
||||||
ui->menuStoreActions->setEnabled(type == Types::VssStore
|
ui->menuStoreActions->setEnabled(type == Types::VssStore
|
||||||
|
|| type == Types::LenovoVssStore
|
||||||
|| type == Types::FdcStore
|
|| type == Types::FdcStore
|
||||||
|| type == Types::FsysStore
|
|| type == Types::FsysStore
|
||||||
|| type == Types::EvsaStore
|
|| type == Types::EvsaStore
|
||||||
@ -629,6 +631,7 @@ void UEFITool::extract(const UINT8 mode)
|
|||||||
case Types::EvsaEntry: path = QFileDialog::getSaveFileName(this, tr("Save EVSA entry to file"), name + ".evse", "EVSA entry files (*.evse *.bin);;All files (*)"); break;
|
case Types::EvsaEntry: path = QFileDialog::getSaveFileName(this, tr("Save EVSA entry to file"), name + ".evse", "EVSA entry files (*.evse *.bin);;All files (*)"); break;
|
||||||
case Types::FlashMapEntry: path = QFileDialog::getSaveFileName(this, tr("Save FlashMap entry to file"), name + ".fme", "FlashMap entry files (*.fme *.bin);;All files (*)"); break;
|
case Types::FlashMapEntry: path = QFileDialog::getSaveFileName(this, tr("Save FlashMap entry to file"), name + ".fme", "FlashMap entry files (*.fme *.bin);;All files (*)"); break;
|
||||||
case Types::VssStore: path = QFileDialog::getSaveFileName(this, tr("Save VSS store to file"), name + ".vss", "VSS store files (*.vss *.bin);;All files (*)"); break;
|
case Types::VssStore: path = QFileDialog::getSaveFileName(this, tr("Save VSS store to file"), name + ".vss", "VSS store files (*.vss *.bin);;All files (*)"); break;
|
||||||
|
case Types::LenovoVssStore: path = QFileDialog::getSaveFileName(this, tr("Save VSS store to file"), name + ".vss", "VSS store files (*.vss *.bin);;All files (*)"); break;
|
||||||
case Types::FdcStore: path = QFileDialog::getSaveFileName(this, tr("Save FDC store to file"), name + ".fdc", "FDC store files (*.fdc *.bin);;All files (*)"); break;
|
case Types::FdcStore: path = QFileDialog::getSaveFileName(this, tr("Save FDC store to file"), name + ".fdc", "FDC store files (*.fdc *.bin);;All files (*)"); break;
|
||||||
case Types::FsysStore: path = QFileDialog::getSaveFileName(this, tr("Save Fsys store to file"), name + ".fsys", "Fsys store files (*.fsys *.bin);;All files (*)"); break;
|
case Types::FsysStore: path = QFileDialog::getSaveFileName(this, tr("Save Fsys store to file"), name + ".fsys", "Fsys store files (*.fsys *.bin);;All files (*)"); break;
|
||||||
case Types::EvsaStore: path = QFileDialog::getSaveFileName(this, tr("Save EVSA store to file"), name + ".evsa", "EVSA store files (*.evsa *.bin);;All files (*)"); break;
|
case Types::EvsaStore: path = QFileDialog::getSaveFileName(this, tr("Save EVSA store to file"), name + ".evsa", "EVSA store files (*.evsa *.bin);;All files (*)"); break;
|
||||||
@ -669,6 +672,7 @@ void UEFITool::extract(const UINT8 mode)
|
|||||||
case Types::FlashMapEntry:
|
case Types::FlashMapEntry:
|
||||||
case Types::FsysEntry: path = QFileDialog::getSaveFileName(this, tr("Save entry body to file"), name + ".bin", "Binary files (*.bin);;All files (*)"); break;
|
case Types::FsysEntry: path = QFileDialog::getSaveFileName(this, tr("Save entry body to file"), name + ".bin", "Binary files (*.bin);;All files (*)"); break;
|
||||||
case Types::VssStore:
|
case Types::VssStore:
|
||||||
|
case Types::LenovoVssStore:
|
||||||
case Types::FtwStore:
|
case Types::FtwStore:
|
||||||
case Types::FdcStore:
|
case Types::FdcStore:
|
||||||
case Types::FsysStore:
|
case Types::FsysStore:
|
||||||
@ -914,6 +918,11 @@ void UEFITool::clearMessages()
|
|||||||
ui->actionMessagesClear->setEnabled(false);
|
ui->actionMessagesClear->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UEFITool::toggleBootGuardMarking(bool enabled)
|
||||||
|
{
|
||||||
|
model->setMarkingEnabled(enabled);
|
||||||
|
}
|
||||||
|
|
||||||
void UEFITool::dragEnterEvent(QDragEnterEvent* event)
|
void UEFITool::dragEnterEvent(QDragEnterEvent* event)
|
||||||
{
|
{
|
||||||
if (event->mimeData()->hasFormat("text/uri-list"))
|
if (event->mimeData()->hasFormat("text/uri-list"))
|
||||||
@ -1032,6 +1041,7 @@ void UEFITool::contextMenuEvent(QContextMenuEvent* event)
|
|||||||
case Types::EvsaEntry:
|
case Types::EvsaEntry:
|
||||||
case Types::FlashMapEntry: ui->menuEntryActions->exec(event->globalPos()); break;
|
case Types::FlashMapEntry: ui->menuEntryActions->exec(event->globalPos()); break;
|
||||||
case Types::VssStore:
|
case Types::VssStore:
|
||||||
|
case Types::LenovoVssStore:
|
||||||
case Types::FdcStore:
|
case Types::FdcStore:
|
||||||
case Types::FsysStore:
|
case Types::FsysStore:
|
||||||
case Types::EvsaStore:
|
case Types::EvsaStore:
|
||||||
|
@ -106,6 +106,8 @@ private slots:
|
|||||||
void enableMessagesCopyActions(QListWidgetItem* item);
|
void enableMessagesCopyActions(QListWidgetItem* item);
|
||||||
void clearMessages();
|
void clearMessages();
|
||||||
|
|
||||||
|
void toggleBootGuardMarking(bool enabled);
|
||||||
|
|
||||||
void about();
|
void about();
|
||||||
void aboutQt();
|
void aboutQt();
|
||||||
|
|
||||||
|
@ -311,7 +311,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>851</width>
|
<width>851</width>
|
||||||
<height>21</height>
|
<height>31</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QMenu" name="menuFile">
|
<widget class="QMenu" name="menuFile">
|
||||||
@ -532,8 +532,15 @@
|
|||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
<addaction name="menuMessageActions"/>
|
<addaction name="menuMessageActions"/>
|
||||||
</widget>
|
</widget>
|
||||||
|
<widget class="QMenu" name="menu_View">
|
||||||
|
<property name="title">
|
||||||
|
<string>&View</string>
|
||||||
|
</property>
|
||||||
|
<addaction name="actionToggleBootGuardMarking"/>
|
||||||
|
</widget>
|
||||||
<addaction name="menuFile"/>
|
<addaction name="menuFile"/>
|
||||||
<addaction name="menuAction"/>
|
<addaction name="menuAction"/>
|
||||||
|
<addaction name="menu_View"/>
|
||||||
<addaction name="menuHelp"/>
|
<addaction name="menuHelp"/>
|
||||||
</widget>
|
</widget>
|
||||||
<action name="actionInsertAfter">
|
<action name="actionInsertAfter">
|
||||||
@ -699,6 +706,9 @@
|
|||||||
<property name="text">
|
<property name="text">
|
||||||
<string>&Quit</string>
|
<string>&Quit</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string>Alt+X</string>
|
||||||
|
</property>
|
||||||
<property name="menuRole">
|
<property name="menuRole">
|
||||||
<enum>QAction::QuitRole</enum>
|
<enum>QAction::QuitRole</enum>
|
||||||
</property>
|
</property>
|
||||||
@ -849,6 +859,20 @@
|
|||||||
<string>Ctrl+Shift+G</string>
|
<string>Ctrl+Shift+G</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="actionToggleBootGuardMarking">
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>&BootGuard marking</string>
|
||||||
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string>Ctrl+Shift+B</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<layoutdefault spacing="6" margin="11"/>
|
<layoutdefault spacing="6" margin="11"/>
|
||||||
<resources/>
|
<resources/>
|
||||||
|
@ -53,6 +53,20 @@ typedef struct BG_VENDOR_HASH_FILE_HEADER_AMI_OLD_
|
|||||||
// Offset is derived from flash map, will be detected as root volume with DXE core
|
// Offset is derived from flash map, will be detected as root volume with DXE core
|
||||||
} BG_VENDOR_HASH_FILE_HEADER_AMI_OLD;
|
} BG_VENDOR_HASH_FILE_HEADER_AMI_OLD;
|
||||||
|
|
||||||
|
typedef struct BG_MICROSOFT_PMDA_HEADER_
|
||||||
|
{
|
||||||
|
UINT32 Version;
|
||||||
|
UINT32 NumEntries;
|
||||||
|
} BG_MICROSOFT_PMDA_HEADER;
|
||||||
|
|
||||||
|
#define BG_MICROSOFT_PMDA_VERSION 0x00000001
|
||||||
|
|
||||||
|
typedef struct BG_MICROSOFT_PMDA_ENTRY_
|
||||||
|
{
|
||||||
|
UINT32 Address;
|
||||||
|
UINT32 Size;
|
||||||
|
UINT8 Hash[SHA256_DIGEST_SIZE];
|
||||||
|
} BG_MICROSOFT_PMDA_ENTRY;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Intel ACM
|
// Intel ACM
|
||||||
@ -66,7 +80,7 @@ typedef struct INTEL_ACM_HEADER_ {
|
|||||||
UINT32 HeaderType;
|
UINT32 HeaderType;
|
||||||
UINT32 HeaderVersion;
|
UINT32 HeaderVersion;
|
||||||
UINT16 ChipsetId;
|
UINT16 ChipsetId;
|
||||||
UINT16 Unknown;
|
UINT16 Flags;
|
||||||
UINT32 ModuleVendor;
|
UINT32 ModuleVendor;
|
||||||
UINT8 DateDay;
|
UINT8 DateDay;
|
||||||
UINT8 DateMonth;
|
UINT8 DateMonth;
|
||||||
@ -151,8 +165,8 @@ typedef struct BG_IBB_ELEMENT_ {
|
|||||||
UINT32 Flags;
|
UINT32 Flags;
|
||||||
UINT64 IbbMchBar;
|
UINT64 IbbMchBar;
|
||||||
UINT64 VtdBar;
|
UINT64 VtdBar;
|
||||||
UINT32 Unknown1;
|
UINT32 PmrlBase;
|
||||||
UINT32 Unknown2;
|
UINT32 PmrlLimit;
|
||||||
UINT64 Unknown3;
|
UINT64 Unknown3;
|
||||||
UINT64 Unknown4;
|
UINT64 Unknown4;
|
||||||
SHA256_HASH IbbHash;
|
SHA256_HASH IbbHash;
|
||||||
|
@ -556,7 +556,7 @@ USTATUS FfsParser::parseIntelImage(const UByteArray & intelImage, const UINT32 l
|
|||||||
const VSCC_TABLE_ENTRY* vsccTableEntry = (const VSCC_TABLE_ENTRY*)(descriptor + ((UINT16)upperMap->VsccTableBase << 4));
|
const VSCC_TABLE_ENTRY* vsccTableEntry = (const VSCC_TABLE_ENTRY*)(descriptor + ((UINT16)upperMap->VsccTableBase << 4));
|
||||||
info += UString("\nFlash chips in VSCC table:");
|
info += UString("\nFlash chips in VSCC table:");
|
||||||
UINT8 vsscTableSize = upperMap->VsccTableSize * sizeof(UINT32) / sizeof(VSCC_TABLE_ENTRY);
|
UINT8 vsscTableSize = upperMap->VsccTableSize * sizeof(UINT32) / sizeof(VSCC_TABLE_ENTRY);
|
||||||
for (int i = 0; i < vsscTableSize; i++) {
|
for (UINT8 i = 0; i < vsscTableSize; i++) {
|
||||||
info += usprintf("\n%02X%02X%02X (",
|
info += usprintf("\n%02X%02X%02X (",
|
||||||
vsccTableEntry->VendorId, vsccTableEntry->DeviceId0, vsccTableEntry->DeviceId1)
|
vsccTableEntry->VendorId, vsccTableEntry->DeviceId0, vsccTableEntry->DeviceId1)
|
||||||
+ jedecIdToUString(vsccTableEntry->VendorId, vsccTableEntry->DeviceId0, vsccTableEntry->DeviceId1)
|
+ jedecIdToUString(vsccTableEntry->VendorId, vsccTableEntry->DeviceId0, vsccTableEntry->DeviceId1)
|
||||||
@ -982,7 +982,7 @@ USTATUS FfsParser::parseVolumeHeader(const UByteArray & volume, const UINT32 loc
|
|||||||
}
|
}
|
||||||
else if (volumeHeader->Revision == 2) {
|
else if (volumeHeader->Revision == 2) {
|
||||||
// Acquire alignment
|
// Acquire alignment
|
||||||
alignment = (UINT32)pow(2.0, (int)(volumeHeader->Attributes & EFI_FVB2_ALIGNMENT) >> 16);
|
alignment = (UINT32)pow(2.0, (INT32)(volumeHeader->Attributes & EFI_FVB2_ALIGNMENT) >> 16);
|
||||||
// Check alignment
|
// Check alignment
|
||||||
if (!isUnknown && !model->compressed(parent) && ((model->offset(parent) + localOffset - capsuleOffsetFixup) % alignment))
|
if (!isUnknown && !model->compressed(parent) && ((model->offset(parent) + localOffset - capsuleOffsetFixup) % alignment))
|
||||||
msgUnaligned = true;
|
msgUnaligned = true;
|
||||||
@ -3011,6 +3011,7 @@ USTATUS FfsParser::checkProtectedRanges(const UModelIndex & index)
|
|||||||
for (UINT32 i = 0; i < (UINT32)bgProtectedRanges.size(); i++) {
|
for (UINT32 i = 0; i < (UINT32)bgProtectedRanges.size(); i++) {
|
||||||
if (bgProtectedRanges[i].Type == BG_PROTECTED_RANGE_INTEL_BOOT_GUARD) {
|
if (bgProtectedRanges[i].Type == BG_PROTECTED_RANGE_INTEL_BOOT_GUARD) {
|
||||||
bgProtectedRangeFound = true;
|
bgProtectedRangeFound = true;
|
||||||
|
bgProtectedRanges[i].Offset -= addressDiff;
|
||||||
protectedParts += openedImage.mid(bgProtectedRanges[i].Offset, bgProtectedRanges[i].Size);
|
protectedParts += openedImage.mid(bgProtectedRanges[i].Offset, bgProtectedRanges[i].Size);
|
||||||
markProtectedRangeRecursive(index, bgProtectedRanges[i]);
|
markProtectedRangeRecursive(index, bgProtectedRanges[i]);
|
||||||
}
|
}
|
||||||
@ -3085,6 +3086,21 @@ USTATUS FfsParser::checkProtectedRanges(const UModelIndex & index)
|
|||||||
model->findByOffset(bgProtectedRanges[i].Offset));
|
model->findByOffset(bgProtectedRanges[i].Offset));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
markProtectedRangeRecursive(index, bgProtectedRanges[i]);
|
||||||
|
}
|
||||||
|
else if (bgProtectedRanges[i].Type == BG_PROTECTED_RANGE_VENDOR_HASH_MICROSOFT) {
|
||||||
|
bgProtectedRanges[i].Offset -= addressDiff;
|
||||||
|
protectedParts = openedImage.mid(bgProtectedRanges[i].Offset, bgProtectedRanges[i].Size);
|
||||||
|
|
||||||
|
UByteArray digest(SHA256_DIGEST_SIZE, '\x00');
|
||||||
|
sha256(protectedParts.constData(), protectedParts.length(), digest.data());
|
||||||
|
|
||||||
|
if (digest != bgProtectedRanges[i].Hash) {
|
||||||
|
msg(usprintf("checkProtectedRanges: Microsoft protected range [%Xh:%Xh] hash mismatch, opened image may refuse to boot",
|
||||||
|
bgProtectedRanges[i].Offset, bgProtectedRanges[i].Offset + bgProtectedRanges[i].Size),
|
||||||
|
model->findByOffset(bgProtectedRanges[i].Offset));
|
||||||
|
}
|
||||||
|
|
||||||
markProtectedRangeRecursive(index, bgProtectedRanges[i]);
|
markProtectedRangeRecursive(index, bgProtectedRanges[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3164,7 +3180,7 @@ USTATUS FfsParser::parseVendorHashFile(const UByteArray & fileGuid, const UModel
|
|||||||
for (UINT32 i = 0; i < header->NumEntries; i++) {
|
for (UINT32 i = 0; i < header->NumEntries; i++) {
|
||||||
const BG_VENDOR_HASH_FILE_ENTRY* entry = (const BG_VENDOR_HASH_FILE_ENTRY*)(header + 1) + i;
|
const BG_VENDOR_HASH_FILE_ENTRY* entry = (const BG_VENDOR_HASH_FILE_ENTRY*)(header + 1) + i;
|
||||||
bootGuardInfo += usprintf("\nRelativeOffset: %08Xh Size: %Xh\nHash: ", entry->Offset, entry->Size);
|
bootGuardInfo += usprintf("\nRelativeOffset: %08Xh Size: %Xh\nHash: ", entry->Offset, entry->Size);
|
||||||
for (int i = 0; i < sizeof(entry->Hash); i++) {
|
for (UINT8 i = 0; i < sizeof(entry->Hash); i++) {
|
||||||
bootGuardInfo += usprintf("%02X", entry->Hash[i]);
|
bootGuardInfo += usprintf("%02X", entry->Hash[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3203,7 +3219,7 @@ USTATUS FfsParser::parseVendorHashFile(const UByteArray & fileGuid, const UModel
|
|||||||
for (UINT32 i = 0; i < NumEntries; i++) {
|
for (UINT32 i = 0; i < NumEntries; i++) {
|
||||||
const BG_VENDOR_HASH_FILE_ENTRY* entry = (const BG_VENDOR_HASH_FILE_ENTRY*)(model->body(index).constData()) + i;
|
const BG_VENDOR_HASH_FILE_ENTRY* entry = (const BG_VENDOR_HASH_FILE_ENTRY*)(model->body(index).constData()) + i;
|
||||||
bootGuardInfo += usprintf("\nAddress: %08Xh Size: %Xh\nHash: ", entry->Offset, entry->Size);
|
bootGuardInfo += usprintf("\nAddress: %08Xh Size: %Xh\nHash: ", entry->Offset, entry->Size);
|
||||||
for (int i = 0; i < sizeof(entry->Hash); i++) {
|
for (UINT8 i = 0; i < sizeof(entry->Hash); i++) {
|
||||||
bootGuardInfo += usprintf("%02X", entry->Hash[i]);
|
bootGuardInfo += usprintf("%02X", entry->Hash[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3216,7 +3232,7 @@ USTATUS FfsParser::parseVendorHashFile(const UByteArray & fileGuid, const UModel
|
|||||||
bootGuardInfo += usprintf("Old AMI hash file found at offset %Xh\nProtected range:", model->offset(fileIndex));
|
bootGuardInfo += usprintf("Old AMI hash file found at offset %Xh\nProtected range:", model->offset(fileIndex));
|
||||||
const BG_VENDOR_HASH_FILE_HEADER_AMI_OLD* entry = (const BG_VENDOR_HASH_FILE_HEADER_AMI_OLD*)(model->body(index).constData());
|
const BG_VENDOR_HASH_FILE_HEADER_AMI_OLD* entry = (const BG_VENDOR_HASH_FILE_HEADER_AMI_OLD*)(model->body(index).constData());
|
||||||
bootGuardInfo += usprintf("\nSize: %Xh\nHash: ", entry->Size);
|
bootGuardInfo += usprintf("\nSize: %Xh\nHash: ", entry->Size);
|
||||||
for (int i = 0; i < sizeof(entry->Hash); i++) {
|
for (UINT8 i = 0; i < sizeof(entry->Hash); i++) {
|
||||||
bootGuardInfo += usprintf("%02X", entry->Hash[i]);
|
bootGuardInfo += usprintf("%02X", entry->Hash[i]);
|
||||||
}
|
}
|
||||||
bootGuardInfo += UString("\n------------------------------------------------------------------------\n\n");
|
bootGuardInfo += UString("\n------------------------------------------------------------------------\n\n");
|
||||||
@ -3488,7 +3504,7 @@ USTATUS FfsParser::parseIntelAcm(const UByteArray & acm, const UINT32 localOffse
|
|||||||
bootGuardInfo += usprintf(
|
bootGuardInfo += usprintf(
|
||||||
"Intel ACM found at offset %Xh\n"
|
"Intel ACM found at offset %Xh\n"
|
||||||
"ModuleType: %08Xh HeaderLength: %08Xh HeaderVersion: %08Xh\n"
|
"ModuleType: %08Xh HeaderLength: %08Xh HeaderVersion: %08Xh\n"
|
||||||
"ChipsetId: %04Xh Unknown: %04Xh ModuleVendor: %04Xh\n"
|
"ChipsetId: %04Xh Flags: %04Xh ModuleVendor: %04Xh\n"
|
||||||
"Date: %02X.%02X.%04X ModuleSize: %08Xh EntryPoint: %08Xh\n"
|
"Date: %02X.%02X.%04X ModuleSize: %08Xh EntryPoint: %08Xh\n"
|
||||||
"AcmSvn: %04Xh Unknown1: %08Xh Unknown2: %08Xh\n"
|
"AcmSvn: %04Xh Unknown1: %08Xh Unknown2: %08Xh\n"
|
||||||
"GdtBase: %08Xh GdtMax: %08Xh SegSel: %08Xh\n"
|
"GdtBase: %08Xh GdtMax: %08Xh SegSel: %08Xh\n"
|
||||||
@ -3498,7 +3514,7 @@ USTATUS FfsParser::parseIntelAcm(const UByteArray & acm, const UINT32 localOffse
|
|||||||
header->ModuleSize * sizeof(UINT32),
|
header->ModuleSize * sizeof(UINT32),
|
||||||
header->HeaderVersion,
|
header->HeaderVersion,
|
||||||
header->ChipsetId,
|
header->ChipsetId,
|
||||||
header->Unknown,
|
header->Flags,
|
||||||
header->ModuleVendor,
|
header->ModuleVendor,
|
||||||
header->DateDay, header->DateMonth, header->DateYear,
|
header->DateDay, header->DateMonth, header->DateYear,
|
||||||
header->ModuleSize * sizeof(UINT32),
|
header->ModuleSize * sizeof(UINT32),
|
||||||
@ -3514,14 +3530,14 @@ USTATUS FfsParser::parseIntelAcm(const UByteArray & acm, const UINT32 localOffse
|
|||||||
);
|
);
|
||||||
// Add PubKey
|
// Add PubKey
|
||||||
bootGuardInfo += usprintf("\n\nACM RSA Public Key (Exponent: %Xh):", header->RsaPubExp);
|
bootGuardInfo += usprintf("\n\nACM RSA Public Key (Exponent: %Xh):", header->RsaPubExp);
|
||||||
for (int i = 0; i < sizeof(header->RsaPubKey); i++) {
|
for (UINT16 i = 0; i < sizeof(header->RsaPubKey); i++) {
|
||||||
if (i % 32 == 0)
|
if (i % 32 == 0)
|
||||||
bootGuardInfo += UString("\n");
|
bootGuardInfo += UString("\n");
|
||||||
bootGuardInfo += usprintf("%02X", header->RsaPubKey[i]);
|
bootGuardInfo += usprintf("%02X", header->RsaPubKey[i]);
|
||||||
}
|
}
|
||||||
// Add RsaSig
|
// Add RsaSig
|
||||||
bootGuardInfo += UString("\n\nACM RSA Signature:");
|
bootGuardInfo += UString("\n\nACM RSA Signature:");
|
||||||
for (int i = 0; i < sizeof(header->RsaSig); i++) {
|
for (UINT16 i = 0; i < sizeof(header->RsaSig); i++) {
|
||||||
if (i % 32 == 0)
|
if (i % 32 == 0)
|
||||||
bootGuardInfo += UString("\n");
|
bootGuardInfo += UString("\n");
|
||||||
bootGuardInfo += usprintf("%02X", header->RsaSig[i]);
|
bootGuardInfo += usprintf("%02X", header->RsaSig[i]);
|
||||||
@ -3565,7 +3581,7 @@ USTATUS FfsParser::parseIntelBootGuardKeyManifest(const UByteArray & keyManifest
|
|||||||
);
|
);
|
||||||
// Add BpKeyHash
|
// Add BpKeyHash
|
||||||
bootGuardInfo += UString("\n\nBoot Policy RSA Public Key Hash:\n");
|
bootGuardInfo += UString("\n\nBoot Policy RSA Public Key Hash:\n");
|
||||||
for (int i = 0; i < sizeof(header->BpKeyHash.HashBuffer); i++) {
|
for (UINT8 i = 0; i < sizeof(header->BpKeyHash.HashBuffer); i++) {
|
||||||
bootGuardInfo += usprintf("%02X", header->BpKeyHash.HashBuffer[i]);
|
bootGuardInfo += usprintf("%02X", header->BpKeyHash.HashBuffer[i]);
|
||||||
}
|
}
|
||||||
bgKmHash = UByteArray((const char*)header->BpKeyHash.HashBuffer, sizeof(header->BpKeyHash.HashBuffer));
|
bgKmHash = UByteArray((const char*)header->BpKeyHash.HashBuffer, sizeof(header->BpKeyHash.HashBuffer));
|
||||||
@ -3573,14 +3589,14 @@ USTATUS FfsParser::parseIntelBootGuardKeyManifest(const UByteArray & keyManifest
|
|||||||
// Add Key Manifest PubKey
|
// Add Key Manifest PubKey
|
||||||
bootGuardInfo += usprintf("\n\nKey Manifest RSA Public Key (Exponent: %Xh):",
|
bootGuardInfo += usprintf("\n\nKey Manifest RSA Public Key (Exponent: %Xh):",
|
||||||
header->KeyManifestSignature.PubKey.Exponent);
|
header->KeyManifestSignature.PubKey.Exponent);
|
||||||
for (int i = 0; i < sizeof(header->KeyManifestSignature.PubKey.Modulus); i++) {
|
for (UINT16 i = 0; i < sizeof(header->KeyManifestSignature.PubKey.Modulus); i++) {
|
||||||
if (i % 32 == 0)
|
if (i % 32 == 0)
|
||||||
bootGuardInfo += UString("\n");
|
bootGuardInfo += UString("\n");
|
||||||
bootGuardInfo += usprintf("%02X", header->KeyManifestSignature.PubKey.Modulus[i]);
|
bootGuardInfo += usprintf("%02X", header->KeyManifestSignature.PubKey.Modulus[i]);
|
||||||
}
|
}
|
||||||
// Add Key Manifest Signature
|
// Add Key Manifest Signature
|
||||||
bootGuardInfo += UString("\n\nKey Manifest RSA Signature:");
|
bootGuardInfo += UString("\n\nKey Manifest RSA Signature:");
|
||||||
for (int i = 0; i < sizeof(header->KeyManifestSignature.Signature.Signature); i++) {
|
for (UINT16 i = 0; i < sizeof(header->KeyManifestSignature.Signature.Signature); i++) {
|
||||||
if (i % 32 == 0)
|
if (i % 32 == 0)
|
||||||
bootGuardInfo += UString("\n");
|
bootGuardInfo += UString("\n");
|
||||||
bootGuardInfo += usprintf("%02X", header->KeyManifestSignature.Signature.Signature[i]);
|
bootGuardInfo += usprintf("%02X", header->KeyManifestSignature.Signature.Signature[i]);
|
||||||
@ -3595,7 +3611,7 @@ USTATUS FfsParser::parseIntelBootGuardKeyManifest(const UByteArray & keyManifest
|
|||||||
return U_INVALID_BG_KEY_MANIFEST;
|
return U_INVALID_BG_KEY_MANIFEST;
|
||||||
}
|
}
|
||||||
|
|
||||||
USTATUS FfsParser::findNextElement(const UByteArray & bootPolicy, const UINT32 localOffset, const UINT32 elementOffset, UINT32 & nextElementOffset, UINT32 & nextElementSize)
|
USTATUS FfsParser::findNextElement(const UByteArray & bootPolicy, const UINT32 elementOffset, UINT32 & nextElementOffset, UINT32 & nextElementSize)
|
||||||
{
|
{
|
||||||
UINT32 dataSize = bootPolicy.size();
|
UINT32 dataSize = bootPolicy.size();
|
||||||
|
|
||||||
@ -3615,7 +3631,7 @@ USTATUS FfsParser::findNextElement(const UByteArray & bootPolicy, const UINT32 l
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (*currentPos == BG_BOOT_POLICY_MANIFEST_PLATFORM_MANUFACTURER_ELEMENT_TAG && offset + sizeof(BG_PLATFORM_MANUFACTURER_ELEMENT) < dataSize) {
|
else if (*currentPos == BG_BOOT_POLICY_MANIFEST_PLATFORM_MANUFACTURER_ELEMENT_TAG && offset + sizeof(BG_PLATFORM_MANUFACTURER_ELEMENT) < dataSize) {
|
||||||
const BG_PLATFORM_MANUFACTURER_ELEMENT* header = (const BG_PLATFORM_MANUFACTURER_ELEMENT*)(bootPolicy.constData() + localOffset + elementOffset);
|
const BG_PLATFORM_MANUFACTURER_ELEMENT* header = (const BG_PLATFORM_MANUFACTURER_ELEMENT*)currentPos;
|
||||||
// Check that data is present
|
// Check that data is present
|
||||||
if (offset + sizeof(BG_PLATFORM_MANUFACTURER_ELEMENT) + header->DataSize < dataSize) {
|
if (offset + sizeof(BG_PLATFORM_MANUFACTURER_ELEMENT) + header->DataSize < dataSize) {
|
||||||
nextElementOffset = offset;
|
nextElementOffset = offset;
|
||||||
@ -3665,7 +3681,7 @@ USTATUS FfsParser::parseIntelBootGuardBootPolicy(const UByteArray & bootPolicy,
|
|||||||
// Iterate over elements to get them all
|
// Iterate over elements to get them all
|
||||||
UINT32 elementOffset = 0;
|
UINT32 elementOffset = 0;
|
||||||
UINT32 elementSize = 0;
|
UINT32 elementSize = 0;
|
||||||
USTATUS status = findNextElement(bootPolicy, localOffset, localOffset + sizeof(BG_BOOT_POLICY_MANIFEST_HEADER), elementOffset, elementSize);
|
USTATUS status = findNextElement(bootPolicy, localOffset + sizeof(BG_BOOT_POLICY_MANIFEST_HEADER), elementOffset, elementSize);
|
||||||
while (status == U_SUCCESS) {
|
while (status == U_SUCCESS) {
|
||||||
const UINT64* currentPos = (const UINT64*)(bootPolicy.constData() + elementOffset);
|
const UINT64* currentPos = (const UINT64*)(bootPolicy.constData() + elementOffset);
|
||||||
if (*currentPos == BG_BOOT_POLICY_MANIFEST_IBB_ELEMENT_TAG) {
|
if (*currentPos == BG_BOOT_POLICY_MANIFEST_IBB_ELEMENT_TAG) {
|
||||||
@ -3675,38 +3691,38 @@ USTATUS FfsParser::parseIntelBootGuardBootPolicy(const UByteArray & bootPolicy,
|
|||||||
"\nInitial Boot Block Element found at offset %Xh\n"
|
"\nInitial Boot Block Element found at offset %Xh\n"
|
||||||
"Tag: __IBBS__ Version: %02Xh Unknown: %02Xh\n"
|
"Tag: __IBBS__ Version: %02Xh Unknown: %02Xh\n"
|
||||||
"Flags: %08Xh IbbMchBar: %08Xh VtdBar: %08Xh\n"
|
"Flags: %08Xh IbbMchBar: %08Xh VtdBar: %08Xh\n"
|
||||||
"Unknown1: %08Xh Unknown2: %08Xh EntryPoint: %08Xh",
|
"PmrlBase: %08Xh PmrlLimit: %08Xh EntryPoint: %08Xh",
|
||||||
model->offset(parent) + localOffset + elementOffset,
|
model->offset(parent) + localOffset + elementOffset,
|
||||||
elementHeader->Version,
|
elementHeader->Version,
|
||||||
elementHeader->Unknown,
|
elementHeader->Unknown,
|
||||||
elementHeader->Flags,
|
elementHeader->Flags,
|
||||||
elementHeader->IbbMchBar,
|
elementHeader->IbbMchBar,
|
||||||
elementHeader->VtdBar,
|
elementHeader->VtdBar,
|
||||||
elementHeader->Unknown1,
|
elementHeader->PmrlBase,
|
||||||
elementHeader->Unknown2,
|
elementHeader->PmrlLimit,
|
||||||
elementHeader->EntryPoint
|
elementHeader->EntryPoint
|
||||||
);
|
);
|
||||||
// Add PostIbbHash
|
// Add PostIbbHash
|
||||||
bootGuardInfo += UString("\n\nPost IBB Hash:\n");
|
bootGuardInfo += UString("\n\nPost IBB Hash:\n");
|
||||||
for (int i = 0; i < sizeof(elementHeader->IbbHash.HashBuffer); i++) {
|
for (UINT8 i = 0; i < sizeof(elementHeader->IbbHash.HashBuffer); i++) {
|
||||||
bootGuardInfo += usprintf("%02X", elementHeader->IbbHash.HashBuffer[i]);
|
bootGuardInfo += usprintf("%02X", elementHeader->IbbHash.HashBuffer[i]);
|
||||||
}
|
}
|
||||||
// Add Digest
|
// Add Digest
|
||||||
bgBpDigest = UByteArray((const char*)elementHeader->Digest.HashBuffer, sizeof(elementHeader->Digest.HashBuffer));
|
bgBpDigest = UByteArray((const char*)elementHeader->Digest.HashBuffer, sizeof(elementHeader->Digest.HashBuffer));
|
||||||
bootGuardInfo += UString("\n\nIBB Digest:\n");
|
bootGuardInfo += UString("\n\nIBB Digest:\n");
|
||||||
for (int i = 0; i < bgBpDigest.size(); i++) {
|
for (UINT8 i = 0; i < (UINT8)bgBpDigest.size(); i++) {
|
||||||
bootGuardInfo += usprintf("%02X", (UINT8)bgBpDigest.at(i));
|
bootGuardInfo += usprintf("%02X", (UINT8)bgBpDigest.at(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add all IBB segments
|
// Add all IBB segments
|
||||||
bootGuardInfo += UString("\n\nIBB Segments:\n");
|
bootGuardInfo += UString("\n\nIBB Segments:\n");
|
||||||
const BG_IBB_SEGMENT_ELEMENT* segments = (const BG_IBB_SEGMENT_ELEMENT*)(elementHeader + 1);
|
const BG_IBB_SEGMENT_ELEMENT* segments = (const BG_IBB_SEGMENT_ELEMENT*)(elementHeader + 1);
|
||||||
for (int i = 0; i < elementHeader->IbbSegCount; i++) {
|
for (UINT8 i = 0; i < elementHeader->IbbSegCount; i++) {
|
||||||
bootGuardInfo += usprintf("Flags: %04Xh Address: %08Xh Size: %08Xh\n",
|
bootGuardInfo += usprintf("Flags: %04Xh Address: %08Xh Size: %08Xh\n",
|
||||||
segments[i].Flags, segments[i].Base, segments[i].Size);
|
segments[i].Flags, segments[i].Base, segments[i].Size);
|
||||||
if (segments[i].Flags == BG_IBB_SEGMENT_FLAG_IBB) {
|
if (segments[i].Flags == BG_IBB_SEGMENT_FLAG_IBB) {
|
||||||
BG_PROTECTED_RANGE range;
|
BG_PROTECTED_RANGE range;
|
||||||
range.Offset = segments[i].Base - addressDiff;
|
range.Offset = segments[i].Base;
|
||||||
range.Size = segments[i].Size;
|
range.Size = segments[i].Size;
|
||||||
range.Type = BG_PROTECTED_RANGE_INTEL_BOOT_GUARD;
|
range.Type = BG_PROTECTED_RANGE_INTEL_BOOT_GUARD;
|
||||||
bgProtectedRanges.push_back(range);
|
bgProtectedRanges.push_back(range);
|
||||||
@ -3717,18 +3733,45 @@ USTATUS FfsParser::parseIntelBootGuardBootPolicy(const UByteArray & bootPolicy,
|
|||||||
const BG_PLATFORM_MANUFACTURER_ELEMENT* elementHeader = (const BG_PLATFORM_MANUFACTURER_ELEMENT*)currentPos;
|
const BG_PLATFORM_MANUFACTURER_ELEMENT* elementHeader = (const BG_PLATFORM_MANUFACTURER_ELEMENT*)currentPos;
|
||||||
bootGuardInfo += usprintf(
|
bootGuardInfo += usprintf(
|
||||||
"\nPlatform Manufacturer Data Element found at offset %Xh\n"
|
"\nPlatform Manufacturer Data Element found at offset %Xh\n"
|
||||||
"Tag: __PMDA__ Version: %02Xh DataSize: %02Xh\n",
|
"Tag: __PMDA__ Version: %02Xh DataSize: %02Xh",
|
||||||
model->offset(parent) + localOffset + elementOffset,
|
model->offset(parent) + localOffset + elementOffset,
|
||||||
elementHeader->Version,
|
elementHeader->Version,
|
||||||
elementHeader->DataSize
|
elementHeader->DataSize
|
||||||
);
|
);
|
||||||
// Add data
|
// Check for Microsoft PMDA hash data
|
||||||
UINT8* data = (UINT8*)(elementHeader + 1);
|
const BG_MICROSOFT_PMDA_HEADER* header = (const BG_MICROSOFT_PMDA_HEADER*)(elementHeader + 1);
|
||||||
for (int i = 0; i < elementHeader->DataSize; i++) {
|
if (header->Version == BG_MICROSOFT_PMDA_VERSION
|
||||||
|
&& elementHeader->DataSize == sizeof(BG_MICROSOFT_PMDA_HEADER) + sizeof(BG_MICROSOFT_PMDA_ENTRY)*header->NumEntries) {
|
||||||
|
// Add entries
|
||||||
|
bootGuardInfo += UString("\nMicrosoft PMDA-based protected ranges:\n");
|
||||||
|
const BG_MICROSOFT_PMDA_ENTRY* entries = (const BG_MICROSOFT_PMDA_ENTRY*)(header + 1);
|
||||||
|
for (UINT32 i = 0; i < header->NumEntries; i++) {
|
||||||
|
|
||||||
|
bootGuardInfo += usprintf("Address: %08Xh Size: %08Xh\n", entries[i].Address, entries[i].Size);
|
||||||
|
bootGuardInfo += UString("Hash: ");
|
||||||
|
for (UINT8 j = 0; j < sizeof(entries[i].Hash); j++) {
|
||||||
|
bootGuardInfo += usprintf("%02X", entries[i].Hash[j]);
|
||||||
|
}
|
||||||
|
bootGuardInfo += UString("\n");
|
||||||
|
|
||||||
|
BG_PROTECTED_RANGE range;
|
||||||
|
range.Offset = entries[i].Address;
|
||||||
|
range.Size = entries[i].Size;
|
||||||
|
range.Hash = UByteArray((const char*)entries[i].Hash, sizeof(entries[i].Hash));
|
||||||
|
range.Type = BG_PROTECTED_RANGE_VENDOR_HASH_MICROSOFT;
|
||||||
|
bgProtectedRanges.push_back(range);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// Add raw data
|
||||||
|
const UINT8* data = (const UINT8*)(elementHeader + 1);
|
||||||
|
for (UINT16 i = 0; i < elementHeader->DataSize; i++) {
|
||||||
if (i % 32 == 0)
|
if (i % 32 == 0)
|
||||||
bootGuardInfo += UString("\n");
|
bootGuardInfo += UString("\n");
|
||||||
bootGuardInfo += usprintf("%02X", data[i]);
|
bootGuardInfo += usprintf("%02X", data[i]);
|
||||||
}
|
}
|
||||||
|
bootGuardInfo += UString("\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (*currentPos == BG_BOOT_POLICY_MANIFEST_SIGNATURE_ELEMENT_TAG) {
|
else if (*currentPos == BG_BOOT_POLICY_MANIFEST_SIGNATURE_ELEMENT_TAG) {
|
||||||
const BG_BOOT_POLICY_MANIFEST_SIGNATURE_ELEMENT* elementHeader = (const BG_BOOT_POLICY_MANIFEST_SIGNATURE_ELEMENT*)currentPos;
|
const BG_BOOT_POLICY_MANIFEST_SIGNATURE_ELEMENT* elementHeader = (const BG_BOOT_POLICY_MANIFEST_SIGNATURE_ELEMENT*)currentPos;
|
||||||
@ -3740,7 +3783,7 @@ USTATUS FfsParser::parseIntelBootGuardBootPolicy(const UByteArray & bootPolicy,
|
|||||||
);
|
);
|
||||||
// Add PubKey
|
// Add PubKey
|
||||||
bootGuardInfo += usprintf("\n\nBoot Policy RSA Public Key (Exponent: %Xh):", elementHeader->KeySignature.PubKey.Exponent);
|
bootGuardInfo += usprintf("\n\nBoot Policy RSA Public Key (Exponent: %Xh):", elementHeader->KeySignature.PubKey.Exponent);
|
||||||
for (int i = 0; i < sizeof(elementHeader->KeySignature.PubKey.Modulus); i++) {
|
for (UINT16 i = 0; i < sizeof(elementHeader->KeySignature.PubKey.Modulus); i++) {
|
||||||
if (i % 32 == 0)
|
if (i % 32 == 0)
|
||||||
bootGuardInfo += UString("\n");
|
bootGuardInfo += UString("\n");
|
||||||
bootGuardInfo += usprintf("%02X", elementHeader->KeySignature.PubKey.Modulus[i]);
|
bootGuardInfo += usprintf("%02X", elementHeader->KeySignature.PubKey.Modulus[i]);
|
||||||
@ -3750,7 +3793,7 @@ USTATUS FfsParser::parseIntelBootGuardBootPolicy(const UByteArray & bootPolicy,
|
|||||||
UINT8 hash[SHA256_DIGEST_SIZE];
|
UINT8 hash[SHA256_DIGEST_SIZE];
|
||||||
sha256(&elementHeader->KeySignature.PubKey.Modulus, sizeof(elementHeader->KeySignature.PubKey.Modulus), hash);
|
sha256(&elementHeader->KeySignature.PubKey.Modulus, sizeof(elementHeader->KeySignature.PubKey.Modulus), hash);
|
||||||
bootGuardInfo += UString("\n\nBoot Policy RSA Public Key Hash:");
|
bootGuardInfo += UString("\n\nBoot Policy RSA Public Key Hash:");
|
||||||
for (int i = 0; i < sizeof(hash); i++) {
|
for (UINT8 i = 0; i < sizeof(hash); i++) {
|
||||||
if (i % 32 == 0)
|
if (i % 32 == 0)
|
||||||
bootGuardInfo += UString("\n");
|
bootGuardInfo += UString("\n");
|
||||||
bootGuardInfo += usprintf("%02X", hash[i]);
|
bootGuardInfo += usprintf("%02X", hash[i]);
|
||||||
@ -3759,13 +3802,13 @@ USTATUS FfsParser::parseIntelBootGuardBootPolicy(const UByteArray & bootPolicy,
|
|||||||
|
|
||||||
// Add Signature
|
// Add Signature
|
||||||
bootGuardInfo += UString("\n\nBoot Policy RSA Signature:");
|
bootGuardInfo += UString("\n\nBoot Policy RSA Signature:");
|
||||||
for (int i = 0; i < sizeof(elementHeader->KeySignature.Signature.Signature); i++) {
|
for (UINT16 i = 0; i < sizeof(elementHeader->KeySignature.Signature.Signature); i++) {
|
||||||
if (i % 32 == 0)
|
if (i % 32 == 0)
|
||||||
bootGuardInfo += UString("\n");
|
bootGuardInfo += UString("\n");
|
||||||
bootGuardInfo += usprintf("%02X", elementHeader->KeySignature.Signature.Signature[i]);
|
bootGuardInfo += usprintf("%02X", elementHeader->KeySignature.Signature.Signature[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
status = findNextElement(bootPolicy, localOffset, elementOffset + elementSize, elementOffset, elementSize);
|
status = findNextElement(bootPolicy, elementOffset + elementSize, elementOffset, elementSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
bootGuardInfo += UString("\n------------------------------------------------------------------------\n\n");
|
bootGuardInfo += UString("\n------------------------------------------------------------------------\n\n");
|
||||||
|
@ -35,6 +35,7 @@ typedef struct BG_PROTECTED_RANGE_
|
|||||||
#define BG_PROTECTED_RANGE_VENDOR_HASH_PHOENIX 0x02
|
#define BG_PROTECTED_RANGE_VENDOR_HASH_PHOENIX 0x02
|
||||||
#define BG_PROTECTED_RANGE_VENDOR_HASH_AMI_OLD 0x03
|
#define BG_PROTECTED_RANGE_VENDOR_HASH_AMI_OLD 0x03
|
||||||
#define BG_PROTECTED_RANGE_VENDOR_HASH_AMI_NEW 0x04
|
#define BG_PROTECTED_RANGE_VENDOR_HASH_AMI_NEW 0x04
|
||||||
|
#define BG_PROTECTED_RANGE_VENDOR_HASH_MICROSOFT 0x05
|
||||||
|
|
||||||
class FfsParser
|
class FfsParser
|
||||||
{
|
{
|
||||||
@ -160,7 +161,7 @@ private:
|
|||||||
USTATUS parseIntelAcm(const UByteArray & acm, const UINT32 localOffset, const UModelIndex & parent, UString & info, UINT32 &realSize);
|
USTATUS parseIntelAcm(const UByteArray & acm, const UINT32 localOffset, const UModelIndex & parent, UString & info, UINT32 &realSize);
|
||||||
USTATUS parseIntelBootGuardKeyManifest(const UByteArray & keyManifest, const UINT32 localOffset, const UModelIndex & parent, UString & info, UINT32 &realSize);
|
USTATUS parseIntelBootGuardKeyManifest(const UByteArray & keyManifest, const UINT32 localOffset, const UModelIndex & parent, UString & info, UINT32 &realSize);
|
||||||
USTATUS parseIntelBootGuardBootPolicy(const UByteArray & bootPolicy, const UINT32 localOffset, const UModelIndex & parent, UString & info, UINT32 &realSize);
|
USTATUS parseIntelBootGuardBootPolicy(const UByteArray & bootPolicy, const UINT32 localOffset, const UModelIndex & parent, UString & info, UINT32 &realSize);
|
||||||
USTATUS findNextElement(const UByteArray & bootPolicy, const UINT32 localOffset, const UINT32 elementOffset, UINT32 & nextElementOffset, UINT32 & nextElementSize);
|
USTATUS findNextElement(const UByteArray & bootPolicy, const UINT32 elementOffset, UINT32 & nextElementOffset, UINT32 & nextElementSize);
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ QVariant TreeModel::data(const UModelIndex &index, int role) const
|
|||||||
return (const char*)item->data(index.column()).toLocal8Bit();
|
return (const char*)item->data(index.column()).toLocal8Bit();
|
||||||
}
|
}
|
||||||
else if (role == Qt::BackgroundRole) {
|
else if (role == Qt::BackgroundRole) {
|
||||||
if (marking(index) > 0) {
|
if (markingEnabled && marking(index) > 0) {
|
||||||
return QBrush((Qt::GlobalColor)marking(index));
|
return QBrush((Qt::GlobalColor)marking(index));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -328,6 +328,11 @@ void TreeModel::setCompressed(const UModelIndex &index, const bool compressed)
|
|||||||
emit dataChanged(index, index);
|
emit dataChanged(index, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TreeModel::TreeModel::setMarkingEnabled(const bool enabled)
|
||||||
|
{
|
||||||
|
markingEnabled = enabled; emit dataChanged(QModelIndex(), QModelIndex());
|
||||||
|
}
|
||||||
|
|
||||||
void TreeModel::setMarking(const UModelIndex &index, const UINT8 marking)
|
void TreeModel::setMarking(const UModelIndex &index, const UINT8 marking)
|
||||||
{
|
{
|
||||||
if (!index.isValid())
|
if (!index.isValid())
|
||||||
|
@ -86,6 +86,7 @@ class TreeModel : public QAbstractItemModel
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
private:
|
private:
|
||||||
|
bool markingEnabled;
|
||||||
TreeItem *rootItem;
|
TreeItem *rootItem;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -93,7 +94,7 @@ public:
|
|||||||
Qt::ItemFlags flags(const UModelIndex &index) const;
|
Qt::ItemFlags flags(const UModelIndex &index) const;
|
||||||
QVariant headerData(int section, Qt::Orientation orientation,
|
QVariant headerData(int section, Qt::Orientation orientation,
|
||||||
int role = Qt::DisplayRole) const;
|
int role = Qt::DisplayRole) const;
|
||||||
TreeModel(QObject *parent = 0) : QAbstractItemModel(parent) {
|
TreeModel(QObject *parent = 0) : QAbstractItemModel(parent), markingEnabled(true) {
|
||||||
rootItem = new TreeItem(0, Types::Root, 0, UString(), UString(), UString(), UByteArray(), UByteArray(), UByteArray(), true, false);
|
rootItem = new TreeItem(0, Types::Root, 0, UString(), UString(), UString(), UByteArray(), UByteArray(), UByteArray(), true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -144,6 +145,7 @@ public:
|
|||||||
void addInfo(const UModelIndex &index, const UString &info, const bool append = TRUE);
|
void addInfo(const UModelIndex &index, const UString &info, const bool append = TRUE);
|
||||||
void setFixed(const UModelIndex &index, const bool fixed);
|
void setFixed(const UModelIndex &index, const bool fixed);
|
||||||
void setCompressed(const UModelIndex &index, const bool compressed);
|
void setCompressed(const UModelIndex &index, const bool compressed);
|
||||||
|
void setMarkingEnabled(const bool enabled);
|
||||||
void setMarking(const UModelIndex &index, const UINT8 marking);
|
void setMarking(const UModelIndex &index, const UINT8 marking);
|
||||||
|
|
||||||
UINT32 offset(const UModelIndex &index) const;
|
UINT32 offset(const UModelIndex &index) const;
|
||||||
|
Loading…
Reference in New Issue
Block a user