| 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 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 delete thunk; | 340 delete thunk; |
| 341 | 341 |
| 342 // Record if we have initialized the blacklist. | 342 // Record if we have initialized the blacklist. |
| 343 g_blacklist_initialized = NT_SUCCESS(ret); | 343 g_blacklist_initialized = NT_SUCCESS(ret); |
| 344 | 344 |
| 345 // Mark the thunk storage as executable and prevent any future writes to it. | 345 // Mark the thunk storage as executable and prevent any future writes to it. |
| 346 page_executable = page_executable && | 346 page_executable = page_executable && |
| 347 VirtualProtect(&g_thunk_storage, sizeof(g_thunk_storage), | 347 VirtualProtect(&g_thunk_storage, sizeof(g_thunk_storage), |
| 348 PAGE_EXECUTE_READ, &old_protect); | 348 PAGE_EXECUTE_READ, &old_protect); |
| 349 | 349 |
| 350 AddDllsFromRegistryToBlacklist(); | |
| 351 | |
| 352 return NT_SUCCESS(ret) && page_executable; | 350 return NT_SUCCESS(ret) && page_executable; |
| 353 } | 351 } |
| 354 | 352 |
| 355 void AddDllsFromRegistryToBlacklist() { | |
| 356 std::vector<std::wstring> dlls; | |
| 357 | |
| 358 if (!nt::QueryRegValueMULTISZ(nt::HKCU, kRegistryFinchListPath, | |
| 359 kRegistryFinchListValueName, &dlls) || | |
| 360 dlls.empty()) | |
| 361 return; | |
| 362 | |
| 363 // Add each DLL to the BL in memory | |
| 364 for (auto name : dlls) { | |
| 365 AddDllToBlacklist(name.c_str()); | |
| 366 } | |
| 367 | |
| 368 return; | |
| 369 } | |
| 370 | |
| 371 } // namespace blacklist | 353 } // namespace blacklist |
| OLD | NEW |