Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions UEFITool/ffsfinder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,25 @@ USTATUS FfsFinder::findTextPattern(const UModelIndex & index, const UString & pa
ret = U_SUCCESS;
}

if (mode == SEARCH_MODE_INFO || mode == SEARCH_MODE_ALL) {
UString info = model->info(index);
if (!info.isEmpty() && info.indexOf(pattern, 0, caseSensitive) >= 0) {
UModelIndex parentFileIndex = model->findParentOfType(index, Types::File);
UString name = model->name(index);
if (model->parent(index) == parentFileIndex) {
name = model->name(parentFileIndex) + UString("/") + name;
}
else if (parentFileIndex.isValid()) {
name = model->name(parentFileIndex) + UString("/.../") + name;
}

msg(UString("Text \"") + UString(pattern) + UString("\" found in ") + name + UString(" information"), index);
ret = U_SUCCESS;
}
if (mode == SEARCH_MODE_INFO)
return ret;
}

UByteArray body;
if (hasChildren) {
if (mode != SEARCH_MODE_BODY)
Expand Down
9 changes: 8 additions & 1 deletion UEFITool/searchdialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@
<item>
<widget class="QRadioButton" name="textScopeFullRadioButton">
<property name="text">
<string>Header and body</string>
<string>Header, body and information</string>
</property>
<property name="checked">
<bool>true</bool>
Expand All @@ -200,6 +200,13 @@
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="textScopeInfoRadioButton">
<property name="text">
<string>Information only</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
Expand Down
9 changes: 7 additions & 2 deletions UEFITool/uefitool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -468,9 +468,10 @@ void UEFITool::search()
searchDialog->ui->guidScopeBodyRadioButton->setChecked(mode == SEARCH_MODE_BODY);
searchDialog->ui->guidScopeFullRadioButton->setChecked(mode >= SEARCH_MODE_ALL);
mode = settings.value("searchDialog/textScopeMode", SEARCH_MODE_ALL).toUInt();
searchDialog->ui->textScopeHeaderRadioButton->setChecked(mode <= SEARCH_MODE_HEADER);
searchDialog->ui->textScopeHeaderRadioButton->setChecked(mode == SEARCH_MODE_HEADER);
searchDialog->ui->textScopeBodyRadioButton->setChecked(mode == SEARCH_MODE_BODY);
searchDialog->ui->textScopeFullRadioButton->setChecked(mode >= SEARCH_MODE_ALL);
searchDialog->ui->textScopeFullRadioButton->setChecked(mode == SEARCH_MODE_ALL);
searchDialog->ui->textScopeInfoRadioButton->setChecked(mode == SEARCH_MODE_INFO);
searchDialog->ui->textUnicodeCheckBox->setChecked(settings.value("searchDialog/textUnicode", true).toBool());
searchDialog->ui->textCaseSensitiveCheckBox->setChecked(settings.value("searchDialog/textCaseSensitive", false).toBool());

Expand All @@ -497,6 +498,8 @@ void UEFITool::search()
mode = SEARCH_MODE_HEADER;
else if (searchDialog->ui->textScopeBodyRadioButton->isChecked())
mode = SEARCH_MODE_BODY;
else if (searchDialog->ui->textScopeInfoRadioButton->isChecked())
mode = SEARCH_MODE_INFO;
else
mode = SEARCH_MODE_ALL;
settings.setValue("searchDialog/textScopeMode", mode);
Expand Down Expand Up @@ -545,6 +548,8 @@ void UEFITool::search()
mode = SEARCH_MODE_HEADER;
else if (searchDialog->ui->textScopeBodyRadioButton->isChecked())
mode = SEARCH_MODE_BODY;
else if (searchDialog->ui->textScopeInfoRadioButton->isChecked())
mode = SEARCH_MODE_INFO;
else
mode = SEARCH_MODE_ALL;
ffsFinder->findTextPattern(pattern, mode, searchDialog->ui->textUnicodeCheckBox->isChecked(),
Expand Down
1 change: 1 addition & 0 deletions common/basetypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ typedef ptrdiff_t INTN;
#define SEARCH_MODE_HEADER 1
#define SEARCH_MODE_BODY 2
#define SEARCH_MODE_ALL 3
#define SEARCH_MODE_INFO 4

// EFI GUID
typedef struct EFI_GUID_ {
Expand Down
Loading