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

Side by Side Diff: chrome_elf/hook_util/thunk_getter.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 unified diff | Download patch
« no previous file with comments | « chrome_elf/hook_util/thunk_getter.h ('k') | chrome_elf/nt_registry/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <stdint.h> 5 #include <stdint.h>
6 #include <windows.h> 6 #include <windows.h>
7 7
8 #include "base/macros.h"
9 #include "sandbox/win/src/interception_internal.h" 8 #include "sandbox/win/src/interception_internal.h"
10 #include "sandbox/win/src/internal_types.h" 9 #include "sandbox/win/src/internal_types.h"
11 #include "sandbox/win/src/sandbox_utils.h" 10 #include "sandbox/win/src/sandbox_utils.h"
12 #include "sandbox/win/src/service_resolver.h" 11 #include "sandbox/win/src/service_resolver.h"
13 12
14 namespace { 13 namespace {
15 enum Version { 14 enum Version {
16 VERSION_PRE_XP_SP2 = 0, // Not supported. 15 VERSION_PRE_XP_SP2 = 0, // Not supported.
17 VERSION_XP_SP2, 16 VERSION_XP_SP2,
18 VERSION_SERVER_2003, // Also includes XP Pro x64 and Server 2003 R2. 17 VERSION_SERVER_2003, // Also includes XP Pro x64 and Server 2003 R2.
19 VERSION_VISTA, // Also includes Windows Server 2008. 18 VERSION_VISTA, // Also includes Windows Server 2008.
20 VERSION_WIN7, // Also includes Windows Server 2008 R2. 19 VERSION_WIN7, // Also includes Windows Server 2008 R2.
21 VERSION_WIN8, // Also includes Windows Server 2012. 20 VERSION_WIN8, // Also includes Windows Server 2012.
22 VERSION_WIN8_1, 21 VERSION_WIN8_1,
23 VERSION_WIN10, 22 VERSION_WIN10,
24 VERSION_WIN_LAST, // Indicates error condition. 23 VERSION_WIN_LAST, // Indicates error condition.
25 }; 24 };
26 25
27 #if !defined(_WIN64) 26 #if !defined(_WIN64)
28 // Whether a process is running under WOW64 (the wrapper that allows 32-bit 27 // Whether a process is running under WOW64 (the wrapper that allows 32-bit
29 // processes to run on 64-bit versions of Windows). This will return 28 // processes to run on 64-bit versions of Windows). This will return
30 // WOW64_DISABLED for both "32-bit Chrome on 32-bit Windows" and "64-bit 29 // WOW64_DISABLED for both "32-bit Chrome on 32-bit Windows" and "64-bit
31 // Chrome on 64-bit Windows". WOW64_UNKNOWN means "an error occurred", e.g. 30 // Chrome on 64-bit Windows". WOW64_UNKNOWN means "an error occurred", e.g.
32 // the process does not have sufficient access rights to determine this. 31 // the process does not have sufficient access rights to determine this.
33 enum WOW64Status { WOW64_DISABLED, WOW64_ENABLED, WOW64_UNKNOWN, }; 32 enum WOW64Status {
33 WOW64_DISABLED,
34 WOW64_ENABLED,
35 WOW64_UNKNOWN,
36 };
34 37
35 WOW64Status GetWOW64StatusForCurrentProcess() { 38 WOW64Status GetWOW64StatusForCurrentProcess() {
36 typedef BOOL(WINAPI * IsWow64ProcessFunc)(HANDLE, PBOOL); 39 typedef BOOL(WINAPI * IsWow64ProcessFunc)(HANDLE, PBOOL);
37 IsWow64ProcessFunc is_wow64_process = reinterpret_cast<IsWow64ProcessFunc>( 40 IsWow64ProcessFunc is_wow64_process = reinterpret_cast<IsWow64ProcessFunc>(
38 GetProcAddress(GetModuleHandle(L"kernel32.dll"), "IsWow64Process")); 41 GetProcAddress(GetModuleHandle(L"kernel32.dll"), "IsWow64Process"));
39 if (!is_wow64_process) 42 if (!is_wow64_process)
40 return WOW64_DISABLED; 43 return WOW64_DISABLED;
41 BOOL is_wow64 = FALSE; 44 BOOL is_wow64 = FALSE;
42 if (!is_wow64_process(GetCurrentProcess(), &is_wow64)) 45 if (!is_wow64_process(GetCurrentProcess(), &is_wow64))
43 return WOW64_UNKNOWN; 46 return WOW64_UNKNOWN;
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 thunk = new sandbox::Wow64ResolverThunk(current_process, relaxed); 143 thunk = new sandbox::Wow64ResolverThunk(current_process, relaxed);
141 } else if (os_info.version() >= VERSION_WIN8) { 144 } else if (os_info.version() >= VERSION_WIN8) {
142 thunk = new sandbox::Win8ResolverThunk(current_process, relaxed); 145 thunk = new sandbox::Win8ResolverThunk(current_process, relaxed);
143 } else { 146 } else {
144 thunk = new sandbox::ServiceResolverThunk(current_process, relaxed); 147 thunk = new sandbox::ServiceResolverThunk(current_process, relaxed);
145 } 148 }
146 #endif 149 #endif
147 150
148 return thunk; 151 return thunk;
149 } 152 }
OLDNEW
« no previous file with comments | « chrome_elf/hook_util/thunk_getter.h ('k') | chrome_elf/nt_registry/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698