Qt+Windows: Remove the DBAR check.

Remove the check for Dell Backup and Recovery. The check was hacky and
obnoxious. At this point it's hopefully safe to assume systems with DBAR
installed are either running Windows 7 and no longer supported or have
upgraded to a safer version.

Change-Id: I458172885870edc34ec707a7748280e0eeed59b9
Reviewed-on: https://code.wireshark.org/review/35815
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
Gerald Combs 2020-01-14 17:23:21 -08:00 committed by Anders Broman
parent 116d381ea4
commit 82032fe375
2 changed files with 0 additions and 127 deletions

View File

@ -531,125 +531,6 @@ void WiresharkApplication::storeCustomColorsInRecent()
}
}
#ifdef _WIN32
// Dell Backup and Recovery is awful and terrible.
// https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=12036
// https://bugreports.qt.io/browse/QTBUG-41416
// https://www.dell.com/community/Productivity-Software/Backup-and-Recovery-causing-applications-using-Qt5-DLLs-to-crash/m-p/4590325
// https://stackoverflow.com/questions/30833889/dll-hell-with-sqlite/33697140#33697140
//
// According to https://www.portraitprofessional.com/support/?qid=79 , which
// points to https://cloudfrontsecure.anthropics.com/Tools/unregister_dell_backup.cmd
// DBAR's shell extension DLLs are named DBROverlayIconBackuped.dll,
// DBROverlayIconNotBackuped.dll, and DBRShellExtension.dll.
//
// Look for them in the registry and show a warning if we find any of them.
//
// This is obnoxious, but so is crashing. Hopefully we can remove it at some
// point.
// Returns only the most significant (major + minor) 32 bits of the version number.
unsigned int WiresharkApplication::fileVersion(QString file_path) {
unsigned int version = 0;
DWORD gfvi_size = GetFileVersionInfoSize((LPCWSTR) file_path.utf16(), NULL);
if (gfvi_size == 0) {
return 0;
}
LPSTR version_info = new char[gfvi_size];
if (GetFileVersionInfo((LPCWSTR) file_path.utf16(), 0, gfvi_size, version_info)) {
void *vqv_buffer = NULL;
UINT vqv_size = 0;
if (VerQueryValue(version_info, TEXT("\\"), &vqv_buffer, &vqv_size)) {
VS_FIXEDFILEINFO *vqv_fileinfo = (VS_FIXEDFILEINFO *)vqv_buffer;
if (vqv_size && vqv_buffer && vqv_fileinfo->dwSignature == 0xfeef04bd) {
version = vqv_fileinfo->dwFileVersionMS;
}
}
}
delete[] version_info;
return version;
}
void WiresharkApplication::checkForDbar()
{
QStringList dbar_dlls = QStringList()
// << "7-Zip.dll" // For testing. I don't have DBAR.
// << "shell32.dll"
<< "DBROverlayIconBackuped.dll"
<< "DBROverlayIconNotBackuped.dll"
<< "DBRShellExtension.dll";
// List of HKCR subkeys in which to look for "shellex\ContextMenuHandlers".
// This may be incomplete.
// https://docs.microsoft.com/en-us/windows/win32/shell/reg-shell-exts
QStringList hkcr_subkeys = QStringList()
<< "*"
<< "AllFileSystemObjects"
<< "Folder"
<< "Directory"
<< "Drive";
QRegExp uuid_re("^\\{.+\\}");
QSet<QString> clsids;
// Look for context menu handler CLSIDs. We might want to skip this and
// just iterate through all of the CLSID subkeys below.
foreach (QString subkey, hkcr_subkeys) {
QString cmh_path = QString("HKEY_CLASSES_ROOT\\%1\\shellex\\ContextMenuHandlers").arg(subkey);
QSettings cmh_reg(cmh_path, QSettings::NativeFormat);
foreach (QString cmh_key, cmh_reg.allKeys()) {
// Add anything that looks like a UUID.
if (!cmh_key.endsWith("/.")) continue; // No default key?
// "Registering Shell Extension Handlers" says the subkey name
// should be the class ID...
if (cmh_key.contains(uuid_re)) {
cmh_key.chop(2);
clsids += cmh_key;
continue;
}
// ...it then gives an example with the subkey named after the
// application, with the default key containing the class ID.
QString cmh_default = cmh_reg.value(cmh_key).toString();
if (cmh_default.contains(uuid_re)) clsids += cmh_default;
}
}
// We have a list of context menu handler CLSIDs. Now look for
// offending DLLs.
foreach (QString clsid, clsids.values()) {
QString inproc_path = QString("HKEY_CLASSES_ROOT\\CLSID\\%1\\InprocServer32").arg(clsid);
QSettings inproc_reg(inproc_path, QSettings::NativeFormat);
QString inproc_default = inproc_reg.value(".").toString();
if (inproc_default.isEmpty()) continue;
foreach (QString dbar_dll, dbar_dlls) {
if (! inproc_default.contains(dbar_dll, Qt::CaseInsensitive)) continue;
// XXX We don't expand environment variables in the path.
unsigned int dll_version = fileVersion(inproc_default);
unsigned int bad_version = 1 << 16 | 8; // Offending DBAR version is 1.8.
if (dll_version == bad_version) {
QMessageBox dbar_msgbox;
dbar_msgbox.setIcon(QMessageBox::Warning);
dbar_msgbox.setStandardButtons(QMessageBox::Ok);
dbar_msgbox.setWindowTitle(tr("Dell Backup and Recovery Found"));
dbar_msgbox.setText(tr("You appear to be running Dell Backup and Recovery 1.8."));
dbar_msgbox.setInformativeText(tr(
"DBAR can make many applications crash"
" <a href=\"https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=12036\">including Wireshark</a>."
));
dbar_msgbox.setDetailedText(tr("Offending DLL: %1").arg(inproc_default));
dbar_msgbox.exec();
return;
}
}
}
}
#endif
void WiresharkApplication::setLastOpenDir(const char *dir_name)
{
qint64 len;
@ -881,10 +762,6 @@ WiresharkApplication::WiresharkApplication(int &argc, char **argv) :
connect(this, SIGNAL(softwareUpdateQuit()), this, SLOT(quit()), Qt::QueuedConnection);
#endif
#ifdef _WIN32
checkForDbar();
#endif
connect(qApp, SIGNAL(aboutToQuit()), this, SLOT(cleanup()));
}

View File

@ -163,10 +163,6 @@ private:
#endif
void storeCustomColorsInRecent();
#ifdef _WIN32
unsigned int fileVersion(QString file_path);
void checkForDbar();
#endif
void clearDynamicMenuGroupItems();
void initializeIcons();