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

Unified Diff: chrome_elf/blacklist/test/blacklist_test_main_dll.cc

Issue 1841573002: [Chrome ELF] New NT registry API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: PRESUBMIT to allow chrome_elf directory files to use wstring. Created 4 years, 5 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
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
}
« no previous file with comments | « chrome_elf/blacklist/test/blacklist_test_main.cc ('k') | chrome_elf/blacklist/test/blacklist_test_main_dll.def » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698