| Index: chrome_elf/blacklist/blacklist.cc
|
| diff --git a/chrome_elf/blacklist/blacklist.cc b/chrome_elf/blacklist/blacklist.cc
|
| index a168c9a044c4ff0a5a54efa57eeeb6556ddcab3b..c42f68210eef0b3807aa37f8a5492980fa97ed60 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,49 @@ 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"");
|
| +
|
| + ::RegCloseKey(key);
|
| + return result == ERROR_SUCCESS;
|
| +}
|
| +
|
| } // namespace blacklist
|
|
|