diff options
author | krstnmnlsn@chromium.org <krstnmnlsn@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-05 14:09:05 +0000 |
---|---|---|
committer | krstnmnlsn@chromium.org <krstnmnlsn@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-05 14:09:05 +0000 |
commit | 189a4aa7696453a1292fd4693335ef2fea292ec8 (patch) | |
tree | d6200ee819d0221346b74e080057971480b185d8 /chrome_elf/blacklist/blacklist.cc | |
parent | c22b60145ba4eddf64a1823d991d3ffb4932b33a (diff) | |
download | chromium_src-189a4aa7696453a1292fd4693335ef2fea292ec8.zip chromium_src-189a4aa7696453a1292fd4693335ef2fea292ec8.tar.gz chromium_src-189a4aa7696453a1292fd4693335ef2fea292ec8.tar.bz2 |
Finch Blacklist is now added to the Hardcoded blacklist.
The finch blacklist is collected from finch in chrome_elf_init_win.cc,
stored in a registry, and added to the blacklist in blacklist.cc.
BUG=
Review URL: https://codereview.chromium.org/300933002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@275086 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_elf/blacklist/blacklist.cc')
-rw-r--r-- | chrome_elf/blacklist/blacklist.cc | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/chrome_elf/blacklist/blacklist.cc b/chrome_elf/blacklist/blacklist.cc index a168c9a..c42f682 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 |