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

Side by Side Diff: sandbox/win/src/process_thread_policy.h

Issue 1539423002: Revert of Switch to standard integer types in sandbox/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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
OLDNEW
1 // Copyright (c) 2006-2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2010 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_PROCESS_THREAD_POLICY_H_ 5 #ifndef SANDBOX_SRC_PROCESS_THREAD_POLICY_H_
6 #define SANDBOX_SRC_PROCESS_THREAD_POLICY_H_ 6 #define SANDBOX_SRC_PROCESS_THREAD_POLICY_H_
7 7
8 #include <stdint.h>
9
10 #include <string> 8 #include <string>
11 9
12 #include "sandbox/win/src/policy_low_level.h" 10 #include "sandbox/win/src/policy_low_level.h"
13 11
12 #include "base/basictypes.h"
14 #include "base/strings/string16.h" 13 #include "base/strings/string16.h"
15 #include "sandbox/win/src/crosscall_server.h" 14 #include "sandbox/win/src/crosscall_server.h"
16 #include "sandbox/win/src/sandbox_policy.h" 15 #include "sandbox/win/src/sandbox_policy.h"
17 16
18 namespace sandbox { 17 namespace sandbox {
19 18
20 enum EvalResult; 19 enum EvalResult;
21 20
22 // This class centralizes most of the knowledge related to process execution. 21 // This class centralizes most of the knowledge related to process execution.
23 class ProcessPolicy { 22 class ProcessPolicy {
24 public: 23 public:
25 // Creates the required low-level policy rules to evaluate a high-level. 24 // Creates the required low-level policy rules to evaluate a high-level.
26 // policy rule for process creation 25 // policy rule for process creation
27 // 'name' is the executable to be spawn. 26 // 'name' is the executable to be spawn.
28 // 'semantics' is the desired semantics. 27 // 'semantics' is the desired semantics.
29 // 'policy' is the policy generator to which the rules are going to be added. 28 // 'policy' is the policy generator to which the rules are going to be added.
30 static bool GenerateRules(const wchar_t* name, 29 static bool GenerateRules(const wchar_t* name,
31 TargetPolicy::Semantics semantics, 30 TargetPolicy::Semantics semantics,
32 LowLevelPolicy* policy); 31 LowLevelPolicy* policy);
33 32
34 // Opens a thread from the child process and returns the handle. 33 // Opens a thread from the child process and returns the handle.
35 // client_info contains the information about the child process, 34 // client_info contains the information about the child process,
36 // desired_access is the access requested by the child and thread_id 35 // desired_access is the access requested by the child and thread_id
37 // is the thread_id to be opened. 36 // is the thread_id to be opened.
38 // The function returns the return value of NtOpenThread. 37 // The function returns the return value of NtOpenThread.
39 static NTSTATUS OpenThreadAction(const ClientInfo& client_info, 38 static NTSTATUS OpenThreadAction(const ClientInfo& client_info,
40 uint32_t desired_access, 39 uint32 desired_access,
41 uint32_t thread_id, 40 uint32 thread_id,
42 HANDLE* handle); 41 HANDLE* handle);
43 42
44 // Opens the process id passed in and returns the duplicated handle to 43 // Opens the process id passed in and returns the duplicated handle to
45 // the child. We only allow the child processes to open themselves. Any other 44 // the child. We only allow the child processes to open themselves. Any other
46 // pid open is denied. 45 // pid open is denied.
47 static NTSTATUS OpenProcessAction(const ClientInfo& client_info, 46 static NTSTATUS OpenProcessAction(const ClientInfo& client_info,
48 uint32_t desired_access, 47 uint32 desired_access,
49 uint32_t process_id, 48 uint32 process_id,
50 HANDLE* handle); 49 HANDLE* handle);
51 50
52 // Opens the token associated with the process and returns the duplicated 51 // Opens the token associated with the process and returns the duplicated
53 // handle to the child. We only allow the child processes to open his own 52 // handle to the child. We only allow the child processes to open his own
54 // token (using ::GetCurrentProcess()). 53 // token (using ::GetCurrentProcess()).
55 static NTSTATUS OpenProcessTokenAction(const ClientInfo& client_info, 54 static NTSTATUS OpenProcessTokenAction(const ClientInfo& client_info,
56 HANDLE process, 55 HANDLE process,
57 uint32_t desired_access, 56 uint32 desired_access,
58 HANDLE* handle); 57 HANDLE* handle);
59 58
60 // Opens the token associated with the process and returns the duplicated 59 // Opens the token associated with the process and returns the duplicated
61 // handle to the child. We only allow the child processes to open his own 60 // handle to the child. We only allow the child processes to open his own
62 // token (using ::GetCurrentProcess()). 61 // token (using ::GetCurrentProcess()).
63 static NTSTATUS OpenProcessTokenExAction(const ClientInfo& client_info, 62 static NTSTATUS OpenProcessTokenExAction(const ClientInfo& client_info,
64 HANDLE process, 63 HANDLE process,
65 uint32_t desired_access, 64 uint32 desired_access,
66 uint32_t attributes, 65 uint32 attributes,
67 HANDLE* handle); 66 HANDLE* handle);
68 67
69 // Processes a 'CreateProcessW()' request from the target. 68 // Processes a 'CreateProcessW()' request from the target.
70 // 'client_info' : the target process that is making the request. 69 // 'client_info' : the target process that is making the request.
71 // 'eval_result' : The desired policy action to accomplish. 70 // 'eval_result' : The desired policy action to accomplish.
72 // 'app_name' : The full path of the process to be created. 71 // 'app_name' : The full path of the process to be created.
73 // 'command_line' : The command line passed to the created process. 72 // 'command_line' : The command line passed to the created process.
74 static DWORD CreateProcessWAction(EvalResult eval_result, 73 static DWORD CreateProcessWAction(EvalResult eval_result,
75 const ClientInfo& client_info, 74 const ClientInfo& client_info,
76 const base::string16 &app_name, 75 const base::string16 &app_name,
77 const base::string16 &command_line, 76 const base::string16 &command_line,
78 PROCESS_INFORMATION* process_info); 77 PROCESS_INFORMATION* process_info);
79 }; 78 };
80 79
81 } // namespace sandbox 80 } // namespace sandbox
82 81
83 82
84 #endif // SANDBOX_SRC_PROCESS_THREAD_POLICY_H_ 83 #endif // SANDBOX_SRC_PROCESS_THREAD_POLICY_H_
OLDNEW
« no previous file with comments | « sandbox/win/src/process_thread_interception.cc ('k') | sandbox/win/src/process_thread_policy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698