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" |
| 6 |
5 #include <windows.h> | 7 #include <windows.h> |
6 | 8 |
7 #include "chrome/install_static/install_util.h" | 9 #include "chrome/install_static/install_util.h" |
8 #include "chrome_elf/blacklist/blacklist.h" | 10 #include "chrome_elf/nt_registry/nt_registry.h" |
9 | 11 |
10 extern "C" void InitBlacklistTestDll() { | 12 namespace { |
| 13 |
| 14 void GetIpcOverrides() { |
| 15 DWORD buffer_size = ::GetEnvironmentVariableW(L"hkcu_override", nullptr, 0); |
| 16 if (buffer_size > 0) { |
| 17 wchar_t* content = new wchar_t[buffer_size]; |
| 18 buffer_size = |
| 19 ::GetEnvironmentVariableW(L"hkcu_override", content, buffer_size); |
| 20 if (buffer_size) |
| 21 ::wcsncpy(nt::HKCU_override, content, nt::g_kRegMaxPathLen - 1); |
| 22 delete[] content; |
| 23 } |
| 24 |
| 25 buffer_size = ::GetEnvironmentVariableW(L"hklm_override", nullptr, 0); |
| 26 if (buffer_size > 0) { |
| 27 wchar_t* content = new wchar_t[buffer_size]; |
| 28 buffer_size = |
| 29 ::GetEnvironmentVariableW(L"hklm_override", content, buffer_size); |
| 30 if (buffer_size) |
| 31 ::wcsncpy(nt::HKLM_override, content, nt::g_kRegMaxPathLen - 1); |
| 32 delete[] content; |
| 33 } |
| 34 |
| 35 return; |
| 36 } |
| 37 |
| 38 } // namespace |
| 39 |
| 40 extern "C" __declspec(dllexport) void InitTestDll() { |
| 41 // Make sure we've got the latest registry overrides. |
| 42 GetIpcOverrides(); |
11 } | 43 } |
12 | 44 |
13 BOOL APIENTRY DllMain(HMODULE module, DWORD reason, LPVOID reserved) { | 45 BOOL APIENTRY DllMain(HMODULE module, DWORD reason, LPVOID reserved) { |
14 if (reason == DLL_PROCESS_ATTACH) { | 46 if (reason == DLL_PROCESS_ATTACH) { |
| 47 GetIpcOverrides(); |
15 install_static::InitializeProcessType(); | 48 install_static::InitializeProcessType(); |
16 blacklist::Initialize(true); // force always on, no beacon | 49 blacklist::Initialize(true); // force always on, no beacon |
17 } | 50 } |
18 | 51 |
19 return TRUE; | 52 return TRUE; |
20 } | 53 } |
OLD | NEW |