Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(279)

Side by Side Diff: chrome/browser/enumerate_modules_model_win.cc

Issue 15969017: Warn by default when certain DLL conflicts exist on XP. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ready for try servers Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/enumerate_modules_model_win.h" 5 #include "chrome/browser/enumerate_modules_model_win.h"
6 6
7 #include <Tlhelp32.h> 7 #include <Tlhelp32.h>
8 #include <wintrust.h> 8 #include <wintrust.h>
9 #include <algorithm> 9 #include <algorithm>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/environment.h" 13 #include "base/environment.h"
14 #include "base/file_version_info_win.h" 14 #include "base/file_version_info_win.h"
15 #include "base/files/file_path.h" 15 #include "base/files/file_path.h"
16 #include "base/i18n/case_conversion.h" 16 #include "base/i18n/case_conversion.h"
17 #include "base/metrics/histogram.h" 17 #include "base/metrics/histogram.h"
18 #include "base/string_util.h" 18 #include "base/string_util.h"
19 #include "base/strings/string_number_conversions.h" 19 #include "base/strings/string_number_conversions.h"
20 #include "base/time.h" 20 #include "base/time.h"
21 #include "base/utf_string_conversions.h" 21 #include "base/utf_string_conversions.h"
22 #include "base/values.h" 22 #include "base/values.h"
23 #include "base/version.h" 23 #include "base/version.h"
24 #include "base/win/registry.h" 24 #include "base/win/registry.h"
25 #include "base/win/scoped_handle.h" 25 #include "base/win/scoped_handle.h"
26 #include "base/win/windows_version.h"
26 #include "chrome/browser/net/service_providers_win.h" 27 #include "chrome/browser/net/service_providers_win.h"
27 #include "chrome/common/chrome_constants.h" 28 #include "chrome/common/chrome_constants.h"
28 #include "chrome/common/chrome_notification_types.h" 29 #include "chrome/common/chrome_notification_types.h"
29 #include "chrome/common/chrome_switches.h" 30 #include "chrome/common/chrome_switches.h"
30 #include "content/public/browser/notification_service.h" 31 #include "content/public/browser/notification_service.h"
31 #include "crypto/sha2.h" 32 #include "crypto/sha2.h"
32 #include "grit/generated_resources.h" 33 #include "grit/generated_resources.h"
34 #include "grit/google_chrome_strings.h"
33 #include "ui/base/l10n/l10n_util.h" 35 #include "ui/base/l10n/l10n_util.h"
34 36
35 using content::BrowserThread; 37 using content::BrowserThread;
36 38
37 // The period of time (in milliseconds) to wait until checking to see if any 39 // The period of time (in milliseconds) to wait until checking to see if any
38 // incompatible modules exist. 40 // incompatible modules exist.
39 static const int kModuleCheckDelayMs = 60 * 1000; 41 static const int kModuleCheckDelayMs = /*60*/ 3 * 1000;
40 42
41 // The path to the Shell Extension key in the Windows registry. 43 // The path to the Shell Extension key in the Windows registry.
42 static const wchar_t kRegPath[] = 44 static const wchar_t kRegPath[] =
43 L"Software\\Microsoft\\Windows\\CurrentVersion\\Shell Extensions\\Approved"; 45 L"Software\\Microsoft\\Windows\\CurrentVersion\\Shell Extensions\\Approved";
44 46
45 // Short-hand for things on the blacklist you should simply get rid of. 47 // Short-hand for things on the blacklist you should simply get rid of.
46 static const ModuleEnumerator::RecommendedAction kUninstallLink = 48 static const ModuleEnumerator::RecommendedAction kUninstallLink =
47 static_cast<ModuleEnumerator::RecommendedAction>( 49 static_cast<ModuleEnumerator::RecommendedAction>(
48 ModuleEnumerator::UNINSTALL | ModuleEnumerator::SEE_LINK); 50 ModuleEnumerator::UNINSTALL | ModuleEnumerator::SEE_LINK);
49 51
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 // with a slash and use environments variables (or just look at one of the 110 // with a slash and use environments variables (or just look at one of the
109 // comments below and keep it consistent with that). When adding an entry with 111 // comments below and keep it consistent with that). When adding an entry with
110 // an environment variable not currently used in the list below, make sure to 112 // an environment variable not currently used in the list below, make sure to
111 // update the list in PreparePathMappings. Filename, Description/Signer, and 113 // update the list in PreparePathMappings. Filename, Description/Signer, and
112 // Location must be entered as hashes (see GenerateHash). Filename is mandatory. 114 // Location must be entered as hashes (see GenerateHash). Filename is mandatory.
113 // Entries without any Description, Signer info, or Location will never be 115 // Entries without any Description, Signer info, or Location will never be
114 // marked as confirmed bad (only as suspicious). 116 // marked as confirmed bad (only as suspicious).
115 const ModuleEnumerator::BlacklistEntry ModuleEnumerator::kModuleBlacklist[] = { 117 const ModuleEnumerator::BlacklistEntry ModuleEnumerator::kModuleBlacklist[] = {
116 // NOTE: Please keep this list sorted by dll name, then location. 118 // NOTE: Please keep this list sorted by dll name, then location.
117 119
120 // "apphelp.dll", "%systemroot%\\system32\\"
121 { "f5fda581", "23d01d5b", "", "", "", XP,
122 static_cast<RecommendedAction>(UPDATE | SEE_LINK | NOTIFY_USER) },
123
118 // Version 3.2.1.6 seems to be implicated in most cases (and 3.2.2.2 in some). 124 // Version 3.2.1.6 seems to be implicated in most cases (and 3.2.2.2 in some).
119 // There is a more recent version available for download. 125 // There is a more recent version available for download.
120 // accelerator.dll, "%programfiles%\\speedbit video accelerator\\". 126 // accelerator.dll, "%programfiles%\\speedbit video accelerator\\".
121 { "7ba9402f", "c9132d48", "", "", "", kInvestigatingLink }, 127 { "7ba9402f", "c9132d48", "", "", "", ALL, kInvestigatingLink },
122 128
123 // apiqq0.dll, "%temp%\\". 129 // apiqq0.dll, "%temp%\\".
124 { "26134911", "59145acf", "", "", "", kUninstallLink }, 130 { "26134911", "59145acf", "", "", "", ALL, kUninstallLink },
125 131
126 // arking0.dll, "%systemroot%\\system32\\". 132 // arking0.dll, "%systemroot%\\system32\\".
127 { "f5d8f549", "23d01d5b", "", "", "", kUninstallLink }, 133 { "f5d8f549", "23d01d5b", "", "", "", ALL, kUninstallLink },
128 134
129 // arking1.dll, "%systemroot%\\system32\\". 135 // arking1.dll, "%systemroot%\\system32\\".
130 { "c60ca062", "23d01d5b", "", "", "", kUninstallLink }, 136 { "c60ca062", "23d01d5b", "", "", "", ALL, kUninstallLink },
131 137
132 // Said to belong to Killer NIC from BigFoot Networks (not verified). Versions 138 // Said to belong to Killer NIC from BigFoot Networks (not verified). Versions
133 // 6.0.0.7 and 6.0.0.10 implicated. 139 // 6.0.0.7 and 6.0.0.10 implicated.
134 // bfllr.dll, "%systemroot%\\system32\\". 140 // bfllr.dll, "%systemroot%\\system32\\".
135 { "6bb57633", "23d01d5b", "", "", "", kInvestigatingLink }, 141 { "6bb57633", "23d01d5b", "", "", "", ALL, kInvestigatingLink },
136 142
137 // clickpotatolitesahook.dll, "". Different version each report. 143 // clickpotatolitesahook.dll, "". Different version each report.
138 { "0396e037.dll", "", "", "", "", kUninstallLink }, 144 { "0396e037.dll", "", "", "", "", ALL, kUninstallLink },
139 145
140 // cvasds0.dll, "%temp%\\". 146 // cvasds0.dll, "%temp%\\".
141 { "5ce0037c", "59145acf", "", "", "", kUninstallLink }, 147 { "5ce0037c", "59145acf", "", "", "", ALL, kUninstallLink },
142 148
143 // cwalsp.dll, "%systemroot%\\system32\\". 149 // cwalsp.dll, "%systemroot%\\system32\\".
144 { "e579a039", "23d01d5b", "", "", "", kUninstallLink }, 150 { "e579a039", "23d01d5b", "", "", "", ALL, kUninstallLink },
145 151
146 // datamngr.dll (1), "%programfiles%\\searchqu toolbar\\datamngr\\". 152 // datamngr.dll (1), "%programfiles%\\searchqu toolbar\\datamngr\\".
147 { "7add320b", "470a3da3", "", "", "", kUninstallLink }, 153 { "7add320b", "470a3da3", "", "", "", ALL, kUninstallLink },
148 154
149 // datamngr.dll (2), "%programfiles%\\windows searchqu toolbar\\". 155 // datamngr.dll (2), "%programfiles%\\windows searchqu toolbar\\".
150 { "7add320b", "7a3c8be3", "", "", "", kUninstallLink }, 156 { "7add320b", "7a3c8be3", "", "", "", ALL, kUninstallLink },
151 157
152 // dsoqq0.dll, "%temp%\\". 158 // dsoqq0.dll, "%temp%\\".
153 { "1c4df325", "59145acf", "", "", "", kUninstallLink }, 159 { "1c4df325", "59145acf", "", "", "", ALL, kUninstallLink },
154 160
155 // flt.dll, "%programfiles%\\tueagles\\". 161 // flt.dll, "%programfiles%\\tueagles\\".
156 { "6d01f4a1", "7935e9c2", "", "", "", kUninstallLink }, 162 { "6d01f4a1", "7935e9c2", "", "", "", ALL, kUninstallLink },
157 163
158 // This looks like a malware edition of a Brazilian Bank plugin, sometimes 164 // This looks like a malware edition of a Brazilian Bank plugin, sometimes
159 // referred to as Malware.Banc.A. 165 // referred to as Malware.Banc.A.
160 // gbieh.dll, "%programfiles%\\gbplugin\\". 166 // gbieh.dll, "%programfiles%\\gbplugin\\".
161 { "4cb4f2e3", "88e4a3b1", "", "", "", kUninstallLink }, 167 { "4cb4f2e3", "88e4a3b1", "", "", "", ALL, kUninstallLink },
162 168
163 // hblitesahook.dll. Each report has different version number in location. 169 // hblitesahook.dll. Each report has different version number in location.
164 { "5d10b363", "", "", "", "", kUninstallLink }, 170 { "5d10b363", "", "", "", "", ALL, kUninstallLink },
165 171
166 // icf.dll, "%systemroot%\\system32\\". 172 // icf.dll, "%systemroot%\\system32\\".
167 { "303825ed", "23d01d5b", "", "", "", INVESTIGATING }, 173 { "303825ed", "23d01d5b", "", "", "", ALL, INVESTIGATING },
168 174
169 // idmmbc.dll (IDM), "%systemroot%\\system32\\". See: http://crbug.com/26892/. 175 // idmmbc.dll (IDM), "%systemroot%\\system32\\". See: http://crbug.com/26892/.
170 { "b8dce5c3", "23d01d5b", "", "", "6.03", 176 { "b8dce5c3", "23d01d5b", "", "", "6.03", ALL,
171 static_cast<RecommendedAction>(UPDATE | DISABLE) }, 177 static_cast<RecommendedAction>(UPDATE | DISABLE) },
172 178
173 // imon.dll (NOD32), "%systemroot%\\system32\\". See: http://crbug.com/21715. 179 // imon.dll (NOD32), "%systemroot%\\system32\\". See: http://crbug.com/21715.
174 { "8f42f22e", "23d01d5b", "", "", "4.0", 180 { "8f42f22e", "23d01d5b", "", "", "4.0", ALL,
175 static_cast<RecommendedAction>(UPDATE | DISABLE) }, 181 static_cast<RecommendedAction>(UPDATE | DISABLE) },
176 182
177 // is3lsp.dll, "%commonprogramfiles%\\is3\\anti-spyware\\". 183 // is3lsp.dll, "%commonprogramfiles%\\is3\\anti-spyware\\".
178 { "7ffbdce9", "bc5673f2", "", "", "", 184 { "7ffbdce9", "bc5673f2", "", "", "", ALL,
179 static_cast<RecommendedAction>(UPDATE | DISABLE | SEE_LINK) }, 185 static_cast<RecommendedAction>(UPDATE | DISABLE | SEE_LINK) },
180 186
181 // jsi.dll, "%programfiles%\\profilecraze\\". 187 // jsi.dll, "%programfiles%\\profilecraze\\".
182 { "f9555eea", "e3548061", "", "", "", kUninstallLink }, 188 { "f9555eea", "e3548061", "", "", "", ALL, kUninstallLink },
183 189
184 // kernel.dll, "%programfiles%\\contentwatch\\internet protection\\modules\\". 190 // kernel.dll, "%programfiles%\\contentwatch\\internet protection\\modules\\".
185 { "ead2768e", "4e61ce60", "", "", "", INVESTIGATING }, 191 { "ead2768e", "4e61ce60", "", "", "", ALL, INVESTIGATING },
186 192
187 // mgking0.dll, "%systemroot%\\system32\\". 193 // mgking0.dll, "%systemroot%\\system32\\".
188 { "d0893e38", "23d01d5b", "", "", "", kUninstallLink }, 194 { "d0893e38", "23d01d5b", "", "", "", ALL, kUninstallLink },
189 195
190 // mgking0.dll, "%temp%\\". 196 // mgking0.dll, "%temp%\\".
191 { "d0893e38", "59145acf", "", "", "", kUninstallLink }, 197 { "d0893e38", "59145acf", "", "", "", ALL, kUninstallLink },
192 198
193 // mgking1.dll, "%systemroot%\\system32\\". 199 // mgking1.dll, "%systemroot%\\system32\\".
194 { "3e837222", "23d01d5b", "", "", "", kUninstallLink }, 200 { "3e837222", "23d01d5b", "", "", "", ALL, kUninstallLink },
195 201
196 // mgking1.dll, "%temp%\\". 202 // mgking1.dll, "%temp%\\".
197 { "3e837222", "59145acf", "", "", "", kUninstallLink }, 203 { "3e837222", "59145acf", "", "", "", ALL, kUninstallLink },
198 204
199 // mstcipha.ime, "%systemroot%\\system32\\". 205 // mstcipha.ime, "%systemroot%\\system32\\".
200 { "5523579e", "23d01d5b", "", "", "", INVESTIGATING }, 206 { "5523579e", "23d01d5b", "", "", "", ALL, INVESTIGATING },
201 207
202 // mwtsp.dll, "%systemroot%\\system32\\". 208 // mwtsp.dll, "%systemroot%\\system32\\".
203 { "9830bff6", "23d01d5b", "", "", "", kUninstallLink }, 209 { "9830bff6", "23d01d5b", "", "", "", ALL, kUninstallLink },
204 210
205 // nodqq0.dll, "%temp%\\". 211 // nodqq0.dll, "%temp%\\".
206 { "b86ce04d", "59145acf", "", "", "", kUninstallLink }, 212 { "b86ce04d", "59145acf", "", "", "", ALL, kUninstallLink },
207 213
208 // nProtect GameGuard Anti-cheat system. Every report has a different 214 // nProtect GameGuard Anti-cheat system. Every report has a different
209 // location, since it is installed into and run from a game folder. Various 215 // location, since it is installed into and run from a game folder. Various
210 // versions implicated. 216 // versions implicated.
211 // npggnt.des, no fixed location. 217 // npggnt.des, no fixed location.
212 { "f2c8790d", "", "", "", "", kInvestigatingLink }, 218 { "f2c8790d", "", "", "", "", ALL, kInvestigatingLink },
213 219
214 // nvlsp.dll, 220 // nvlsp.dll,
215 // "%programfiles%\\nvidia corporation\\networkaccessmanager\\bin32\\". 221 // "%programfiles%\\nvidia corporation\\networkaccessmanager\\bin32\\".
216 { "37f907e2", "3ad0ff23", "", "", "", INVESTIGATING }, 222 { "37f907e2", "3ad0ff23", "", "", "", ALL, INVESTIGATING },
217 223
218 // post0.dll, "%systemroot%\\system32\\". 224 // post0.dll, "%systemroot%\\system32\\".
219 { "7405c0c8", "23d01d5b", "", "", "", kUninstallLink }, 225 { "7405c0c8", "23d01d5b", "", "", "", ALL, kUninstallLink },
220 226
221 // questbrwsearch.dll, "%programfiles%\\questbrwsearch\\". 227 // questbrwsearch.dll, "%programfiles%\\questbrwsearch\\".
222 { "0953ed09", "f0d5eeda", "", "", "", kUninstallLink }, 228 { "0953ed09", "f0d5eeda", "", "", "", ALL, kUninstallLink },
223 229
224 // questscan.dll, "%programfiles%\\questscan\\". 230 // questscan.dll, "%programfiles%\\questscan\\".
225 { "f4f3391e", "119d20f7", "", "", "", kUninstallLink }, 231 { "f4f3391e", "119d20f7", "", "", "", ALL, kUninstallLink },
226 232
227 // radhslib.dll (Naomi web filter), "%programfiles%\\rnamfler\\". 233 // radhslib.dll (Naomi web filter), "%programfiles%\\rnamfler\\".
228 // See http://crbug.com/12517. 234 // See http://crbug.com/12517.
229 { "7edcd250", "0733dc3e", "", "", "", INVESTIGATING }, 235 { "7edcd250", "0733dc3e", "", "", "", ALL, INVESTIGATING },
230 236
231 // rlls.dll, "%programfiles%\\relevantknowledge\\". 237 // rlls.dll, "%programfiles%\\relevantknowledge\\".
232 { "a1ed94a7", "ea9d6b36", "", "", "", kUninstallLink }, 238 { "a1ed94a7", "ea9d6b36", "", "", "", ALL, kUninstallLink },
233 239
234 // rooksdol.dll, "%programfiles%\\trusteer\\rapport\\bin\\". 240 // rooksdol.dll, "%programfiles%\\trusteer\\rapport\\bin\\".
235 { "802aefef", "06120e13", "", "", "3.5.1008.40", UPDATE }, 241 { "802aefef", "06120e13", "", "", "3.5.1008.40", ALL, UPDATE },
236 242
237 // scanquery.dll, "%programfiles%\\scanquery\\". 243 // scanquery.dll, "%programfiles%\\scanquery\\".
238 { "0b52d2ae", "a4cc88b1", "", "", "", kUninstallLink }, 244 { "0b52d2ae", "a4cc88b1", "", "", "", ALL, kUninstallLink },
239 245
240 // sdata.dll, "%programdata%\\srtserv\\". 246 // sdata.dll, "%programdata%\\srtserv\\".
241 { "1936d5cc", "223c44be", "", "", "", kUninstallLink }, 247 { "1936d5cc", "223c44be", "", "", "", ALL, kUninstallLink },
242 248
243 // searchtree.dll, 249 // searchtree.dll,
244 // "%programfiles%\\contentwatch\\internet protection\\modules\\". 250 // "%programfiles%\\contentwatch\\internet protection\\modules\\".
245 { "f6915a31", "4e61ce60", "", "", "", INVESTIGATING }, 251 { "f6915a31", "4e61ce60", "", "", "", ALL, INVESTIGATING },
246 252
247 // sgprxy.dll, "%commonprogramfiles%\\is3\\anti-spyware\\". 253 // sgprxy.dll, "%commonprogramfiles%\\is3\\anti-spyware\\".
248 { "005965ea", "bc5673f2", "", "", "", INVESTIGATING }, 254 { "005965ea", "bc5673f2", "", "", "", ALL, INVESTIGATING },
249 255
250 // sprotector.dll, "". Different location each report. 256 // sprotector.dll, "". Different location each report.
251 { "24555d74", "", "", "", "", kUninstallLink }, 257 { "24555d74", "", "", "", "", ALL, kUninstallLink },
252 258
253 // swi_filter_0001.dll (Sophos Web Intelligence), 259 // swi_filter_0001.dll (Sophos Web Intelligence),
254 // "%programfiles%\\sophos\\sophos anti-virus\\web intelligence\\". 260 // "%programfiles%\\sophos\\sophos anti-virus\\web intelligence\\".
255 // A small random sample all showed version 1.0.5.0. 261 // A small random sample all showed version 1.0.5.0.
256 { "61112d7b", "25fb120f", "", "", "", kInvestigatingLink }, 262 { "61112d7b", "25fb120f", "", "", "", ALL, kInvestigatingLink },
257 263
258 // twking0.dll, "%systemroot%\\system32\\". 264 // twking0.dll, "%systemroot%\\system32\\".
259 { "0355549b", "23d01d5b", "", "", "", kUninstallLink }, 265 { "0355549b", "23d01d5b", "", "", "", ALL, kUninstallLink },
260 266
261 // twking1.dll, "%systemroot%\\system32\\". 267 // twking1.dll, "%systemroot%\\system32\\".
262 { "02e44508", "23d01d5b", "", "", "", kUninstallLink }, 268 { "02e44508", "23d01d5b", "", "", "", ALL, kUninstallLink },
263 269
264 // vksaver.dll, "%systemroot%\\system32\\". 270 // vksaver.dll, "%systemroot%\\system32\\".
265 { "c4a784d5", "23d01d5b", "", "", "", kUninstallLink }, 271 { "c4a784d5", "23d01d5b", "", "", "", ALL, kUninstallLink },
266 272
267 // vlsp.dll (Venturi Firewall?), "%systemroot%\\system32\\". 273 // vlsp.dll (Venturi Firewall?), "%systemroot%\\system32\\".
268 { "2e4eb93d", "23d01d5b", "", "", "", INVESTIGATING }, 274 { "2e4eb93d", "23d01d5b", "", "", "", ALL, INVESTIGATING },
269 275
270 // vmn3_1dn.dll, "%appdata%\\roaming\\vmndtxtb\\". 276 // vmn3_1dn.dll, "%appdata%\\roaming\\vmndtxtb\\".
271 { "bba2037d", "9ab68585", "", "", "", kUninstallLink }, 277 { "bba2037d", "9ab68585", "", "", "", ALL, kUninstallLink },
272 278
273 // webanalyzer.dll, 279 // webanalyzer.dll,
274 // "%programfiles%\\contentwatch\\internet protection\\modules\\". 280 // "%programfiles%\\contentwatch\\internet protection\\modules\\".
275 { "c70b697d", "4e61ce60", "", "", "", INVESTIGATING }, 281 { "c70b697d", "4e61ce60", "", "", "", ALL, INVESTIGATING },
276 282
277 // wowst0.dll, "%systemroot%\\system32\\". 283 // wowst0.dll, "%systemroot%\\system32\\".
278 { "38ad9963", "23d01d5b", "", "", "", kUninstallLink }, 284 { "38ad9963", "23d01d5b", "", "", "", ALL, kUninstallLink },
279 285
280 // wxbase28u_vc_cw.dll, "%systemroot%\\system32\\". 286 // wxbase28u_vc_cw.dll, "%systemroot%\\system32\\".
281 { "e967210d", "23d01d5b", "", "", "", kUninstallLink }, 287 { "e967210d", "23d01d5b", "", "", "", ALL, kUninstallLink },
282 }; 288 };
283 289
284 // Generates an 8 digit hash from the input given. 290 // Generates an 8 digit hash from the input given.
285 static void GenerateHash(const std::string& input, std::string* output) { 291 static void GenerateHash(const std::string& input, std::string* output) {
286 if (input.empty()) { 292 if (input.empty()) {
287 *output = ""; 293 *output = "";
288 return; 294 return;
289 } 295 }
290 296
291 uint8 hash[4]; 297 uint8 hash[4];
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 ModuleEnumerator::ModuleStatus ModuleEnumerator::Match( 333 ModuleEnumerator::ModuleStatus ModuleEnumerator::Match(
328 const ModuleEnumerator::Module& module, 334 const ModuleEnumerator::Module& module,
329 const ModuleEnumerator::BlacklistEntry& blacklisted) { 335 const ModuleEnumerator::BlacklistEntry& blacklisted) {
330 // All modules must be normalized before matching against blacklist. 336 // All modules must be normalized before matching against blacklist.
331 DCHECK(module.normalized); 337 DCHECK(module.normalized);
332 // Filename is mandatory and version should not contain spaces. 338 // Filename is mandatory and version should not contain spaces.
333 DCHECK(strlen(blacklisted.filename) > 0); 339 DCHECK(strlen(blacklisted.filename) > 0);
334 DCHECK(!strstr(blacklisted.version_from, " ")); 340 DCHECK(!strstr(blacklisted.version_from, " "));
335 DCHECK(!strstr(blacklisted.version_to, " ")); 341 DCHECK(!strstr(blacklisted.version_to, " "));
336 342
343 base::win::Version version = base::win::GetVersion();
344 switch (version) {
345 // case base::win::VERSION_XP: // This is what I'll check in.
346 case base::win::VERSION_WIN7: // This is so I can test on Win7.
347 if (!(blacklisted.os & XP)) return NOT_MATCHED;
348 break;
349 default:
350 break;
351 }
352
337 std::string filename_hash, location_hash; 353 std::string filename_hash, location_hash;
338 GenerateHash(WideToUTF8(module.name), &filename_hash); 354 GenerateHash(WideToUTF8(module.name), &filename_hash);
339 GenerateHash(WideToUTF8(module.location), &location_hash); 355 GenerateHash(WideToUTF8(module.location), &location_hash);
340 356
341 // Filenames are mandatory. Location is mandatory if given. 357 // Filenames are mandatory. Location is mandatory if given.
342 if (filename_hash == blacklisted.filename && 358 if (filename_hash == blacklisted.filename &&
343 (std::string(blacklisted.location).empty() || 359 (std::string(blacklisted.location).empty() ||
344 location_hash == blacklisted.location)) { 360 location_hash == blacklisted.location)) {
345 // We have a name match against the blacklist (and possibly location match 361 // We have a name match against the blacklist (and possibly location match
346 // also), so check version. 362 // also), so check version.
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
769 return subject_name; 785 return subject_name;
770 } 786 }
771 787
772 // ---------------------------------------------------------------------------- 788 // ----------------------------------------------------------------------------
773 789
774 // static 790 // static
775 EnumerateModulesModel* EnumerateModulesModel::GetInstance() { 791 EnumerateModulesModel* EnumerateModulesModel::GetInstance() {
776 return Singleton<EnumerateModulesModel>::get(); 792 return Singleton<EnumerateModulesModel>::get();
777 } 793 }
778 794
795 // static
796 void EnumerateModulesModel::RecordLearnMoreStat(bool from_menu) {
797 UMA_HISTOGRAM_ENUMERATION("ConflictingModule.UserSelection",
798 from_menu ? ACTION_MENU_LEARN_MORE : ACTION_BUBBLE_LEARN_MORE,
799 ACTION_BOUNDARY);
800 }
801
779 bool EnumerateModulesModel::ShouldShowConflictWarning() const { 802 bool EnumerateModulesModel::ShouldShowConflictWarning() const {
780 // If the user has acknowledged the conflict notification, then we don't need 803 // If the user has acknowledged the conflict notification, then we don't need
781 // to show it again (because the scanning only happens once per the lifetime 804 // to show it again (because the scanning only happens once per the lifetime
782 // of the process). If we were to run the scanning more than once, then we'd 805 // of the process). If we were to run the scanning more than once, then we'd
783 // need to clear the flag somewhere when we are ready to show it again. 806 // need to clear the flag somewhere when we are ready to show it again.
784 if (conflict_notification_acknowledged_) 807 if (conflict_notification_acknowledged_)
785 return false; 808 return false;
786 809
787 return confirmed_bad_modules_detected_ > 0; 810 return confirmed_bad_modules_detected_ > 0;
788 } 811 }
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
894 ConstructHelpCenterUrl(*module).spec().c_str()); 917 ConstructHelpCenterUrl(*module).spec().c_str());
895 } 918 }
896 919
897 list->Append(data); 920 list->Append(data);
898 } 921 }
899 922
900 lock->Release(); 923 lock->Release();
901 return list; 924 return list;
902 } 925 }
903 926
927 GURL EnumerateModulesModel::GetFirstNotableConflict() {
928 lock->Acquire();
929 GURL url;
930
931 if (enumerated_modules_.empty()) {
932 lock->Release();
933 return GURL();
934 }
935
936 for (ModuleEnumerator::ModulesVector::const_iterator module =
937 enumerated_modules_.begin();
938 module != enumerated_modules_.end(); ++module) {
939 if (!(module->recommended_action & ModuleEnumerator::NOTIFY_USER))
940 continue;
941
942 url = ConstructHelpCenterUrl(*module);
943 DCHECK(url.is_valid());
944 break;
945 }
946
947 lock->Release();
948 return url;
949 }
950
951
904 EnumerateModulesModel::EnumerateModulesModel() 952 EnumerateModulesModel::EnumerateModulesModel()
905 : limited_mode_(false), 953 : limited_mode_(false),
906 scanning_(false), 954 scanning_(false),
907 conflict_notification_acknowledged_(false), 955 conflict_notification_acknowledged_(false),
908 confirmed_bad_modules_detected_(0), 956 confirmed_bad_modules_detected_(0),
909 suspected_bad_modules_detected_(0) { 957 suspected_bad_modules_detected_(0),
958 modules_to_notify_about_(0) {
910 const CommandLine& cmd_line = *CommandLine::ForCurrentProcess(); 959 const CommandLine& cmd_line = *CommandLine::ForCurrentProcess();
911 if (cmd_line.HasSwitch(switches::kConflictingModulesCheck)) { 960
961 if (cmd_line.HasSwitch(switches::kConflictingModulesCheck) ||
962 // base::win::GetVersion() == base::win::VERSION_XP) { // For checkin.
963 base::win::GetVersion() == base::win::VERSION_WIN7) { // For debugging.
912 check_modules_timer_.Start(FROM_HERE, 964 check_modules_timer_.Start(FROM_HERE,
913 base::TimeDelta::FromMilliseconds(kModuleCheckDelayMs), 965 base::TimeDelta::FromMilliseconds(kModuleCheckDelayMs),
914 this, &EnumerateModulesModel::ScanNow); 966 this, &EnumerateModulesModel::ScanNow);
915 } 967 }
916 968
917 lock = new base::Lock(); 969 lock = new base::Lock();
918 } 970 }
919 971
920 EnumerateModulesModel::~EnumerateModulesModel() { 972 EnumerateModulesModel::~EnumerateModulesModel() {
921 delete lock; 973 delete lock;
922 } 974 }
923 975
924 void EnumerateModulesModel::DoneScanning() { 976 void EnumerateModulesModel::DoneScanning() {
925 confirmed_bad_modules_detected_ = 0; 977 confirmed_bad_modules_detected_ = 0;
926 suspected_bad_modules_detected_ = 0; 978 suspected_bad_modules_detected_ = 0;
979 modules_to_notify_about_ = 0;
927 for (ModuleEnumerator::ModulesVector::const_iterator module = 980 for (ModuleEnumerator::ModulesVector::const_iterator module =
928 enumerated_modules_.begin(); 981 enumerated_modules_.begin();
929 module != enumerated_modules_.end(); ++module) { 982 module != enumerated_modules_.end(); ++module) {
930 if (module->status == ModuleEnumerator::CONFIRMED_BAD) 983 if (module->status == ModuleEnumerator::CONFIRMED_BAD) {
931 ++confirmed_bad_modules_detected_; 984 ++confirmed_bad_modules_detected_;
932 if (module->status == ModuleEnumerator::SUSPECTED_BAD) 985 if (module->recommended_action & ModuleEnumerator::NOTIFY_USER)
986 ++modules_to_notify_about_;
987 } else if (module->status == ModuleEnumerator::SUSPECTED_BAD) {
933 ++suspected_bad_modules_detected_; 988 ++suspected_bad_modules_detected_;
989 if (module->recommended_action & ModuleEnumerator::NOTIFY_USER)
990 ++modules_to_notify_about_;
991 }
934 } 992 }
935 993
936 scanning_ = false; 994 scanning_ = false;
937 lock->Release(); 995 lock->Release();
938 996
939 UMA_HISTOGRAM_COUNTS_100("Conflicts.SuspectedBadModules", 997 UMA_HISTOGRAM_COUNTS_100("Conflicts.SuspectedBadModules",
940 suspected_bad_modules_detected_); 998 suspected_bad_modules_detected_);
941 UMA_HISTOGRAM_COUNTS_100("Conflicts.ConfirmedBadModules", 999 UMA_HISTOGRAM_COUNTS_100("Conflicts.ConfirmedBadModules",
942 confirmed_bad_modules_detected_); 1000 confirmed_bad_modules_detected_);
943 1001
(...skipping 29 matching lines...) Expand all
973 GenerateHash(WideToUTF8(module.name), &filename); 1031 GenerateHash(WideToUTF8(module.name), &filename);
974 GenerateHash(WideToUTF8(module.location), &location); 1032 GenerateHash(WideToUTF8(module.location), &location);
975 GenerateHash(WideToUTF8(module.description), &description); 1033 GenerateHash(WideToUTF8(module.description), &description);
976 GenerateHash(WideToUTF8(module.digital_signer), &signer); 1034 GenerateHash(WideToUTF8(module.digital_signer), &signer);
977 1035
978 string16 url = l10n_util::GetStringFUTF16(IDS_HELP_CENTER_VIEW_CONFLICTS, 1036 string16 url = l10n_util::GetStringFUTF16(IDS_HELP_CENTER_VIEW_CONFLICTS,
979 ASCIIToUTF16(filename), ASCIIToUTF16(location), 1037 ASCIIToUTF16(filename), ASCIIToUTF16(location),
980 ASCIIToUTF16(description), ASCIIToUTF16(signer)); 1038 ASCIIToUTF16(description), ASCIIToUTF16(signer));
981 return GURL(UTF16ToUTF8(url)); 1039 return GURL(UTF16ToUTF8(url));
982 } 1040 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698