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

Side by Side Diff: sandbox/win/src/handle_policy.cc

Issue 614813002: Cleanup sandbox/ in advance of re-enabling some MSVC warnings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review comments Created 6 years, 2 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
« no previous file with comments | « sandbox/win/src/handle_closer_test.cc ('k') | sandbox/win/src/policy_opcodes_unittest.cc » ('j') | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/win/src/handle_policy.h" 5 #include "sandbox/win/src/handle_policy.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/win/scoped_handle.h" 9 #include "base/win/scoped_handle.h"
10 #include "sandbox/win/src/broker_services.h" 10 #include "sandbox/win/src/broker_services.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 remote_target_process.Set(::OpenProcess(PROCESS_DUP_HANDLE, FALSE, 72 remote_target_process.Set(::OpenProcess(PROCESS_DUP_HANDLE, FALSE,
73 target_process_id)); 73 target_process_id));
74 if (!remote_target_process.IsValid()) 74 if (!remote_target_process.IsValid())
75 return ::GetLastError(); 75 return ::GetLastError();
76 } 76 }
77 77
78 // If the policy didn't block us and we have no valid target, then the broker 78 // If the policy didn't block us and we have no valid target, then the broker
79 // (this process) is the valid target. 79 // (this process) is the valid target.
80 HANDLE target_process = remote_target_process.IsValid() ? 80 HANDLE target_process = remote_target_process.IsValid() ?
81 remote_target_process.Get() : ::GetCurrentProcess(); 81 remote_target_process.Get() : ::GetCurrentProcess();
82 DWORD result = ERROR_SUCCESS;
83 if (!::DuplicateHandle(::GetCurrentProcess(), source_handle, target_process, 82 if (!::DuplicateHandle(::GetCurrentProcess(), source_handle, target_process,
84 target_handle, desired_access, FALSE, 83 target_handle, desired_access, FALSE,
85 options)) { 84 options)) {
86 return ::GetLastError(); 85 return ::GetLastError();
87 } 86 }
88 87
89 return ERROR_SUCCESS; 88 return ERROR_SUCCESS;
90 } 89 }
91 90
92 } // namespace sandbox 91 } // namespace sandbox
93 92
OLDNEW
« no previous file with comments | « sandbox/win/src/handle_closer_test.cc ('k') | sandbox/win/src/policy_opcodes_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698