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

Unified Diff: chrome_elf/blacklist/blacklist.cc

Issue 300933002: Finch Blacklist is now added to the Hardcoded blacklist. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Final changes? Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome_elf/blacklist/blacklist.h ('k') | chrome_elf/blacklist/test/blacklist_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « chrome_elf/blacklist/blacklist.h ('k') | chrome_elf/blacklist/test/blacklist_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698