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

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

Issue 1106203002: sandbox/win: Fix warnings found by clang chromium-style plugin on Windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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/restricted_token.h ('k') | sandbox/win/src/win2k_threadpool.h » ('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/restricted_token.h" 5 #include "sandbox/win/src/restricted_token.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "sandbox/win/src/acl.h" 10 #include "sandbox/win/src/acl.h"
11 #include "sandbox/win/src/win_utils.h" 11 #include "sandbox/win/src/win_utils.h"
12 12
13 namespace sandbox {
13 14
14 namespace sandbox { 15 RestrictedToken::RestrictedToken()
16 : init_(false),
17 effective_token_(NULL),
18 integrity_level_(INTEGRITY_LEVEL_LAST) {
19 }
20
21 RestrictedToken::~RestrictedToken() {
22 if (effective_token_)
23 CloseHandle(effective_token_);
24 }
15 25
16 unsigned RestrictedToken::Init(const HANDLE effective_token) { 26 unsigned RestrictedToken::Init(const HANDLE effective_token) {
17 if (init_) 27 if (init_)
18 return ERROR_ALREADY_INITIALIZED; 28 return ERROR_ALREADY_INITIALIZED;
19 29
20 if (effective_token) { 30 if (effective_token) {
21 // We duplicate the handle to be able to use it even if the original handle 31 // We duplicate the handle to be able to use it even if the original handle
22 // is closed. 32 // is closed.
23 HANDLE effective_token_dup; 33 HANDLE effective_token_dup;
24 if (::DuplicateHandle(::GetCurrentProcess(), 34 if (::DuplicateHandle(::GetCurrentProcess(),
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 472
463 return ERROR_SUCCESS; 473 return ERROR_SUCCESS;
464 } 474 }
465 475
466 unsigned RestrictedToken::SetIntegrityLevel(IntegrityLevel integrity_level) { 476 unsigned RestrictedToken::SetIntegrityLevel(IntegrityLevel integrity_level) {
467 integrity_level_ = integrity_level; 477 integrity_level_ = integrity_level;
468 return ERROR_SUCCESS; 478 return ERROR_SUCCESS;
469 } 479 }
470 480
471 } // namespace sandbox 481 } // namespace sandbox
OLDNEW
« no previous file with comments | « sandbox/win/src/restricted_token.h ('k') | sandbox/win/src/win2k_threadpool.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698