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

Side by Side Diff: sandbox/src/registry_dispatcher.cc

Issue 6126002: Remove base/scoped_handle_win.h stub and fix up all callers to use the new location and namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review Created 9 years, 11 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/scoped_handle_win.h" 7 #include "base/win/scoped_handle.h"
8 #include "base/win/windows_version.h" 8 #include "base/win/windows_version.h"
9 #include "sandbox/src/crosscall_client.h" 9 #include "sandbox/src/crosscall_client.h"
10 #include "sandbox/src/interception.h" 10 #include "sandbox/src/interception.h"
11 #include "sandbox/src/interceptors.h" 11 #include "sandbox/src/interceptors.h"
12 #include "sandbox/src/ipc_tags.h" 12 #include "sandbox/src/ipc_tags.h"
13 #include "sandbox/src/sandbox_nt_util.h" 13 #include "sandbox/src/sandbox_nt_util.h"
14 #include "sandbox/src/policy_broker.h" 14 #include "sandbox/src/policy_broker.h"
15 #include "sandbox/src/policy_params.h" 15 #include "sandbox/src/policy_params.h"
16 #include "sandbox/src/sandbox.h" 16 #include "sandbox/src/sandbox.h"
17 #include "sandbox/src/registry_interception.h" 17 #include "sandbox/src/registry_interception.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 result &= INTERCEPT_NT(manager, NtOpenKeyEx, OPEN_KEY_EX_ID, 20); 67 result &= INTERCEPT_NT(manager, NtOpenKeyEx, OPEN_KEY_EX_ID, 20);
68 return result; 68 return result;
69 } 69 }
70 70
71 return false; 71 return false;
72 } 72 }
73 73
74 bool RegistryDispatcher::NtCreateKey( 74 bool RegistryDispatcher::NtCreateKey(
75 IPCInfo* ipc, std::wstring* name, DWORD attributes, HANDLE root, 75 IPCInfo* ipc, std::wstring* name, DWORD attributes, HANDLE root,
76 DWORD desired_access, DWORD title_index, DWORD create_options) { 76 DWORD desired_access, DWORD title_index, DWORD create_options) {
77 ScopedHandle root_handle; 77 base::win::ScopedHandle root_handle;
78 std::wstring real_path = *name; 78 std::wstring real_path = *name;
79 79
80 // If there is a root directory, we need to duplicate the handle to make 80 // If there is a root directory, we need to duplicate the handle to make
81 // it valid in this process. 81 // it valid in this process.
82 if (root) { 82 if (root) {
83 if (!::DuplicateHandle(ipc->client_info->process, root, 83 if (!::DuplicateHandle(ipc->client_info->process, root,
84 ::GetCurrentProcess(), &root, 0, FALSE, 84 ::GetCurrentProcess(), &root, 0, FALSE,
85 DUPLICATE_SAME_ACCESS)) 85 DUPLICATE_SAME_ACCESS))
86 return false; 86 return false;
87 87
(...skipping 25 matching lines...) Expand all
113 // Return operation status on the IPC. 113 // Return operation status on the IPC.
114 ipc->return_info.extended[0].unsigned_int = disposition; 114 ipc->return_info.extended[0].unsigned_int = disposition;
115 ipc->return_info.nt_status = nt_status; 115 ipc->return_info.nt_status = nt_status;
116 ipc->return_info.handle = handle; 116 ipc->return_info.handle = handle;
117 return true; 117 return true;
118 } 118 }
119 119
120 bool RegistryDispatcher::NtOpenKey(IPCInfo* ipc, std::wstring* name, 120 bool RegistryDispatcher::NtOpenKey(IPCInfo* ipc, std::wstring* name,
121 DWORD attributes, HANDLE root, 121 DWORD attributes, HANDLE root,
122 DWORD desired_access) { 122 DWORD desired_access) {
123 ScopedHandle root_handle; 123 base::win::ScopedHandle root_handle;
124 std::wstring real_path = *name; 124 std::wstring real_path = *name;
125 125
126 // If there is a root directory, we need to duplicate the handle to make 126 // If there is a root directory, we need to duplicate the handle to make
127 // it valid in this process. 127 // it valid in this process.
128 if (root) { 128 if (root) {
129 if (!::DuplicateHandle(ipc->client_info->process, root, 129 if (!::DuplicateHandle(ipc->client_info->process, root,
130 ::GetCurrentProcess(), &root, 0, FALSE, 130 ::GetCurrentProcess(), &root, 0, FALSE,
131 DUPLICATE_SAME_ACCESS)) 131 DUPLICATE_SAME_ACCESS))
132 return false; 132 return false;
133 root_handle.Set(root); 133 root_handle.Set(root);
(...skipping 18 matching lines...) Expand all
152 return true; 152 return true;
153 } 153 }
154 154
155 // Return operation status on the IPC. 155 // Return operation status on the IPC.
156 ipc->return_info.nt_status = nt_status; 156 ipc->return_info.nt_status = nt_status;
157 ipc->return_info.handle = handle; 157 ipc->return_info.handle = handle;
158 return true; 158 return true;
159 } 159 }
160 160
161 } // namespace sandbox 161 } // namespace sandbox
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698