Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_elf/blacklist/blacklist.h" | 5 #include "chrome_elf/blacklist/blacklist.h" |
| 6 | 6 |
| 7 #include <assert.h> | 7 #include <assert.h> |
| 8 #include <string.h> | 8 #include <string.h> |
| 9 | 9 |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 364 HKEY key = NULL; | 364 HKEY key = NULL; |
| 365 LONG result = ::RegOpenKeyEx(HKEY_CURRENT_USER, | 365 LONG result = ::RegOpenKeyEx(HKEY_CURRENT_USER, |
| 366 kRegistryFinchListPath, | 366 kRegistryFinchListPath, |
| 367 0, | 367 0, |
| 368 KEY_QUERY_VALUE | KEY_SET_VALUE, | 368 KEY_QUERY_VALUE | KEY_SET_VALUE, |
| 369 &key); | 369 &key); |
| 370 | 370 |
| 371 if (result != ERROR_SUCCESS) | 371 if (result != ERROR_SUCCESS) |
| 372 return false; | 372 return false; |
| 373 | 373 |
| 374 // We add dlls from the registry to the blacklist, and then clear registry. | 374 // We add dlls from the registry to the blacklist. |
| 375 DWORD value_len; | 375 DWORD value_len; |
| 376 DWORD name_len = MAX_PATH; | 376 DWORD name_len = MAX_PATH; |
| 377 std::vector<wchar_t> name_buffer(name_len); | 377 std::vector<wchar_t> name_buffer(name_len); |
| 378 for (int i = 0; result == ERROR_SUCCESS; ++i) { | 378 for (int i = 0; result == ERROR_SUCCESS; ++i) { |
| 379 name_len = MAX_PATH; | 379 name_len = MAX_PATH; |
| 380 value_len = 0; | 380 value_len = 0; |
| 381 result = ::RegEnumValue( | 381 result = ::RegEnumValue( |
| 382 key, i, &name_buffer[0], &name_len, NULL, NULL, NULL, &value_len); | 382 key, i, &name_buffer[0], &name_len, NULL, NULL, NULL, &value_len); |
| 383 name_len = name_len + 1; | 383 name_len = name_len + 1; |
| 384 value_len = value_len + 1; | 384 value_len = value_len + 1; |
| 385 std::vector<wchar_t> value_buffer(value_len); | 385 std::vector<wchar_t> value_buffer(value_len); |
| 386 result = ::RegEnumValue(key, i, &name_buffer[0], &name_len, NULL, NULL, | 386 result = ::RegEnumValue(key, i, &name_buffer[0], &name_len, NULL, NULL, |
| 387 reinterpret_cast<BYTE*>(&value_buffer[0]), | 387 reinterpret_cast<BYTE*>(&value_buffer[0]), |
| 388 &value_len); | 388 &value_len); |
| 389 value_buffer[value_len - 1] = L'\0'; | 389 value_buffer[value_len - 1] = L'\0'; |
| 390 | 390 |
| 391 if (result == ERROR_SUCCESS) { | 391 if (result == ERROR_SUCCESS) { |
| 392 AddDllToBlacklist(&value_buffer[0]); | 392 AddDllToBlacklist(&value_buffer[0]); |
| 393 } | 393 } |
| 394 } | 394 } |
| 395 | 395 |
| 396 // Delete the finch registry key to clear the values. | 396 result = ::RegCloseKey(key); |
| 397 result = ::RegDeleteKey(key, L""); | |
| 398 | |
| 399 ::RegCloseKey(key); | |
| 400 return result == ERROR_SUCCESS; | 397 return result == ERROR_SUCCESS; |
|
grt (UTC plus 2)
2014/06/19 20:06:59
i don't understand the return value from this func
krstnmnlsn
2014/06/19 22:13:15
The return value is used by blacklist_test.cc. The
grt (UTC plus 2)
2014/06/20 14:40:59
since the return value isn't used by the productio
krstnmnlsn
2014/06/20 18:02:58
Okay I'll do that.
| |
| 401 } | 398 } |
| 402 | 399 |
| 403 } // namespace blacklist | 400 } // namespace blacklist |
| OLD | NEW |