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

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

Issue 20287: In windows 7 there is a new Reg call that we need to... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 10 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
« no previous file with comments | « sandbox/src/registry_interception.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_interception.h" 5 #include "sandbox/src/registry_interception.h"
6 6
7 #include "sandbox/src/crosscall_client.h" 7 #include "sandbox/src/crosscall_client.h"
8 #include "sandbox/src/ipc_tags.h" 8 #include "sandbox/src/ipc_tags.h"
9 #include "sandbox/src/sandbox_factory.h" 9 #include "sandbox/src/sandbox_factory.h"
10 #include "sandbox/src/sandbox_nt_util.h" 10 #include "sandbox/src/sandbox_nt_util.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 81
82 status = answer.nt_status; 82 status = answer.nt_status;
83 } __except(EXCEPTION_EXECUTE_HANDLER) { 83 } __except(EXCEPTION_EXECUTE_HANDLER) {
84 break; 84 break;
85 } 85 }
86 } while (false); 86 } while (false);
87 87
88 return status; 88 return status;
89 } 89 }
90 90
91 NTSTATUS WINAPI TargetNtOpenKey(NtOpenKeyFunction orig_OpenKey, PHANDLE key, 91 NTSTATUS WINAPI CommonNtOpenKey(NTSTATUS status, PHANDLE key,
92 ACCESS_MASK desired_access, 92 ACCESS_MASK desired_access,
93 POBJECT_ATTRIBUTES object_attributes) { 93 POBJECT_ATTRIBUTES object_attributes) {
94 // Check if the process can open it first.
95 NTSTATUS status = orig_OpenKey(key, desired_access, object_attributes);
96 if (NT_SUCCESS(status))
97 return status;
98
99 // We don't trust that the IPC can work this early. 94 // We don't trust that the IPC can work this early.
100 if (!SandboxFactory::GetTargetServices()->GetState()->InitCalled()) 95 if (!SandboxFactory::GetTargetServices()->GetState()->InitCalled())
101 return status; 96 return status;
102 97
103 do { 98 do {
104 if (!ValidParameter(key, sizeof(HANDLE), WRITE)) 99 if (!ValidParameter(key, sizeof(HANDLE), WRITE))
105 break; 100 break;
106 101
107 void* memory = GetGlobalIPCMemory(); 102 void* memory = GetGlobalIPCMemory();
108 if (NULL == memory) 103 if (NULL == memory)
(...skipping 30 matching lines...) Expand all
139 *key = answer.handle; 134 *key = answer.handle;
140 status = answer.nt_status; 135 status = answer.nt_status;
141 } __except(EXCEPTION_EXECUTE_HANDLER) { 136 } __except(EXCEPTION_EXECUTE_HANDLER) {
142 break; 137 break;
143 } 138 }
144 } while (false); 139 } while (false);
145 140
146 return status; 141 return status;
147 } 142 }
148 143
144 NTSTATUS WINAPI TargetNtOpenKey(NtOpenKeyFunction orig_OpenKey, PHANDLE key,
145 ACCESS_MASK desired_access,
146 POBJECT_ATTRIBUTES object_attributes) {
147 // Check if the process can open it first.
148 NTSTATUS status = orig_OpenKey(key, desired_access, object_attributes);
149 if (NT_SUCCESS(status))
150 return status;
151
152 return CommonNtOpenKey(status, key, desired_access, object_attributes);
153 }
154
155 NTSTATUS WINAPI TargetNtOpenKeyEx(NtOpenKeyExFunction orig_OpenKeyEx,
156 PHANDLE key, ACCESS_MASK desired_access,
157 POBJECT_ATTRIBUTES object_attributes,
158 DWORD unknown) {
159 // Check if the process can open it first.
160 NTSTATUS status = orig_OpenKeyEx(key, desired_access, object_attributes,
161 unknown);
162
163 // TODO(nsylvain): We don't know what the last parameter is. If it's not
164 // zero, we don't attempt to proxy the call. We need to find out what it is!
165 // See bug 7611
166 if (NT_SUCCESS(status) || unknown != 0)
167 return status;
168
169 return CommonNtOpenKey(status, key, desired_access, object_attributes);
170 }
171
149 } // namespace sandbox 172 } // namespace sandbox
150 173
OLDNEW
« no previous file with comments | « sandbox/src/registry_interception.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698