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

Side by Side 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: Nit fixes & CreateRegKey now recursive. Created 4 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 unified diff | Download patch
OLDNEW
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 std::wstring content;
18 content.resize(buffer_size);
19 buffer_size =
20 ::GetEnvironmentVariableW(L"hkcu_override", &content[0], buffer_size);
21 if (!buffer_size)
22 return;
23 nt::HKCU_override.assign(content);
24 }
25
26 buffer_size = ::GetEnvironmentVariableW(L"hklm_override", nullptr, 0);
27 if (buffer_size > 0) {
28 std::wstring content;
29 content.resize(buffer_size);
30 buffer_size =
31 ::GetEnvironmentVariableW(L"hklm_override", &content[0], buffer_size);
32 if (!buffer_size)
33 return;
34 nt::HKLM_override.assign(content);
35 }
36
37 return;
38 }
39
40 } // namespace
41
42 extern "C" __declspec(dllexport) void InitTestDll() {
43 // Make sure we've got the latest registry overrides.
44 GetIpcOverrides();
11 } 45 }
12 46
13 BOOL APIENTRY DllMain(HMODULE module, DWORD reason, LPVOID reserved) { 47 BOOL APIENTRY DllMain(HMODULE module, DWORD reason, LPVOID reserved) {
14 if (reason == DLL_PROCESS_ATTACH) { 48 if (reason == DLL_PROCESS_ATTACH) {
49 GetIpcOverrides();
15 install_static::InitializeProcessType(); 50 install_static::InitializeProcessType();
16 blacklist::Initialize(true); // force always on, no beacon 51 blacklist::Initialize(true); // force always on, no beacon
17 } 52 }
18 53
19 return TRUE; 54 return TRUE;
20 } 55 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698