OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "sandbox/src/registry_dispatcher.h" | 5 #include "sandbox/src/registry_dispatcher.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/scoped_handle_win.h" | 8 #include "base/scoped_handle_win.h" |
| 9 #include "base/win_util.h" |
9 #include "sandbox/src/crosscall_client.h" | 10 #include "sandbox/src/crosscall_client.h" |
10 #include "sandbox/src/interception.h" | 11 #include "sandbox/src/interception.h" |
11 #include "sandbox/src/ipc_tags.h" | 12 #include "sandbox/src/ipc_tags.h" |
12 #include "sandbox/src/sandbox_nt_util.h" | 13 #include "sandbox/src/sandbox_nt_util.h" |
13 #include "sandbox/src/policy_broker.h" | 14 #include "sandbox/src/policy_broker.h" |
14 #include "sandbox/src/policy_params.h" | 15 #include "sandbox/src/policy_params.h" |
15 #include "sandbox/src/sandbox.h" | 16 #include "sandbox/src/sandbox.h" |
16 #include "sandbox/src/registry_interception.h" | 17 #include "sandbox/src/registry_interception.h" |
17 #include "sandbox/src/registry_policy.h" | 18 #include "sandbox/src/registry_policy.h" |
18 | 19 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 | 54 |
54 ipc_calls_.push_back(create_params); | 55 ipc_calls_.push_back(create_params); |
55 ipc_calls_.push_back(open_params); | 56 ipc_calls_.push_back(open_params); |
56 } | 57 } |
57 | 58 |
58 bool RegistryDispatcher::SetupService(InterceptionManager* manager, | 59 bool RegistryDispatcher::SetupService(InterceptionManager* manager, |
59 int service) { | 60 int service) { |
60 if (IPC_NTCREATEKEY_TAG == service) | 61 if (IPC_NTCREATEKEY_TAG == service) |
61 return INTERCEPT_NT(manager, NtCreateKey, "_TargetNtCreateKey@32"); | 62 return INTERCEPT_NT(manager, NtCreateKey, "_TargetNtCreateKey@32"); |
62 | 63 |
63 if (IPC_NTOPENKEY_TAG == service) | 64 if (IPC_NTOPENKEY_TAG == service) { |
64 return INTERCEPT_NT(manager, NtOpenKey, "_TargetNtOpenKey@16"); | 65 bool result = INTERCEPT_NT(manager, NtOpenKey, "_TargetNtOpenKey@16"); |
| 66 if (win_util::GetWinVersion() >= win_util::WINVERSION_WIN7) |
| 67 result &= INTERCEPT_NT(manager, NtOpenKeyEx, "_TargetNtOpenKeyEx@20"); |
| 68 return result; |
| 69 } |
65 | 70 |
66 return false; | 71 return false; |
67 } | 72 } |
68 | 73 |
69 bool RegistryDispatcher::NtCreateKey( | 74 bool RegistryDispatcher::NtCreateKey( |
70 IPCInfo* ipc, std::wstring* name, DWORD attributes, DWORD root_directory, | 75 IPCInfo* ipc, std::wstring* name, DWORD attributes, DWORD root_directory, |
71 DWORD desired_access, DWORD title_index, DWORD create_options) { | 76 DWORD desired_access, DWORD title_index, DWORD create_options) { |
72 ScopedHandle root_handle; | 77 ScopedHandle root_handle; |
73 std::wstring real_path = *name; | 78 std::wstring real_path = *name; |
74 | 79 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 } | 159 } |
155 | 160 |
156 // Return operation status on the IPC. | 161 // Return operation status on the IPC. |
157 ipc->return_info.nt_status = nt_status; | 162 ipc->return_info.nt_status = nt_status; |
158 ipc->return_info.handle = handle; | 163 ipc->return_info.handle = handle; |
159 return true; | 164 return true; |
160 } | 165 } |
161 | 166 |
162 } // namespace sandbox | 167 } // namespace sandbox |
163 | 168 |
OLD | NEW |