mirror of
https://github.com/LongSoft/UEFITool.git
synced 2025-05-13 14:44:47 -04:00
UT 0.21.3 / UP 0.3.7
- solved a bug with Gigabyte-specific descriptor settings (BIOS region has size of the whole image), thanks to lordkag for #37
This commit is contained in:
parent
388dd25093
commit
1ab52fde35
3 changed files with 24 additions and 4 deletions
|
@ -31,7 +31,7 @@ int main(int argc, char *argv[])
|
||||||
result = w.patchFromFile(a.arguments().at(1));
|
result = w.patchFromFile(a.arguments().at(1));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
std::cout << "UEFIPatch 0.3.6 - UEFI image file patching utility" << std::endl << std::endl <<
|
std::cout << "UEFIPatch 0.3.7 - UEFI image file patching utility" << std::endl << std::endl <<
|
||||||
"Usage: UEFIPatch image_file" << std::endl << std::endl <<
|
"Usage: UEFIPatch image_file" << std::endl << std::endl <<
|
||||||
"Patches will be read from patches.txt file\n";
|
"Patches will be read from patches.txt file\n";
|
||||||
return ERR_SUCCESS;
|
return ERR_SUCCESS;
|
||||||
|
|
|
@ -303,10 +303,18 @@ UINT8 FfsEngine::parseIntelImage(const QByteArray & intelImage, QModelIndex & in
|
||||||
return ERR_INVALID_FLASH_DESCRIPTOR;
|
return ERR_INVALID_FLASH_DESCRIPTOR;
|
||||||
}
|
}
|
||||||
biosBegin = meEnd;
|
biosBegin = meEnd;
|
||||||
|
// biosEnd will point to the end of the image file
|
||||||
|
// it may be wrong, but it's pretty hard to detect a padding after BIOS region
|
||||||
|
// with malformed descriptor
|
||||||
|
}
|
||||||
|
// Normal descriptor map
|
||||||
|
else {
|
||||||
|
// Calculate biosEnd
|
||||||
|
biosEnd += biosBegin;
|
||||||
}
|
}
|
||||||
|
|
||||||
bios = intelImage.mid(biosBegin, biosEnd);
|
bios = intelImage.mid(biosBegin, biosEnd);
|
||||||
biosEnd += biosBegin;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
msg(tr("parseIntelImage: descriptor parsing failed, BIOS region not found in descriptor"));
|
msg(tr("parseIntelImage: descriptor parsing failed, BIOS region not found in descriptor"));
|
||||||
|
@ -2843,15 +2851,27 @@ UINT8 FfsEngine::reconstructIntelImage(const QModelIndex& index, QByteArray& rec
|
||||||
QByteArray gbe;
|
QByteArray gbe;
|
||||||
UINT32 gbeBegin = calculateRegionOffset(regionSection->GbeBase);
|
UINT32 gbeBegin = calculateRegionOffset(regionSection->GbeBase);
|
||||||
UINT32 gbeEnd = gbeBegin + calculateRegionSize(regionSection->GbeBase, regionSection->GbeLimit);
|
UINT32 gbeEnd = gbeBegin + calculateRegionSize(regionSection->GbeBase, regionSection->GbeLimit);
|
||||||
|
|
||||||
QByteArray me;
|
QByteArray me;
|
||||||
UINT32 meBegin = calculateRegionOffset(regionSection->MeBase);
|
UINT32 meBegin = calculateRegionOffset(regionSection->MeBase);
|
||||||
UINT32 meEnd = meBegin + calculateRegionSize(regionSection->MeBase, regionSection->MeLimit);
|
UINT32 meEnd = meBegin + calculateRegionSize(regionSection->MeBase, regionSection->MeLimit);
|
||||||
|
|
||||||
QByteArray bios;
|
QByteArray bios;
|
||||||
UINT32 biosBegin = calculateRegionOffset(regionSection->BiosBase);
|
UINT32 biosBegin = calculateRegionOffset(regionSection->BiosBase);
|
||||||
UINT32 biosEnd = biosBegin + calculateRegionSize(regionSection->BiosBase, regionSection->BiosLimit);
|
UINT32 biosEnd = calculateRegionSize(regionSection->BiosBase, regionSection->BiosLimit);
|
||||||
|
// Gigabyte descriptor map
|
||||||
|
if (biosEnd - biosBegin == model->header(index).size() + model->body(index).size()) {
|
||||||
|
biosBegin = meEnd;
|
||||||
|
biosEnd = model->header(index).size() + model->body(index).size();
|
||||||
|
}
|
||||||
|
// Normal descriptor map
|
||||||
|
else
|
||||||
|
biosEnd += biosBegin;
|
||||||
|
|
||||||
QByteArray pdr;
|
QByteArray pdr;
|
||||||
UINT32 pdrBegin = calculateRegionOffset(regionSection->PdrBase);
|
UINT32 pdrBegin = calculateRegionOffset(regionSection->PdrBase);
|
||||||
UINT32 pdrEnd = pdrBegin + calculateRegionSize(regionSection->PdrBase, regionSection->PdrLimit);
|
UINT32 pdrEnd = pdrBegin + calculateRegionSize(regionSection->PdrBase, regionSection->PdrLimit);
|
||||||
|
|
||||||
QByteArray ec;
|
QByteArray ec;
|
||||||
UINT32 ecBegin = 0;
|
UINT32 ecBegin = 0;
|
||||||
UINT32 ecEnd = 0;
|
UINT32 ecEnd = 0;
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
UEFITool::UEFITool(QWidget *parent) :
|
UEFITool::UEFITool(QWidget *parent) :
|
||||||
QMainWindow(parent),
|
QMainWindow(parent),
|
||||||
ui(new Ui::UEFITool),
|
ui(new Ui::UEFITool),
|
||||||
version(tr("0.21.2"))
|
version(tr("0.21.3"))
|
||||||
{
|
{
|
||||||
clipboard = QApplication::clipboard();
|
clipboard = QApplication::clipboard();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue