Chromium Code Reviews| Index: chrome_elf/blacklist/blacklist.cc |
| diff --git a/chrome_elf/blacklist/blacklist.cc b/chrome_elf/blacklist/blacklist.cc |
| index a168c9a044c4ff0a5a54efa57eeeb6556ddcab3b..67cb0596cfe47fd4119ba68e4d089afde3bb4109 100644 |
| --- a/chrome_elf/blacklist/blacklist.cc |
| +++ b/chrome_elf/blacklist/blacklist.cc |
| @@ -7,6 +7,8 @@ |
| #include <assert.h> |
| #include <string.h> |
| +#include <vector> |
| + |
| #include "base/basictypes.h" |
| #include "chrome_elf/blacklist/blacklist_interceptions.h" |
| #include "chrome_elf/chrome_elf_constants.h" |
| @@ -342,7 +344,52 @@ bool Initialize(bool force) { |
| RecordSuccessfulThunkSetup(&key); |
| + AddDllsFromRegistryToBlacklist(); |
| + |
| return NT_SUCCESS(ret) && page_executable; |
| } |
| +bool AddDllsFromRegistryToBlacklist() { |
| + HKEY key = NULL; |
| + LONG result = ::RegOpenKeyEx(HKEY_CURRENT_USER, |
| + kRegistryFinchListPath, |
| + 0, |
| + KEY_QUERY_VALUE | KEY_SET_VALUE, |
| + &key); |
| + |
| + if (result != ERROR_SUCCESS) |
| + return false; |
| + |
| + // We add dlls from the registry to the blacklist, and then clear registry. |
| + DWORD value_len; |
| + DWORD name_len = MAX_PATH; |
| + std::vector<wchar_t> name_buffer(name_len); |
| + for (int i = 0; result == ERROR_SUCCESS; ++i) { |
| + name_len = MAX_PATH; |
| + value_len = 0; |
| + result = ::RegEnumValue( |
| + key, i, &name_buffer[0], &name_len, NULL, NULL, NULL, &value_len); |
| + name_len = name_len + 1; |
| + value_len = value_len + 1; |
| + std::vector<wchar_t> value_buffer(value_len); |
| + result = ::RegEnumValue(key, i, &name_buffer[0], &name_len, NULL, NULL, |
| + reinterpret_cast<BYTE*>(&value_buffer[0]), |
| + &value_len); |
| + value_buffer[value_len - 1] = L'\0'; |
| + |
| + if (result == ERROR_SUCCESS) { |
| + AddDllToBlacklist(&value_buffer[0]); |
| + } |
| + } |
| + |
| + // Delete the finch registry key to clear the values. |
| + result = ::RegDeleteKey(key, L""); |
| + if (result != ERROR_SUCCESS) { |
|
csharp
2014/06/04 17:12:56
Remove this code (lines 387-389) and replace line
krstnmnlsn
2014/06/04 18:12:00
Done.
|
| + return false; |
| + } |
| + |
| + ::RegCloseKey(key); |
| + return true; |
| +} |
| + |
| } // namespace blacklist |