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

Side by Side Diff: rlz/win/lib/process_info.cc

Issue 14114002: Rewrite scoped_array<T> to scoped_ptr<T[]> in rlz. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « rlz/win/lib/machine_id_win.cc ('k') | rlz/win/lib/rlz_lib_win.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 // Information about the current process. 5 // Information about the current process.
6 6
7 #include "rlz/win/lib/process_info.h" 7 #include "rlz/win/lib/process_info.h"
8 8
9 #include <windows.h> 9 #include <windows.h>
10 #include <Sddl.h> // For ConvertSidToStringSid. 10 #include <Sddl.h> // For ConvertSidToStringSid.
(...skipping 22 matching lines...) Expand all
33 // In which case, search for and use the process handle of a running 33 // In which case, search for and use the process handle of a running
34 // Explorer.exe.) 34 // Explorer.exe.)
35 HANDLE token; 35 HANDLE token;
36 if (!::OpenProcessToken(::GetCurrentProcess(), TOKEN_QUERY, &token)) 36 if (!::OpenProcessToken(::GetCurrentProcess(), TOKEN_QUERY, &token))
37 return E_FAIL; 37 return E_FAIL;
38 38
39 base::win::ScopedHandle scoped_process_token(token); 39 base::win::ScopedHandle scoped_process_token(token);
40 40
41 // (Following call will fail with ERROR_INSUFFICIENT_BUFFER and give us the 41 // (Following call will fail with ERROR_INSUFFICIENT_BUFFER and give us the
42 // required size.) 42 // required size.)
43 scoped_array<char> token_user_bytes; 43 scoped_ptr<char[]> token_user_bytes;
44 DWORD token_user_size; 44 DWORD token_user_size;
45 DWORD token_user_size2; 45 DWORD token_user_size2;
46 BOOL result = ::GetTokenInformation(token, TokenUser, NULL, 0, 46 BOOL result = ::GetTokenInformation(token, TokenUser, NULL, 0,
47 &token_user_size); 47 &token_user_size);
48 err = ::GetLastError(); 48 err = ::GetLastError();
49 CHECK(!result && err == ERROR_INSUFFICIENT_BUFFER); 49 CHECK(!result && err == ERROR_INSUFFICIENT_BUFFER);
50 50
51 token_user_bytes.reset(new char[token_user_size]); 51 token_user_bytes.reset(new char[token_user_size]);
52 if (!token_user_bytes.get()) 52 if (!token_user_bytes.get())
53 return E_OUTOFMEMORY; 53 return E_OUTOFMEMORY;
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 } 186 }
187 187
188 evaluated = true; 188 evaluated = true;
189 if (!has_rights) 189 if (!has_rights)
190 ASSERT_STRING("ProcessInfo::HasAdminRights: Does not have admin rights."); 190 ASSERT_STRING("ProcessInfo::HasAdminRights: Does not have admin rights.");
191 191
192 return has_rights; 192 return has_rights;
193 } 193 }
194 194
195 }; // namespace 195 }; // namespace
OLDNEW
« no previous file with comments | « rlz/win/lib/machine_id_win.cc ('k') | rlz/win/lib/rlz_lib_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698