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

Side by Side Diff: base/process/process_info_win.cc

Issue 1852433005: Convert //base to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase after r384946 Created 4 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 | « base/process/process_info_mac.cc ('k') | base/process/process_metrics.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 "base/process/process_info.h" 5 #include "base/process/process_info.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 8
9 #include "base/memory/scoped_ptr.h" 9 #include <memory>
10
10 #include "base/time/time.h" 11 #include "base/time/time.h"
11 #include "base/win/scoped_handle.h" 12 #include "base/win/scoped_handle.h"
12 #include "base/win/windows_version.h" 13 #include "base/win/windows_version.h"
13 14
14 namespace base { 15 namespace base {
15 16
16 // static 17 // static
17 const Time CurrentProcessInfo::CreationTime() { 18 const Time CurrentProcessInfo::CreationTime() {
18 FILETIME creation_time = {}; 19 FILETIME creation_time = {};
19 FILETIME ignore1 = {}; 20 FILETIME ignore1 = {};
(...skipping 17 matching lines...) Expand all
37 } 38 }
38 win::ScopedHandle scoped_process_token(process_token); 39 win::ScopedHandle scoped_process_token(process_token);
39 40
40 DWORD token_info_length = 0; 41 DWORD token_info_length = 0;
41 if (::GetTokenInformation(process_token, TokenIntegrityLevel, nullptr, 0, 42 if (::GetTokenInformation(process_token, TokenIntegrityLevel, nullptr, 0,
42 &token_info_length) || 43 &token_info_length) ||
43 ::GetLastError() != ERROR_INSUFFICIENT_BUFFER) { 44 ::GetLastError() != ERROR_INSUFFICIENT_BUFFER) {
44 return INTEGRITY_UNKNOWN; 45 return INTEGRITY_UNKNOWN;
45 } 46 }
46 47
47 scoped_ptr<char[]> token_label_bytes(new char[token_info_length]); 48 std::unique_ptr<char[]> token_label_bytes(new char[token_info_length]);
48 if (!token_label_bytes.get()) 49 if (!token_label_bytes.get())
49 return INTEGRITY_UNKNOWN; 50 return INTEGRITY_UNKNOWN;
50 51
51 TOKEN_MANDATORY_LABEL* token_label = 52 TOKEN_MANDATORY_LABEL* token_label =
52 reinterpret_cast<TOKEN_MANDATORY_LABEL*>(token_label_bytes.get()); 53 reinterpret_cast<TOKEN_MANDATORY_LABEL*>(token_label_bytes.get());
53 if (!token_label) 54 if (!token_label)
54 return INTEGRITY_UNKNOWN; 55 return INTEGRITY_UNKNOWN;
55 56
56 if (!::GetTokenInformation(process_token, TokenIntegrityLevel, token_label, 57 if (!::GetTokenInformation(process_token, TokenIntegrityLevel, token_label,
57 token_info_length, &token_info_length)) { 58 token_info_length, &token_info_length)) {
(...skipping 14 matching lines...) Expand all
72 } 73 }
73 74
74 if (integrity_level >= SECURITY_MANDATORY_HIGH_RID) 75 if (integrity_level >= SECURITY_MANDATORY_HIGH_RID)
75 return HIGH_INTEGRITY; 76 return HIGH_INTEGRITY;
76 77
77 NOTREACHED(); 78 NOTREACHED();
78 return INTEGRITY_UNKNOWN; 79 return INTEGRITY_UNKNOWN;
79 } 80 }
80 81
81 } // namespace base 82 } // namespace base
OLDNEW
« no previous file with comments | « base/process/process_info_mac.cc ('k') | base/process/process_metrics.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698