diff options
author | finnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-06 08:57:45 +0000 |
---|---|---|
committer | finnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-06 08:57:45 +0000 |
commit | d80268a511216fb8b0f815e50f415046a7320b7f (patch) | |
tree | c73482c104ec4605d47c7e9e0b20639fc4c6946c /chrome/browser/diagnostics/recon_diagnostics.cc | |
parent | f2b94f97aded3c9e93116bcac143bf2ccb653d46 (diff) | |
download | chromium_src-d80268a511216fb8b0f815e50f415046a7320b7f.zip chromium_src-d80268a511216fb8b0f815e50f415046a7320b7f.tar.gz chromium_src-d80268a511216fb8b0f815e50f415046a7320b7f.tar.bz2 |
Integrate about:conflicts with --diagnostics
This should enable the user to find conflicting dlls that are crashing Chrome on startup.
This changelist introduces a limited_mode for scanning, since the diagnostics tests run without the help of many Chrome services, so we can't use the File thread for asynchronous scanning or the notification system.
Also changed the scanning so that if no signature/description is given in the blacklist, then we mark the DLL as a confirmed match if the name and the location match (before we used to match it as a 'suspected' match). A very sizable chunk of the blacklist is malware, which has no signature, so this gives us the ability to trigger the wrench badge on finding malware (that part remains opt-in through about:flags).
Also added failure count to diagnostics output (sometimes the error scrolls off screen, so having a note at the bottom helps).
BUG=51105
TEST=All diagnostics tests run as part of the unit tests.
Review URL: http://codereview.chromium.org/6098004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70600 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/diagnostics/recon_diagnostics.cc')
-rw-r--r-- | chrome/browser/diagnostics/recon_diagnostics.cc | 73 |
1 files changed, 66 insertions, 7 deletions
diff --git a/chrome/browser/diagnostics/recon_diagnostics.cc b/chrome/browser/diagnostics/recon_diagnostics.cc index f657fef..2cacd86 100644 --- a/chrome/browser/diagnostics/recon_diagnostics.cc +++ b/chrome/browser/diagnostics/recon_diagnostics.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -22,6 +22,7 @@ #if defined(OS_WIN) #include "base/win/windows_version.h" +#include "chrome/browser/enumerate_modules_model_win.h" #include "chrome/installer/util/install_util.h" #endif @@ -29,7 +30,7 @@ // diagnostic tests. Here we check for the existence of critical files. // TODO(cpu): Define if it makes sense to localize strings. -// TODO(cpu): There are a few maxium file sizes hardcoded in this file +// TODO(cpu): There are a few maximum file sizes hardcoded in this file // that have little or no theoretical or experimental ground. Find a way // to justify them. @@ -61,7 +62,7 @@ class OperatingSystemTest : public DiagnosticTest { return false; } #else - // TODO(port): define the OS criteria for linux and mac. + // TODO(port): define the OS criteria for Linux and Mac. #endif // defined(OS_WIN) RecordSuccess(ASCIIToUTF16(StringPrintf("%s %s (%d [%d:%d])", base::SysInfo::OperatingSystemName().c_str(), @@ -74,6 +75,60 @@ class OperatingSystemTest : public DiagnosticTest { DISALLOW_COPY_AND_ASSIGN(OperatingSystemTest); }; +// Check if any conflicting DLLs are loaded. +class ConflictingDllsTest : public DiagnosticTest { + public: + ConflictingDllsTest() : DiagnosticTest(ASCIIToUTF16("Conflicting modules")) {} + + virtual int GetId() { return 0; } + + virtual bool ExecuteImpl(DiagnosticsModel::Observer* observer) { +#if defined(OS_WIN) + EnumerateModulesModel* model = EnumerateModulesModel::GetInstance(); + model->set_limited_mode(true); + model->ScanNow(); + ListValue* list = model->GetModuleList(); + if (!model->confirmed_bad_modules_detected() && + !model->suspected_bad_modules_detected()) { + RecordSuccess(ASCIIToUTF16("No conflicting modules found")); + return true; + } + + string16 failures = ASCIIToUTF16("Possibly conflicting modules:"); + DictionaryValue* dictionary; + for (size_t i = 0; i < list->GetSize(); ++i) { + list->GetDictionary(i, &dictionary); + int status; + string16 location; + string16 name; + if (!dictionary->GetInteger("status", &status)) + RecordFailure(ASCIIToUTF16("No 'status' field found")); + if (status < ModuleEnumerator::SUSPECTED_BAD) + continue; + + if (!dictionary->GetString("location", &location)) { + RecordFailure(ASCIIToUTF16("No 'location' field found")); + return true; + } + if (!dictionary->GetString("name", &name)) { + RecordFailure(ASCIIToUTF16("No 'name' field found")); + return true; + } + + failures += ASCIIToUTF16("\n") + location + name; + } + RecordFailure(failures); + return true; +#else + RecordFailure(ASCIIToUTF16("Not implemented")); + return true; +#endif // defined(OS_WIN) + } + + private: + DISALLOW_COPY_AND_ASSIGN(ConflictingDllsTest); +}; + // Check if it is system install or per-user install. class InstallTypeTest : public DiagnosticTest { public: @@ -163,9 +218,9 @@ const TestPathInfo kPathsToTest[] = { true, false, false, 0} }; -// Check that the user's data directory exists and the paths are writeable. -// If it is a systemwide install some paths are not expected to be writeable. -// This test depends on |InstallTypeTest| having run succesfuly. +// Check that the user's data directory exists and the paths are writable. +// If it is a systemwide install some paths are not expected to be writable. +// This test depends on |InstallTypeTest| having run successfully. class PathTest : public DiagnosticTest { public: explicit PathTest(const TestPathInfo& path_info) @@ -227,7 +282,7 @@ class PathTest : public DiagnosticTest { }; // Check that the disk space in the volume where the user data dir normally -// lives is not dangerosly low. +// lives is not dangerously low. class DiskSpaceTest : public DiagnosticTest { public: DiskSpaceTest() : DiagnosticTest(ASCIIToUTF16("Disk Space")) {} @@ -337,6 +392,10 @@ DiagnosticTest* MakeOperatingSystemTest() { return new OperatingSystemTest(); } +DiagnosticTest* MakeConflictingDllsTest() { + return new ConflictingDllsTest(); +} + DiagnosticTest* MakeInstallTypeTest() { return new InstallTypeTest(); } |