Index: chrome_elf/blacklist/test/blacklist_test_main_dll.cc |
diff --git a/chrome_elf/blacklist/test/blacklist_test_main_dll.cc b/chrome_elf/blacklist/test/blacklist_test_main_dll.cc |
index 8dd16a61d97b872892d3163fe5a248d7fc329bcc..3b2c4d7deac0cdb6d6f362c63cead8bb2632a355 100644 |
--- a/chrome_elf/blacklist/test/blacklist_test_main_dll.cc |
+++ b/chrome_elf/blacklist/test/blacklist_test_main_dll.cc |
@@ -2,16 +2,49 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
+#include "chrome_elf/blacklist/blacklist.h" |
+ |
#include <windows.h> |
#include "chrome/install_static/install_util.h" |
-#include "chrome_elf/blacklist/blacklist.h" |
+#include "chrome_elf/nt_registry/nt_registry.h" |
+ |
+namespace { |
+ |
+void GetIpcOverrides() { |
+ DWORD buffer_size = ::GetEnvironmentVariableW(L"hkcu_override", nullptr, 0); |
+ if (buffer_size > 0) { |
+ wchar_t* content = new wchar_t[buffer_size]; |
+ buffer_size = |
+ ::GetEnvironmentVariableW(L"hkcu_override", content, buffer_size); |
+ if (buffer_size) |
+ ::wcsncpy(nt::HKCU_override, content, nt::g_kRegMaxPathLen - 1); |
+ delete[] content; |
+ } |
+ |
+ buffer_size = ::GetEnvironmentVariableW(L"hklm_override", nullptr, 0); |
+ if (buffer_size > 0) { |
+ wchar_t* content = new wchar_t[buffer_size]; |
+ buffer_size = |
+ ::GetEnvironmentVariableW(L"hklm_override", content, buffer_size); |
+ if (buffer_size) |
+ ::wcsncpy(nt::HKLM_override, content, nt::g_kRegMaxPathLen - 1); |
+ delete[] content; |
+ } |
+ |
+ return; |
+} |
+ |
+} // namespace |
-extern "C" void InitBlacklistTestDll() { |
+extern "C" __declspec(dllexport) void InitTestDll() { |
+ // Make sure we've got the latest registry overrides. |
+ GetIpcOverrides(); |
} |
BOOL APIENTRY DllMain(HMODULE module, DWORD reason, LPVOID reserved) { |
if (reason == DLL_PROCESS_ATTACH) { |
+ GetIpcOverrides(); |
install_static::InitializeProcessType(); |
blacklist::Initialize(true); // force always on, no beacon |
} |