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

Side by Side Diff: sandbox/src/policy_broker.h

Issue 266: Fix the sandbox when used with the SANDBOX_EXPORTS define. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 12 years, 3 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) 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 #ifndef SANDBOX_SRC_POLICY_BROKER_H__ 5 #ifndef SANDBOX_SRC_POLICY_BROKER_H__
6 #define SANDBOX_SRC_POLICY_BROKER_H__ 6 #define SANDBOX_SRC_POLICY_BROKER_H__
7 7
8 namespace sandbox { 8 namespace sandbox {
9 9
10 class InterceptionManager; 10 class InterceptionManager;
11 class TargetProcess; 11 class TargetProcess;
12 12
13 // Sets up interceptions not controlled by explicit policies. 13 // Sets up interceptions not controlled by explicit policies.
14 bool SetupBasicInterceptions(InterceptionManager* manager); 14 bool SetupBasicInterceptions(InterceptionManager* manager);
15 15
16 // Sets up imports from NTDLL for the given target process so the interceptions 16 // Sets up imports from NTDLL for the given target process so the interceptions
17 // can work. 17 // can work.
18 bool SetupNtdllImports(TargetProcess *child); 18 bool SetupNtdllImports(TargetProcess *child);
19 19
20 // This macro simply calls interception_manager.AddToPatchedFunctions with 20 // This macro simply calls interception_manager.AddToPatchedFunctions with
21 // the given service to intercept (INTERCEPTION_SERVICE_CALL), and assumes that 21 // the given service to intercept (INTERCEPTION_SERVICE_CALL), and assumes that
22 // the interceptor is called "TargetXXX", where XXX is the name of the service. 22 // the interceptor is called "TargetXXX", where XXX is the name of the service.
23 // Note that exported_target is the actual exported name of the interceptor, 23 // Note that exported_target is the actual exported name of the interceptor,
24 // following the calling convention of a service call (WINAPI = with the "C" 24 // following the calling convention of a service call (WINAPI = with the "C"
25 // underscore and the number of bytes to pop out of the stack) 25 // underscore and the number of bytes to pop out of the stack)
26 #if SANDBOX_EXPORTS 26 #if SANDBOX_EXPORTS
27 #define INTERCEPT_NT(manager, service, exported_target) \ 27 #define INTERCEPT_NT(manager, service, exported_target) \
28 (&Target##service) ? \ 28 ((&Target##service) ? \
29 manager->AddToPatchedFunctions(kNtdllName, #service, \ 29 manager->AddToPatchedFunctions(kNtdllName, #service, \
30 sandbox::INTERCEPTION_SERVICE_CALL, \ 30 sandbox::INTERCEPTION_SERVICE_CALL, \
31 exported_target) : false 31 exported_target) : false)
32 32
33 #define INTERCEPT_EAT(manager, dll, function, exported_target) \ 33 #define INTERCEPT_EAT(manager, dll, function, exported_target) \
34 (&Target##function) ? \ 34 ((&Target##function) ? \
35 manager->AddToPatchedFunctions(dll, #function, sandbox::INTERCEPTION_EAT, \ 35 manager->AddToPatchedFunctions(dll, #function, sandbox::INTERCEPTION_EAT, \
36 exported_target) : false 36 exported_target) : false)
37 #else 37 #else
38 #define INTERCEPT_NT(manager, service, exported_target) \ 38 #define INTERCEPT_NT(manager, service, exported_target) \
39 manager->AddToPatchedFunctions(kNtdllName, #service, \ 39 manager->AddToPatchedFunctions(kNtdllName, #service, \
40 sandbox::INTERCEPTION_SERVICE_CALL, \ 40 sandbox::INTERCEPTION_SERVICE_CALL, \
41 &Target##service) 41 &Target##service)
42 42
43 #define INTERCEPT_EAT(manager, dll, function, exported_target) \ 43 #define INTERCEPT_EAT(manager, dll, function, exported_target) \
44 manager->AddToPatchedFunctions(dll, #function, sandbox::INTERCEPTION_EAT, \ 44 manager->AddToPatchedFunctions(dll, #function, sandbox::INTERCEPTION_EAT, \
45 &Target##function) 45 &Target##function)
46 #endif 46 #endif
47 47
48 } // namespace sandbox 48 } // namespace sandbox
49 49
50 #endif // SANDBOX_SRC_POLICY_BROKER_H__ 50 #endif // SANDBOX_SRC_POLICY_BROKER_H__
51 51
OLDNEW
« sandbox/src/filesystem_interception.h ('K') | « sandbox/src/filesystem_interception.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698